@sap-ux/generator-odata-downloader 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators/app/index.js +4 -4
- package/package.json +9 -9
- package/prebuilds/keyring.darwin-arm64.node +0 -0
- package/prebuilds/keyring.darwin-x64.node +0 -0
- package/prebuilds/keyring.linux-arm-gnueabihf.node +0 -0
- package/prebuilds/keyring.linux-arm64-gnu.node +0 -0
- package/prebuilds/keyring.linux-arm64-musl.node +0 -0
- package/prebuilds/keyring.linux-ia32-gnu.node +0 -0
- package/prebuilds/keyring.linux-x64-gnu.node +0 -0
- package/prebuilds/keyring.linux-x64-musl.node +0 -0
- package/prebuilds/keyring.win32-arm64-msvc.node +0 -0
- package/prebuilds/keyring.win32-ia32-msvc.node +0 -0
- package/prebuilds/keyring.win32-x64-msvc.node +0 -0
package/generators/app/index.js
CHANGED
|
@@ -657,7 +657,7 @@ PGHZoN9jcvvvWDLUGtJkEotMgdFpEA2XWR83H4fVFVc=
|
|
|
657
657
|
ABAP Package: ${s?s.Package:r.package}`);let a=this.createConfig(r.transport,n,i),u=this.getAbapFrontendUrl();try{let c=await this.updateRepoRequest(!!s,r.name,o,a);if(c?.headers?.["sap-message"]&&VQ({msg:c.headers["sap-message"],log:this.log,host:u,isDest:this.isDest}),n)GQ({error:$Q(c?.data),log:this.log,host:u,isDest:this.isDest},!1);else{let l="/sap/bc/ui5_ui5"+(r.name.startsWith("/")?"":"/sap/")+r.name.toLowerCase(),f=this.defaults.params?.["sap-client"]?"?sap-client="+this.defaults.params["sap-client"]:"";this.log.info(`App available at ${u}${l}${f}`)}return s&&s.Package!==r.package&&this.log.warn(`Cannot change package assignment from ${s.Package} to ${r.package}.`),c}catch(c){throw fP({error:c,host:u,log:this.log,isDest:this.isDest}),c}}async undeploy({bsp:t,testMode:r=!1}){let n=this.createConfig(t.transport,r),i=this.getAbapFrontendUrl(),s=await this.getInfo(t.name);try{if(s){let o=await this.deleteRepoRequest(t.name,n);return o?.headers?.["sap-message"]&&VQ({msg:o.headers["sap-message"],log:this.log,host:i,isDest:this.isDest}),o}else{this.log.warn(`Application ${t.name} not found, nothing to undeploy.`);return}}catch(o){throw fP({error:o,host:i,log:this.log}),o}}getAbapFrontendUrl(){let t=new URL(this.publicUrl);return $gr.forEach((r,n)=>{t.hostname=t.hostname.replace(n,r)}),`${t.protocol}//${t.host}`}createConfig(t,r,n){let i={"Content-Type":"application/atom+xml",type:"entry",charset:"UTF8"},s={CodePage:"'UTF8'",CondenseMessagesInHttpResponseHeader:"X",format:"json"};return t&&(s.TransportRequest=t),r&&(s.TestMode=!0),n!==void 0&&(s.SafeMode=n),{headers:i,params:s,maxBodyLength:1/0,maxContentLength:1/0}}createPayload(t,r,n,i){let s=t.toString("base64"),o=new Date().toISOString(),a=UUe(r);return`<entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="${this.publicUrl}"> <id>${this.publicUrl}/Repositories('${a}')</id> <title type="text">Repositories('${a}')</title> <updated>${o}</updated> <category term="/UI5/ABAP_REPOSITORY_SRV.Repository" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="Repositories('${a}')" rel="edit" title="Repository"/> <content type="application/xml"> <m:properties> <d:Name>${a}</d:Name> <d:Package>${i?.toUpperCase()}</d:Package> <d:Description>${UUe(n)}</d:Description> <d:ZipArchive>${s}</d:ZipArchive> <d:Info/> </m:properties> </content></entry>`}async updateRepoRequest(t,r,n,i,s=1){try{s===2&&this.log.warn("Warning: The BSP application deployment timed out while waiting for a response from the backend. This may indicate the deployment was not finished. To resolve this, consider increasing the value of the HTML5.Timeout property for the destination.");let o=t;return s!==1&&(o=await this.getInfo(r)!==void 0),this.log.info(`${r} found on target system: ${o}`),o?await this.put(`/Repositories('${encodeURIComponent(r)}')`,n,i):await this.post("/Repositories",n,i)}catch(o){if([504,408].includes(o?.response?.status)){if(s>=3)throw o;return this.updateRepoRequest(t,r,n,i,s+1)}else{if(i?.params?.TestMode)return o.response;throw o}}}async deleteRepoRequest(t,r,n=1){try{return n===2&&this.log.warn("Warning: retry undeploy to handle a backend rejection..."),await this.delete(`/Repositories('${encodeURIComponent(t)}')`,r)}catch(i){if(i?.response?.status===400){if(n>=2)throw i;return this.deleteRepoRequest(t,r,n+1)}else throw i}}};var BUe=require("node:fs"),yk=require("node:url");var qUe=be(dZ(),1),vZ;(function(e){e.ON_PREMISE="onPremise",e.CLOUD_READY="cloudReady"})(vZ||(vZ={}));function gZ(e){return typeof e!="string"?`apps/${e.reference}/appVariants/${e.id}/`:e}function Ygr(e){return e.BYTES_PER_ELEMENT!==void 0}var kUe=e=>decodeURIComponent(e.toString());function yZ(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}var gk="/dta_folder/",ub=class extends Pa{static PATH="/sap/bc/lrep";log;async getCsrfToken(){try{return await this.get("/actions/getcsrftoken/")}catch(t){throw _c(t)&&this.tryLogResponse(t.response),t}}async mergeAppDescriptorVariant(t,r){let n="/appdescr_variant_preview/",i=new yk.URLSearchParams(this.defaults?.params);r&&i.append("workspacePath",r);try{let s=await this.put(n,t,{paramsSerializer:kUe,params:i,headers:{"Content-Type":"application/zip"}});return JSON.parse(s.data)}catch(s){throw _c(s)&&this.tryLogResponse(s.response),s}}async isExistingVariant(t,r="CUSTOMER_BASE"){try{let n=await this.get(gk,{params:{name:gZ(t),layer:r,timestamp:Date.now()}});return this.tryLogResponse(n),n}catch(n){if(_c(n)&&(this.tryLogResponse(n.response),n.response?.status===404))return n.response;throw n}}async deploy(t,r){let n=Ygr(t)?t:(0,BUe.readFileSync)(t),i=await this.isExistingVariant(r.namespace),s={name:gZ(r.namespace),layer:r.layer??"CUSTOMER_BASE"};s.package=r.package??"$TMP",s.package.toUpperCase()!=="$TMP"&&(s.changelist=r.transport);try{let o=await this.request({method:i.status===200?"PUT":"POST",url:gk,data:n,params:s,headers:{"Content-Type":"application/octet-stream"}});return this.tryLogResponse(o,"Deployment successful."),o}catch(o){throw fP({error:o,log:this.log}),o}}async undeploy(t){if((await this.isExistingVariant(t.namespace)).status!==200)throw new Error("Undeploy failed because the given project does not exist.");let n={name:gZ(t.namespace),layer:t.layer??"CUSTOMER_BASE"};t.transport&&(n.changelist=t.transport);try{let i=await this.delete(gk,{params:n});return this.tryLogResponse(i,"Undeployment successful."),i}catch(i){throw this.log.error("Undeployment failed"),this.log.debug(i),_c(i)&&i.response?.status===405&&this.log.error("Newer version of SAP_UI required, please check https://help.sap.com/docs/bas/developing-sap-fiori-app-in-sap-business-application-studio/delete-adaptation-project"),i}}async listAdaptations(t,r){try{let n=await this.get(`/flex/apps/${encodeURIComponent(t)}/adaptations/?version=${encodeURIComponent(r)}`,{transformResponse:yZ});return this.tryLogResponse(n,`Successfully fetched adaptations for app ${t}`),n.data}catch(n){throw _c(n)&&this.tryLogResponse(n.response),n}}async getKeyUserData(t,r){let n=new yk.URLSearchParams(this.defaults?.params);n.append("adaptationId",encodeURIComponent(r));try{let i=await this.get(`/flex/keyuserdata/${t}`,{params:n,paramsSerializer:kUe,transformResponse:yZ});return this.tryLogResponse(i,`Successfully fetched key user data for component ${t} and ${r} adaptation.`),i.data}catch(i){throw _c(i)&&this.tryLogResponse(i.response),i}}async getFlexVersions(t,r=2,n="EN"){try{let i=new yk.URLSearchParams(this.defaults?.params);i.append("sap-language",n),i.append("limit",r.toString());let s=await this.get(`/flex/versions/${encodeURIComponent(t)}`,{params:i,transformResponse:yZ});return this.tryLogResponse(s,`Successfully fetched flex versions for component ${t}`),s.data}catch(i){throw _c(i)&&this.tryLogResponse(i.response),i}}async getSystemInfo(t="EN",r,n){try{let i={"sap-language":t};r&&(i.package=r),n&&(i["sap-app-id"]=n);let s=await this.get(`${gk}system_info`,{params:i,paramsSerializer:o=>qUe.default.stringify(o,{encode:!1})});return this.tryLogResponse(s,"Successful getting system info."),JSON.parse(s.data)}catch(i){throw this.log.error("Getting system data failed."),this.log.debug(i),i}}tryLogResponse(t,r){try{let n=t.data?JSON.parse(t.data):{};n.result&&this.logMessage(n.result),(n.messages??[]).forEach(i=>{this.logMessage(i)})}catch{r&&this.log.info(r),this.log.warn("Could not parse returned messages.")}}logMessage(t){let r=t.severity==="Error"?so.Error:so.Info;this.log.log({level:r,message:t.text}),(t.details??[]).forEach(n=>{this.log.log({level:r,message:n})})}};var pBe=require("node:path/posix");var vk=class{adtSchema;getAdtCollection(t){if(!this.adtSchema)return null;let r=this.serializeAdtCategory(t);return this.adtSchema[r]}updateSchemaData(t){if(t){this.adtSchema={};let r=t.service.workspace;for(let n of r){let i=n.collection;if(i)if(Array.isArray(i))i.forEach(s=>{s.workspaceTitle=n.title;let o=this.serializeAdtCategory(s.category);this.adtSchema[o]=s});else{let s=i,o=this.serializeAdtCategory(s.category);this.adtSchema[o]=i}}}}isAdtSchemaEmpty(){return!this.adtSchema}serializeAdtCategory(t){return`${t.scheme},${t.term}`}};var jUe=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",zgr=jUe+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Kgr="["+jUe+"]["+zgr+"]*",Xgr=new RegExp("^"+Kgr+"$");function Ek(e,t){let r=[],n=t.exec(e);for(;n;){let i=[];i.startIndex=t.lastIndex-n[0].length;let s=n.length;for(let o=0;o<s;o++)i.push(n[o]);r.push(i),n=t.exec(e)}return r}var EZ=function(e){let t=Xgr.exec(e);return!(t===null||typeof t>"u")};function VUe(e){return typeof e<"u"}var xP=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],_k=["__proto__","constructor","prototype"];var Jgr={allowBooleanAttributes:!1,unpairedTags:[]};function Sk(e,t){t=Object.assign({},Jgr,t);let r=[],n=!1,i=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let s=0;s<e.length;s++)if(e[s]==="<"&&e[s+1]==="?"){if(s+=2,s=$Ue(e,s),s.err)return s}else if(e[s]==="<"){let o=s;if(s++,e[s]==="!"){s=HUe(e,s);continue}else{let a=!1;e[s]==="/"&&(a=!0,s++);let u="";for(;s<e.length&&e[s]!==">"&&e[s]!==" "&&e[s]!==" "&&e[s]!==`
|
|
658
658
|
`&&e[s]!=="\r";s++)u+=e[s];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),s--),!syr(u)){let f;return u.trim().length===0?f="Invalid space after '<'.":f="Tag '"+u+"' is an invalid name.",Ai("InvalidTag",f,zo(e,s))}let c=eyr(e,s);if(c===!1)return Ai("InvalidAttr","Attributes for '"+u+"' have open quote.",zo(e,s));let l=c.value;if(s=c.index,l[l.length-1]==="/"){let f=s-l.length;l=l.substring(0,l.length-1);let p=WUe(l,t);if(p===!0)n=!0;else return Ai(p.err.code,p.err.msg,zo(e,f+p.err.line))}else if(a)if(c.tagClosed){if(l.trim().length>0)return Ai("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",zo(e,o));if(r.length===0)return Ai("InvalidTag","Closing tag '"+u+"' has not been opened.",zo(e,o));{let f=r.pop();if(u!==f.tagName){let p=zo(e,f.tagStartPos);return Ai("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+u+"'.",zo(e,o))}r.length==0&&(i=!0)}}else return Ai("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",zo(e,s));else{let f=WUe(l,t);if(f!==!0)return Ai(f.err.code,f.err.msg,zo(e,s-l.length+f.err.line));if(i===!0)return Ai("InvalidXml","Multiple possible root nodes found.",zo(e,s));t.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:o}),n=!0}for(s++;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="!"){s++,s=HUe(e,s);continue}else if(e[s+1]==="?"){if(s=$Ue(e,++s),s.err)return s}else break;else if(e[s]==="&"){let f=nyr(e,s);if(f==-1)return Ai("InvalidChar","char '&' is not expected.",zo(e,s));s=f}else if(i===!0&&!GUe(e[s]))return Ai("InvalidXml","Extra text at the end",zo(e,s));e[s]==="<"&&s--}}else{if(GUe(e[s]))continue;return Ai("InvalidChar","char '"+e[s]+"' is not expected.",zo(e,s))}if(n){if(r.length==1)return Ai("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",zo(e,r[0].tagStartPos));if(r.length>0)return Ai("InvalidXml","Invalid '"+JSON.stringify(r.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ai("InvalidXml","Start tag expected.",1);return!0}function GUe(e){return e===" "||e===" "||e===`
|
|
659
659
|
`||e==="\r"}function $Ue(e,t){let r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let n=e.substr(r,t-r);if(t>5&&n==="xml")return Ai("InvalidXml","XML declaration allowed only at the start of the document.",zo(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function HUe(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var Qgr='"',Zgr="'";function eyr(e,t){let r="",n="",i=!1;for(;t<e.length;t++){if(e[t]===Qgr||e[t]===Zgr)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){i=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:i}}var tyr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function WUe(e,t){let r=Ek(e,tyr),n={};for(let i=0;i<r.length;i++){if(r[i][1].length===0)return Ai("InvalidAttr","Attribute '"+r[i][2]+"' has no space in starting.",wP(r[i]));if(r[i][3]!==void 0&&r[i][4]===void 0)return Ai("InvalidAttr","Attribute '"+r[i][2]+"' is without value.",wP(r[i]));if(r[i][3]===void 0&&!t.allowBooleanAttributes)return Ai("InvalidAttr","boolean attribute '"+r[i][2]+"' is not allowed.",wP(r[i]));let s=r[i][2];if(!iyr(s))return Ai("InvalidAttr","Attribute '"+s+"' is an invalid name.",wP(r[i]));if(!Object.prototype.hasOwnProperty.call(n,s))n[s]=1;else return Ai("InvalidAttr","Attribute '"+s+"' is repeated.",wP(r[i]))}return!0}function ryr(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function nyr(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,ryr(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function Ai(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function iyr(e){return EZ(e)}function syr(e){return EZ(e)}function zo(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function wP(e){return e.startIndex+e[1].length}var YUe={amp:"&",AMP:"&",lt:"<",LT:"<",gt:">",GT:">",quot:'"',QUOT:'"',apos:"'",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",lsquor:"\u201A",rsquor:"\u2019",ldquor:"\u201E",bdquo:"\u201E",comma:",",period:".",colon:":",semi:";",excl:"!",quest:"?",num:"#",dollar:"$",percent:"%",amp:"&",ast:"*",commat:"@",lowbar:"_",verbar:"|",vert:"|",sol:"/",bsol:"\\",lbrace:"{",rbrace:"}",lbrack:"[",rbrack:"]",lpar:"(",rpar:")",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",COPY:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",REG:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",half:"\xBD",frac34:"\xBE",iquest:"\xBF",times:"\xD7",div:"\xF7",divide:"\xF7"},zUe={Agrave:"\xC0",agrave:"\xE0",Aacute:"\xC1",aacute:"\xE1",Acirc:"\xC2",acirc:"\xE2",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",Aring:"\xC5",aring:"\xE5",AElig:"\xC6",aelig:"\xE6",Ccedil:"\xC7",ccedil:"\xE7",Egrave:"\xC8",egrave:"\xE8",Eacute:"\xC9",eacute:"\xE9",Ecirc:"\xCA",ecirc:"\xEA",Euml:"\xCB",euml:"\xEB",Igrave:"\xCC",igrave:"\xEC",Iacute:"\xCD",iacute:"\xED",Icirc:"\xCE",icirc:"\xEE",Iuml:"\xCF",iuml:"\xEF",ETH:"\xD0",eth:"\xF0",Ntilde:"\xD1",ntilde:"\xF1",Ograve:"\xD2",ograve:"\xF2",Oacute:"\xD3",oacute:"\xF3",Ocirc:"\xD4",ocirc:"\xF4",Otilde:"\xD5",otilde:"\xF5",Ouml:"\xD6",ouml:"\xF6",Oslash:"\xD8",oslash:"\xF8",Ugrave:"\xD9",ugrave:"\xF9",Uacute:"\xDA",uacute:"\xFA",Ucirc:"\xDB",ucirc:"\xFB",Uuml:"\xDC",uuml:"\xFC",Yacute:"\xDD",yacute:"\xFD",THORN:"\xDE",thorn:"\xFE",szlig:"\xDF",yuml:"\xFF",Yuml:"\u0178"},KUe={Amacr:"\u0100",amacr:"\u0101",Abreve:"\u0102",abreve:"\u0103",Aogon:"\u0104",aogon:"\u0105",Cacute:"\u0106",cacute:"\u0107",Ccirc:"\u0108",ccirc:"\u0109",Cdot:"\u010A",cdot:"\u010B",Ccaron:"\u010C",ccaron:"\u010D",Dcaron:"\u010E",dcaron:"\u010F",Dstrok:"\u0110",dstrok:"\u0111",Emacr:"\u0112",emacr:"\u0113",Ecaron:"\u011A",ecaron:"\u011B",Edot:"\u0116",edot:"\u0117",Eogon:"\u0118",eogon:"\u0119",Gcirc:"\u011C",gcirc:"\u011D",Gbreve:"\u011E",gbreve:"\u011F",Gdot:"\u0120",gdot:"\u0121",Gcedil:"\u0122",Hcirc:"\u0124",hcirc:"\u0125",Hstrok:"\u0126",hstrok:"\u0127",Itilde:"\u0128",itilde:"\u0129",Imacr:"\u012A",imacr:"\u012B",Iogon:"\u012E",iogon:"\u012F",Idot:"\u0130",IJlig:"\u0132",ijlig:"\u0133",Jcirc:"\u0134",jcirc:"\u0135",Kcedil:"\u0136",kcedil:"\u0137",kgreen:"\u0138",Lacute:"\u0139",lacute:"\u013A",Lcedil:"\u013B",lcedil:"\u013C",Lcaron:"\u013D",lcaron:"\u013E",Lmidot:"\u013F",lmidot:"\u0140",Lstrok:"\u0141",lstrok:"\u0142",Nacute:"\u0143",nacute:"\u0144",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ENG:"\u014A",eng:"\u014B",Omacr:"\u014C",omacr:"\u014D",Odblac:"\u0150",odblac:"\u0151",OElig:"\u0152",oelig:"\u0153",Racute:"\u0154",racute:"\u0155",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",Sacute:"\u015A",sacute:"\u015B",Scirc:"\u015C",scirc:"\u015D",Scedil:"\u015E",scedil:"\u015F",Scaron:"\u0160",scaron:"\u0161",Tcedil:"\u0162",tcedil:"\u0163",Tcaron:"\u0164",tcaron:"\u0165",Tstrok:"\u0166",tstrok:"\u0167",Utilde:"\u0168",utilde:"\u0169",Umacr:"\u016A",umacr:"\u016B",Ubreve:"\u016C",ubreve:"\u016D",Uring:"\u016E",uring:"\u016F",Udblac:"\u0170",udblac:"\u0171",Uogon:"\u0172",uogon:"\u0173",Wcirc:"\u0174",wcirc:"\u0175",Ycirc:"\u0176",ycirc:"\u0177",Zacute:"\u0179",zacute:"\u017A",Zdot:"\u017B",zdot:"\u017C",Zcaron:"\u017D",zcaron:"\u017E"},XUe={Alpha:"\u0391",alpha:"\u03B1",Beta:"\u0392",beta:"\u03B2",Gamma:"\u0393",gamma:"\u03B3",Delta:"\u0394",delta:"\u03B4",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",varepsilon:"\u03F5",Zeta:"\u0396",zeta:"\u03B6",Eta:"\u0397",eta:"\u03B7",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",vartheta:"\u03D1",Iota:"\u0399",iota:"\u03B9",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",varkappa:"\u03F0",Lambda:"\u039B",lambda:"\u03BB",Mu:"\u039C",mu:"\u03BC",Nu:"\u039D",nu:"\u03BD",Xi:"\u039E",xi:"\u03BE",Omicron:"\u039F",omicron:"\u03BF",Pi:"\u03A0",pi:"\u03C0",piv:"\u03D6",varpi:"\u03D6",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",varrho:"\u03F1",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",varsigma:"\u03C2",Tau:"\u03A4",tau:"\u03C4",Upsilon:"\u03A5",upsilon:"\u03C5",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",varphi:"\u03D5",Chi:"\u03A7",chi:"\u03C7",Psi:"\u03A8",psi:"\u03C8",Omega:"\u03A9",omega:"\u03C9",ohm:"\u03A9",Gammad:"\u03DC",gammad:"\u03DD",digamma:"\u03DD"},JUe={Afr:"\u{1D504}",afr:"\u{1D51E}",Acy:"\u0410",acy:"\u0430",Bcy:"\u0411",bcy:"\u0431",Vcy:"\u0412",vcy:"\u0432",Gcy:"\u0413",gcy:"\u0433",Dcy:"\u0414",dcy:"\u0434",IEcy:"\u0415",iecy:"\u0435",IOcy:"\u0401",iocy:"\u0451",ZHcy:"\u0416",zhcy:"\u0436",Zcy:"\u0417",zcy:"\u0437",Icy:"\u0418",icy:"\u0438",Jcy:"\u0419",jcy:"\u0439",Kcy:"\u041A",kcy:"\u043A",Lcy:"\u041B",lcy:"\u043B",Mcy:"\u041C",mcy:"\u043C",Ncy:"\u041D",ncy:"\u043D",Ocy:"\u041E",ocy:"\u043E",Pcy:"\u041F",pcy:"\u043F",Rcy:"\u0420",rcy:"\u0440",Scy:"\u0421",scy:"\u0441",Tcy:"\u0422",tcy:"\u0442",Ucy:"\u0423",ucy:"\u0443",Fcy:"\u0424",fcy:"\u0444",KHcy:"\u0425",khcy:"\u0445",TScy:"\u0426",tscy:"\u0446",CHcy:"\u0427",chcy:"\u0447",SHcy:"\u0428",shcy:"\u0448",SHCHcy:"\u0429",shchcy:"\u0449",HARDcy:"\u042A",hardcy:"\u044A",Ycy:"\u042B",ycy:"\u044B",SOFTcy:"\u042C",softcy:"\u044C",Ecy:"\u042D",ecy:"\u044D",YUcy:"\u042E",yucy:"\u044E",YAcy:"\u042F",yacy:"\u044F",DJcy:"\u0402",djcy:"\u0452",GJcy:"\u0403",gjcy:"\u0453",Jukcy:"\u0404",jukcy:"\u0454",DScy:"\u0405",dscy:"\u0455",Iukcy:"\u0406",iukcy:"\u0456",YIcy:"\u0407",yicy:"\u0457",Jsercy:"\u0408",jsercy:"\u0458",LJcy:"\u0409",ljcy:"\u0459",NJcy:"\u040A",njcy:"\u045A",TSHcy:"\u040B",tshcy:"\u045B",KJcy:"\u040C",kjcy:"\u045C",Ubrcy:"\u040E",ubrcy:"\u045E",DZcy:"\u040F",dzcy:"\u045F"},QUe={plus:"+",minus:"\u2212",mnplus:"\u2213",mp:"\u2213",pm:"\xB1",times:"\xD7",div:"\xF7",divide:"\xF7",sdot:"\u22C5",star:"\u2606",starf:"\u2605",bigstar:"\u2605",lowast:"\u2217",ast:"*",midast:"*",compfn:"\u2218",smallcircle:"\u2218",bullet:"\u2022",bull:"\u2022",nbsp:"\xA0",hellip:"\u2026",mldr:"\u2026",prime:"\u2032",Prime:"\u2033",tprime:"\u2034",bprime:"\u2035",backprime:"\u2035",minus:"\u2212",minusd:"\u2238",dotminus:"\u2238",plusdo:"\u2214",dotplus:"\u2214",plusmn:"\xB1",minusplus:"\u2213",mnplus:"\u2213",mp:"\u2213",setminus:"\u2216",smallsetminus:"\u2216",Backslash:"\u2216",setmn:"\u2216",ssetmn:"\u2216",lowbar:"_",verbar:"|",vert:"|",VerticalLine:"|",colon:":",Colon:"\u2237",Proportion:"\u2237",ratio:"\u2236",equals:"=",ne:"\u2260",nequiv:"\u2262",equiv:"\u2261",Congruent:"\u2261",sim:"\u223C",thicksim:"\u223C",thksim:"\u223C",sime:"\u2243",simeq:"\u2243",TildeEqual:"\u2243",asymp:"\u2248",approx:"\u2248",thickapprox:"\u2248",thkap:"\u2248",TildeTilde:"\u2248",ncong:"\u2247",cong:"\u2245",TildeFullEqual:"\u2245",asympeq:"\u224D",CupCap:"\u224D",bump:"\u224E",Bumpeq:"\u224E",HumpDownHump:"\u224E",bumpe:"\u224F",bumpeq:"\u224F",HumpEqual:"\u224F",dotminus:"\u2238",minusd:"\u2238",plusdo:"\u2214",dotplus:"\u2214",le:"\u2264",LessEqual:"\u2264",ge:"\u2265",GreaterEqual:"\u2265",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",greater:">",less:"<"},ZUe={alefsym:"\u2135",aleph:"\u2135",beth:"\u2136",gimel:"\u2137",daleth:"\u2138",forall:"\u2200",ForAll:"\u2200",part:"\u2202",PartialD:"\u2202",exist:"\u2203",Exists:"\u2203",nexist:"\u2204",nexists:"\u2204",empty:"\u2205",emptyset:"\u2205",emptyv:"\u2205",varnothing:"\u2205",nabla:"\u2207",Del:"\u2207",isin:"\u2208",isinv:"\u2208",in:"\u2208",Element:"\u2208",notin:"\u2209",notinva:"\u2209",ni:"\u220B",niv:"\u220B",SuchThat:"\u220B",ReverseElement:"\u220B",notni:"\u220C",notniva:"\u220C",prod:"\u220F",Product:"\u220F",coprod:"\u2210",Coproduct:"\u2210",sum:"\u2211",Sum:"\u2211",minus:"\u2212",mp:"\u2213",plusdo:"\u2214",dotplus:"\u2214",setminus:"\u2216",lowast:"\u2217",radic:"\u221A",Sqrt:"\u221A",prop:"\u221D",propto:"\u221D",Proportional:"\u221D",varpropto:"\u221D",infin:"\u221E",infintie:"\u29DD",ang:"\u2220",angle:"\u2220",angmsd:"\u2221",measuredangle:"\u2221",angsph:"\u2222",mid:"\u2223",VerticalBar:"\u2223",nmid:"\u2224",nsmid:"\u2224",npar:"\u2226",parallel:"\u2225",spar:"\u2225",nparallel:"\u2226",nspar:"\u2226",and:"\u2227",wedge:"\u2227",or:"\u2228",vee:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",Integral:"\u222B",conint:"\u222E",ContourIntegral:"\u222E",Conint:"\u222F",DoubleContourIntegral:"\u222F",Cconint:"\u2230",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",becaus:"\u2235",because:"\u2235",Because:"\u2235",ratio:"\u2236",Proportion:"\u2237",minusd:"\u2238",dotminus:"\u2238",mDDot:"\u223A",homtht:"\u223B",sim:"\u223C",bsimg:"\u223D",backsim:"\u223D",ac:"\u223E",mstpos:"\u223E",acd:"\u223F",VerticalTilde:"\u2240",wr:"\u2240",wreath:"\u2240",nsime:"\u2244",nsimeq:"\u2244",nsimeq:"\u2244",ncong:"\u2247",simne:"\u2246",ncongdot:"\u2A6D\u0338",ngsim:"\u2275",nsim:"\u2241",napprox:"\u2249",nap:"\u2249",ngeq:"\u2271",nge:"\u2271",nleq:"\u2270",nle:"\u2270",ngtr:"\u226F",ngt:"\u226F",nless:"\u226E",nlt:"\u226E",nprec:"\u2280",npr:"\u2280",nsucc:"\u2281",nsc:"\u2281"},eke={larr:"\u2190",leftarrow:"\u2190",LeftArrow:"\u2190",uarr:"\u2191",uparrow:"\u2191",UpArrow:"\u2191",rarr:"\u2192",rightarrow:"\u2192",RightArrow:"\u2192",darr:"\u2193",downarrow:"\u2193",DownArrow:"\u2193",harr:"\u2194",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",varr:"\u2195",updownarrow:"\u2195",UpDownArrow:"\u2195",nwarr:"\u2196",nwarrow:"\u2196",UpperLeftArrow:"\u2196",nearr:"\u2197",nearrow:"\u2197",UpperRightArrow:"\u2197",searr:"\u2198",searrow:"\u2198",LowerRightArrow:"\u2198",swarr:"\u2199",swarrow:"\u2199",LowerLeftArrow:"\u2199",lArr:"\u21D0",Leftarrow:"\u21D0",uArr:"\u21D1",Uparrow:"\u21D1",rArr:"\u21D2",Rightarrow:"\u21D2",dArr:"\u21D3",Downarrow:"\u21D3",hArr:"\u21D4",Leftrightarrow:"\u21D4",iff:"\u21D4",vArr:"\u21D5",Updownarrow:"\u21D5",lAarr:"\u21DA",Lleftarrow:"\u21DA",rAarr:"\u21DB",Rrightarrow:"\u21DB",lrarr:"\u21C6",leftrightarrows:"\u21C6",rlarr:"\u21C4",rightleftarrows:"\u21C4",lrhar:"\u21CB",leftrightharpoons:"\u21CB",ReverseEquilibrium:"\u21CB",rlhar:"\u21CC",rightleftharpoons:"\u21CC",Equilibrium:"\u21CC",udarr:"\u21C5",UpArrowDownArrow:"\u21C5",duarr:"\u21F5",DownArrowUpArrow:"\u21F5",llarr:"\u21C7",leftleftarrows:"\u21C7",rrarr:"\u21C9",rightrightarrows:"\u21C9",ddarr:"\u21CA",downdownarrows:"\u21CA",har:"\u21BD",lhard:"\u21BD",leftharpoondown:"\u21BD",lharu:"\u21BC",leftharpoonup:"\u21BC",rhard:"\u21C1",rightharpoondown:"\u21C1",rharu:"\u21C0",rightharpoonup:"\u21C0",lsh:"\u21B0",Lsh:"\u21B0",rsh:"\u21B1",Rsh:"\u21B1",ldsh:"\u21B2",rdsh:"\u21B3",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",mapstoleft:"\u21A4",mapstoup:"\u21A5",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",crarr:"\u21B5",nwarrow:"\u2196",nearrow:"\u2197",searrow:"\u2198",swarrow:"\u2199",nleftarrow:"\u219A",nleftrightarrow:"\u21AE",nrightarrow:"\u219B",nrarr:"\u219B",larrtl:"\u21A2",rarrtl:"\u21A3",leftarrowtail:"\u21A2",rightarrowtail:"\u21A3",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Larr:"\u219E",Rarr:"\u21A0",larrhk:"\u21A9",rarrhk:"\u21AA",larrlp:"\u21AB",looparrowleft:"\u21AB",rarrlp:"\u21AC",looparrowright:"\u21AC",harrw:"\u21AD",leftrightsquigarrow:"\u21AD",nrarrw:"\u219D\u0338",rarrw:"\u219D",rightsquigarrow:"\u219D",larrbfs:"\u291F",rarrbfs:"\u2920",nvHarr:"\u2904",nvlArr:"\u2902",nvrArr:"\u2903",larrfs:"\u291D",rarrfs:"\u291E",Map:"\u2905",larrsim:"\u2973",rarrsim:"\u2974",harrcir:"\u2948",Uarrocir:"\u2949",lurdshar:"\u294A",ldrdhar:"\u2967",ldrushar:"\u294B",rdldhar:"\u2969",lrhard:"\u296D",rlhar:"\u21CC",uharr:"\u21BE",uharl:"\u21BF",dharr:"\u21C2",dharl:"\u21C3",Uarr:"\u219F",Darr:"\u21A1",zigrarr:"\u21DD",nwArr:"\u21D6",neArr:"\u21D7",seArr:"\u21D8",swArr:"\u21D9",nharr:"\u21AE",nhArr:"\u21CE",nlarr:"\u219A",nlArr:"\u21CD",nrarr:"\u219B",nrArr:"\u21CF",larrb:"\u21E4",LeftArrowBar:"\u21E4",rarrb:"\u21E5",RightArrowBar:"\u21E5"},tke={square:"\u25A1",Square:"\u25A1",squ:"\u25A1",squf:"\u25AA",squarf:"\u25AA",blacksquar:"\u25AA",blacksquare:"\u25AA",FilledVerySmallSquare:"\u25AA",blk34:"\u2593",blk12:"\u2592",blk14:"\u2591",block:"\u2588",srect:"\u25AD",rect:"\u25AD",sdot:"\u22C5",sdotb:"\u22A1",dotsquare:"\u22A1",triangle:"\u25B5",tri:"\u25B5",trine:"\u25B5",utri:"\u25B5",triangledown:"\u25BF",dtri:"\u25BF",tridown:"\u25BF",triangleleft:"\u25C3",ltri:"\u25C3",triangleright:"\u25B9",rtri:"\u25B9",blacktriangle:"\u25B4",utrif:"\u25B4",blacktriangledown:"\u25BE",dtrif:"\u25BE",blacktriangleleft:"\u25C2",ltrif:"\u25C2",blacktriangleright:"\u25B8",rtrif:"\u25B8",loz:"\u25CA",lozenge:"\u25CA",blacklozenge:"\u29EB",lozf:"\u29EB",bigcirc:"\u25EF",xcirc:"\u25EF",circ:"\u02C6",Circle:"\u25CB",cir:"\u25CB",o:"\u25CB",bullet:"\u2022",bull:"\u2022",hellip:"\u2026",mldr:"\u2026",nldr:"\u2025",boxh:"\u2500",HorizontalLine:"\u2500",boxv:"\u2502",boxdr:"\u250C",boxdl:"\u2510",boxur:"\u2514",boxul:"\u2518",boxvr:"\u251C",boxvl:"\u2524",boxhd:"\u252C",boxhu:"\u2534",boxvh:"\u253C",boxH:"\u2550",boxV:"\u2551",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxDl:"\u2555",boxdL:"\u2556",boxDL:"\u2557",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255A",boxUl:"\u255C",boxuL:"\u255B",boxUL:"\u255D",boxvR:"\u255E",boxVr:"\u255F",boxVR:"\u2560",boxVl:"\u2562",boxvL:"\u2561",boxVL:"\u2563",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxvH:"\u256A",boxVh:"\u256B",boxVH:"\u256C"},rke={excl:"!",iexcl:"\xA1",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",nbsp:"\xA0",comma:",",period:".",colon:":",semi:";",vert:"|",Verbar:"\u2016",verbar:"|",dblac:"\u02DD",circ:"\u02C6",caron:"\u02C7",breve:"\u02D8",dot:"\u02D9",ring:"\u02DA",ogon:"\u02DB",tilde:"\u02DC",DiacriticalGrave:"`",DiacriticalAcute:"\xB4",DiacriticalTilde:"\u02DC",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",grave:"`",acute:"\xB4"},bk={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",euro:"\u20AC",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},nke={frac12:"\xBD",half:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044"},ike={trade:"\u2122",TRADE:"\u2122",telrec:"\u2315",target:"\u2316",ulcorn:"\u231C",ulcorner:"\u231C",urcorn:"\u231D",urcorner:"\u231D",dlcorn:"\u231E",llcorner:"\u231E",drcorn:"\u231F",lrcorner:"\u231F",intercal:"\u22BA",intcal:"\u22BA",oplus:"\u2295",CirclePlus:"\u2295",ominus:"\u2296",CircleMinus:"\u2296",otimes:"\u2297",CircleTimes:"\u2297",osol:"\u2298",odot:"\u2299",CircleDot:"\u2299",oast:"\u229B",circledast:"\u229B",odash:"\u229D",circleddash:"\u229D",ocirc:"\u229A",circledcirc:"\u229A",boxplus:"\u229E",plusb:"\u229E",boxminus:"\u229F",minusb:"\u229F",boxtimes:"\u22A0",timesb:"\u22A0",boxdot:"\u22A1",sdotb:"\u22A1",veebar:"\u22BB",vee:"\u2228",barvee:"\u22BD",and:"\u2227",wedge:"\u2227",Cap:"\u22D2",Cup:"\u22D3",Fork:"\u22D4",pitchfork:"\u22D4",epar:"\u22D5",ltlarr:"\u2976",nvap:"\u224D\u20D2",nvsim:"\u223C\u20D2",nvge:"\u2265\u20D2",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvgt:">\u20D2",nvltrie:"\u22B4\u20D2",nvrtrie:"\u22B5\u20D2",Vdash:"\u22A9",dashv:"\u22A3",vDash:"\u22A8",Vdash:"\u22A9",Vvdash:"\u22AA",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF"},oyr={...YUe,...zUe,...KUe,...XUe,...JUe,...QUe,...ZUe,...eke,...tke,...rke,...bk,...nke,...ike},CP={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},_Z={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var ayr=new Set("!?\\\\/[]$%{}^&*()<>|+");function ske(e){if(e[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let t of e)if(ayr.has(t))throw new Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`);return e}function SZ(...e){let t=Object.create(null);for(let r of e)if(r)for(let n of Object.keys(r)){let i=r[n];if(typeof i=="string")t[n]=i;else if(i&&typeof i=="object"&&i.val!==void 0){let s=i.val;typeof s=="string"&&(t[n]=s)}}return t}var Zv="external",Tk="base",bZ="all";function uyr(e){return!e||e===Zv?new Set([Zv]):e===bZ?new Set([bZ]):e===Tk?new Set([Tk]):Array.isArray(e)?new Set(e):new Set([Zv])}var Fa=Object.freeze({allow:0,leave:1,remove:2,throw:3}),cyr=new Set([9,10,13]);function lyr(e){if(!e)return{xmlVersion:1,onLevel:Fa.allow,nullLevel:Fa.remove};let t=e.xmlVersion===1.1?1.1:1,r=Fa[e.onNCR]??Fa.allow,n=Fa[e.nullNCR]??Fa.remove,i=Math.max(n,Fa.remove);return{xmlVersion:t,onLevel:r,nullLevel:i}}var cb=class{constructor(t={}){this._limit=t.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof t.postCheck=="function"?t.postCheck:n=>n,this._limitTiers=uyr(this._limit.applyLimitsTo??Zv),this._numericAllowed=t.numericAllowed??!0,this._baseMap=SZ(CP,t.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(t.remove&&Array.isArray(t.remove)?t.remove:[]),this._leaveSet=new Set(t.leave&&Array.isArray(t.leave)?t.leave:[]);let r=lyr(t.ncr);this._ncrXmlVersion=r.xmlVersion,this._ncrOnLevel=r.onLevel,this._ncrNullLevel=r.nullLevel}setExternalEntities(t){if(t)for(let r of Object.keys(t))ske(r);this._externalMap=SZ(t)}addExternalEntity(t,r){ske(t),typeof r=="string"&&r.indexOf("&")===-1&&(this._externalMap[t]=r)}addInputEntities(t){this._totalExpansions=0,this._expandedLength=0,this._inputMap=SZ(t)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(t){this._ncrXmlVersion=t===1.1?1.1:1}decode(t){if(typeof t!="string"||t.length===0)return t;let r=t,n=[],i=t.length,s=0,o=0,a=this._maxTotalExpansions>0,u=this._maxExpandedLength>0,c=a||u;for(;o<i;){if(t.charCodeAt(o)!==38){o++;continue}let f=o+1;for(;f<i&&t.charCodeAt(f)!==59&&f-o<=32;)f++;if(f>=i||t.charCodeAt(f)!==59){o++;continue}let p=t.slice(o+1,f);if(p.length===0){o++;continue}let d,h;if(this._removeSet.has(p))d="",h===void 0&&(h=Zv);else if(this._leaveSet.has(p)){o++;continue}else if(p.charCodeAt(0)===35){let g=this._resolveNCR(p);if(g===void 0){o++;continue}d=g,h=Tk}else{let g=this._resolveName(p);d=g?.value,h=g?.tier}if(d===void 0){o++;continue}if(o>s&&n.push(t.slice(s,o)),n.push(d),s=f+1,o=s,c&&this._tierCounts(h)){if(a&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(u){let g=d.length-(p.length+2);if(g>0&&(this._expandedLength+=g,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}s<i&&n.push(t.slice(s));let l=n.length===0?t:n.join("");return this._postCheck(l,r)}_tierCounts(t){return this._limitTiers.has(bZ)?!0:this._limitTiers.has(t)}_resolveName(t){if(t in this._inputMap)return{value:this._inputMap[t],tier:Zv};if(t in this._externalMap)return{value:this._externalMap[t],tier:Zv};if(t in this._baseMap)return{value:this._baseMap[t],tier:Tk}}_classifyNCR(t){return t===0?this._ncrNullLevel:t>=55296&&t<=57343||this._ncrXmlVersion===1&&t>=1&&t<=31&&!cyr.has(t)?Fa.remove:-1}_applyNCRAction(t,r,n){switch(t){case Fa.allow:return String.fromCodePoint(n);case Fa.remove:return"";case Fa.leave:return;case Fa.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${r}; (U+${n.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(n)}}_resolveNCR(t){let r=t.charCodeAt(1),n;if(r===120||r===88?n=parseInt(t.slice(2),16):n=parseInt(t.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let i=this._classifyNCR(n);if(!this._numericAllowed&&i<Fa.remove)return;let s=i===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,i);return this._applyNCRAction(s,t,n)}};var oke=e=>xP.includes(e)?"__"+e:e,fyr={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:oke};function pyr(e,t){if(typeof e!="string")return;let r=e.toLowerCase();if(xP.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);if(_k.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function ake(e,t){return typeof e=="boolean"?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof e=="object"&&e!==null?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??"all"}:ake(!0)}var uke=function(e){let t=Object.assign({},fyr,e),r=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(let{value:n,name:i}of r)n&&pyr(n,i);return t.onDangerousProperty===null&&(t.onDangerousProperty=oke),t.processEntities=ake(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(n=>typeof n=="string"&&n.startsWith("*.")?".."+n.substring(2):n)),t};var Ak;typeof Symbol!="function"?Ak="@@xmlMetadata":Ak=Symbol("XML Node Metadata");var Ua=class{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t,r){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),r!==void 0&&(this.child[this.child.length-1][Ak]={startIndex:r})}static getMetaDataSymbol(){return Ak}};var cke=":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",dyr=cke+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",lke=":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}",hyr=lke+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",fke=(e,t,r="")=>{let n=e.replace(":",""),i=t.replace(":",""),s=`[${n}][${i}]*`;return{name:new RegExp(`^[${e}][${t}]*$`,r),ncName:new RegExp(`^${s}$`,r),qName:new RegExp(`^${s}(?::${s})?$`,r),nmToken:new RegExp(`^[${t}]+$`,r),nmTokens:new RegExp(`^[${t}]+(?:\\s+[${t}]+)*$`,r)}},myr=fke(cke,dyr),gyr=fke(lke,hyr,"u"),yyr=(e="1.0")=>e==="1.1"?gyr:myr;var TZ=(e,{xmlVersion:t="1.0"}={})=>yyr(t).qName.test(e);var PP=class{constructor(t,r){this.suppressValidationErr=!t,this.options=t,this.xmlVersion=r||1}setXmlVersion(t=1){this.xmlVersion=t}readDocType(t,r){let n=Object.create(null),i=0;if(t[r+3]==="O"&&t[r+4]==="C"&&t[r+5]==="T"&&t[r+6]==="Y"&&t[r+7]==="P"&&t[r+8]==="E"){r=r+9;let s=1,o=!1,a=!1,u="";for(;r<t.length;r++)if(t[r]==="<"&&!a){if(o&&eE(t,"!ENTITY",r)){r+=7;let c,l;if([c,l,r]=this.readEntityExp(t,r+1,this.suppressValidationErr),l.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&i>=this.options.maxEntityCount)throw new Error(`Entity count (${i+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[c]=l,i++}}else if(o&&eE(t,"!ELEMENT",r)){r+=8;let{index:c}=this.readElementExp(t,r+1);r=c}else if(o&&eE(t,"!ATTLIST",r))r+=8;else if(o&&eE(t,"!NOTATION",r)){r+=9;let{index:c}=this.readNotationExp(t,r+1,this.suppressValidationErr);r=c}else if(eE(t,"!--",r))a=!0;else throw new Error("Invalid DOCTYPE");s++,u=""}else if(t[r]===">"){if(a?t[r-1]==="-"&&t[r-2]==="-"&&(a=!1,s--):s--,s===0)break}else t[r]==="["?o=!0:u+=t[r];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(t,r){r=ka(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r])&&t[r]!=='"'&&t[r]!=="'";)r++;let i=t.substring(n,r);if(OP(i,{xmlVersion:this.xmlVersion}),r=ka(t,r),!this.suppressValidationErr){if(t.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[r]==="%")throw new Error("Parameter entities are not supported")}let s="";if([r,s]=this.readIdentifierVal(t,r,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&s.length>this.options.maxEntitySize)throw new Error(`Entity "${i}" size (${s.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return r--,[i,s,r]}readNotationExp(t,r){r=ka(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let i=t.substring(n,r);!this.suppressValidationErr&&OP(i,{xmlVersion:this.xmlVersion}),r=ka(t,r);let s=t.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&s!=="SYSTEM"&&s!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);r+=s.length,r=ka(t,r);let o=null,a=null;if(s==="PUBLIC")[r,o]=this.readIdentifierVal(t,r,"publicIdentifier"),r=ka(t,r),(t[r]==='"'||t[r]==="'")&&([r,a]=this.readIdentifierVal(t,r,"systemIdentifier"));else if(s==="SYSTEM"&&([r,a]=this.readIdentifierVal(t,r,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:i,publicIdentifier:o,systemIdentifier:a,index:--r}}readIdentifierVal(t,r,n){let i="",s=t[r];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);r++;let o=r;for(;r<t.length&&t[r]!==s;)r++;if(i=t.substring(o,r),t[r]!==s)throw new Error(`Unterminated ${n} value`);return r++,[r,i]}readElementExp(t,r){r=ka(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let i=t.substring(n,r);if(!this.suppressValidationErr&&!TZ(i,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${i}"`);r=ka(t,r);let s="";if(t[r]==="E"&&eE(t,"MPTY",r))r+=4;else if(t[r]==="A"&&eE(t,"NY",r))r+=2;else if(t[r]==="("){r++;let o=r;for(;r<t.length&&t[r]!==")";)r++;if(s=t.substring(o,r),t[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[r]}"`);return{elementName:i,contentModel:s.trim(),index:r}}readAttlistExp(t,r){r=ka(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let i=t.substring(n,r);for(OP(i,{xmlVersion:this.xmlVersion}),r=ka(t,r),n=r;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(n,r);if(!OP(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${s}"`);r=ka(t,r);let o="";if(t.substring(r,r+8).toUpperCase()==="NOTATION"){if(o="NOTATION",r+=8,r=ka(t,r),t[r]!=="(")throw new Error(`Expected '(', found "${t[r]}"`);r++;let u=[];for(;r<t.length&&t[r]!==")";){let c=r;for(;r<t.length&&t[r]!=="|"&&t[r]!==")";)r++;let l=t.substring(c,r);if(l=l.trim(),!OP(l,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${l}"`);u.push(l),t[r]==="|"&&(r++,r=ka(t,r))}if(t[r]!==")")throw new Error("Unterminated list of notations");r++,o+=" ("+u.join("|")+")"}else{let u=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;o+=t.substring(u,r);let c=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!c.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}r=ka(t,r);let a="";return t.substring(r,r+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",r+=8):t.substring(r,r+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",r+=7):[r,a]=this.readIdentifierVal(t,r,"ATTLIST"),{elementName:i,attributeName:s,attributeType:o,defaultValue:a,index:r}}},ka=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function eE(e,t,r){for(let n=0;n<t.length;n++)if(t[n]!==e[r+n+1])return!1;return!0}function OP(e,t){if(TZ(e,{xmlVersion:t}))return e;throw new Error(`Invalid entity name ${e}`)}var vyr=/^[-+]?0x[a-fA-F0-9]+$/,Eyr=/^0b[01]+$/,_yr=/^0o[0-7]+$/,Syr=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,byr={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function xZ(e,t={}){if(t=Object.assign({},byr,t),!e||typeof e!="string")return e;let r=e.trim();if(r.length===0)return e;if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(r==="0")return 0;if(t.hex&&vyr.test(r))return AZ(r,16);if(t.binary&&Eyr.test(r))return AZ(r,2);if(t.octal&&_yr.test(r))return AZ(r,8);if(isFinite(r)){if(r.includes("e")||r.includes("E"))return Ayr(e,r,t);{let n=Syr.exec(r);if(n){let i=n[1]||"",s=n[2],o=xyr(n[3]),a=i?e[s.length+1]===".":e[s.length]===".";if(!t.leadingZeros&&(s.length>1||s.length===1&&!a))return e;{let u=Number(r),c=String(u);if(u===0)return u;if(c.search(/[eE]/)!==-1)return t.eNotation?u:e;if(r.indexOf(".")!==-1)return c==="0"||c===o||c===`${i}${o}`?u:e;let l=s?o:r;return s?l===c||i+l===c?u:e:l===c||l===i+c?u:e}}else return e}}else return wyr(e,Number(r),t)}var Tyr=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Ayr(e,t,r){if(!r.eNotation)return e;let n=t.match(Tyr);if(n){let i=n[1]||"",s=n[3].indexOf("e")===-1?"E":"e",o=n[2],a=i?e[o.length+1]===s:e[o.length]===s;return o.length>1&&a?e:o.length===1&&(n[3].startsWith(`.${s}`)||n[3][0]===s)?Number(t):o.length>0?r.leadingZeros&&!a?(t=(n[1]||"")+n[3],Number(t)):e:Number(t)}else return e}function xyr(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function AZ(e,t){let r=e.trim();if((t===2||t===8)&&(e=r.substring(2)),parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function wyr(e,t,r){let n=t===1/0;switch(r.infinity.toLowerCase()){case"null":return null;case"infinity":return t;case"string":return n?"Infinity":"-Infinity";default:return e}}function wZ(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(let r of e)if(typeof r=="string"&&t===r||r instanceof RegExp&&r.test(t))return!0}:()=>!1}var tE=class{constructor(t,r={},n){this.pattern=t,this.separator=r.separator||".",this.segments=this._parse(t),this.data=n,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(t){let r=[],n=0,i="";for(;n<t.length;)t[n]===this.separator?n+1<t.length&&t[n+1]===this.separator?(i.trim()&&(r.push(this._parseSegment(i.trim())),i=""),r.push({type:"deep-wildcard"}),n+=2):(i.trim()&&r.push(this._parseSegment(i.trim())),i="",n++):(i+=t[n],n++);return i.trim()&&r.push(this._parseSegment(i.trim())),r}_parseSegment(t){let r={type:"tag"},n=null,i=t,s=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){let l=s[2].slice(1,-1);l&&(n=l)}let o,a=i;if(i.includes("::")){let l=i.indexOf("::");if(o=i.substring(0,l).trim(),a=i.substring(l+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${t}`)}let u,c=null;if(a.includes(":")){let l=a.lastIndexOf(":"),f=a.substring(0,l).trim(),p=a.substring(l+1).trim();["first","last","odd","even"].includes(p)||/^nth\(\d+\)$/.test(p)?(u=f,c=p):u=a}else u=a;if(!u)throw new Error(`Invalid segment pattern: ${t}`);if(r.tag=u,o&&(r.namespace=o),n)if(n.includes("=")){let l=n.indexOf("=");r.attrName=n.substring(0,l).trim(),r.attrValue=n.substring(l+1).trim()}else r.attrName=n.trim();if(c){let l=c.match(/^nth\((\d+)\)$/);l?(r.position="nth",r.positionValue=parseInt(l[1],10)):r.position=c}return r}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var lb=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(t){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(t.pattern))return this;if(this._patterns.add(t.pattern),t.hasDeepWildcard())return this._deepWildcards.push(t),this;let r=t.length,i=t.segments[t.segments.length-1]?.tag;if(!i||i==="*")this._wildcardByDepth.has(r)||this._wildcardByDepth.set(r,[]),this._wildcardByDepth.get(r).push(t);else{let s=`${r}:${i}`;this._byDepthAndTag.has(s)||this._byDepthAndTag.set(s,[]),this._byDepthAndTag.get(s).push(t)}return this}addAll(t){for(let r of t)this.add(r);return this}has(t){return this._patterns.has(t.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(t){return this.findMatch(t)!==null}findMatch(t){let r=t.getDepth(),n=t.getCurrentTag(),i=`${r}:${n}`,s=this._byDepthAndTag.get(i);if(s){for(let a=0;a<s.length;a++)if(t.matches(s[a]))return s[a]}let o=this._wildcardByDepth.get(r);if(o){for(let a=0;a<o.length;a++)if(t.matches(o[a]))return o[a]}for(let a=0;a<this._deepWildcards.length;a++)if(t.matches(this._deepWildcards[a]))return this._deepWildcards[a];return null}};var CZ=class{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){let t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){let t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){let r=this._matcher.path;if(r.length!==0)return r[r.length-1].values?.[t]}hasAttr(t){let r=this._matcher.path;if(r.length===0)return!1;let n=r[r.length-1];return n.values!==void 0&&t in n.values}getPosition(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].position??0}getCounter(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,r=!0){return this._matcher.toString(t,r)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}},fb=class{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new CZ(this)}push(t,r=null,n=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);let s=this.siblingStacks[i],o=n?`${n}:${t}`:t,a=s.get(o)||0,u=0;for(let l of s.values())u+=l;s.set(o,a+1);let c={tag:t,position:u,counter:a};n!=null&&(c.namespace=n),r!=null&&(c.values=r),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){let r=this.path[this.path.length-1];t!=null&&(r.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(this.path.length!==0)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(this.path.length===0)return!1;let r=this.path[this.path.length-1];return r.values!==void 0&&t in r.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,r=!0){let n=t||this.separator;if(n===this.separator&&r===!0){if(this._pathStringCache!==null)return this._pathStringCache;let s=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(n);return this._pathStringCache=s,s}return this.path.map(s=>r&&s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(n)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(t){let r=t.segments;return r.length===0?!1:t.hasDeepWildcard()?this._matchWithDeepWildcard(r):this._matchSimple(r)}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let r=0;r<t.length;r++)if(!this._matchSegment(t[r],this.path[r],r===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let r=this.path.length-1,n=t.length-1;for(;n>=0&&r>=0;){let i=t[n];if(i.type==="deep-wildcard"){if(n--,n<0)return!0;let s=t[n],o=!1;for(let a=r;a>=0;a--)if(this._matchSegment(s,this.path[a],a===this.path.length-1)){r=a-1,n--,o=!0;break}if(!o)return!1}else{if(!this._matchSegment(i,this.path[r],r===this.path.length-1))return!1;r--,n--}}return n<0}_matchSegment(t,r,n){if(t.tag!=="*"&&t.tag!==r.tag||t.namespace!==void 0&&t.namespace!=="*"&&t.namespace!==r.namespace||t.attrName!==void 0&&(!n||!r.values||!(t.attrName in r.values)||t.attrValue!==void 0&&String(r.values[t.attrName])!==String(t.attrValue)))return!1;if(t.position!==void 0){if(!n)return!1;let i=r.counter??0;if(t.position==="first"&&i!==0)return!1;if(t.position==="odd"&&i%2!==1)return!1;if(t.position==="even"&&i%2!==0)return!1;if(t.position==="nth"&&i!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this._pathStringCache=null,this.path=t.path.map(r=>({...r})),this.siblingStacks=t.siblingStacks.map(r=>new Map(r))}readOnly(){return this._view}};function Cyr(e,t){if(!e)return{};let r=t.attributesGroupName?e[t.attributesGroupName]:e;if(!r)return{};let n={};for(let i in r)if(i.startsWith(t.attributeNamePrefix)){let s=i.substring(t.attributeNamePrefix.length);n[s]=r[i]}else n[i]=r[i];return n}function Oyr(e){if(!e||typeof e!="string")return;let t=e.indexOf(":");if(t!==-1&&t>0){let r=e.substring(0,t);if(r!=="xmlns")return r}}var DP=class{constructor(t,r){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Iyr,this.parseTextData=Pyr,this.resolveNameSpace=Dyr,this.buildAttributesMap=Nyr,this.isItStopNode=Uyr,this.replaceEntitiesValue=Myr,this.readStopNodeData=qyr,this.saveTextToParentTag=Fyr,this.addChild=Lyr,this.ignoreAttributesFn=wZ(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let n={...CP};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?n=this.options.htmlEntities:this.options.htmlEntities===!0&&(n={..._Z,...bk}),this.entityDecoder=new cb({namedEntities:{...n,...r},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new fb,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new lb;let i=this.options.stopNodes;if(i&&i.length>0){for(let s=0;s<i.length;s++){let o=i[s];typeof o=="string"?this.stopNodeExpressionsSet.add(new tE(o)):o instanceof tE&&this.stopNodeExpressionsSet.add(o)}this.stopNodeExpressionsSet.seal()}}};function Pyr(e,t,r,n,i,s,o){let a=this.options;if(e!==void 0&&(a.trimValues&&!n&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e,t,r));let u=a.jPath?r.toString():r,c=a.tagValueProcessor(t,e,u,i,s);return c==null?e:typeof c!=typeof e||c!==e?c:a.trimValues||e.trim()===e?DZ(e,a.parseTagValue,a.numberParseOptions):e}}function Dyr(e){if(this.options.removeNSPrefix){let t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}var Ryr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Nyr(e,t,r,n=!1){let i=this.options;if(n===!0||i.ignoreAttributes!==!0&&typeof e=="string"){let s=Ek(e,Ryr),o=s.length,a={},u=new Array(o),c=!1,l={};for(let d=0;d<o;d++){let h=this.resolveNameSpace(s[d][1]),g=s[d][4];if(h.length&&g!==void 0){let _=g;i.trimValues&&(_=_.trim()),_=this.replaceEntitiesValue(_,r,this.readonlyMatcher),u[d]=_,l[h]=_,c=!0}}c&&typeof t=="object"&&t.updateCurrent&&t.updateCurrent(l);let f=i.jPath?t.toString():this.readonlyMatcher,p=!1;for(let d=0;d<o;d++){let h=this.resolveNameSpace(s[d][1]);if(this.ignoreAttributesFn(h,f))continue;let g=i.attributeNamePrefix+h;if(h.length)if(i.transformAttributeName&&(g=i.transformAttributeName(g)),g=pke(g,i),s[d][4]!==void 0){let _=u[d],S=i.attributeValueProcessor(h,_,f);S==null?a[g]=_:typeof S!=typeof _||S!==_?a[g]=S:a[g]=DZ(_,i.parseAttributeValue,i.numberParseOptions),p=!0}else i.allowBooleanAttributes&&(a[g]=!0,p=!0)}if(!p)return;if(i.attributesGroupName&&!i.preserveOrder){let d={};return d[i.attributesGroupName]=a,d}return a}}var Iyr=function(e){e=e.replace(/\r\n?/g,`
|
|
660
|
-
`);let t=new Ua("!xml"),r=t,n="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let i=this.options,s=new PP(i.processEntities),o=e.length;for(let a=0;a<o;a++)if(e[a]==="<"){let c=e.charCodeAt(a+1);if(c===47){let l=pb(e,">",a,"Closing Tag is not closed."),f=e.substring(a+2,l).trim();if(i.removeNSPrefix){let d=f.indexOf(":");d!==-1&&(f=f.substr(d+1))}f=OZ(i.transformTagName,f,"",i).tagName,r&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher));let p=this.matcher.getCurrentTag();if(f&&i.unpairedTagsSet.has(f))throw new Error(`Unpaired tag can not be used as closing tag: </${f}>`);p&&i.unpairedTagsSet.has(p)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=this.tagsNodeStack.pop(),n="",a=l}else if(c===63){let l=PZ(e,a,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let f=this.buildAttributesMap(l.tagExp,this.matcher,l.tagName,!0);if(f){let p=f[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(p)||1),s.setXmlVersion(Number(p)||1)}if(!(i.ignoreDeclaration&&l.tagName==="?xml"||i.ignorePiTags)){let p=new Ua(l.tagName);p.add(i.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&i.ignoreAttributes!==!0&&(p[":@"]=f),this.addChild(r,p,this.readonlyMatcher,a)}a=l.closeIndex+1}else if(c===33&&e.charCodeAt(a+2)===45&&e.charCodeAt(a+3)===45){let l=pb(e,"-->",a+4,"Comment is not closed.");if(i.commentPropName){let f=e.substring(a+4,l-2);n=this.saveTextToParentTag(n,r,this.readonlyMatcher),r.add(i.commentPropName,[{[i.textNodeName]:f}])}a=l}else if(c===33&&e.charCodeAt(a+2)===68){let l=s.readDocType(e,a);this.entityDecoder.addInputEntities(l.entities),a=l.i}else if(c===33&&e.charCodeAt(a+2)===91){let l=pb(e,"]]>",a,"CDATA is not closed.")-2,f=e.substring(a+9,l);n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let p=this.parseTextData(f,r.tagname,this.readonlyMatcher,!0,!1,!0,!0);p==null&&(p=""),i.cdataPropName?r.add(i.cdataPropName,[{[i.textNodeName]:f}]):r.add(i.textNodeName,p),a=l+2}else{let l=PZ(e,a,i.removeNSPrefix);if(!l){let N=e.substring(Math.max(0,a-50),Math.min(o,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${N}"`)}let f=l.tagName,p=l.rawTagName,d=l.tagExp,h=l.attrExpPresent,g=l.closeIndex;if({tagName:f,tagExp:d}=OZ(i.transformTagName,f,d,i),i.strictReservedNames&&(f===i.commentPropName||f===i.cdataPropName||f===i.textNodeName||f===i.attributesGroupName))throw new Error(`Invalid tag name: ${f}`);r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher,!1));let _=r;_&&i.unpairedTagsSet.has(_.tagname)&&(r=this.tagsNodeStack.pop(),this.matcher.pop());let S=!1;d.length>0&&d.lastIndexOf("/")===d.length-1&&(S=!0,f[f.length-1]==="/"?(f=f.substr(0,f.length-1),d=f):d=d.substr(0,d.length-1),h=f!==d);let T=null,A={},w;w=Oyr(p),f!==t.tagname&&this.matcher.push(f,{},w),f!==d&&h&&(T=this.buildAttributesMap(d,this.matcher,f),T&&(A=Cyr(T,i))),f!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let x=a;if(this.isCurrentNodeStopNode){let N="";if(S)a=l.closeIndex;else if(i.unpairedTagsSet.has(f))a=l.closeIndex;else{let D=this.readStopNodeData(e,p,g+1);if(!D)throw new Error(`Unexpected end of ${p}`);a=D.i,N=D.tagContent}let F=new Ua(f);T&&(F[":@"]=T),F.add(i.textNodeName,N),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(r,F,this.readonlyMatcher,x)}else{if(S){({tagName:f,tagExp:d}=OZ(i.transformTagName,f,d,i));let N=new Ua(f);T&&(N[":@"]=T),this.addChild(r,N,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(i.unpairedTagsSet.has(f)){let N=new Ua(f);T&&(N[":@"]=T),this.addChild(r,N,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=!1,a=l.closeIndex;continue}else{let N=new Ua(f);if(this.tagsNodeStack.length>i.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),T&&(N[":@"]=T),this.addChild(r,N,this.readonlyMatcher,x),r=N}n="",a=g}}}else n+=e[a];return t.child};function Lyr(e,t,r,n){this.options.captureMetaData||(n=void 0);let i=this.options.jPath?r.toString():r,s=this.options.updateTag(t.tagname,i,t[":@"]);s===!1||(typeof s=="string"&&(t.tagname=s),e.addChild(t,n))}function Myr(e,t,r){let n=this.options.processEntities;if(!n||!n.enabled)return e;if(n.allowedTags){let i=this.options.jPath?r.toString():r;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(t):n.allowedTags(t,i)))return e}if(n.tagFilter){let i=this.options.jPath?r.toString():r;if(!n.tagFilter(t,i))return e}return this.entityDecoder.decode(e)}function Fyr(e,t,r,n){return e&&(n===void 0&&(n=t.child.length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Uyr(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function kyr(e,t,r=">"){let n=0,i=e.length,s=r.charCodeAt(0),o=r.length>1?r.charCodeAt(1):-1,a="",u=t;for(let c=t;c<i;c++){let l=e.charCodeAt(c);if(n)l===n&&(n=0);else if(l===34||l===39)n=l;else if(l===s)if(o!==-1){if(e.charCodeAt(c+1)===o)return a+=e.substring(u,c),{data:a,index:c}}else return a+=e.substring(u,c),{data:a,index:c};else l===9&&!n&&(a+=e.substring(u,c)+" ",u=c+1)}}function pb(e,t,r,n){let i=e.indexOf(t,r);if(i===-1)throw new Error(n);return i+t.length-1}function Byr(e,t,r,n){let i=e.indexOf(t,r);if(i===-1)throw new Error(n);return i}function PZ(e,t,r,n=">"){let i=kyr(e,t+1,n);if(!i)return;let s=i.data,o=i.index,a=s.search(/\s/),u=s,c=!0;a!==-1&&(u=s.substring(0,a),s=s.substring(a+1).trimStart());let l=u;if(r){let f=u.indexOf(":");f!==-1&&(u=u.substr(f+1),c=u!==i.data.substr(f+1))}return{tagName:u,tagExp:s,closeIndex:o,attrExpPresent:c,rawTagName:l}}function qyr(e,t,r){let n=r,i=1,s=e.length;for(;r<s;r++)if(e[r]==="<"){let o=e.charCodeAt(r+1);if(o===47){let a=Byr(e,">",r,`${t} is not closed`);if(e.substring(r+2,a).trim()===t&&(i--,i===0))return{tagContent:e.substring(n,r),i:a};r=a}else if(o===63)r=pb(e,"?>",r+1,"StopNode is not closed.");else if(o===33&&e.charCodeAt(r+2)===45&&e.charCodeAt(r+3)===45)r=pb(e,"-->",r+3,"StopNode is not closed.");else if(o===33&&e.charCodeAt(r+2)===91)r=pb(e,"]]>",r,"StopNode is not closed.")-2;else{let a=PZ(e,r,!1);a&&((a&&a.tagName)===t&&a.tagExp[a.tagExp.length-1]!=="/"&&i++,r=a.closeIndex)}}}function DZ(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:xZ(e,r)}else return VUe(e)?e:""}function OZ(e,t,r,n){if(e){let i=e(t);r===t&&(r=i),t=i}return t=pke(t,n),{tagName:t,tagExp:r}}function pke(e,t){if(_k.includes(e))throw new Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return xP.includes(e)?t.onDangerousProperty(e):e}var RZ=Ua.getMetaDataSymbol();function jyr(e,t){if(!e||typeof e!="object")return{};if(!t)return e;let r={};for(let n in e)if(n.startsWith(t)){let i=n.substring(t.length);r[i]=e[n]}else r[n]=e[n];return r}function NZ(e,t,r,n){return dke(e,t,r,n)}function dke(e,t,r,n){let i,s={};for(let o=0;o<e.length;o++){let a=e[o],u=Vyr(a);if(u!==void 0&&u!==t.textNodeName){let c=jyr(a[":@"]||{},t.attributeNamePrefix);r.push(u,c)}if(u===t.textNodeName)i===void 0?i=a[u]:i+=""+a[u];else{if(u===void 0)continue;if(a[u]){let c=dke(a[u],t,r,n),l=$yr(c,t);if(Object.keys(c).length===0&&t.alwaysCreateTextNode&&(c[t.textNodeName]=""),a[":@"]?Gyr(c,a[":@"],n,t):Object.keys(c).length===1&&c[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?c=c[t.textNodeName]:Object.keys(c).length===0&&(t.alwaysCreateTextNode?c[t.textNodeName]="":c=""),a[RZ]!==void 0&&typeof c=="object"&&c!==null&&(c[RZ]=a[RZ]),s[u]!==void 0&&Object.prototype.hasOwnProperty.call(s,u))Array.isArray(s[u])||(s[u]=[s[u]]),s[u].push(c);else{let f=t.jPath?n.toString():n;t.isArray(u,f,l)?s[u]=[c]:s[u]=c}u!==void 0&&u!==t.textNodeName&&r.pop()}}}return typeof i=="string"?i.length>0&&(s[t.textNodeName]=i):i!==void 0&&(s[t.textNodeName]=i),s}function Vyr(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function Gyr(e,t,r,n){if(t){let i=Object.keys(t),s=i.length;for(let o=0;o<s;o++){let a=i[o],u=a.startsWith(n.attributeNamePrefix)?a.substring(n.attributeNamePrefix.length):a,c=n.jPath?r.toString()+"."+u:r;n.isArray(a,c,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function $yr(e,t){let{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}var zf=class{constructor(t){this.externalEntities={},this.options=uke(t)}parse(t,r){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let s=Sk(t,r);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}let n=new DP(this.options,this.externalEntities),i=n.parseXml(t);return this.options.preserveOrder||i===void 0?i:NZ(i,this.options,n.matcher,n.readonlyMatcher)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}static getMetaDataSymbol(){return Ua.getMetaDataSymbol()}};var db={validate:Sk};var Bm=class extends Pa{static ADT_DISCOVERY_SERVICE_PATH="/sap/bc/adt/discovery";schemaStore=new vk;log;async getServiceDefinition(t){await this.checkOrLoadAdtDiscoverySchema();let r=this.schemaStore.getAdtCollection(t);return this.validateServiceSchema(t,r)?r:(this.log.warn("Invalid Discovery Schema"),null)}validateServiceSchema(t,r){return r?r.href?!0:(this.log.warn(`Empty href in schema: ${t.term} - ${t.scheme}`),!1):(this.log.warn(`Schema Not Found: ${t.term} - ${t.scheme}`),!1)}async checkOrLoadAdtDiscoverySchema(){if(!this.schemaStore.isAdtSchemaEmpty())return;let t=await this.get("",{headers:{Accept:"application/*"}}),r=this.parseAdtSchemaData(t.data);this.schemaStore.updateSchemaData(r)}parseAdtSchemaData(t){if(db.validate(t)!==!0)return null;let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0},i=new zf(r).parse(t,!0);return i.service?i:null}};var Cd=class extends Pa{static PATH="/sap/bc/ui2/app_index";log;async search(t={},r){let n={...t};r&&(n.fields=r.join(","));let i=await this.get("/",{params:n});return JSON.parse(i.data).results}async getIsManiFirstSupported(t){try{let r={id:t},n=await this.get("/ui5_app_mani_first_supported",{params:r});return JSON.parse(n.data)}catch(r){throw this.log.error(`Fail fetching ui5_app_mani_first_supported for app with id: ${t}.`),this.log.debug(r),r}}async getAppInfo(t){try{let r=await this.get("/ui5_app_info_json",{params:{id:t}});return JSON.parse(r.data)}catch(r){throw vF(r)?this.log.error(`Failed fetching ui5_app_info_json for app with id ${t}.`):this.log.error(`Parsing error: ui5_app_info_json is not in expected format for app with id ${t}.`),this.log.debug(r),r}}};var RP={UI:"UI",NotClassified:"Not Classified",WebApi:"WEB_API",NotDetermined:"Not Determined"},hb=class extends bm{entitySet;services;isS4Cloud;async listServices(t=!1){return this.services||(this.services=await this.fetchServices(t)),this.services}};var hke="ServiceCollection",mke="RecommendedServiceCollection",Hyr="((IsSapService%20eq%20true)and(ReleaseStatus%20eq%20%27RELEASED%27))or((IsSapService%20eq%20false))",qm=class extends hb{static PATH="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2";async determineEntitySet(){let t=await this.document();this.entitySet=t.EntitySets.includes(mke)?mke:hke}getServicePath(t,r){let n;try{n=new URL(t)}catch{n=new URL(t,r)}return n.pathname}mapServices(t){return t.map(r=>{let n=this.getServicePath(r.ServiceUrl,this.defaults.baseURL);return{id:r.ID,name:r.TechnicalServiceName,path:n,serviceVersion:r.TechnicalServiceVersion+"",odataVersion:Er.v2,serviceType:r.ServiceType}})}async fetchServices(){let t={$format:"json"};this.entitySet||await this.determineEntitySet(),this.entitySet===hke&&await this.isS4Cloud&&(t.$filter=Hyr);let n=(await this.get(`/${this.entitySet}`,{params:t})).odata();if(If.containsError(n))throw new If(n);return this.mapServices(n)}async findService({title:t,path:r}){let n=1;if(!t){let u=r.replace(/\/$/,"").split("/").pop().split(";");if(t=u[0].toUpperCase(),!t)throw new Error(`Cannot determine service title from path: ${r}`);u.slice(1).forEach(l=>{let[f,p]=l.split("=");f==="v"&&(n=Number.parseInt(p,10))})}let i={$format:"json",$filter:`Title eq '${t}' and TechnicalServiceVersion eq ${n}`},s=this.entitySet?`/${this.entitySet}`:"/ServiceCollection",a=(await this.get(s,{params:i})).odata();if(a.length>1){let u=a.filter(c=>c.ServiceUrl?.toUpperCase().includes((r||t).toUpperCase()));if(u.length>1)this.log.warn("Service filter was not sufficient to identify one service.");else if(u.length>0)return this.log.info(`Service filter chose service: ${u[0].TechnicalServiceName}`),u[0]}return a.length>0?a[0]:void 0}async getServiceAnnotations({id:t,title:r,path:n}){if(!t){let i=await this.findService({title:r,path:n});i&&(t=i.ID)}return t?(await this.get(`/ServiceCollection('${encodeURIComponent(t)}')/Annotations`,{params:{$format:"json"}})).odata():[]}async getAnnotations({id:t,title:r,path:n}){if(!t&&!r&&!n)throw new Error("No filter parameters passed in");let i=await this.getServiceAnnotations({id:t,title:r,path:n}),s=[];for(let o of i){let a=`/Annotations(TechnicalName='${encodeURIComponent(o.TechnicalName)}',Version='${o.Version}')/$value/`,u=await this.get(a,{headers:{Accept:"application/xml"}});u.data?s.push({TechnicalName:o.TechnicalName,Version:o.Version,Definitions:u.data,Uri:this.defaults.baseURL+a}):this.log.warn(`No annotations found for TechnicalName=${o.TechnicalName}, Version=${o.Version}`)}return s}async getServiceType(t){let r,{ID:n}=await this.findService({path:t});if(n){let i=await this.get(`/ServiceTypeForHUBServices('${encodeURIComponent(n)}')`);i&&(r=i.odata().ServiceType)}return r}};var gke="RecommendedServices",yke="Services",mb=class extends hb{logger=new vs;static PATH="/sap/opu/odata4/iwfnd/config/default/iwfnd/catalog/0002";mapServices(t,r,n=!1){let i=[],s=new Set;return t.filter(o=>o?.DefaultSystem?.[r]?.length>0).forEach(o=>{i.push(...o.DefaultSystem[r].flatMap(a=>{let u=a.ServiceUrl.split("?").shift();if(n){let c=`${a.ServiceId}|${u}`;if(s.has(c))return[];s.add(c)}return{id:a.ServiceId,group:o.GroupId,path:u,name:`${o.GroupId} > ${a.ServiceAlias||a.ServiceId}`,serviceVersion:a.ServiceVersion,odataVersion:Er.v4,serviceType:a.ServiceType}}))}),i}async fetchServicesNextLink(){if(this.entitySet===void 0){let o=await this.metadata();this.entitySet=o.includes('Name="RecommendedServices"')?gke:yke}let t=new URLSearchParams([["$count","true"],["$expand",`DefaultSystem($expand=${this.entitySet})`]]),n=(await this.get("/ServiceGroups",{params:t},!0)).odata(),i=n.value,s=1;for(;n["@odata.nextLink"];){let o=new URL(n["@odata.nextLink"],this.defaults.baseURL);n=(await this.get("/ServiceGroups",{params:o.searchParams},!0)).odata(),s++,i.push(...n.value)}if(this.logger.log(`Fetched ${i.length} service groups in ${s} requests.`),If.containsError(i))throw new If(i);return this.mapServices(i,this.entitySet)}async fetchServices(t=!1){return t?this.fetchServicesNextLink():this.fetchServicesParallel()}async fetchServicesParallel(){if(this.entitySet===void 0){let c=await this.metadata();this.entitySet=c.includes('Name="RecommendedServices"')?gke:yke}let r=new URLSearchParams([["$count","true"],["$top","1000"],["$expand",`DefaultSystem($expand=${this.entitySet})`]]),i=(await this.get("/ServiceGroups",{params:r},!0)).odata(),s=i.value,o=i["@odata.count"],a=Number.parseInt(i["@odata.nextLink"]?.split("skiptoken=")[1],10),u=1;if(!Number.isNaN(a)){let c=Math.ceil(o/a),l=Array.from({length:c-1},(p,d)=>{let h=new URLSearchParams([["$count","true"],["$skip",String((d+1)*a)],["$top",a.toString()],["$expand",`DefaultSystem($expand=${this.entitySet})`]]);return u++,this.get("/ServiceGroups",{params:h},!0)});(await Promise.all(l)).forEach(p=>{let d=p.odata();s.push(...d.value)})}if(this.logger.log(`Fetched ${s.length} service groups in ${u} requests.`),If.containsError(s))throw new If(s);return this.mapServices(s,this.entitySet,!0)}getAnnotations(){return Promise.resolve([])}getServiceType(){return Promise.resolve(void 0)}};var NP;(function(e){e.SAP="SAP",e.Customer="CUSTOMER"})(NP||(NP={}));var ti=class extends Pa{log;serviceSchema;static getAdtCatagory(){throw new Error("NEEDS TO BE IMPLEMENTED BY AdtService SUBCLASSES")}attachAdtSchema(t){this.serviceSchema=t}parseResponse(t){if(db.validate(t)!==!0)return this.log.warn(`Invalid XML: ${t}`),{};let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0};return new zf(r).parse(t,!0)}};var IP=class e extends ti{static adtCategory={scheme:"http://www.sap.com/adt/categories/ato",term:"settings"};static getAdtCatagory(){return e.adtCategory}async getAtoInfo(){let t={headers:{Accept:"application/*"}},r=await this.get("",t);return this.parseAtoResponse(r.data)}parseAtoResponse(t){if(db.validate(t)!==!0)return this.log.warn(`Invalid XML: ${t}`),{};let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0},i=new zf(r).parse(t,!0);return i.settings?i.settings:{}}};var fBe=be(vke(),1),bvr=be(lBe(),1);var WP=class e extends ti{static adtCategory={scheme:"http://www.sap.com/adt/categories/respository",term:"generators"};static getAdtCatagory(){return e.adtCategory}async getUIServiceGeneratorConfig(t){let r=await this.get("",{headers:{Accept:"application/atom+xml;type=feed"},params:{referencedObject:t,type:"webapi"}}),n=this.parseResponse(r.data).feed?.entry;if(n?.id==="published-ui-service")return n;throw new Error("UI Service Generator not found")}};var YP=class e extends ti{static adtCategory={scheme:"http://www.sap.com/adt/categories/respository",term:"generators"};static getAdtCatagory(){return e.adtCategory}id;async getRAPGeneratorConfig(){let t=await this.get("",{headers:{Accept:"application/atom+xml;type=feed"},params:{type:"webapi",fetchAllGenerators:!0}}),r=this.parseResponse(t.data).feed?.entry??[];r&&!Array.isArray(r)&&(r=[r]);let n=r.find(i=>i.id==="published-x-ui-service");if(n)return n;throw new Error("OData Service Generator not found")}};var zP=class extends ti{packageName;contentType;configure(t,r){this.packageName=r}setContentType(t){this.contentType=t}async validate(t){let r=await this.post("/validation",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.validationMessages.v1+xml, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage"},params:{package:this.packageName}});return this.parseValidateResponse(r.data)}async getTechnicalDetails(t){let r=await this.post("/preview",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.repository.objects.massoperation.v1+xml"},params:{package:this.packageName}});return this.parsePreviewResponse(r.data)}async generate(t){return(await this.post("",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.repository.generator.v1+json"},params:{package:this.packageName}})).status}parseValidateResponse(t){let n=this.parseResponse(t).validationMessages;return Array.isArray(n)||(n=[n]),n.map(i=>i.validationMessage||{})||[]}parsePreviewResponse(t){let n=(this.parseResponse(t).group.group||[]).find(a=>a.name==="Business Service Layer");if(!n)return;let i=Array.isArray(n.object)?n.object:[n.object],s=i.find(a=>a.objectReference?.type==="SRVD/SRV"),o=i.find(a=>a.objectReference?.type==="SRVB/SVB");if(!(!s||!o))return{serviceName:o.objectReference?.name||"",serviceDefinitionName:s.objectReference?.name||"",serviceVersion:"0001"}}};var xb=class extends ti{referencedObject;contentType;configure(t,r,n){this.referencedObject=r,this.contentType=n}async getSchema(){let t=await this.get("/schema",{headers:{Accept:"application/vnd.sap.adt.repository.generator.schema.v1+json"},params:{referencedObject:this.referencedObject.uri}});return JSON.parse(t.data)}async getContent(t){let n=(await this.get("/content",{headers:{Accept:this.contentType},params:{referencedObject:this.referencedObject.uri,package:t}})).data,i=JSON.parse(n);return i.metadata||(i.metadata={package:t}),JSON.stringify(i)}async validatePackage(t){let r=await this.get("/validation",{headers:{Accept:"application/vnd.sap.adt.validationMessages.v1+xml"},params:{referencedObject:this.referencedObject.uri,package:t,checks:"package"}});return this.parseResponse(r.data)}async validateContent(t){let r=await this.post("/validation",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.validationMessages.v1+xml"},params:{referencedObject:this.referencedObject.uri,checks:"package,referencedobject,authorization"}});return this.parseResponse(r.data).validationMessages?.validationMessage}async generate(t,r){let n=await this.post("",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.repository.generator.v1+json, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage"},params:{referencedObject:this.referencedObject.uri,corrNr:r}});return this.parseResponse(n.data)}};var Uk=class extends ti{async getSystemInfo(){let t={headers:{Accept:"application/vnd.sap.adt.core.http.systeminformation.v1+json"}},r=await this.get("/sap/bc/adt/core/http/systeminformation",t);if(typeof r.data=="string")try{return JSON.parse(r.data)}catch(n){this.log.error(`System info could not be parsed from response. Error: ${n.message}`)}else return r.data}};var KP=class extends Pa{static PATH="/sap/public/bc/ui5_ui5";log;async getUI5Version(){try{let t=await this.get("/bootstrap_info.json",{transformResponse:n=>JSON.parse(n)}),{Version:r}=t.data;if(!r)throw new Error("UI5 version not provided.");return r}catch(t){throw this.log.error("Could not get UI5 Version."),this.log.debug(t),t}}};var Va=class extends km{atoSettings;_publicUrl;_systemInfo;async user(){return await Promise.resolve(this.defaults.auth?.username)||(await this.getSystemInfo())?.userName}async getSystemInfo(){if(this._systemInfo)return this._systemInfo;try{let t=this.createService("",Uk);this._systemInfo=await t.getSystemInfo()}catch(t){this.log.error(`An error occurred retrieving system info: ${t}`)}return this._systemInfo}setAtoInfo(t){this.atoSettings=t}async getAtoInfo(){if(this.atoSettings)return this.atoSettings;let t;try{t=await this.getAdtService(IP),t?this.atoSettings=await t.getAtoInfo():this.atoSettings={}}catch{this.atoSettings={}}return this.atoSettings}set publicUrl(t){this._publicUrl=t}get publicUrl(){return this._publicUrl||this.defaults.baseURL}async isAbapCloud(){return this.atoSettings===void 0&&await this.getAtoInfo(),this.atoSettings.tenantType===NP.Customer&&this.atoSettings.operationsType==="C"}getAdtCatalogService(){if(!this.services[Bm.ADT_DISCOVERY_SERVICE_PATH]){let t=this.createService(Bm.ADT_DISCOVERY_SERVICE_PATH,Bm);this.services[Bm.ADT_DISCOVERY_SERVICE_PATH]=t}return this.services[Bm.ADT_DISCOVERY_SERVICE_PATH]}catalog(t){let r;if(t===Er.v2)r=this.services[qm.PATH]??this.createService(qm.PATH,qm);else if(t===Er.v4)r=this.services[mb.PATH]??this.createService(mb.PATH,mb);else throw new Error("not implemented yet");return Object.defineProperty(r,"isAbapCloud",{get:this.isAbapCloud.bind(this)}),r}getUi5AbapRepository(t){let r=t??ab.PATH;return this.services[r]||(this.services[r]=this.createService(r,ab)),this.services[r]}getAppIndex(){return this.services[Cd.PATH]||(this.services[Cd.PATH]=this.createService(Cd.PATH,Cd)),this.services[Cd.PATH]}getLayeredRepository(t){let r=t??ub.PATH;return this.services[r]||(this.services[r]=this.createService(r,ub)),this.services[r]}async getAdtService(t){let r=t.name;if(!this.services[r]){let i=await this.getAdtCatalogService().getServiceDefinition(t.getAdtCatagory());if(!i)return null;this.services[r]=this.createService(i.href,t),this.services[r].attachAdtSchema(i)}return this.services[r]}getUI5VersionService(){let t=KP.PATH;return this.services[t]||(this.services[t]=this.createService(t,KP)),this.services[t]}async getUiServiceGenerator(t){let r=await this.getAdtService(WP);if(!r)throw new Error("Generators are not supported on this system");let n=await r.getUIServiceGeneratorConfig(t.uri),i=this.createService(this.getServiceUrlFromConfig(n),xb);return i.configure(n,t,this.getContentType(n)),i}async getODataServiceGenerator(t){let r=await this.getAdtService(YP);if(!r)throw new Error("RAP Generator are not support on this system");let n=await r.getRAPGeneratorConfig(),i=this.createService(this.getServiceUrlFromConfig(n),zP);return i.setContentType(this.getContentType(n)),i.configure(n,t||"$TMP"),i}async fetchExternalServices(t){let r=[],n=t.map(async i=>{let{serviceRootPath:s,value:o}=i,a=(0,pBe.join)(s,o).replace("/$metadata",""),u=this.service(a);try{let c=await u.metadata();i.type==="value-list"?r.push({type:"value-list",path:a,target:i.target,metadata:c}):i.type==="code-list"&&r.push({type:"code-list",path:a,metadata:c})}catch(c){this.log.warn(`Could not fetch value list reference metadata from ${a}, ${c.message}`)}});return await Promise.allSettled(n),r}getServiceUrlFromConfig(t){if(Array.isArray(t.link)&&!t.link[0]?.href)throw new Error("No service URL found in the generator config");let r=t.link[0].href.indexOf(t.id)+t.id.length;return t.link[0].href.substring(0,r)}getContentType(t){return(t.link?.find(n=>typeof n.href=="string"&&n.href.includes("/content"))).type}async createLockServiceBindingGenerator(t){return this.createService(t,xb)}};var vHe=be(BGe(),1),ap=be(nq(),1);var eg;(function(e){e.H2O_URL="H2O_URL",e.HTTP_PROXY="HTTP_PROXY",e.HTTPS_PROXY="HTTPS_PROXY"})(eg||(eg={}));var iq;(function(e){e.HTTP="HTTP",e.LDAP="LDAP",e.MAIL="MAIL",e.RFC="RFC"})(iq||(iq={}));var sq;(function(e){e.DEDICATED="Dedicated",e.COMMON="Common"})(sq||(sq={}));var op;(function(e){e.BASIC_AUTHENTICATION="BasicAuthentication",e.CLIENT_CERT_AUTHENTICATION="ClientCertificateAuthentication",e.NO_AUTHENTICATION="NoAuthentication",e.OAUTH2_CLIENT_CREDENTIALS="OAuth2ClientCredentials",e.OAUTH2_JWT_BEARER="OAuth2JWTBearer",e.OAUTH2_PASSWORD="OAuth2Password",e.OAUTH2_REFRESH_TOKEN="OAuth2RefreshToken",e.OAUTH2_SAML_BEARER_ASSERTION="OAuth2SAMLBearerAssertion",e.OAUTH2_USER_TOKEN_EXCHANGE="OAuth2UserTokenExchange",e.SAML_ASSERTION="SAMLAssertion"})(op||(op={}));var oq;(function(e){e.S4HC="S4HC",e.BTP="BTP"})(oq||(oq={}));var dre;(function(e){e.ON_PREMISE="OnPremise",e.INTERNET="Internet",e.PRIVATE_LINK="PrivateLink"})(dre||(dre={}));var SE;(function(e){e.ODATA_GENERIC="odata_gen",e.ODATA_ABAP="odata_abap",e.DEV_ABAP="dev_abap",e.ABAP_CLOUD="abap_cloud"})(SE||(SE={}));var aq;(function(e){e.FULL_URL="full_url",e.API_MGMT="api_mgmt"})(aq||(aq={}));var ND;(function(e){e.ON_PREMISE="OnPremise",e.INTERNET="Internet",e.PRIVATE_LINK="PrivateLink"})(ND||(ND={}));function hHe(e){return!!(e.WebIDEUsage?.includes("abap")||e["sap-client"]||e["sap-platform"]?.toLocaleLowerCase()==="abap"||e.ProxyType==="OnPremise")}function zOr(e){return!!(e.WebIDEUsage?.includes(SE.ABAP_CLOUD)||e["sap-platform"]?.toLocaleLowerCase()==="abap")}function uq(e){return!!(e.WebIDEUsage?.includes(SE.ODATA_GENERIC)&&!e.WebIDEUsage.includes(SE.ODATA_ABAP))}function Kl(e){return!!(!e.WebIDEAdditionalData?.includes(aq.FULL_URL)&&uq(e))}function tg(e){return!!(e.WebIDEAdditionalData?.includes(aq.FULL_URL)&&uq(e))}function mHe(e){return!!e.ProxyType.includes(ND.ON_PREMISE)}function gHe(e){return!!e["HTML5.DynamicDestination"]}function KOr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dHe(e,t){let r=` (${t})`;return RegExp(`${KOr(r)}$`).exec(e.trim())?e:`${e} (${t})`}function yHe(e,t){let r=t?` [${t}]`:"",n;return zOr(e)?n=dHe(e.Name,oq.BTP):hre(e)?n=dHe(e.Name,oq.S4HC):n=e.Name,`${n}${r}`}function hre(e){return!!(e.WebIDEUsage?.includes(SE.ODATA_ABAP)&&e.Authentication===op.SAML_ASSERTION&&e.ProxyType===dre.INTERNET)}function cq(e){return!!e.WebIDEUsage?.includes(SE.ODATA_ABAP)}var Gd={ABAP:"abap",ABAP_TRIAL:"abap-trial",ABAP_CANARY:"abap-canary",ABAP_OEM:"abap-oem",ABAP_OEM_CANARY:"abap-oem-canary",ABAP_HAAS:"abap-haas",DESTINATION:"destination",ABAP_STAGING:"abap-staging",ABAP_INTERNAL_STAGING:"abap-internal-staging"};var mre="abap-cloud-destination-instance",EHe="bas-destination-instance-cred";function Vr(){return!!process.env[eg.H2O_URL]}async function _He(e){try{let t=await(0,ap.cfGetInstanceKeyParameters)(e);if(!t)throw new Error(`No destination instance ${e} found`);let r=t.credentials;if(!r)throw new Error(`No credentials for destination instance ${e} found`);let n=r.uaa?.clientid||r.clientid,i=r.uaa?.clientsecret||r.clientsecret;return Buffer.from(`${encodeURIComponent(n)}:${encodeURIComponent(i)}`).toString("base64")}catch(t){throw new Error(`An error occurred while retrieving service key for the destination instance ${e}: ${t}`)}}function rT(e,t){let r=`https://${e}.dest`;return t&&t.length>1?new URL(t,r).toString():r}function XOr(e){let[t,...r]=e.split(".");return[t.replace(/-api$/,""),...r].join(".")}async function gre(e){let t={};await Oa.get("/reload",{baseURL:process.env[eg.HTTP_PROXY]}),JOr();let r=await Oa.get("/api/listDestinations",{baseURL:process.env[eg.H2O_URL]});return(Array.isArray(r.data)?r.data:[]).forEach(i=>{e?.stripS4HCApiHosts&&hre(i)&&(i.Host=XOr(i.Host)),i.WebIDEEnabled&&(t[i.Name]=i)}),t}function JOr(){!Vr()||!globalThis.GLOBAL_AGENT||(globalThis.GLOBAL_AGENT.HTTP_PROXY||(globalThis.GLOBAL_AGENT.HTTP_PROXY=process.env[eg.HTTP_PROXY]??null),globalThis.GLOBAL_AGENT.HTTPS_PROXY||(globalThis.GLOBAL_AGENT.HTTPS_PROXY=process.env[eg.HTTPS_PROXY]??null))}function QOr(e,t,r,n){let i={usage:"odata_abap,dev_abap,abap_cloud",html5DynamicDestination:"true",html5Timeout:"60000"},s={clientId:r.clientid,clientSecret:r.clientsecret,tokenServiceURL:new URL("/oauth/token",r.url).toString(),tokenServiceURLType:sq.DEDICATED};return{name:e,description:t,url:new URL(n),type:iq.HTTP,proxyType:ND.INTERNET,basProperties:i,credentials:{authentication:op.OAUTH2_USER_TOKEN_EXCHANGE,oauth2UserTokenExchange:s}}}async function yre(e){let t=await(0,ap.cfGetTarget)(!0);if(!t.space)throw new Error("No Dev Space has been created for the subaccount.");return`abap-cloud-${`${e}-${t.org}-${t.space}`.replace(/\W/gi,"-").toLowerCase()}`.substring(0,199)}async function ZOr(e,t,r,n){let i=await yre(e);return(await(0,ap.apiGetServicesInstancesFilteredByType)(["destination"])).find(a=>a.label===mre)||(await(0,ap.apiCreateServiceInstance)("destination","lite",mre,null),n?.info(`New ABAP destination instance ${mre} created.`)),QOr(i,`Destination generated by App Studio for Cloud Foundry Abap service instance: '${e}', Do not remove.`,t,r)}async function SHe(e,t,r){if(!Vr())throw new Error("Creating a SAP BTP destinations is only supported on SAP Business Application Studio.");let n=t;try{if(!n){let a=await(0,ap.apiGetInstanceCredentials)(e);if(!a?.credentials)throw new Error(`Could not retrieve SAP BTP credentials for ${e}.`);n={uaaCredentials:a.credentials.uaa,hostUrl:a.credentials.url}}let i=await ZOr(e,n.uaaCredentials,n.hostUrl,r);await vHe.destinations.createDestination(i),r?.debug(`SAP BTP destination ${JSON.stringify(i,null,2)} created.`);let o=(await gre())?.[i.name];if(!o)throw new Error("Destination not found on SAP BTP.");return o}catch(i){throw new Error(`An error occurred while generating destination ${e}: ${i}`)}}var kHe=be(_re(),1),BHe=require("node:https"),qHe=be(Sre(),1),jHe=be(LF(),1),VHe=be(UHe(),1),GHe=require("node:util");var bre=class extends qHe.HttpsProxyAgent{extraOptions;constructor(t,r){super(t,r),this.extraOptions=r}async connect(t,r){return super.connect(t,{...this.extraOptions,...r})}};function bE(e,t){let r=(0,jHe.default)(t),n={rejectUnauthorized:!r.ignoreCertErrors};r.httpsAgent||(r.httpsAgent=new BHe.Agent(n)),delete r.ignoreCertErrors,r.withCredentials=r?.auth&&Object.keys(r.auth).length>0,r.validateStatus=s=>s<400;let i=new e(r);return i.interceptors.request.use(s=>{let o=i.getUri(s),a=(0,VHe.getProxyForUrl)(o);return a&&!Vr()&&(s.httpsAgent=new bre(a,n),s.httpAgent=new kHe.HttpProxyAgent(a),s.proxy=!1),s}),i.defaults.headers=i.defaults.headers??{common:{},delete:{},put:{},get:{},post:{},head:{},patch:{}},IFe(i),r.auth?.password&&LUe(i),t.cookies&&t.cookies.split(";").forEach(s=>{i.cookies.addCookie(s.trim())}),AP.isPatchRequired(t.baseURL)&&AP.apply(),i}function $He(e){return typeof e=="string"?bE(km,{baseURL:e}):bE(km,e)}function AE(e){return bE(Va,e)}var TE;(function(e){e.Standalone="Standalone",e.EmbeddedSteampunk="EmbeddedSteampunk"})(TE||(TE={}));function Tre(e){let t;switch(e.environment){case TE.Standalone:{let{service:r,refreshToken:n,refreshTokenChangedCb:i,cookies:s,...o}=e;t=bE(Va,{baseURL:r.url,cookies:s,...o}),s||(e.service?.uaa?.username&&e.service.uaa.password?MUe(t,r,n,i):hZ({provider:t}));break}case TE.EmbeddedSteampunk:{let{url:r,cookies:n,...i}=e;t=bE(Va,{baseURL:r,cookies:n,...i}),n||hZ({provider:t});break}default:{let r=e;throw new Error(`Unknown environment type supplied: ${(0,GHe.inspect)(r)}`)}}return t}function HHe(e,t,r){let{cookies:n,...i}=e,s={...i,baseURL:rT(t.Name,t.Host?new URL(t.Host).pathname:void 0),cookies:n};s.params=s.params??{},s.params.saml2="disabled";let o;if(hHe(t)?(o=bE(Va,s),o.publicUrl=t.Host):o=bE(km,s),r){let a=o.interceptors.request.use(async u=>{let c=await _He(r);return o.defaults.headers.common[EHe]=c,o.interceptors.request.eject(a),u})}return o}var WHe;(function(e){e.FF_SIMPLE="basic"})(WHe||(WHe={}));var YHe;(function(e){e.FE_FPM="fpm",e.FE_LROP="lrop",e.FE_OVP="ovp",e.FE_ALP="alp",e.FE_FEOP="feop",e.FE_WORKLIST="worklist"})(YHe||(YHe={}));var cn={vscode:{name:"Visual Studio Code",technical:"VSCode"},bas:{name:"SAP Business Application Studio",technical:"SBAS"},cli:{name:"CLI",technical:"CLI"}};var zHe;(function(e){e.CF="CF",e.ABAP="ABAP"})(zHe||(zHe={}));function MPr(){return!!(process.argv[1]?.includes("yo")||process.stdin.isTTY)}function kc(){return MPr()?cn.cli:Vr()?cn.bas:cn.vscode}var Ut=e=>typeof e=="string",LD=()=>{let e,t,r=new Promise((n,i)=>{e=n,t=i});return r.resolve=e,r.reject=t,r},KHe=e=>e==null?"":""+e,FPr=(e,t,r)=>{e.forEach(n=>{t[n]&&(r[n]=t[n])})},UPr=/###/g,XHe=e=>e&&e.indexOf("###")>-1?e.replace(UPr,"."):e,JHe=e=>!e||Ut(e),MD=(e,t,r)=>{let n=Ut(t)?t.split("."):t,i=0;for(;i<n.length-1;){if(JHe(e))return{};let s=XHe(n[i]);!e[s]&&r&&(e[s]=new r),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++i}return JHe(e)?{}:{obj:e,k:XHe(n[i])}},QHe=(e,t,r)=>{let{obj:n,k:i}=MD(e,t,Object);if(n!==void 0||t.length===1){n[i]=r;return}let s=t[t.length-1],o=t.slice(0,t.length-1),a=MD(e,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=MD(e,o,Object),a?.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=r},kPr=(e,t,r,n)=>{let{obj:i,k:s}=MD(e,t,Object);i[s]=i[s]||[],i[s].push(r)},mq=(e,t)=>{let{obj:r,k:n}=MD(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},BPr=(e,t,r)=>{let n=mq(e,r);return n!==void 0?n:mq(t,r)},s5e=(e,t,r)=>{for(let n in t)n!=="__proto__"&&n!=="constructor"&&(n in e?Ut(e[n])||e[n]instanceof String||Ut(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):s5e(e[n],t[n],r):e[n]=t[n]);return e},xE=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),qPr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},jPr=e=>Ut(e)?e.replace(/[&<>"'\/]/g,t=>qPr[t]):e,Cre=class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){let r=this.regExpMap.get(t);if(r!==void 0)return r;let n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}},VPr=[" ",",","?","!",";"],GPr=new Cre(20),$Pr=(e,t,r)=>{t=t||"",r=r||"";let n=VPr.filter(o=>t.indexOf(o)<0&&r.indexOf(o)<0);if(n.length===0)return!0;let i=GPr.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),s=!i.test(e);if(!s){let o=e.indexOf(r);o>0&&!i.test(e.substring(0,o))&&(s=!0)}return s},Ore=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let n=t.split(r),i=e;for(let s=0;s<n.length;){if(!i||typeof i!="object")return;let o,a="";for(let u=s;u<n.length;++u)if(u!==s&&(a+=r),a+=n[u],o=i[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&u<n.length-1)continue;s+=u-s+1;break}i=o}return i},FD=e=>e?.replace(/_/g,"-"),HPr={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}},Pre=class e{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||HPr,this.options=r,this.debug=r.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,n,i){return i&&!this.debug?null:(Ut(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},cp=new Pre,aT=class{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let i=this.observers[n].get(r)||0;this.observers[n].set(r,i+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([i,s])=>{for(let o=0;o<s;o++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,s])=>{for(let o=0;o<s;o++)i.apply(i,[t,...r])})}},gq=class extends aT{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){let r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,n,i={}){let s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,a;t.indexOf(".")>-1?a=t.split("."):(a=[t,r],n&&(Array.isArray(n)?a.push(...n):Ut(n)&&s?a.push(...n.split(s)):a.push(n)));let u=mq(this.data,a);return!u&&!r&&!n&&t.indexOf(".")>-1&&(t=a[0],r=a[1],n=a.slice(2).join(".")),u||!o||!Ut(n)?u:Ore(this.data?.[t]?.[r],n,s)}addResource(t,r,n,i,s={silent:!1}){let o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=[t,r];n&&(a=a.concat(o?n.split(o):n)),t.indexOf(".")>-1&&(a=t.split("."),i=r,r=a[1]),this.addNamespaces(r),QHe(this.data,a,i),s.silent||this.emit("added",t,r,n,i)}addResources(t,r,n,i={silent:!1}){for(let s in n)(Ut(n[s])||Array.isArray(n[s]))&&this.addResource(t,r,s,n[s],{silent:!0});i.silent||this.emit("added",t,r,n)}addResourceBundle(t,r,n,i,s,o={silent:!1,skipCopy:!1}){let a=[t,r];t.indexOf(".")>-1&&(a=t.split("."),i=n,n=r,r=a[1]),this.addNamespaces(r);let u=mq(this.data,a)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?s5e(u,n,s):u={...u,...n},QHe(this.data,a,u),o.silent||this.emit("added",t,r,n)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){let r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},o5e={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(s=>{t=this.processors[s]?.process(t,r,n,i)??t}),t}},a5e=Symbol("i18next/PATH_KEY");function WPr(){let e=[],t=Object.create(null),r;return t.get=(n,i)=>(r?.revoke?.(),i===a5e?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}function oT(e,t){let{[a5e]:r}=e(WPr()),n=t?.keySeparator??".",i=t?.nsSeparator??":";if(r.length>1&&i){let s=t?.ns,o=Array.isArray(s)?s:null;if(o&&o.length>1&&o.slice(1).includes(r[0]))return`${r[0]}${i}${r.slice(1).join(n)}`}return r.join(n)}var ZHe={},Are=e=>!Ut(e)&&typeof e!="boolean"&&typeof e!="number",yq=class e extends aT{constructor(t,r={}){super(),FPr(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=cp.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){let n={...r};if(t==null)return!1;let i=this.resolve(t,n);if(i?.res===void 0)return!1;let s=Are(i.res);return!(n.returnObjects===!1&&s)}extractFromKey(t,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");let i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,s=r.ns||this.options.defaultNS||[],o=n&&t.indexOf(n)>-1,a=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!$Pr(t,n,i);if(o&&!a){let u=t.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:t,namespaces:Ut(s)?[s]:s};let c=t.split(n);(n!==i||n===i&&this.options.ns.indexOf(c[0])>-1)&&(s=c.shift()),t=c.join(i)}return{key:t,namespaces:Ut(s)?[s]:s}}translate(t,r,n){let i=typeof r=="object"?{...r}:r;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),t==null)return"";typeof t=="function"&&(t=oT(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(de=>typeof de=="function"?oT(de,{...this.options,...i}):String(de));let s=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:u}=this.extractFromKey(t[t.length-1],i),c=u[u.length-1],l=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");let f=i.lng||this.language,p=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()==="cimode")return p?s?{res:`${c}${l}${a}`,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:`${c}${l}${a}`:s?{res:a,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:a;let d=this.resolve(t,i),h=d?.res,g=d?.usedKey||a,_=d?.exactUsedKey||a,S=["[object Number]","[object Function]","[object RegExp]"],T=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,w=i.count!==void 0&&!Ut(i.count),x=e.hasDefaultValue(i),N=w?this.pluralResolver.getSuffix(f,i.count,i):"",F=i.ordinal&&w?this.pluralResolver.getSuffix(f,i.count,{ordinal:!1}):"",D=w&&!i.ordinal&&i.count===0,V=D&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${N}`]||i[`defaultValue${F}`]||i.defaultValue,z=h;A&&!h&&x&&(z=V);let L=Are(z),J=Object.prototype.toString.apply(z);if(A&&z&&L&&S.indexOf(J)<0&&!(Ut(T)&&Array.isArray(z))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let de=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,z,{...i,ns:u}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(d.res=de,d.usedParams=this.getUsedParamsDetails(i),d):de}if(o){let de=Array.isArray(z),ie=de?[]:{},H=de?_:g;for(let G in z)if(Object.prototype.hasOwnProperty.call(z,G)){let ye=`${H}${o}${G}`;x&&!h?ie[G]=this.translate(ye,{...i,defaultValue:Are(V)?V[G]:void 0,joinArrays:!1,ns:u}):ie[G]=this.translate(ye,{...i,joinArrays:!1,ns:u}),ie[G]===ye&&(ie[G]=z[G])}h=ie}}else if(A&&Ut(T)&&Array.isArray(h))h=h.join(T),h&&(h=this.extendTranslation(h,t,i,n));else{let de=!1,ie=!1;!this.isValidLookup(h)&&x&&(de=!0,h=V),this.isValidLookup(h)||(ie=!0,h=a);let G=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ie?void 0:h,ye=x&&V!==h&&this.options.updateMissing;if(ie||de||ye){if(this.logger.log(ye?"updateKey":"missingKey",f,c,a,ye?V:h),o){let Xe=this.resolve(a,{...i,keySeparator:!1});Xe&&Xe.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let xe=[],Ce=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Ce&&Ce[0])for(let Xe=0;Xe<Ce.length;Xe++)xe.push(Ce[Xe]);else this.options.saveMissingTo==="all"?xe=this.languageUtils.toResolveHierarchy(i.lng||this.language):xe.push(i.lng||this.language);let Ie=(Xe,_e,je)=>{let mt=x&&je!==h?je:G;this.options.missingKeyHandler?this.options.missingKeyHandler(Xe,c,_e,mt,ye,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(Xe,c,_e,mt,ye,i),this.emit("missingKey",Xe,c,_e,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?xe.forEach(Xe=>{let _e=this.pluralResolver.getSuffixes(Xe,i);D&&i[`defaultValue${this.options.pluralSeparator}zero`]&&_e.indexOf(`${this.options.pluralSeparator}zero`)<0&&_e.push(`${this.options.pluralSeparator}zero`),_e.forEach(je=>{Ie([Xe],a+je,i[`defaultValue${je}`]||V)})}):Ie(xe,a,V))}h=this.extendTranslation(h,t,i,d,n),ie&&h===a&&this.options.appendNamespaceToMissingKey&&(h=`${c}${l}${a}`),(ie||de)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${l}${a}`:a,de?h:void 0,i))}return s?(d.res=h,d.usedParams=this.getUsedParamsDetails(i),d):h}extendTranslation(t,r,n,i,s){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let u=Ut(t)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),c;if(u){let f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let l=n.replace&&!Ut(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),t=this.interpolator.interpolate(t,l,n.lng||this.language||i.usedLng,n),u){let f=t.match(this.interpolator.nestingRegexp),p=f&&f.length;c<p&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(t=this.interpolator.nest(t,(...f)=>s?.[0]===f[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${r[0]}`),null):this.translate(...f,r),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,a=Ut(o)?[o]:o;return t!=null&&a?.length&&n.applyPostProcessor!==!1&&(t=o5e.handle(a,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t,r={}){let n,i,s,o,a;return Ut(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(u=>typeof u=="function"?oT(u,{...this.options,...r}):u)),t.forEach(u=>{if(this.isValidLookup(n))return;let c=this.extractFromKey(u,r),l=c.key;i=l;let f=c.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));let p=r.count!==void 0&&!Ut(r.count),d=p&&!r.ordinal&&r.count===0,h=r.context!==void 0&&(Ut(r.context)||typeof r.context=="number")&&r.context!=="",g=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);f.forEach(_=>{this.isValidLookup(n)||(a=_,!ZHe[`${g[0]}-${_}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(ZHe[`${g[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(S=>{if(this.isValidLookup(n))return;o=S;let T=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(T,l,S,_,r);else{let w;p&&(w=this.pluralResolver.getSuffix(S,r.count,r));let x=`${this.options.pluralSeparator}zero`,N=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(r.ordinal&&w.indexOf(N)===0&&T.push(l+w.replace(N,this.options.pluralSeparator)),T.push(l+w),d&&T.push(l+x)),h){let F=`${l}${this.options.contextSeparator||"_"}${r.context}`;T.push(F),p&&(r.ordinal&&w.indexOf(N)===0&&T.push(F+w.replace(N,this.options.pluralSeparator)),T.push(F+w),d&&T.push(F+x))}}let A;for(;A=T.pop();)this.isValidLookup(n)||(s=A,n=this.getResource(S,_,A,r))}))})}),{res:n,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,r,n,i):this.resourceStore.getResource(t,r,n,i)}getUsedParamsDetails(t={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!Ut(t.replace),i=n?t.replace:t;if(n&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let s of r)delete i[s]}return i}static hasDefaultValue(t){let r="defaultValue";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&r===n.substring(0,r.length)&&t[n]!==void 0)return!0;return!1}},vq=class{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=cp.create("languageUtils")}getScriptPartFromCode(t){if(t=FD(t),!t||t.indexOf("-")<0)return null;let r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=FD(t),!t||t.indexOf("-")<0)return t;let r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(Ut(t)&&t.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&t.forEach(n=>{if(r)return;let i=this.getScriptPartFromCode(n);if(this.isSupportedCode(i))return r=i;let s=this.getLanguagePartFromCode(n);if(this.isSupportedCode(s))return r=s;r=this.options.supportedLngs.find(o=>{if(o===s)return o;if(!(o.indexOf("-")<0&&s.indexOf("-")<0)&&(o.indexOf("-")>0&&s.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===s||o.indexOf(s)===0&&s.length>1))return o})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),Ut(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let n=t[r];return n||(n=t[this.getScriptPartFromCode(r)]),n||(n=t[this.formatLanguageCode(r)]),n||(n=t[this.getLanguagePartFromCode(r)]),n||(n=t.default),n||[]}toResolveHierarchy(t,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],t),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return Ut(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):Ut(t)&&s(this.formatLanguageCode(t)),n.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}},e5e={zero:0,one:1,two:2,few:3,many:4,other:5},t5e={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},Dre=class{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=cp.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){let n=FD(t==="dev"?"en":t),i=r.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:n,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(n,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),t5e;if(!t.match(/-|_/))return t5e;let u=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(u,r)}return this.pluralRulesCache[s]=o,o}needsPlural(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,r,n={}){return this.getSuffixes(t,n).map(i=>`${r}${i}`)}getSuffixes(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,s)=>e5e[i]-e5e[s]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(t,r,n={}){let i=this.getRule(t,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,n))}},r5e=(e,t,r,n=".",i=!0)=>{let s=BPr(e,t,r);return!s&&i&&Ut(r)&&(s=Ore(e,r,n),s===void 0&&(s=Ore(t,r,n))),s},xre=e=>e.replace(/\$/g,"$$$$"),Eq=class{constructor(t={}){this.logger=cp.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});let{escape:r,escapeValue:n,useRawValueToEscape:i,prefix:s,prefixEscaped:o,suffix:a,suffixEscaped:u,formatSeparator:c,unescapeSuffix:l,unescapePrefix:f,nestingPrefix:p,nestingPrefixEscaped:d,nestingSuffix:h,nestingSuffixEscaped:g,nestingOptionsSeparator:_,maxReplaces:S,alwaysFormat:T}=t.interpolation;this.escape=r!==void 0?r:jPr,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?xE(s):o||"{{",this.suffix=a?xE(a):u||"}}",this.formatSeparator=c||",",this.unescapePrefix=l?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=p?xE(p):d||xE("$t("),this.nestingSuffix=h?xE(h):g||xE(")"),this.nestingOptionsSeparator=_||",",this.maxReplaces=S||1e3,this.alwaysFormat=T!==void 0?T:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let t=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,r,n,i){let s,o,a,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=d=>{if(d.indexOf(this.formatSeparator)<0){let S=r5e(r,u,d,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(S,void 0,n,{...i,...r,interpolationkey:d}):S}let h=d.split(this.formatSeparator),g=h.shift().trim(),_=h.join(this.formatSeparator).trim();return this.format(r5e(r,u,g,this.options.keySeparator,this.options.ignoreJSONStructure),_,n,{...i,...r,interpolationkey:g})};this.resetRegExp();let l=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:d=>xre(d)},{regex:this.regexp,safeValue:d=>this.escapeValue?xre(this.escape(d)):xre(d)}].forEach(d=>{for(a=0;s=d.regex.exec(t);){let h=s[1].trim();if(o=c(h),o===void 0)if(typeof l=="function"){let _=l(t,s,i);o=Ut(_)?_:""}else if(i&&Object.prototype.hasOwnProperty.call(i,h))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${h} for interpolating ${t}`),o="";else!Ut(o)&&!this.useRawValueToEscape&&(o=KHe(o));let g=d.safeValue(o);if(t=t.replace(s[0],g),f?(d.regex.lastIndex+=o.length,d.regex.lastIndex-=s[0].length):d.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,r,n={}){let i,s,o,a=(u,c)=>{let l=this.nestingOptionsSeparator;if(u.indexOf(l)<0)return u;let f=u.split(new RegExp(`${xE(l)}[ ]*{`)),p=`{${f[1]}`;u=f[0],p=this.interpolate(p,o);let d=p.match(/'/g),h=p.match(/"/g);((d?.length??0)%2===0&&!h||(h?.length??0)%2!==0)&&(p=p.replace(/'/g,'"'));try{o=JSON.parse(p),c&&(o={...c,...o})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,g),`${u}${l}${p}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,u};for(;i=this.nestingRegexp.exec(t);){let u=[];o={...n},o=o.replace&&!Ut(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(c!==-1&&(u=i[1].slice(c).split(this.formatSeparator).map(l=>l.trim()).filter(Boolean),i[1]=i[1].slice(0,c)),s=r(a.call(this,i[1].trim(),o),o),s&&i[0]===t&&!Ut(s))return s;Ut(s)||(s=KHe(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),s=""),u.length&&(s=u.reduce((l,f)=>this.format(l,f,n.lng,{...n,interpolationkey:i[1].trim()}),s.trim())),t=t.replace(i[0],s),this.regexp.lastIndex=0}return t}},YPr=e=>{let t=e.toLowerCase().trim(),r={};if(e.indexOf("(")>-1){let n=e.split("(");t=n[0].toLowerCase().trim();let i=n[1].substring(0,n[1].length-1);t==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(o=>{if(o){let[a,...u]=o.split(":"),c=u.join(":").trim().replace(/^'+|'+$/g,""),l=a.trim();r[l]||(r[l]=c),c==="false"&&(r[l]=!1),c==="true"&&(r[l]=!0),isNaN(c)||(r[l]=parseInt(c,10))}})}return{formatName:t,formatOptions:r}},n5e=e=>{let t={};return(r,n,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});let o=n+JSON.stringify(s),a=t[o];return a||(a=e(FD(n),i),t[o]=a),a(r)}},zPr=e=>(t,r,n)=>e(FD(r),n)(t),Rre=class{constructor(t={}){this.logger=cp.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?n5e:zPr;this.formats={number:n((i,s)=>{let o=new Intl.NumberFormat(i,{...s});return a=>o.format(a)}),currency:n((i,s)=>{let o=new Intl.NumberFormat(i,{...s,style:"currency"});return a=>o.format(a)}),datetime:n((i,s)=>{let o=new Intl.DateTimeFormat(i,{...s});return a=>o.format(a)}),relativetime:n((i,s)=>{let o=new Intl.RelativeTimeFormat(i,{...s});return a=>o.format(a,s.range||"day")}),list:n((i,s)=>{let o=new Intl.ListFormat(i,{...s});return a=>o.format(a)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=n5e(r)}format(t,r,n,i={}){let s=r.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(a=>a.indexOf(")")>-1)){let a=s.findIndex(u=>u.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,u)=>{let{formatName:c,formatOptions:l}=YPr(u);if(this.formats[c]){let f=a;try{let p=i?.formatParams?.[i.interpolationkey]||{},d=p.locale||p.lng||i.locale||i.lng||n;f=this.formats[c](a,d,{...l,...i,...p})}catch(p){this.logger.warn(p)}return f}else this.logger.warn(`there was no format function for ${c}`);return a},t)}},KPr=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Nre=class extends aT{constructor(t,r,n,i={}){super(),this.backend=t,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=cp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,i.backend,i)}queueLoad(t,r,n,i){let s={},o={},a={},u={};return t.forEach(c=>{let l=!0;r.forEach(f=>{let p=`${c}|${f}`;!n.reload&&this.store.hasResourceBundle(c,f)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?o[p]===void 0&&(o[p]=!0):(this.state[p]=1,l=!1,o[p]===void 0&&(o[p]=!0),s[p]===void 0&&(s[p]=!0),u[f]===void 0&&(u[f]=!0)))}),l||(a[c]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(u)}}loaded(t,r,n){let i=t.split("|"),s=i[0],o=i[1];r&&this.emit("failedLoading",s,o,r),!r&&n&&this.store.addResourceBundle(s,o,n,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&n&&(this.state[t]=0);let a={};this.queue.forEach(u=>{kPr(u.loaded,[s],o),KPr(u,t),r&&u.errors.push(r),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(c=>{a[c]||(a[c]={});let l=u.loaded[c];l.length&&l.forEach(f=>{a[c][f]===void 0&&(a[c][f]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(u=>!u.done)}read(t,r,n,i=0,s=this.retryTimeout,o){if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:n,tried:i,wait:s,callback:o});return}this.readingCalls++;let a=(c,l)=>{if(this.readingCalls--,this.waitingReads.length>0){let f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(c&&l&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,r,n,i+1,s*2,o)},s);return}o(c,l)},u=this.backend[n].bind(this.backend);if(u.length===2){try{let c=u(t,r);c&&typeof c.then=="function"?c.then(l=>a(null,l)).catch(a):a(null,c)}catch(c){a(c)}return}return u(t,r,a)}prepareLoading(t,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();Ut(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Ut(r)&&(r=[r]);let s=this.queueLoad(t,r,n,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(t,r,n){this.prepareLoading(t,r,{},n)}reload(t,r,n){this.prepareLoading(t,r,{reload:!0},n)}loadOne(t,r=""){let n=t.split("|"),i=n[0],s=n[1];this.read(i,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${r}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${r}loaded namespace ${s} for language ${i}`,a),this.loaded(t,o,a)})}saveMissing(t,r,n,i,s,o={},a=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){let u={...o,isUpdate:s},c=this.backend.create.bind(this.backend);if(c.length<6)try{let l;c.length===5?l=c(t,r,n,i,u):l=c(t,r,n,i),l&&typeof l.then=="function"?l.then(f=>a(null,f)).catch(a):a(null,l)}catch(l){a(l)}else c(t,r,n,i,a,u)}!t||!t[0]||this.store.addResource(t[0],r,n,i)}}},wre=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Ut(e[1])&&(t.defaultValue=e[1]),Ut(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){let r=e[3]||e[2];Object.keys(r).forEach(n=>{t[n]=r[n]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),i5e=e=>(Ut(e.ns)&&(e.ns=[e.ns]),Ut(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Ut(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),hq=()=>{},XPr=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})},u5e="__i18next_supportNoticeShown",JPr=()=>!!(typeof globalThis<"u"&&globalThis[u5e]||typeof process<"u"&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&process.env&&process.env.NODE_ENV==="production"),QPr=()=>{typeof globalThis<"u"&&(globalThis[u5e]=!0)},ZPr=e=>!!(e?.modules?.backend?.name?.indexOf("Locize")>0||e?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||e?.options?.backend?.backends&&e.options.backend.backends.some(t=>t?.name?.indexOf("Locize")>0||t?.constructor?.name?.indexOf("Locize")>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(t=>t?.projectId)),Ire=class e extends aT{constructor(t={},r){if(super(),this.options=i5e(t),this.services={},this.logger=cp,this.modules={external:[]},XPr(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=t,t={}),t.defaultNS==null&&t.ns&&(Ut(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));let n=wre();this.options={...n,...this.options,...i5e(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!ZPr(this)&&!JPr()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("\u{1F310} i18next is made possible by our own product, Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}"),QPr());let i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?cp.init(i(this.modules.logger),this.options):cp.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=Rre;let l=new vq(this.options);this.store=new gq(this.options.resources,this.options);let f=this.services;f.logger=cp,f.resourceStore=this.store,f.languageUtils=l,f.pluralResolver=new Dre(l,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(f.formatter=i(c),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Eq(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Nre(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(d,...h)=>{this.emit(d,...h)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new yq(this.services,this.options),this.translator.on("*",(d,...h)=>{this.emit(d,...h)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,r||(r=hq),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...l)=>this.store[c](...l)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...l)=>(this.store[c](...l),this)});let a=LD(),u=()=>{let c=(l,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(f),r(l,f)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),a}loadResources(t,r=hq){let n=r,i=Ut(t)?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&s.indexOf(c)<0&&s.push(c)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>o(u)),this.options.preload?.forEach?.(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(a)})}else n(null)}reloadResources(t,r,n){let i=LD();return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),n||(n=hq),this.services.backendConnector.reload(t,r,s=>{i.resolve(),n(s)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&o5e.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,r){this.isLanguageChangingTo=t;let n=LD();this.emit("languageChanging",t);let i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},s=(a,u)=>{u?this.isLanguageChangingTo===t&&(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(a,(...c)=>this.t(...c))},o=a=>{!t&&!a&&this.services.languageDetector&&(a=[]);let u=Ut(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(u)?u:this.services.languageUtils.getBestMatchFromCodes(Ut(a)?[a]:a);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,l=>{s(l,c)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(t),n}getFixedT(t,r,n){let i=(s,o,...a)=>{let u;typeof o!="object"?u=this.options.overloadTranslationOptionHandler([s,o].concat(a)):u={...o},u.lng=u.lng||i.lng,u.lngs=u.lngs||i.lngs,u.ns=u.ns||i.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||n||i.keyPrefix);let c={...this.options,...u};typeof u.keyPrefix=="function"&&(u.keyPrefix=oT(u.keyPrefix,c));let l=this.options.keySeparator||".",f;return u.keyPrefix&&Array.isArray(s)?f=s.map(p=>(typeof p=="function"&&(p=oT(p,c)),`${u.keyPrefix}${l}${p}`)):(typeof s=="function"&&(s=oT(s,c)),f=u.keyPrefix?`${u.keyPrefix}${l}${s}`:s),this.t(f,u)};return Ut(t)?i.lng=t:i.lngs=t,i.ns=r,i.keyPrefix=n,i}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let o=(a,u)=>{let c=this.services.backendConnector.state[`${a}|${u}`];return c===-1||c===0||c===2};if(r.precheck){let a=r.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,t)&&(!i||o(s,t)))}loadNamespaces(t,r){let n=LD();return this.options.ns?(Ut(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(t,r){let n=LD();Ut(t)&&(t=[t]);let i=this.options.preload||[],s=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{n.resolve(),r&&r(o)}),n):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{let i=new Intl.Locale(t);if(i&&i.getTextInfo){let s=i.getTextInfo();if(s&&s.direction)return s.direction}}catch{}let r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new vq(wre());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){let n=new e(t,r);return n.createInstance=e.createInstance,n}cloneInstance(t={},r=hq){let n=t.forkResourceStore;n&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},s=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},n){let a=Object.keys(this.store.data).reduce((u,c)=>(u[c]={...this.store.data[c]},u[c]=Object.keys(u[c]).reduce((l,f)=>(l[f]={...u[c][f]},l),u[c]),u),{});s.store=new gq(a,i),s.services.resourceStore=s.store}if(t.interpolation){let u={...wre().interpolation,...this.options.interpolation,...t.interpolation},c={...i,interpolation:u};s.services.interpolator=new Eq(c)}return s.translator=new yq(s.services,i),s.translator.on("*",(a,...u)=>{s.emit(a,...u)}),s.init(i,r),s.translator.options=i,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},kr=Ire.createInstance(),gyi=kr.createInstance,yyi=kr.dir,vyi=kr.init,Eyi=kr.loadResources,_yi=kr.reloadResources,Syi=kr.use,byi=kr.changeLanguage,Tyi=kr.getFixedT,Ayi=kr.t,xyi=kr.exists,wyi=kr.setDefaultNamespace,Cyi=kr.hasLoadedNamespace,Oyi=kr.loadNamespaces,Pyi=kr.loadLanguages;var c5e={logMessages:{info:{mockOnlyWarning:"This application was generated with a local metadata file and does not reference a live server. Please add the required server configuration or start this application with mock data using the target: `npm run start-mock`."},error:{logWrapperNotInitialised:"`LogWrapper` is not initialised."},debug:{loggingConfigured:"Logging has been configured at log level: {{logLevel}}."}},telemetry:{unknownOs:"Unknown"},texts:{systemTypeLabel:{abapCloud:"ABAP Cloud"}}};var Lre="fiori-freestyle-writer",l5e=kr.createInstance();async function tDr(){await l5e.init({resources:{en:{[Lre]:c5e}},lng:"en",fallbackLng:"en",defaultNS:Lre,ns:[Lre],showSupportNotice:!1})}function rg(e,t){return l5e.t(e,t)}tDr().catch(()=>{});function f5e(e){return rDr(e.name,e.userDisplayName,e.systemType)}function rDr(e,t,r){let n=t?` [${t}]`:"";return`${e}${nDr(r)}${n}`}function nDr(e){let t="",r=` (${rg("texts.systemTypeLabel.abapCloud")})`;return(e==="AbapCloud"||e==="S4HC"||e==="BTP")&&(t=r),t}var UD=class{applicationKey="";extensionName="";extensionVersion="";getApplicationKey(){return this.applicationKey}getExtensionVersion(){return this.extensionVersion}getExtensionName(){return this.extensionName}};var Vct=be(kue(),1);var UR=class{extensionName;eventName;constructor(t,r){this.extensionName=t,this.eventName=r}getExtensionName(){return this.extensionName}getEventName(){return this.eventName}toString(){return`${this.extensionName}/${this.eventName}`}};var Pi;(function(e){e[e.OnePercent=0]="OnePercent",e[e.TenPercent=1]="TenPercent",e[e.NoSampling=2]="NoSampling"})(Pi||(Pi={}));function fG(e){e.channel.setUseDiskRetryCaching(!0),e.addTelemetryProcessor(t=>(t.tags["ai.location.ip"]="0.0.0.0",t.tags["ai.cloud.roleInstance"]="masked",t.tags["ai.cloud.role"]="masked",t.tags["ai.device.type"]="masked",!0))}var Bue={name:"@sap-ux/telemetry",version:"1.0.7",description:"Library for sending usage telemetry data",type:"module",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/telemetry"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Atelemetry"},license:"Apache-2.0",private:!1,main:"dist/index.js",scripts:{build:"tsc --build",watch:"tsc --watch",clean:"rimraf --glob dist coverage *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",example:"ts-node example/index.ts"},dependencies:{"@sap-ux/store":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/nodejs-utils":"workspace:*",applicationinsights:"2.9.8",axios:"1.16.0","performance-now":"2.1.0",yaml:"2.8.3"},devDependencies:{"@jest/globals":"30.3.0","jest-extended":"7.0.0",memfs:"3.4.13",unionfs:"4.6.0",dotenv:"17.4.2"},files:["dist","LICENSE","!dist/*.map","!dist/**/*.map"],engines:{node:">=22.x"}};var Eo={azureInstrumentationKey:"",telemetryEnabled:!0,telemetryLibName:Bue.name,telemetryLibVersion:Bue.version,consumerModuleName:"",consumerModuleVersion:""};var kR=class extends UD{clients;constructor(t,r,n){super(),this.clients=new Map,this.applicationKey=t,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(Pi.OnePercent),s=this.createTelemetryClient(Pi.TenPercent),o=this.createTelemetryClient(Pi.NoSampling);this.clients.set(Pi.OnePercent,i),this.clients.set(Pi.TenPercent,s),this.clients.set(Pi.NoSampling,o)}reportBlocking(t,r,n,i,s=!1){if(!s||Eo.telemetryEnabled){let{client:o,event:a}=this.prepareClientAndEvent(t,r,n,i);return this.trackEventBlocking(o,a)}return Promise.resolve()}async report(t,r,n,i,s,o){if(o!==void 0&&!o||!Eo.telemetryEnabled)return;let{client:a,event:u}=this.prepareClientAndEvent(t,r,n,i);this.trackEvent(a,u)}prepareClientAndEvent(t,r,n,i=Pi.NoSampling){let s=this.clients.get(i),a={name:new UR(this.extensionName,t).toString(),properties:r,measurements:n};return{client:s,event:a}}async trackEventBlocking(t,r){if(process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true")return new Promise((n,i)=>{try{t.trackEvent(r),t.flush({callback:()=>n()})}catch(s){i(s)}})}trackEvent(t,r){return process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"?(t.trackEvent(r),!0):!1}createTelemetryClient(t){let r;switch(t){case Pi.OnePercent:r=1;break;case Pi.TenPercent:r=10;break;case Pi.NoSampling:default:r=100;break}let n=new Vct.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,fG(n),n}};var que=()=>{let e=new Date().getTime();return new Date(e).toISOString()};var BR=class extends kR{constructor(t,r,n){super(t,r,n)}async report(t,r,n,i,s,o){let a=await pG(s),u={v:this.extensionVersion,datetime:que()},c={...r,...a,...u};await super.report(t,c,n,i,s,o)}async reportEvent(t,r,n,i){let{finalProperties:s,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(t,n);return super.report(t.eventName,s,o,r,n,i)}async reportEventBlocking(t,r,n,i){let{finalProperties:s,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(t,n);return super.reportBlocking(t.eventName,s,o,r,i)}async collectToolsSuiteTelemetry(t,r){let n=await pG(r),i={v:this.extensionVersion,datetime:que()},s={...t.properties,...n,...i},o={...t.measurements};return{finalProperties:s,finalMeasurements:o}}};var Gct=require("node:child_process"),qR=class{run(t,r=[],n={},i){return i&&i.debug(`Running command: ${t} ${r.join(" ")}`),new Promise((s,o)=>{let a=[],u=process.platform==="win32"?{...n,shell:!0}:n,c=(0,Gct.spawn)(t,r,u);c.stdout.setEncoding("utf8");let l;c.stdout.on("data",f=>{i?.info(f.toString().replace(/[\r\n]$/,"")),l=f.toString()}),c.stderr.on("data",f=>{i?.info(f.toString().replace(/[\r\n]$/,"")),a.push(f.toString())}),c.on("error",f=>{let p=`Command failed with error: ${f.message}`;i?.error(p),o(f)}),c.on("close",f=>{if(f!==0){let p=`Command failed, \`${t} ${r.join(" ")}\`, ${a.join(", ")}`;i?.debug(p),o(p)}s(l)})})}};var Mnn=be(jG(),1);var Fnn=be(tfe(),1),nfe=be(ta(),1);var Pht={error:{unsupportedYoVersion:"The installed version of the `Yo` CLI tool: {{installedYoVersion}} is not supported. Please use `npm` or `yarn` to globally install the latest supported version by running: 'npm i -g yo@{{latestSupportedYoVer}}'.",executingYoVersionCmd:"Running: {{yoCmd}} returned an error: {{- error}}. Check that `yo` is installed and available on the path. If `yo@{{latestSupportedYoVer}}` is not installed, use `npm` or `yarn` to globally install the latest required version by running: 'npm i -g yo@{{latestSupportedYoVer}}'."}};var rfe="nodejs-utils",Inn=kr.createInstance();async function Lnn(){await Inn.init({lng:"en",fallbackLng:"en",defaultNS:rfe,ns:[rfe],resources:{en:{[rfe]:Pht}},interpolation:{escapeValue:!1},showSupportNotice:!1})}Lnn().catch(()=>{});var QR=be(require("node:https"),1);function VA(e){QR.default.globalAgent.options&&(QR.default.globalAgent.options.rejectUnauthorized=e),QR.default.globalAgent.fallbackAgent?.options&&(QR.default.globalAgent.fallbackAgent.options.rejectUnauthorized=e)}var il=be(kpe(),1),nvt=be(rvt(),1);var yi=class extends Error{code;constructor(t,r){super(t),this.code=r,this.name=this.constructor.name}};var ss=Object.freeze({yamlParsing:"yamlParsing",nodeNotFound:"nodeNotFound",nodeNotFoundMatching:"nodeNotFoundMatching",nodeNotAMap:"nodeNotAMap",propertyNotFound:"propertyNotFound",pathCannotBeEmpty:"pathCannotBeEmpty",pathDoesNotExist:"pathDoesNotExist",seqDoesNotExist:"seqDoesNotExist",tryingToAppendToNonSequence:"tryingToAppendToNonSequence",startNodeMustBeCollection:"startNodeMustBeCollection",scalarValuesDoNotHaveProperties:"scalarValuesDoNotHaveProperties"}),Ao=Object.freeze({yamlParsing:"Error parsing YAML document",nodeNotFound:"Node not found at path: [{{- path }}]",nodeNotFoundMatching:"Node not found at path: [{{- path }}, matching [{{- key }} = {{- value }}]",nodeNotAMap:"Node path: [{{- path }}, matching [{{- key }} = {{- value }}], is not a map",propertyNotFound:"Node not found at path: [{{- path }}]",pathCannotBeEmpty:"Path cannot be empty",pathDoesNotExist:"Parent node does not exist at: [{{- path }}]",seqDoesNotExist:"Sequence does not exist at: [{{- path }}]",tryingToAppendToNonSequence:"Cannot append to non-sequence at: [{{- path }}]",startNodeMustBeCollection:"Starting node must be an array or an object",scalarValuesDoNotHaveProperties:"Scalar values do not have properties"});function nl(e,t){try{return t?e?.replace(/{{-?([^{}]*)}}/g,(r,n)=>{let i=n?.trim();return t[i]?.toString()||r}):e}catch{return""}}var DN=class e{documents;static async newInstance(t){return new e(t)}constructor(t){this.documents=il.default.parseAllDocuments(t),this.documents.length===0&&this.documents.push(il.default.parseDocument(t));let r=this.documents.filter(n=>n.errors.length>0);if(r.length>0)throw new yi(Ao.yamlParsing+`
|
|
660
|
+
`);let t=new Ua("!xml"),r=t,n="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let i=this.options,s=new PP(i.processEntities),o=e.length;for(let a=0;a<o;a++)if(e[a]==="<"){let c=e.charCodeAt(a+1);if(c===47){let l=pb(e,">",a,"Closing Tag is not closed."),f=e.substring(a+2,l).trim();if(i.removeNSPrefix){let d=f.indexOf(":");d!==-1&&(f=f.substr(d+1))}f=OZ(i.transformTagName,f,"",i).tagName,r&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher));let p=this.matcher.getCurrentTag();if(f&&i.unpairedTagsSet.has(f))throw new Error(`Unpaired tag can not be used as closing tag: </${f}>`);p&&i.unpairedTagsSet.has(p)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=this.tagsNodeStack.pop(),n="",a=l}else if(c===63){let l=PZ(e,a,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let f=this.buildAttributesMap(l.tagExp,this.matcher,l.tagName,!0);if(f){let p=f[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(p)||1),s.setXmlVersion(Number(p)||1)}if(!(i.ignoreDeclaration&&l.tagName==="?xml"||i.ignorePiTags)){let p=new Ua(l.tagName);p.add(i.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&i.ignoreAttributes!==!0&&(p[":@"]=f),this.addChild(r,p,this.readonlyMatcher,a)}a=l.closeIndex+1}else if(c===33&&e.charCodeAt(a+2)===45&&e.charCodeAt(a+3)===45){let l=pb(e,"-->",a+4,"Comment is not closed.");if(i.commentPropName){let f=e.substring(a+4,l-2);n=this.saveTextToParentTag(n,r,this.readonlyMatcher),r.add(i.commentPropName,[{[i.textNodeName]:f}])}a=l}else if(c===33&&e.charCodeAt(a+2)===68){let l=s.readDocType(e,a);this.entityDecoder.addInputEntities(l.entities),a=l.i}else if(c===33&&e.charCodeAt(a+2)===91){let l=pb(e,"]]>",a,"CDATA is not closed.")-2,f=e.substring(a+9,l);n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let p=this.parseTextData(f,r.tagname,this.readonlyMatcher,!0,!1,!0,!0);p==null&&(p=""),i.cdataPropName?r.add(i.cdataPropName,[{[i.textNodeName]:f}]):r.add(i.textNodeName,p),a=l+2}else{let l=PZ(e,a,i.removeNSPrefix);if(!l){let N=e.substring(Math.max(0,a-50),Math.min(o,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${N}"`)}let f=l.tagName,p=l.rawTagName,d=l.tagExp,h=l.attrExpPresent,g=l.closeIndex;if({tagName:f,tagExp:d}=OZ(i.transformTagName,f,d,i),i.strictReservedNames&&(f===i.commentPropName||f===i.cdataPropName||f===i.textNodeName||f===i.attributesGroupName))throw new Error(`Invalid tag name: ${f}`);r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher,!1));let _=r;_&&i.unpairedTagsSet.has(_.tagname)&&(r=this.tagsNodeStack.pop(),this.matcher.pop());let S=!1;d.length>0&&d.lastIndexOf("/")===d.length-1&&(S=!0,f[f.length-1]==="/"?(f=f.substr(0,f.length-1),d=f):d=d.substr(0,d.length-1),h=f!==d);let T=null,A={},w;w=Oyr(p),f!==t.tagname&&this.matcher.push(f,{},w),f!==d&&h&&(T=this.buildAttributesMap(d,this.matcher,f),T&&(A=Cyr(T,i))),f!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let x=a;if(this.isCurrentNodeStopNode){let N="";if(S)a=l.closeIndex;else if(i.unpairedTagsSet.has(f))a=l.closeIndex;else{let D=this.readStopNodeData(e,p,g+1);if(!D)throw new Error(`Unexpected end of ${p}`);a=D.i,N=D.tagContent}let F=new Ua(f);T&&(F[":@"]=T),F.add(i.textNodeName,N),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(r,F,this.readonlyMatcher,x)}else{if(S){({tagName:f,tagExp:d}=OZ(i.transformTagName,f,d,i));let N=new Ua(f);T&&(N[":@"]=T),this.addChild(r,N,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(i.unpairedTagsSet.has(f)){let N=new Ua(f);T&&(N[":@"]=T),this.addChild(r,N,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=!1,a=l.closeIndex;continue}else{let N=new Ua(f);if(this.tagsNodeStack.length>i.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),T&&(N[":@"]=T),this.addChild(r,N,this.readonlyMatcher,x),r=N}n="",a=g}}}else n+=e[a];return t.child};function Lyr(e,t,r,n){this.options.captureMetaData||(n=void 0);let i=this.options.jPath?r.toString():r,s=this.options.updateTag(t.tagname,i,t[":@"]);s===!1||(typeof s=="string"&&(t.tagname=s),e.addChild(t,n))}function Myr(e,t,r){let n=this.options.processEntities;if(!n||!n.enabled)return e;if(n.allowedTags){let i=this.options.jPath?r.toString():r;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(t):n.allowedTags(t,i)))return e}if(n.tagFilter){let i=this.options.jPath?r.toString():r;if(!n.tagFilter(t,i))return e}return this.entityDecoder.decode(e)}function Fyr(e,t,r,n){return e&&(n===void 0&&(n=t.child.length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Uyr(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function kyr(e,t,r=">"){let n=0,i=e.length,s=r.charCodeAt(0),o=r.length>1?r.charCodeAt(1):-1,a="",u=t;for(let c=t;c<i;c++){let l=e.charCodeAt(c);if(n)l===n&&(n=0);else if(l===34||l===39)n=l;else if(l===s)if(o!==-1){if(e.charCodeAt(c+1)===o)return a+=e.substring(u,c),{data:a,index:c}}else return a+=e.substring(u,c),{data:a,index:c};else l===9&&!n&&(a+=e.substring(u,c)+" ",u=c+1)}}function pb(e,t,r,n){let i=e.indexOf(t,r);if(i===-1)throw new Error(n);return i+t.length-1}function Byr(e,t,r,n){let i=e.indexOf(t,r);if(i===-1)throw new Error(n);return i}function PZ(e,t,r,n=">"){let i=kyr(e,t+1,n);if(!i)return;let s=i.data,o=i.index,a=s.search(/\s/),u=s,c=!0;a!==-1&&(u=s.substring(0,a),s=s.substring(a+1).trimStart());let l=u;if(r){let f=u.indexOf(":");f!==-1&&(u=u.substr(f+1),c=u!==i.data.substr(f+1))}return{tagName:u,tagExp:s,closeIndex:o,attrExpPresent:c,rawTagName:l}}function qyr(e,t,r){let n=r,i=1,s=e.length;for(;r<s;r++)if(e[r]==="<"){let o=e.charCodeAt(r+1);if(o===47){let a=Byr(e,">",r,`${t} is not closed`);if(e.substring(r+2,a).trim()===t&&(i--,i===0))return{tagContent:e.substring(n,r),i:a};r=a}else if(o===63)r=pb(e,"?>",r+1,"StopNode is not closed.");else if(o===33&&e.charCodeAt(r+2)===45&&e.charCodeAt(r+3)===45)r=pb(e,"-->",r+3,"StopNode is not closed.");else if(o===33&&e.charCodeAt(r+2)===91)r=pb(e,"]]>",r,"StopNode is not closed.")-2;else{let a=PZ(e,r,!1);a&&((a&&a.tagName)===t&&a.tagExp[a.tagExp.length-1]!=="/"&&i++,r=a.closeIndex)}}}function DZ(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:xZ(e,r)}else return VUe(e)?e:""}function OZ(e,t,r,n){if(e){let i=e(t);r===t&&(r=i),t=i}return t=pke(t,n),{tagName:t,tagExp:r}}function pke(e,t){if(_k.includes(e))throw new Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return xP.includes(e)?t.onDangerousProperty(e):e}var RZ=Ua.getMetaDataSymbol();function jyr(e,t){if(!e||typeof e!="object")return{};if(!t)return e;let r={};for(let n in e)if(n.startsWith(t)){let i=n.substring(t.length);r[i]=e[n]}else r[n]=e[n];return r}function NZ(e,t,r,n){return dke(e,t,r,n)}function dke(e,t,r,n){let i,s={};for(let o=0;o<e.length;o++){let a=e[o],u=Vyr(a);if(u!==void 0&&u!==t.textNodeName){let c=jyr(a[":@"]||{},t.attributeNamePrefix);r.push(u,c)}if(u===t.textNodeName)i===void 0?i=a[u]:i+=""+a[u];else{if(u===void 0)continue;if(a[u]){let c=dke(a[u],t,r,n),l=$yr(c,t);if(Object.keys(c).length===0&&t.alwaysCreateTextNode&&(c[t.textNodeName]=""),a[":@"]?Gyr(c,a[":@"],n,t):Object.keys(c).length===1&&c[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?c=c[t.textNodeName]:Object.keys(c).length===0&&(t.alwaysCreateTextNode?c[t.textNodeName]="":c=""),a[RZ]!==void 0&&typeof c=="object"&&c!==null&&(c[RZ]=a[RZ]),s[u]!==void 0&&Object.prototype.hasOwnProperty.call(s,u))Array.isArray(s[u])||(s[u]=[s[u]]),s[u].push(c);else{let f=t.jPath?n.toString():n;t.isArray(u,f,l)?s[u]=[c]:s[u]=c}u!==void 0&&u!==t.textNodeName&&r.pop()}}}return typeof i=="string"?i.length>0&&(s[t.textNodeName]=i):i!==void 0&&(s[t.textNodeName]=i),s}function Vyr(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function Gyr(e,t,r,n){if(t){let i=Object.keys(t),s=i.length;for(let o=0;o<s;o++){let a=i[o],u=a.startsWith(n.attributeNamePrefix)?a.substring(n.attributeNamePrefix.length):a,c=n.jPath?r.toString()+"."+u:r;n.isArray(a,c,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function $yr(e,t){let{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}var zf=class{constructor(t){this.externalEntities={},this.options=uke(t)}parse(t,r){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let s=Sk(t,r);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}let n=new DP(this.options,this.externalEntities),i=n.parseXml(t);return this.options.preserveOrder||i===void 0?i:NZ(i,this.options,n.matcher,n.readonlyMatcher)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}static getMetaDataSymbol(){return Ua.getMetaDataSymbol()}};var db={validate:Sk};var Bm=class extends Pa{static ADT_DISCOVERY_SERVICE_PATH="/sap/bc/adt/discovery";schemaStore=new vk;log;async getServiceDefinition(t){await this.checkOrLoadAdtDiscoverySchema();let r=this.schemaStore.getAdtCollection(t);return this.validateServiceSchema(t,r)?r:(this.log.warn("Invalid Discovery Schema"),null)}validateServiceSchema(t,r){return r?r.href?!0:(this.log.warn(`Empty href in schema: ${t.term} - ${t.scheme}`),!1):(this.log.warn(`Schema Not Found: ${t.term} - ${t.scheme}`),!1)}async checkOrLoadAdtDiscoverySchema(){if(!this.schemaStore.isAdtSchemaEmpty())return;let t=await this.get("",{headers:{Accept:"application/*"}}),r=this.parseAdtSchemaData(t.data);this.schemaStore.updateSchemaData(r)}parseAdtSchemaData(t){if(db.validate(t)!==!0)return null;let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0},i=new zf(r).parse(t,!0);return i.service?i:null}};var Cd=class extends Pa{static PATH="/sap/bc/ui2/app_index";log;async search(t={},r){let n={...t};r&&(n.fields=r.join(","));let i=await this.get("/",{params:n});return JSON.parse(i.data).results}async getIsManiFirstSupported(t){try{let r={id:t},n=await this.get("/ui5_app_mani_first_supported",{params:r});return JSON.parse(n.data)}catch(r){throw this.log.error(`Fail fetching ui5_app_mani_first_supported for app with id: ${t}.`),this.log.debug(r),r}}async getAppInfo(t){try{let r=await this.get("/ui5_app_info_json",{params:{id:t}});return JSON.parse(r.data)}catch(r){throw vF(r)?this.log.error(`Failed fetching ui5_app_info_json for app with id ${t}.`):this.log.error(`Parsing error: ui5_app_info_json is not in expected format for app with id ${t}.`),this.log.debug(r),r}}};var RP={UI:"UI",NotClassified:"Not Classified",WebApi:"WEB_API",NotDetermined:"Not Determined"},hb=class extends bm{entitySet;services;isS4Cloud;async listServices(t=!1){return this.services||(this.services=await this.fetchServices(t)),this.services}};var hke="ServiceCollection",mke="RecommendedServiceCollection",Hyr="((IsSapService%20eq%20true)and(ReleaseStatus%20eq%20%27RELEASED%27))or((IsSapService%20eq%20false))",qm=class extends hb{static PATH="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2";async determineEntitySet(){let t=await this.document();this.entitySet=t.EntitySets.includes(mke)?mke:hke}getServicePath(t,r){let n;try{n=new URL(t)}catch{n=new URL(t,r)}return n.pathname}mapServices(t){return t.map(r=>{let n=this.getServicePath(r.ServiceUrl,this.defaults.baseURL);return{id:r.ID,name:r.TechnicalServiceName,path:n,serviceVersion:r.TechnicalServiceVersion+"",odataVersion:Er.v2,serviceType:r.ServiceType}})}async fetchServices(){let t={$format:"json"};this.entitySet||await this.determineEntitySet(),this.entitySet===hke&&await this.isS4Cloud&&(t.$filter=Hyr);let n=(await this.get(`/${this.entitySet}`,{params:t})).odata();if(If.containsError(n))throw new If(n);return this.mapServices(n)}async findService({title:t,path:r}){let n=1;if(!t){let u=r.replace(/\/$/,"").split("/").pop().split(";");if(t=u[0].toUpperCase(),!t)throw new Error(`Cannot determine service title from path: ${r}`);u.slice(1).forEach(l=>{let[f,p]=l.split("=");f==="v"&&(n=Number.parseInt(p,10))})}let i={$format:"json",$filter:`Title eq '${t}' and TechnicalServiceVersion eq ${n}`},s=this.entitySet?`/${this.entitySet}`:"/ServiceCollection",a=(await this.get(s,{params:i})).odata();if(a.length>1){let u=a.filter(c=>c.ServiceUrl?.toUpperCase().includes((r||t).toUpperCase()));if(u.length>1)this.log.warn("Service filter was not sufficient to identify one service.");else if(u.length>0)return this.log.info(`Service filter chose service: ${u[0].TechnicalServiceName}`),u[0]}return a.length>0?a[0]:void 0}async getServiceAnnotations({id:t,title:r,path:n}){if(!t){let i=await this.findService({title:r,path:n});i&&(t=i.ID)}return t?(await this.get(`/ServiceCollection('${encodeURIComponent(t)}')/Annotations`,{params:{$format:"json"}})).odata():[]}async getAnnotations({id:t,title:r,path:n}){if(!t&&!r&&!n)throw new Error("No filter parameters passed in");let i=await this.getServiceAnnotations({id:t,title:r,path:n}),s=[];for(let o of i){let a=`/Annotations(TechnicalName='${encodeURIComponent(o.TechnicalName)}',Version='${o.Version}')/$value/`,u=await this.get(a,{headers:{Accept:"application/xml"}});u.data?s.push({TechnicalName:o.TechnicalName,Version:o.Version,Definitions:u.data,Uri:this.defaults.baseURL+a}):this.log.warn(`No annotations found for TechnicalName=${o.TechnicalName}, Version=${o.Version}`)}return s}async getServiceType(t){let r,{ID:n}=await this.findService({path:t});if(n){let i=await this.get(`/ServiceTypeForHUBServices('${encodeURIComponent(n)}')`);i&&(r=i.odata().ServiceType)}return r}};var gke="RecommendedServices",yke="Services",mb=class extends hb{logger=new vs;static PATH="/sap/opu/odata4/iwfnd/config/default/iwfnd/catalog/0002";mapServices(t,r,n=!1){let i=[],s=new Set;return t.filter(o=>o?.DefaultSystem?.[r]?.length>0).forEach(o=>{i.push(...o.DefaultSystem[r].flatMap(a=>{let u=a.ServiceUrl.split("?").shift();if(n){let c=`${a.ServiceId}|${u}`;if(s.has(c))return[];s.add(c)}return{id:a.ServiceId,group:o.GroupId,path:u,name:`${o.GroupId} > ${a.ServiceAlias||a.ServiceId}`,serviceVersion:a.ServiceVersion,odataVersion:Er.v4,serviceType:a.ServiceType}}))}),i}async fetchServicesNextLink(){if(this.entitySet===void 0){let o=await this.metadata();this.entitySet=o.includes('Name="RecommendedServices"')?gke:yke}let t=new URLSearchParams([["$count","true"],["$expand",`DefaultSystem($expand=${this.entitySet})`]]),n=(await this.get("/ServiceGroups",{params:t},!0)).odata(),i=n.value,s=1;for(;n["@odata.nextLink"];){let o=new URL(n["@odata.nextLink"],this.defaults.baseURL);n=(await this.get("/ServiceGroups",{params:o.searchParams},!0)).odata(),s++,i.push(...n.value)}if(this.logger.log(`Fetched ${i.length} service groups in ${s} requests.`),If.containsError(i))throw new If(i);return this.mapServices(i,this.entitySet)}async fetchServices(t=!1){return t?this.fetchServicesNextLink():this.fetchServicesParallel()}async fetchServicesParallel(){if(this.entitySet===void 0){let c=await this.metadata();this.entitySet=c.includes('Name="RecommendedServices"')?gke:yke}let r=new URLSearchParams([["$count","true"],["$top","1000"],["$expand",`DefaultSystem($expand=${this.entitySet})`]]),i=(await this.get("/ServiceGroups",{params:r},!0)).odata(),s=i.value,o=i["@odata.count"],a=Number.parseInt(i["@odata.nextLink"]?.split("skiptoken=")[1],10),u=1;if(!Number.isNaN(a)){let c=Math.ceil(o/a),l=Array.from({length:c-1},(p,d)=>{let h=new URLSearchParams([["$count","true"],["$skip",String((d+1)*a)],["$top",a.toString()],["$expand",`DefaultSystem($expand=${this.entitySet})`]]);return u++,this.get("/ServiceGroups",{params:h},!0)});(await Promise.all(l)).forEach(p=>{let d=p.odata();s.push(...d.value)})}if(this.logger.log(`Fetched ${s.length} service groups in ${u} requests.`),If.containsError(s))throw new If(s);return this.mapServices(s,this.entitySet,!0)}getAnnotations(){return Promise.resolve([])}getServiceType(){return Promise.resolve(void 0)}};var NP;(function(e){e.SAP="SAP",e.Customer="CUSTOMER"})(NP||(NP={}));var ti=class extends Pa{log;serviceSchema;static getAdtCatagory(){throw new Error("NEEDS TO BE IMPLEMENTED BY AdtService SUBCLASSES")}attachAdtSchema(t){this.serviceSchema=t}parseResponse(t){if(db.validate(t)!==!0)return this.log.warn(`Invalid XML: ${t}`),{};let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0};return new zf(r).parse(t,!0)}};var IP=class e extends ti{static adtCategory={scheme:"http://www.sap.com/adt/categories/ato",term:"settings"};static getAdtCatagory(){return e.adtCategory}async getAtoInfo(){let t={headers:{Accept:"application/*"}},r=await this.get("",t);return this.parseAtoResponse(r.data)}parseAtoResponse(t){if(db.validate(t)!==!0)return this.log.warn(`Invalid XML: ${t}`),{};let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0},i=new zf(r).parse(t,!0);return i.settings?i.settings:{}}};var fBe=be(vke(),1),bvr=be(lBe(),1);var WP=class e extends ti{static adtCategory={scheme:"http://www.sap.com/adt/categories/respository",term:"generators"};static getAdtCatagory(){return e.adtCategory}async getUIServiceGeneratorConfig(t){let r=await this.get("",{headers:{Accept:"application/atom+xml;type=feed"},params:{referencedObject:t,type:"webapi"}}),n=this.parseResponse(r.data).feed?.entry;if(n?.id==="published-ui-service")return n;throw new Error("UI Service Generator not found")}};var YP=class e extends ti{static adtCategory={scheme:"http://www.sap.com/adt/categories/respository",term:"generators"};static getAdtCatagory(){return e.adtCategory}id;async getRAPGeneratorConfig(){let t=await this.get("",{headers:{Accept:"application/atom+xml;type=feed"},params:{type:"webapi",fetchAllGenerators:!0}}),r=this.parseResponse(t.data).feed?.entry??[];r&&!Array.isArray(r)&&(r=[r]);let n=r.find(i=>i.id==="published-x-ui-service");if(n)return n;throw new Error("OData Service Generator not found")}};var zP=class extends ti{packageName;contentType;configure(t,r){this.packageName=r}setContentType(t){this.contentType=t}async validate(t){let r=await this.post("/validation",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.validationMessages.v1+xml, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage"},params:{package:this.packageName}});return this.parseValidateResponse(r.data)}async getTechnicalDetails(t){let r=await this.post("/preview",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.repository.objects.massoperation.v1+xml"},params:{package:this.packageName}});return this.parsePreviewResponse(r.data)}async generate(t){return(await this.post("",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.repository.generator.v1+json"},params:{package:this.packageName}})).status}parseValidateResponse(t){let n=this.parseResponse(t).validationMessages;return Array.isArray(n)||(n=[n]),n.map(i=>i.validationMessage||{})||[]}parsePreviewResponse(t){let n=(this.parseResponse(t).group.group||[]).find(a=>a.name==="Business Service Layer");if(!n)return;let i=Array.isArray(n.object)?n.object:[n.object],s=i.find(a=>a.objectReference?.type==="SRVD/SRV"),o=i.find(a=>a.objectReference?.type==="SRVB/SVB");if(!(!s||!o))return{serviceName:o.objectReference?.name||"",serviceDefinitionName:s.objectReference?.name||"",serviceVersion:"0001"}}};var xb=class extends ti{referencedObject;contentType;configure(t,r,n){this.referencedObject=r,this.contentType=n}async getSchema(){let t=await this.get("/schema",{headers:{Accept:"application/vnd.sap.adt.repository.generator.schema.v1+json"},params:{referencedObject:this.referencedObject.uri}});return JSON.parse(t.data)}async getContent(t){let n=(await this.get("/content",{headers:{Accept:this.contentType},params:{referencedObject:this.referencedObject.uri,package:t}})).data,i=JSON.parse(n);return i.metadata||(i.metadata={package:t}),JSON.stringify(i)}async validatePackage(t){let r=await this.get("/validation",{headers:{Accept:"application/vnd.sap.adt.validationMessages.v1+xml"},params:{referencedObject:this.referencedObject.uri,package:t,checks:"package"}});return this.parseResponse(r.data)}async validateContent(t){let r=await this.post("/validation",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.validationMessages.v1+xml"},params:{referencedObject:this.referencedObject.uri,checks:"package,referencedobject,authorization"}});return this.parseResponse(r.data).validationMessages?.validationMessage}async generate(t,r){let n=await this.post("",t,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.repository.generator.v1+json, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage"},params:{referencedObject:this.referencedObject.uri,corrNr:r}});return this.parseResponse(n.data)}};var Uk=class extends ti{async getSystemInfo(){let t={headers:{Accept:"application/vnd.sap.adt.core.http.systeminformation.v1+json"}},r=await this.get("/sap/bc/adt/core/http/systeminformation",t);if(typeof r.data=="string")try{return JSON.parse(r.data)}catch(n){this.log.error(`System info could not be parsed from response. Error: ${n.message}`)}else return r.data}};var KP=class extends Pa{static PATH="/sap/public/bc/ui5_ui5";log;async getUI5Version(){try{let t=await this.get("/bootstrap_info.json",{transformResponse:n=>JSON.parse(n)}),{Version:r}=t.data;if(!r)throw new Error("UI5 version not provided.");return r}catch(t){throw this.log.error("Could not get UI5 Version."),this.log.debug(t),t}}};var Va=class extends km{atoSettings;_publicUrl;_systemInfo;async user(){return await Promise.resolve(this.defaults.auth?.username)||(await this.getSystemInfo())?.userName}async getSystemInfo(){if(this._systemInfo)return this._systemInfo;try{let t=this.createService("",Uk);this._systemInfo=await t.getSystemInfo()}catch(t){this.log.error(`An error occurred retrieving system info: ${t}`)}return this._systemInfo}setAtoInfo(t){this.atoSettings=t}async getAtoInfo(){if(this.atoSettings)return this.atoSettings;let t;try{t=await this.getAdtService(IP),t?this.atoSettings=await t.getAtoInfo():this.atoSettings={}}catch{this.atoSettings={}}return this.atoSettings}set publicUrl(t){this._publicUrl=t}get publicUrl(){return this._publicUrl||this.defaults.baseURL}async isAbapCloud(){return this.atoSettings===void 0&&await this.getAtoInfo(),this.atoSettings.tenantType===NP.Customer&&this.atoSettings.operationsType==="C"}getAdtCatalogService(){if(!this.services[Bm.ADT_DISCOVERY_SERVICE_PATH]){let t=this.createService(Bm.ADT_DISCOVERY_SERVICE_PATH,Bm);this.services[Bm.ADT_DISCOVERY_SERVICE_PATH]=t}return this.services[Bm.ADT_DISCOVERY_SERVICE_PATH]}catalog(t){let r;if(t===Er.v2)r=this.services[qm.PATH]??this.createService(qm.PATH,qm);else if(t===Er.v4)r=this.services[mb.PATH]??this.createService(mb.PATH,mb);else throw new Error("not implemented yet");return Object.defineProperty(r,"isAbapCloud",{get:this.isAbapCloud.bind(this)}),r}getUi5AbapRepository(t){let r=t??ab.PATH;return this.services[r]||(this.services[r]=this.createService(r,ab)),this.services[r]}getAppIndex(){return this.services[Cd.PATH]||(this.services[Cd.PATH]=this.createService(Cd.PATH,Cd)),this.services[Cd.PATH]}getLayeredRepository(t){let r=t??ub.PATH;return this.services[r]||(this.services[r]=this.createService(r,ub)),this.services[r]}async getAdtService(t){let r=t.name;if(!this.services[r]){let i=await this.getAdtCatalogService().getServiceDefinition(t.getAdtCatagory());if(!i)return null;this.services[r]=this.createService(i.href,t),this.services[r].attachAdtSchema(i)}return this.services[r]}getUI5VersionService(){let t=KP.PATH;return this.services[t]||(this.services[t]=this.createService(t,KP)),this.services[t]}async getUiServiceGenerator(t){let r=await this.getAdtService(WP);if(!r)throw new Error("Generators are not supported on this system");let n=await r.getUIServiceGeneratorConfig(t.uri),i=this.createService(this.getServiceUrlFromConfig(n),xb);return i.configure(n,t,this.getContentType(n)),i}async getODataServiceGenerator(t){let r=await this.getAdtService(YP);if(!r)throw new Error("RAP Generator are not support on this system");let n=await r.getRAPGeneratorConfig(),i=this.createService(this.getServiceUrlFromConfig(n),zP);return i.setContentType(this.getContentType(n)),i.configure(n,t||"$TMP"),i}async fetchExternalServices(t){let r=[],n=t.map(async i=>{let{serviceRootPath:s,value:o}=i,a=(0,pBe.join)(s,o).replace("/$metadata",""),u=this.service(a);try{let c=await u.metadata();i.type==="value-list"?r.push({type:"value-list",path:a,target:i.target,metadata:c}):i.type==="code-list"&&r.push({type:"code-list",path:a,metadata:c})}catch(c){this.log.warn(`Could not fetch value list reference metadata from ${a}, ${c.message}`)}});return await Promise.allSettled(n),r}getServiceUrlFromConfig(t){if(Array.isArray(t.link)&&!t.link[0]?.href)throw new Error("No service URL found in the generator config");let r=t.link[0].href.indexOf(t.id)+t.id.length;return t.link[0].href.substring(0,r)}getContentType(t){return(t.link?.find(n=>typeof n.href=="string"&&n.href.includes("/content"))).type}async createLockServiceBindingGenerator(t){return this.createService(t,xb)}};var vHe=be(BGe(),1),ap=be(nq(),1);var eg;(function(e){e.H2O_URL="H2O_URL",e.HTTP_PROXY="HTTP_PROXY",e.HTTPS_PROXY="HTTPS_PROXY"})(eg||(eg={}));var iq;(function(e){e.HTTP="HTTP",e.LDAP="LDAP",e.MAIL="MAIL",e.RFC="RFC"})(iq||(iq={}));var sq;(function(e){e.DEDICATED="Dedicated",e.COMMON="Common"})(sq||(sq={}));var op;(function(e){e.BASIC_AUTHENTICATION="BasicAuthentication",e.CLIENT_CERT_AUTHENTICATION="ClientCertificateAuthentication",e.NO_AUTHENTICATION="NoAuthentication",e.OAUTH2_CLIENT_CREDENTIALS="OAuth2ClientCredentials",e.OAUTH2_JWT_BEARER="OAuth2JWTBearer",e.OAUTH2_PASSWORD="OAuth2Password",e.OAUTH2_REFRESH_TOKEN="OAuth2RefreshToken",e.OAUTH2_SAML_BEARER_ASSERTION="OAuth2SAMLBearerAssertion",e.OAUTH2_USER_TOKEN_EXCHANGE="OAuth2UserTokenExchange",e.SAML_ASSERTION="SAMLAssertion"})(op||(op={}));var oq;(function(e){e.S4HC="S4HC",e.BTP="BTP"})(oq||(oq={}));var dre;(function(e){e.ON_PREMISE="OnPremise",e.INTERNET="Internet",e.PRIVATE_LINK="PrivateLink"})(dre||(dre={}));var SE;(function(e){e.ODATA_GENERIC="odata_gen",e.ODATA_ABAP="odata_abap",e.DEV_ABAP="dev_abap",e.ABAP_CLOUD="abap_cloud"})(SE||(SE={}));var aq;(function(e){e.FULL_URL="full_url",e.API_MGMT="api_mgmt"})(aq||(aq={}));var ND;(function(e){e.ON_PREMISE="OnPremise",e.INTERNET="Internet",e.PRIVATE_LINK="PrivateLink"})(ND||(ND={}));function hHe(e){return!!(e.WebIDEUsage?.includes("abap")||e["sap-client"]||e["sap-platform"]?.toLocaleLowerCase()==="abap"||e.ProxyType==="OnPremise")}function zOr(e){return!!(e.WebIDEUsage?.includes(SE.ABAP_CLOUD)||e["sap-platform"]?.toLocaleLowerCase()==="abap")}function uq(e){return!!(e.WebIDEUsage?.includes(SE.ODATA_GENERIC)&&!e.WebIDEUsage.includes(SE.ODATA_ABAP))}function Kl(e){return!!(!e.WebIDEAdditionalData?.includes(aq.FULL_URL)&&uq(e))}function tg(e){return!!(e.WebIDEAdditionalData?.includes(aq.FULL_URL)&&uq(e))}function mHe(e){return!!e.ProxyType.includes(ND.ON_PREMISE)}function gHe(e){return!!e["HTML5.DynamicDestination"]}function KOr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dHe(e,t){let r=` (${t})`;return RegExp(`${KOr(r)}$`).exec(e.trim())?e:`${e} (${t})`}function yHe(e,t){let r=t?` [${t}]`:"",n;return zOr(e)?n=dHe(e.Name,oq.BTP):hre(e)?n=dHe(e.Name,oq.S4HC):n=e.Name,`${n}${r}`}function hre(e){return!!(e.WebIDEUsage?.includes(SE.ODATA_ABAP)&&e.Authentication===op.SAML_ASSERTION&&e.ProxyType===dre.INTERNET)}function cq(e){return!!e.WebIDEUsage?.includes(SE.ODATA_ABAP)}var Gd={ABAP:"abap",ABAP_TRIAL:"abap-trial",ABAP_CANARY:"abap-canary",ABAP_OEM:"abap-oem",ABAP_OEM_CANARY:"abap-oem-canary",ABAP_HAAS:"abap-haas",DESTINATION:"destination",ABAP_STAGING:"abap-staging",ABAP_INTERNAL_STAGING:"abap-internal-staging"};var mre="abap-cloud-destination-instance",EHe="bas-destination-instance-cred";function Vr(){return!!process.env[eg.H2O_URL]}async function _He(e){try{let t=await(0,ap.cfGetInstanceKeyParameters)(e);if(!t)throw new Error(`No destination instance ${e} found`);let r=t.credentials;if(!r)throw new Error(`No credentials for destination instance ${e} found`);let n=r.uaa?.clientid||r.clientid,i=r.uaa?.clientsecret||r.clientsecret;return Buffer.from(`${encodeURIComponent(n)}:${encodeURIComponent(i)}`).toString("base64")}catch(t){throw new Error(`An error occurred while retrieving service key for the destination instance ${e}: ${t}`)}}function rT(e,t){let r=`https://${e}.dest`;return t&&t.length>1?new URL(t,r).toString():r}function XOr(e){let[t,...r]=e.split(".");return[t.replace(/-api$/,""),...r].join(".")}async function gre(e){let t={};await Oa.get("/reload",{baseURL:process.env[eg.HTTP_PROXY]}),JOr();let r=await Oa.get("/api/listDestinations",{baseURL:process.env[eg.H2O_URL]});return(Array.isArray(r.data)?r.data:[]).forEach(i=>{e?.stripS4HCApiHosts&&hre(i)&&(i.Host=XOr(i.Host)),i.WebIDEEnabled&&(t[i.Name]=i)}),t}function JOr(){!Vr()||!globalThis.GLOBAL_AGENT||(globalThis.GLOBAL_AGENT.HTTP_PROXY||(globalThis.GLOBAL_AGENT.HTTP_PROXY=process.env[eg.HTTP_PROXY]??null),globalThis.GLOBAL_AGENT.HTTPS_PROXY||(globalThis.GLOBAL_AGENT.HTTPS_PROXY=process.env[eg.HTTPS_PROXY]??null))}function QOr(e,t,r,n){let i={usage:"odata_abap,dev_abap,abap_cloud",html5DynamicDestination:"true",html5Timeout:"60000"},s={clientId:r.clientid,clientSecret:r.clientsecret,tokenServiceURL:new URL("/oauth/token",r.url).toString(),tokenServiceURLType:sq.DEDICATED};return{name:e,description:t,url:new URL(n),type:iq.HTTP,proxyType:ND.INTERNET,basProperties:i,credentials:{authentication:op.OAUTH2_USER_TOKEN_EXCHANGE,oauth2UserTokenExchange:s}}}async function yre(e){let t=await(0,ap.cfGetTarget)(!0);if(!t.space)throw new Error("No Dev Space has been created for the subaccount.");return`abap-cloud-${`${e}-${t.org}-${t.space}`.replace(/\W/gi,"-").toLowerCase()}`.substring(0,199)}async function ZOr(e,t,r,n){let i=await yre(e);return(await(0,ap.apiGetServicesInstancesFilteredByType)(["destination"])).find(a=>a.label===mre)||(await(0,ap.apiCreateServiceInstance)("destination","lite",mre,null),n?.info(`New ABAP destination instance ${mre} created.`)),QOr(i,`Destination generated by App Studio for Cloud Foundry Abap service instance: '${e}', Do not remove.`,t,r)}async function SHe(e,t,r){if(!Vr())throw new Error("Creating a SAP BTP destinations is only supported on SAP Business Application Studio.");let n=t;try{if(!n){let a=await(0,ap.apiGetInstanceCredentials)(e);if(!a?.credentials)throw new Error(`Could not retrieve SAP BTP credentials for ${e}.`);n={uaaCredentials:a.credentials.uaa,hostUrl:a.credentials.url}}let i=await ZOr(e,n.uaaCredentials,n.hostUrl,r);await vHe.destinations.createDestination(i),r?.debug(`SAP BTP destination ${JSON.stringify(i,null,2)} created.`);let o=(await gre())?.[i.name];if(!o)throw new Error("Destination not found on SAP BTP.");return o}catch(i){throw new Error(`An error occurred while generating destination ${e}: ${i}`)}}var kHe=be(_re(),1),BHe=require("node:https"),qHe=be(Sre(),1),jHe=be(LF(),1),VHe=be(UHe(),1),GHe=require("node:util");var bre=class extends qHe.HttpsProxyAgent{extraOptions;constructor(t,r){super(t,r),this.extraOptions=r}async connect(t,r){return super.connect(t,{...this.extraOptions,...r})}};function bE(e,t){let r=(0,jHe.default)(t),n={rejectUnauthorized:!r.ignoreCertErrors};r.httpsAgent||(r.httpsAgent=new BHe.Agent(n)),delete r.ignoreCertErrors,r.withCredentials=r?.auth&&Object.keys(r.auth).length>0,r.validateStatus=s=>s<400;let i=new e(r);return i.interceptors.request.use(s=>{let o=i.getUri(s),a=(0,VHe.getProxyForUrl)(o);return a&&!Vr()&&(s.httpsAgent=new bre(a,n),s.httpAgent=new kHe.HttpProxyAgent(a),s.proxy=!1),s}),i.defaults.headers=i.defaults.headers??{common:{},delete:{},put:{},get:{},post:{},head:{},patch:{}},IFe(i),r.auth?.password&&LUe(i),t.cookies&&t.cookies.split(";").forEach(s=>{i.cookies.addCookie(s.trim())}),AP.isPatchRequired(t.baseURL)&&AP.apply(),i}function $He(e){return typeof e=="string"?bE(km,{baseURL:e}):bE(km,e)}function AE(e){return bE(Va,e)}var TE;(function(e){e.Standalone="Standalone",e.EmbeddedSteampunk="EmbeddedSteampunk"})(TE||(TE={}));function Tre(e){let t;switch(e.environment){case TE.Standalone:{let{service:r,refreshToken:n,refreshTokenChangedCb:i,cookies:s,...o}=e;t=bE(Va,{baseURL:r.url,cookies:s,...o}),s||(e.service?.uaa?.username&&e.service.uaa.password?MUe(t,r,n,i):hZ({provider:t}));break}case TE.EmbeddedSteampunk:{let{url:r,cookies:n,...i}=e;t=bE(Va,{baseURL:r,cookies:n,...i}),n||hZ({provider:t});break}default:{let r=e;throw new Error(`Unknown environment type supplied: ${(0,GHe.inspect)(r)}`)}}return t}function HHe(e,t,r){let{cookies:n,...i}=e,s={...i,baseURL:rT(t.Name,t.Host?new URL(t.Host).pathname:void 0),cookies:n};s.params=s.params??{},s.params.saml2="disabled";let o;if(hHe(t)?(o=bE(Va,s),o.publicUrl=t.Host):o=bE(km,s),r){let a=o.interceptors.request.use(async u=>{let c=await _He(r);return o.defaults.headers.common[EHe]=c,o.interceptors.request.eject(a),u})}return o}var WHe;(function(e){e.FF_SIMPLE="basic"})(WHe||(WHe={}));var YHe;(function(e){e.FE_FPM="fpm",e.FE_LROP="lrop",e.FE_OVP="ovp",e.FE_ALP="alp",e.FE_FEOP="feop",e.FE_WORKLIST="worklist"})(YHe||(YHe={}));var cn={vscode:{name:"Visual Studio Code",technical:"VSCode"},bas:{name:"SAP Business Application Studio",technical:"SBAS"},cli:{name:"CLI",technical:"CLI"}};var zHe;(function(e){e.CF="CF",e.ABAP="ABAP"})(zHe||(zHe={}));function MPr(){return!!(process.argv[1]?.includes("yo")||process.stdin.isTTY)}function kc(){return MPr()?cn.cli:Vr()?cn.bas:cn.vscode}var Ut=e=>typeof e=="string",LD=()=>{let e,t,r=new Promise((n,i)=>{e=n,t=i});return r.resolve=e,r.reject=t,r},KHe=e=>e==null?"":""+e,FPr=(e,t,r)=>{e.forEach(n=>{t[n]&&(r[n]=t[n])})},UPr=/###/g,XHe=e=>e&&e.indexOf("###")>-1?e.replace(UPr,"."):e,JHe=e=>!e||Ut(e),MD=(e,t,r)=>{let n=Ut(t)?t.split("."):t,i=0;for(;i<n.length-1;){if(JHe(e))return{};let s=XHe(n[i]);!e[s]&&r&&(e[s]=new r),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++i}return JHe(e)?{}:{obj:e,k:XHe(n[i])}},QHe=(e,t,r)=>{let{obj:n,k:i}=MD(e,t,Object);if(n!==void 0||t.length===1){n[i]=r;return}let s=t[t.length-1],o=t.slice(0,t.length-1),a=MD(e,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=MD(e,o,Object),a?.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=r},kPr=(e,t,r,n)=>{let{obj:i,k:s}=MD(e,t,Object);i[s]=i[s]||[],i[s].push(r)},mq=(e,t)=>{let{obj:r,k:n}=MD(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},BPr=(e,t,r)=>{let n=mq(e,r);return n!==void 0?n:mq(t,r)},s5e=(e,t,r)=>{for(let n in t)n!=="__proto__"&&n!=="constructor"&&(n in e?Ut(e[n])||e[n]instanceof String||Ut(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):s5e(e[n],t[n],r):e[n]=t[n]);return e},xE=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),qPr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},jPr=e=>Ut(e)?e.replace(/[&<>"'\/]/g,t=>qPr[t]):e,Cre=class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){let r=this.regExpMap.get(t);if(r!==void 0)return r;let n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}},VPr=[" ",",","?","!",";"],GPr=new Cre(20),$Pr=(e,t,r)=>{t=t||"",r=r||"";let n=VPr.filter(o=>t.indexOf(o)<0&&r.indexOf(o)<0);if(n.length===0)return!0;let i=GPr.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),s=!i.test(e);if(!s){let o=e.indexOf(r);o>0&&!i.test(e.substring(0,o))&&(s=!0)}return s},Ore=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let n=t.split(r),i=e;for(let s=0;s<n.length;){if(!i||typeof i!="object")return;let o,a="";for(let u=s;u<n.length;++u)if(u!==s&&(a+=r),a+=n[u],o=i[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&u<n.length-1)continue;s+=u-s+1;break}i=o}return i},FD=e=>e?.replace(/_/g,"-"),HPr={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}},Pre=class e{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||HPr,this.options=r,this.debug=r.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,n,i){return i&&!this.debug?null:(Ut(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},cp=new Pre,aT=class{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let i=this.observers[n].get(r)||0;this.observers[n].set(r,i+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([i,s])=>{for(let o=0;o<s;o++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,s])=>{for(let o=0;o<s;o++)i.apply(i,[t,...r])})}},gq=class extends aT{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){let r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,n,i={}){let s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,a;t.indexOf(".")>-1?a=t.split("."):(a=[t,r],n&&(Array.isArray(n)?a.push(...n):Ut(n)&&s?a.push(...n.split(s)):a.push(n)));let u=mq(this.data,a);return!u&&!r&&!n&&t.indexOf(".")>-1&&(t=a[0],r=a[1],n=a.slice(2).join(".")),u||!o||!Ut(n)?u:Ore(this.data?.[t]?.[r],n,s)}addResource(t,r,n,i,s={silent:!1}){let o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=[t,r];n&&(a=a.concat(o?n.split(o):n)),t.indexOf(".")>-1&&(a=t.split("."),i=r,r=a[1]),this.addNamespaces(r),QHe(this.data,a,i),s.silent||this.emit("added",t,r,n,i)}addResources(t,r,n,i={silent:!1}){for(let s in n)(Ut(n[s])||Array.isArray(n[s]))&&this.addResource(t,r,s,n[s],{silent:!0});i.silent||this.emit("added",t,r,n)}addResourceBundle(t,r,n,i,s,o={silent:!1,skipCopy:!1}){let a=[t,r];t.indexOf(".")>-1&&(a=t.split("."),i=n,n=r,r=a[1]),this.addNamespaces(r);let u=mq(this.data,a)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?s5e(u,n,s):u={...u,...n},QHe(this.data,a,u),o.silent||this.emit("added",t,r,n)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){let r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},o5e={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(s=>{t=this.processors[s]?.process(t,r,n,i)??t}),t}},a5e=Symbol("i18next/PATH_KEY");function WPr(){let e=[],t=Object.create(null),r;return t.get=(n,i)=>(r?.revoke?.(),i===a5e?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}function oT(e,t){let{[a5e]:r}=e(WPr()),n=t?.keySeparator??".",i=t?.nsSeparator??":";if(r.length>1&&i){let s=t?.ns,o=Array.isArray(s)?s:null;if(o&&o.length>1&&o.slice(1).includes(r[0]))return`${r[0]}${i}${r.slice(1).join(n)}`}return r.join(n)}var ZHe={},Are=e=>!Ut(e)&&typeof e!="boolean"&&typeof e!="number",yq=class e extends aT{constructor(t,r={}){super(),FPr(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=cp.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){let n={...r};if(t==null)return!1;let i=this.resolve(t,n);if(i?.res===void 0)return!1;let s=Are(i.res);return!(n.returnObjects===!1&&s)}extractFromKey(t,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");let i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,s=r.ns||this.options.defaultNS||[],o=n&&t.indexOf(n)>-1,a=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!$Pr(t,n,i);if(o&&!a){let u=t.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:t,namespaces:Ut(s)?[s]:s};let c=t.split(n);(n!==i||n===i&&this.options.ns.indexOf(c[0])>-1)&&(s=c.shift()),t=c.join(i)}return{key:t,namespaces:Ut(s)?[s]:s}}translate(t,r,n){let i=typeof r=="object"?{...r}:r;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),t==null)return"";typeof t=="function"&&(t=oT(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(de=>typeof de=="function"?oT(de,{...this.options,...i}):String(de));let s=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:u}=this.extractFromKey(t[t.length-1],i),c=u[u.length-1],l=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");let f=i.lng||this.language,p=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()==="cimode")return p?s?{res:`${c}${l}${a}`,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:`${c}${l}${a}`:s?{res:a,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:a;let d=this.resolve(t,i),h=d?.res,g=d?.usedKey||a,_=d?.exactUsedKey||a,S=["[object Number]","[object Function]","[object RegExp]"],T=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,w=i.count!==void 0&&!Ut(i.count),x=e.hasDefaultValue(i),N=w?this.pluralResolver.getSuffix(f,i.count,i):"",F=i.ordinal&&w?this.pluralResolver.getSuffix(f,i.count,{ordinal:!1}):"",D=w&&!i.ordinal&&i.count===0,V=D&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${N}`]||i[`defaultValue${F}`]||i.defaultValue,z=h;A&&!h&&x&&(z=V);let L=Are(z),J=Object.prototype.toString.apply(z);if(A&&z&&L&&S.indexOf(J)<0&&!(Ut(T)&&Array.isArray(z))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let de=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,z,{...i,ns:u}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(d.res=de,d.usedParams=this.getUsedParamsDetails(i),d):de}if(o){let de=Array.isArray(z),ie=de?[]:{},H=de?_:g;for(let G in z)if(Object.prototype.hasOwnProperty.call(z,G)){let ye=`${H}${o}${G}`;x&&!h?ie[G]=this.translate(ye,{...i,defaultValue:Are(V)?V[G]:void 0,joinArrays:!1,ns:u}):ie[G]=this.translate(ye,{...i,joinArrays:!1,ns:u}),ie[G]===ye&&(ie[G]=z[G])}h=ie}}else if(A&&Ut(T)&&Array.isArray(h))h=h.join(T),h&&(h=this.extendTranslation(h,t,i,n));else{let de=!1,ie=!1;!this.isValidLookup(h)&&x&&(de=!0,h=V),this.isValidLookup(h)||(ie=!0,h=a);let G=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ie?void 0:h,ye=x&&V!==h&&this.options.updateMissing;if(ie||de||ye){if(this.logger.log(ye?"updateKey":"missingKey",f,c,a,ye?V:h),o){let Xe=this.resolve(a,{...i,keySeparator:!1});Xe&&Xe.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let xe=[],Ce=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Ce&&Ce[0])for(let Xe=0;Xe<Ce.length;Xe++)xe.push(Ce[Xe]);else this.options.saveMissingTo==="all"?xe=this.languageUtils.toResolveHierarchy(i.lng||this.language):xe.push(i.lng||this.language);let Ie=(Xe,_e,je)=>{let mt=x&&je!==h?je:G;this.options.missingKeyHandler?this.options.missingKeyHandler(Xe,c,_e,mt,ye,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(Xe,c,_e,mt,ye,i),this.emit("missingKey",Xe,c,_e,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?xe.forEach(Xe=>{let _e=this.pluralResolver.getSuffixes(Xe,i);D&&i[`defaultValue${this.options.pluralSeparator}zero`]&&_e.indexOf(`${this.options.pluralSeparator}zero`)<0&&_e.push(`${this.options.pluralSeparator}zero`),_e.forEach(je=>{Ie([Xe],a+je,i[`defaultValue${je}`]||V)})}):Ie(xe,a,V))}h=this.extendTranslation(h,t,i,d,n),ie&&h===a&&this.options.appendNamespaceToMissingKey&&(h=`${c}${l}${a}`),(ie||de)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${l}${a}`:a,de?h:void 0,i))}return s?(d.res=h,d.usedParams=this.getUsedParamsDetails(i),d):h}extendTranslation(t,r,n,i,s){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let u=Ut(t)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),c;if(u){let f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let l=n.replace&&!Ut(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),t=this.interpolator.interpolate(t,l,n.lng||this.language||i.usedLng,n),u){let f=t.match(this.interpolator.nestingRegexp),p=f&&f.length;c<p&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(t=this.interpolator.nest(t,(...f)=>s?.[0]===f[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${r[0]}`),null):this.translate(...f,r),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,a=Ut(o)?[o]:o;return t!=null&&a?.length&&n.applyPostProcessor!==!1&&(t=o5e.handle(a,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t,r={}){let n,i,s,o,a;return Ut(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(u=>typeof u=="function"?oT(u,{...this.options,...r}):u)),t.forEach(u=>{if(this.isValidLookup(n))return;let c=this.extractFromKey(u,r),l=c.key;i=l;let f=c.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));let p=r.count!==void 0&&!Ut(r.count),d=p&&!r.ordinal&&r.count===0,h=r.context!==void 0&&(Ut(r.context)||typeof r.context=="number")&&r.context!=="",g=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);f.forEach(_=>{this.isValidLookup(n)||(a=_,!ZHe[`${g[0]}-${_}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(ZHe[`${g[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(S=>{if(this.isValidLookup(n))return;o=S;let T=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(T,l,S,_,r);else{let w;p&&(w=this.pluralResolver.getSuffix(S,r.count,r));let x=`${this.options.pluralSeparator}zero`,N=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(r.ordinal&&w.indexOf(N)===0&&T.push(l+w.replace(N,this.options.pluralSeparator)),T.push(l+w),d&&T.push(l+x)),h){let F=`${l}${this.options.contextSeparator||"_"}${r.context}`;T.push(F),p&&(r.ordinal&&w.indexOf(N)===0&&T.push(F+w.replace(N,this.options.pluralSeparator)),T.push(F+w),d&&T.push(F+x))}}let A;for(;A=T.pop();)this.isValidLookup(n)||(s=A,n=this.getResource(S,_,A,r))}))})}),{res:n,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,r,n,i):this.resourceStore.getResource(t,r,n,i)}getUsedParamsDetails(t={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!Ut(t.replace),i=n?t.replace:t;if(n&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let s of r)delete i[s]}return i}static hasDefaultValue(t){let r="defaultValue";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&r===n.substring(0,r.length)&&t[n]!==void 0)return!0;return!1}},vq=class{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=cp.create("languageUtils")}getScriptPartFromCode(t){if(t=FD(t),!t||t.indexOf("-")<0)return null;let r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=FD(t),!t||t.indexOf("-")<0)return t;let r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(Ut(t)&&t.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&t.forEach(n=>{if(r)return;let i=this.getScriptPartFromCode(n);if(this.isSupportedCode(i))return r=i;let s=this.getLanguagePartFromCode(n);if(this.isSupportedCode(s))return r=s;r=this.options.supportedLngs.find(o=>{if(o===s)return o;if(!(o.indexOf("-")<0&&s.indexOf("-")<0)&&(o.indexOf("-")>0&&s.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===s||o.indexOf(s)===0&&s.length>1))return o})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),Ut(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let n=t[r];return n||(n=t[this.getScriptPartFromCode(r)]),n||(n=t[this.formatLanguageCode(r)]),n||(n=t[this.getLanguagePartFromCode(r)]),n||(n=t.default),n||[]}toResolveHierarchy(t,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],t),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return Ut(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):Ut(t)&&s(this.formatLanguageCode(t)),n.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}},e5e={zero:0,one:1,two:2,few:3,many:4,other:5},t5e={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},Dre=class{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=cp.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){let n=FD(t==="dev"?"en":t),i=r.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:n,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(n,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),t5e;if(!t.match(/-|_/))return t5e;let u=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(u,r)}return this.pluralRulesCache[s]=o,o}needsPlural(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,r,n={}){return this.getSuffixes(t,n).map(i=>`${r}${i}`)}getSuffixes(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,s)=>e5e[i]-e5e[s]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(t,r,n={}){let i=this.getRule(t,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,n))}},r5e=(e,t,r,n=".",i=!0)=>{let s=BPr(e,t,r);return!s&&i&&Ut(r)&&(s=Ore(e,r,n),s===void 0&&(s=Ore(t,r,n))),s},xre=e=>e.replace(/\$/g,"$$$$"),Eq=class{constructor(t={}){this.logger=cp.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});let{escape:r,escapeValue:n,useRawValueToEscape:i,prefix:s,prefixEscaped:o,suffix:a,suffixEscaped:u,formatSeparator:c,unescapeSuffix:l,unescapePrefix:f,nestingPrefix:p,nestingPrefixEscaped:d,nestingSuffix:h,nestingSuffixEscaped:g,nestingOptionsSeparator:_,maxReplaces:S,alwaysFormat:T}=t.interpolation;this.escape=r!==void 0?r:jPr,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?xE(s):o||"{{",this.suffix=a?xE(a):u||"}}",this.formatSeparator=c||",",this.unescapePrefix=l?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=p?xE(p):d||xE("$t("),this.nestingSuffix=h?xE(h):g||xE(")"),this.nestingOptionsSeparator=_||",",this.maxReplaces=S||1e3,this.alwaysFormat=T!==void 0?T:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let t=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,r,n,i){let s,o,a,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=d=>{if(d.indexOf(this.formatSeparator)<0){let S=r5e(r,u,d,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(S,void 0,n,{...i,...r,interpolationkey:d}):S}let h=d.split(this.formatSeparator),g=h.shift().trim(),_=h.join(this.formatSeparator).trim();return this.format(r5e(r,u,g,this.options.keySeparator,this.options.ignoreJSONStructure),_,n,{...i,...r,interpolationkey:g})};this.resetRegExp();let l=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:d=>xre(d)},{regex:this.regexp,safeValue:d=>this.escapeValue?xre(this.escape(d)):xre(d)}].forEach(d=>{for(a=0;s=d.regex.exec(t);){let h=s[1].trim();if(o=c(h),o===void 0)if(typeof l=="function"){let _=l(t,s,i);o=Ut(_)?_:""}else if(i&&Object.prototype.hasOwnProperty.call(i,h))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${h} for interpolating ${t}`),o="";else!Ut(o)&&!this.useRawValueToEscape&&(o=KHe(o));let g=d.safeValue(o);if(t=t.replace(s[0],g),f?(d.regex.lastIndex+=o.length,d.regex.lastIndex-=s[0].length):d.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,r,n={}){let i,s,o,a=(u,c)=>{let l=this.nestingOptionsSeparator;if(u.indexOf(l)<0)return u;let f=u.split(new RegExp(`${xE(l)}[ ]*{`)),p=`{${f[1]}`;u=f[0],p=this.interpolate(p,o);let d=p.match(/'/g),h=p.match(/"/g);((d?.length??0)%2===0&&!h||(h?.length??0)%2!==0)&&(p=p.replace(/'/g,'"'));try{o=JSON.parse(p),c&&(o={...c,...o})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,g),`${u}${l}${p}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,u};for(;i=this.nestingRegexp.exec(t);){let u=[];o={...n},o=o.replace&&!Ut(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(c!==-1&&(u=i[1].slice(c).split(this.formatSeparator).map(l=>l.trim()).filter(Boolean),i[1]=i[1].slice(0,c)),s=r(a.call(this,i[1].trim(),o),o),s&&i[0]===t&&!Ut(s))return s;Ut(s)||(s=KHe(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),s=""),u.length&&(s=u.reduce((l,f)=>this.format(l,f,n.lng,{...n,interpolationkey:i[1].trim()}),s.trim())),t=t.replace(i[0],s),this.regexp.lastIndex=0}return t}},YPr=e=>{let t=e.toLowerCase().trim(),r={};if(e.indexOf("(")>-1){let n=e.split("(");t=n[0].toLowerCase().trim();let i=n[1].substring(0,n[1].length-1);t==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(o=>{if(o){let[a,...u]=o.split(":"),c=u.join(":").trim().replace(/^'+|'+$/g,""),l=a.trim();r[l]||(r[l]=c),c==="false"&&(r[l]=!1),c==="true"&&(r[l]=!0),isNaN(c)||(r[l]=parseInt(c,10))}})}return{formatName:t,formatOptions:r}},n5e=e=>{let t={};return(r,n,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});let o=n+JSON.stringify(s),a=t[o];return a||(a=e(FD(n),i),t[o]=a),a(r)}},zPr=e=>(t,r,n)=>e(FD(r),n)(t),Rre=class{constructor(t={}){this.logger=cp.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?n5e:zPr;this.formats={number:n((i,s)=>{let o=new Intl.NumberFormat(i,{...s});return a=>o.format(a)}),currency:n((i,s)=>{let o=new Intl.NumberFormat(i,{...s,style:"currency"});return a=>o.format(a)}),datetime:n((i,s)=>{let o=new Intl.DateTimeFormat(i,{...s});return a=>o.format(a)}),relativetime:n((i,s)=>{let o=new Intl.RelativeTimeFormat(i,{...s});return a=>o.format(a,s.range||"day")}),list:n((i,s)=>{let o=new Intl.ListFormat(i,{...s});return a=>o.format(a)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=n5e(r)}format(t,r,n,i={}){let s=r.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(a=>a.indexOf(")")>-1)){let a=s.findIndex(u=>u.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,u)=>{let{formatName:c,formatOptions:l}=YPr(u);if(this.formats[c]){let f=a;try{let p=i?.formatParams?.[i.interpolationkey]||{},d=p.locale||p.lng||i.locale||i.lng||n;f=this.formats[c](a,d,{...l,...i,...p})}catch(p){this.logger.warn(p)}return f}else this.logger.warn(`there was no format function for ${c}`);return a},t)}},KPr=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Nre=class extends aT{constructor(t,r,n,i={}){super(),this.backend=t,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=cp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,i.backend,i)}queueLoad(t,r,n,i){let s={},o={},a={},u={};return t.forEach(c=>{let l=!0;r.forEach(f=>{let p=`${c}|${f}`;!n.reload&&this.store.hasResourceBundle(c,f)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?o[p]===void 0&&(o[p]=!0):(this.state[p]=1,l=!1,o[p]===void 0&&(o[p]=!0),s[p]===void 0&&(s[p]=!0),u[f]===void 0&&(u[f]=!0)))}),l||(a[c]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(u)}}loaded(t,r,n){let i=t.split("|"),s=i[0],o=i[1];r&&this.emit("failedLoading",s,o,r),!r&&n&&this.store.addResourceBundle(s,o,n,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&n&&(this.state[t]=0);let a={};this.queue.forEach(u=>{kPr(u.loaded,[s],o),KPr(u,t),r&&u.errors.push(r),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(c=>{a[c]||(a[c]={});let l=u.loaded[c];l.length&&l.forEach(f=>{a[c][f]===void 0&&(a[c][f]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(u=>!u.done)}read(t,r,n,i=0,s=this.retryTimeout,o){if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:n,tried:i,wait:s,callback:o});return}this.readingCalls++;let a=(c,l)=>{if(this.readingCalls--,this.waitingReads.length>0){let f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(c&&l&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,r,n,i+1,s*2,o)},s);return}o(c,l)},u=this.backend[n].bind(this.backend);if(u.length===2){try{let c=u(t,r);c&&typeof c.then=="function"?c.then(l=>a(null,l)).catch(a):a(null,c)}catch(c){a(c)}return}return u(t,r,a)}prepareLoading(t,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();Ut(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Ut(r)&&(r=[r]);let s=this.queueLoad(t,r,n,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(t,r,n){this.prepareLoading(t,r,{},n)}reload(t,r,n){this.prepareLoading(t,r,{reload:!0},n)}loadOne(t,r=""){let n=t.split("|"),i=n[0],s=n[1];this.read(i,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${r}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${r}loaded namespace ${s} for language ${i}`,a),this.loaded(t,o,a)})}saveMissing(t,r,n,i,s,o={},a=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){let u={...o,isUpdate:s},c=this.backend.create.bind(this.backend);if(c.length<6)try{let l;c.length===5?l=c(t,r,n,i,u):l=c(t,r,n,i),l&&typeof l.then=="function"?l.then(f=>a(null,f)).catch(a):a(null,l)}catch(l){a(l)}else c(t,r,n,i,a,u)}!t||!t[0]||this.store.addResource(t[0],r,n,i)}}},wre=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Ut(e[1])&&(t.defaultValue=e[1]),Ut(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){let r=e[3]||e[2];Object.keys(r).forEach(n=>{t[n]=r[n]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),i5e=e=>(Ut(e.ns)&&(e.ns=[e.ns]),Ut(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Ut(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),hq=()=>{},XPr=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})},u5e="__i18next_supportNoticeShown",JPr=()=>!!(typeof globalThis<"u"&&globalThis[u5e]||typeof process<"u"&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&process.env&&process.env.NODE_ENV==="production"),QPr=()=>{typeof globalThis<"u"&&(globalThis[u5e]=!0)},ZPr=e=>!!(e?.modules?.backend?.name?.indexOf("Locize")>0||e?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||e?.options?.backend?.backends&&e.options.backend.backends.some(t=>t?.name?.indexOf("Locize")>0||t?.constructor?.name?.indexOf("Locize")>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(t=>t?.projectId)),Ire=class e extends aT{constructor(t={},r){if(super(),this.options=i5e(t),this.services={},this.logger=cp,this.modules={external:[]},XPr(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=t,t={}),t.defaultNS==null&&t.ns&&(Ut(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));let n=wre();this.options={...n,...this.options,...i5e(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!ZPr(this)&&!JPr()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("\u{1F310} i18next is made possible by our own product, Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}"),QPr());let i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?cp.init(i(this.modules.logger),this.options):cp.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=Rre;let l=new vq(this.options);this.store=new gq(this.options.resources,this.options);let f=this.services;f.logger=cp,f.resourceStore=this.store,f.languageUtils=l,f.pluralResolver=new Dre(l,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(f.formatter=i(c),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Eq(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Nre(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(d,...h)=>{this.emit(d,...h)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new yq(this.services,this.options),this.translator.on("*",(d,...h)=>{this.emit(d,...h)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,r||(r=hq),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...l)=>this.store[c](...l)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...l)=>(this.store[c](...l),this)});let a=LD(),u=()=>{let c=(l,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(f),r(l,f)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),a}loadResources(t,r=hq){let n=r,i=Ut(t)?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&s.indexOf(c)<0&&s.push(c)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>o(u)),this.options.preload?.forEach?.(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(a)})}else n(null)}reloadResources(t,r,n){let i=LD();return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),n||(n=hq),this.services.backendConnector.reload(t,r,s=>{i.resolve(),n(s)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&o5e.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,r){this.isLanguageChangingTo=t;let n=LD();this.emit("languageChanging",t);let i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},s=(a,u)=>{u?this.isLanguageChangingTo===t&&(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(a,(...c)=>this.t(...c))},o=a=>{!t&&!a&&this.services.languageDetector&&(a=[]);let u=Ut(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(u)?u:this.services.languageUtils.getBestMatchFromCodes(Ut(a)?[a]:a);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,l=>{s(l,c)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(t),n}getFixedT(t,r,n){let i=(s,o,...a)=>{let u;typeof o!="object"?u=this.options.overloadTranslationOptionHandler([s,o].concat(a)):u={...o},u.lng=u.lng||i.lng,u.lngs=u.lngs||i.lngs,u.ns=u.ns||i.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||n||i.keyPrefix);let c={...this.options,...u};typeof u.keyPrefix=="function"&&(u.keyPrefix=oT(u.keyPrefix,c));let l=this.options.keySeparator||".",f;return u.keyPrefix&&Array.isArray(s)?f=s.map(p=>(typeof p=="function"&&(p=oT(p,c)),`${u.keyPrefix}${l}${p}`)):(typeof s=="function"&&(s=oT(s,c)),f=u.keyPrefix?`${u.keyPrefix}${l}${s}`:s),this.t(f,u)};return Ut(t)?i.lng=t:i.lngs=t,i.ns=r,i.keyPrefix=n,i}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let o=(a,u)=>{let c=this.services.backendConnector.state[`${a}|${u}`];return c===-1||c===0||c===2};if(r.precheck){let a=r.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,t)&&(!i||o(s,t)))}loadNamespaces(t,r){let n=LD();return this.options.ns?(Ut(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(t,r){let n=LD();Ut(t)&&(t=[t]);let i=this.options.preload||[],s=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{n.resolve(),r&&r(o)}),n):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{let i=new Intl.Locale(t);if(i&&i.getTextInfo){let s=i.getTextInfo();if(s&&s.direction)return s.direction}}catch{}let r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new vq(wre());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){let n=new e(t,r);return n.createInstance=e.createInstance,n}cloneInstance(t={},r=hq){let n=t.forkResourceStore;n&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},s=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},n){let a=Object.keys(this.store.data).reduce((u,c)=>(u[c]={...this.store.data[c]},u[c]=Object.keys(u[c]).reduce((l,f)=>(l[f]={...u[c][f]},l),u[c]),u),{});s.store=new gq(a,i),s.services.resourceStore=s.store}if(t.interpolation){let u={...wre().interpolation,...this.options.interpolation,...t.interpolation},c={...i,interpolation:u};s.services.interpolator=new Eq(c)}return s.translator=new yq(s.services,i),s.translator.on("*",(a,...u)=>{s.emit(a,...u)}),s.init(i,r),s.translator.options=i,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},kr=Ire.createInstance(),gyi=kr.createInstance,yyi=kr.dir,vyi=kr.init,Eyi=kr.loadResources,_yi=kr.reloadResources,Syi=kr.use,byi=kr.changeLanguage,Tyi=kr.getFixedT,Ayi=kr.t,xyi=kr.exists,wyi=kr.setDefaultNamespace,Cyi=kr.hasLoadedNamespace,Oyi=kr.loadNamespaces,Pyi=kr.loadLanguages;var c5e={logMessages:{info:{mockOnlyWarning:"This application was generated with a local metadata file and does not reference a live server. Please add the required server configuration or start this application with mock data using the target: `npm run start-mock`."},error:{logWrapperNotInitialised:"`LogWrapper` is not initialised."},debug:{loggingConfigured:"Logging has been configured at log level: {{logLevel}}."}},telemetry:{unknownOs:"Unknown"},texts:{systemTypeLabel:{abapCloud:"ABAP Cloud"}}};var Lre="fiori-freestyle-writer",l5e=kr.createInstance();async function tDr(){await l5e.init({resources:{en:{[Lre]:c5e}},lng:"en",fallbackLng:"en",defaultNS:Lre,ns:[Lre],showSupportNotice:!1})}function rg(e,t){return l5e.t(e,t)}tDr().catch(()=>{});function f5e(e){return rDr(e.name,e.userDisplayName,e.systemType)}function rDr(e,t,r){let n=t?` [${t}]`:"";return`${e}${nDr(r)}${n}`}function nDr(e){let t="",r=` (${rg("texts.systemTypeLabel.abapCloud")})`;return(e==="AbapCloud"||e==="S4HC"||e==="BTP")&&(t=r),t}var UD=class{applicationKey="";extensionName="";extensionVersion="";getApplicationKey(){return this.applicationKey}getExtensionVersion(){return this.extensionVersion}getExtensionName(){return this.extensionName}};var Vct=be(kue(),1);var UR=class{extensionName;eventName;constructor(t,r){this.extensionName=t,this.eventName=r}getExtensionName(){return this.extensionName}getEventName(){return this.eventName}toString(){return`${this.extensionName}/${this.eventName}`}};var Pi;(function(e){e[e.OnePercent=0]="OnePercent",e[e.TenPercent=1]="TenPercent",e[e.NoSampling=2]="NoSampling"})(Pi||(Pi={}));function fG(e){e.channel.setUseDiskRetryCaching(!0),e.addTelemetryProcessor(t=>(t.tags["ai.location.ip"]="0.0.0.0",t.tags["ai.cloud.roleInstance"]="masked",t.tags["ai.cloud.role"]="masked",t.tags["ai.device.type"]="masked",!0))}var Bue={name:"@sap-ux/telemetry",version:"1.0.8",description:"Library for sending usage telemetry data",type:"module",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/telemetry"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Atelemetry"},license:"Apache-2.0",private:!1,main:"dist/index.js",scripts:{build:"tsc --build",watch:"tsc --watch",clean:"rimraf --glob dist coverage *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",example:"ts-node example/index.ts"},dependencies:{"@sap-ux/store":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/nodejs-utils":"workspace:*",applicationinsights:"2.9.8",axios:"1.16.0","performance-now":"2.1.0",yaml:"2.8.3"},devDependencies:{"@jest/globals":"30.3.0","jest-extended":"7.0.0",memfs:"3.4.13",unionfs:"4.6.0",dotenv:"17.4.2"},files:["dist","LICENSE","!dist/*.map","!dist/**/*.map"],engines:{node:">=22.x"}};var Eo={azureInstrumentationKey:"",telemetryEnabled:!0,telemetryLibName:Bue.name,telemetryLibVersion:Bue.version,consumerModuleName:"",consumerModuleVersion:""};var kR=class extends UD{clients;constructor(t,r,n){super(),this.clients=new Map,this.applicationKey=t,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(Pi.OnePercent),s=this.createTelemetryClient(Pi.TenPercent),o=this.createTelemetryClient(Pi.NoSampling);this.clients.set(Pi.OnePercent,i),this.clients.set(Pi.TenPercent,s),this.clients.set(Pi.NoSampling,o)}reportBlocking(t,r,n,i,s=!1){if(!s||Eo.telemetryEnabled){let{client:o,event:a}=this.prepareClientAndEvent(t,r,n,i);return this.trackEventBlocking(o,a)}return Promise.resolve()}async report(t,r,n,i,s,o){if(o!==void 0&&!o||!Eo.telemetryEnabled)return;let{client:a,event:u}=this.prepareClientAndEvent(t,r,n,i);this.trackEvent(a,u)}prepareClientAndEvent(t,r,n,i=Pi.NoSampling){let s=this.clients.get(i),a={name:new UR(this.extensionName,t).toString(),properties:r,measurements:n};return{client:s,event:a}}async trackEventBlocking(t,r){if(process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true")return new Promise((n,i)=>{try{t.trackEvent(r),t.flush({callback:()=>n()})}catch(s){i(s)}})}trackEvent(t,r){return process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"?(t.trackEvent(r),!0):!1}createTelemetryClient(t){let r;switch(t){case Pi.OnePercent:r=1;break;case Pi.TenPercent:r=10;break;case Pi.NoSampling:default:r=100;break}let n=new Vct.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,fG(n),n}};var que=()=>{let e=new Date().getTime();return new Date(e).toISOString()};var BR=class extends kR{constructor(t,r,n){super(t,r,n)}async report(t,r,n,i,s,o){let a=await pG(s),u={v:this.extensionVersion,datetime:que()},c={...r,...a,...u};await super.report(t,c,n,i,s,o)}async reportEvent(t,r,n,i){let{finalProperties:s,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(t,n);return super.report(t.eventName,s,o,r,n,i)}async reportEventBlocking(t,r,n,i){let{finalProperties:s,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(t,n);return super.reportBlocking(t.eventName,s,o,r,i)}async collectToolsSuiteTelemetry(t,r){let n=await pG(r),i={v:this.extensionVersion,datetime:que()},s={...t.properties,...n,...i},o={...t.measurements};return{finalProperties:s,finalMeasurements:o}}};var Gct=require("node:child_process"),qR=class{run(t,r=[],n={},i){return i&&i.debug(`Running command: ${t} ${r.join(" ")}`),new Promise((s,o)=>{let a=[],u=process.platform==="win32"?{...n,shell:!0}:n,c=(0,Gct.spawn)(t,r,u);c.stdout.setEncoding("utf8");let l;c.stdout.on("data",f=>{i?.info(f.toString().replace(/[\r\n]$/,"")),l=f.toString()}),c.stderr.on("data",f=>{i?.info(f.toString().replace(/[\r\n]$/,"")),a.push(f.toString())}),c.on("error",f=>{let p=`Command failed with error: ${f.message}`;i?.error(p),o(f)}),c.on("close",f=>{if(f!==0){let p=`Command failed, \`${t} ${r.join(" ")}\`, ${a.join(", ")}`;i?.debug(p),o(p)}s(l)})})}};var Mnn=be(jG(),1);var Fnn=be(tfe(),1),nfe=be(ta(),1);var Pht={error:{unsupportedYoVersion:"The installed version of the `Yo` CLI tool: {{installedYoVersion}} is not supported. Please use `npm` or `yarn` to globally install the latest supported version by running: 'npm i -g yo@{{latestSupportedYoVer}}'.",executingYoVersionCmd:"Running: {{yoCmd}} returned an error: {{- error}}. Check that `yo` is installed and available on the path. If `yo@{{latestSupportedYoVer}}` is not installed, use `npm` or `yarn` to globally install the latest required version by running: 'npm i -g yo@{{latestSupportedYoVer}}'."}};var rfe="nodejs-utils",Inn=kr.createInstance();async function Lnn(){await Inn.init({lng:"en",fallbackLng:"en",defaultNS:rfe,ns:[rfe],resources:{en:{[rfe]:Pht}},interpolation:{escapeValue:!1},showSupportNotice:!1})}Lnn().catch(()=>{});var QR=be(require("node:https"),1);function VA(e){QR.default.globalAgent.options&&(QR.default.globalAgent.options.rejectUnauthorized=e),QR.default.globalAgent.fallbackAgent?.options&&(QR.default.globalAgent.fallbackAgent.options.rejectUnauthorized=e)}var il=be(kpe(),1),nvt=be(rvt(),1);var yi=class extends Error{code;constructor(t,r){super(t),this.code=r,this.name=this.constructor.name}};var ss=Object.freeze({yamlParsing:"yamlParsing",nodeNotFound:"nodeNotFound",nodeNotFoundMatching:"nodeNotFoundMatching",nodeNotAMap:"nodeNotAMap",propertyNotFound:"propertyNotFound",pathCannotBeEmpty:"pathCannotBeEmpty",pathDoesNotExist:"pathDoesNotExist",seqDoesNotExist:"seqDoesNotExist",tryingToAppendToNonSequence:"tryingToAppendToNonSequence",startNodeMustBeCollection:"startNodeMustBeCollection",scalarValuesDoNotHaveProperties:"scalarValuesDoNotHaveProperties"}),Ao=Object.freeze({yamlParsing:"Error parsing YAML document",nodeNotFound:"Node not found at path: [{{- path }}]",nodeNotFoundMatching:"Node not found at path: [{{- path }}, matching [{{- key }} = {{- value }}]",nodeNotAMap:"Node path: [{{- path }}, matching [{{- key }} = {{- value }}], is not a map",propertyNotFound:"Node not found at path: [{{- path }}]",pathCannotBeEmpty:"Path cannot be empty",pathDoesNotExist:"Parent node does not exist at: [{{- path }}]",seqDoesNotExist:"Sequence does not exist at: [{{- path }}]",tryingToAppendToNonSequence:"Cannot append to non-sequence at: [{{- path }}]",startNodeMustBeCollection:"Starting node must be an array or an object",scalarValuesDoNotHaveProperties:"Scalar values do not have properties"});function nl(e,t){try{return t?e?.replace(/{{-?([^{}]*)}}/g,(r,n)=>{let i=n?.trim();return t[i]?.toString()||r}):e}catch{return""}}var DN=class e{documents;static async newInstance(t){return new e(t)}constructor(t){this.documents=il.default.parseAllDocuments(t),this.documents.length===0&&this.documents.push(il.default.parseDocument(t));let r=this.documents.filter(n=>n.errors.length>0);if(r.length>0)throw new yi(Ao.yamlParsing+`
|
|
661
661
|
`+r.map(n=>n.errors.map(i=>i.message).join("")),ss.yamlParsing)}toString(){return this.documents.map(t=>t.toString({singleQuote:!0})).join("")}addDocumentComment({comment:t,location:r="beginning"}){switch(r){case"beginning":this.documents[0].commentBefore=t;break;case"end":this.documents[0].comment=t;break;default:break}return this}createNode({value:t,comments:r}){let n=this.documents[0].createNode(t);if(r?.length)for(let i of r){let s=n.items.findIndex(o=>o.key.value===i.key);n.items[s].value.comment=i.comment}return n}setIn({path:t,value:r,createIntermediateKeys:n,comment:i}){let s=this.toPathArray(t);if(s.length>1){let a=s.slice(0,-1);if(!this.documents[0].getIn(a)&&!n)throw new yi(nl(Ao.pathDoesNotExist,{path:a}),ss.pathDoesNotExist)}let o=this.documents[0].createNode(r);return i&&(o.commentBefore=i),this.documents[0].setIn(s,o),this}appendTo({path:t,value:r,createIntermediateKeys:n=!0,nodeComment:i,comments:s}){let o=this.toPathArray(t),a=this.documents[0].clone(),u=a.getIn(o);if(u){if(!(0,il.isSeq)(u))throw new yi(nl(Ao.tryingToAppendToNonSequence,{path:t}),ss.tryingToAppendToNonSequence)}else{if(!n)throw new yi(nl(Ao.seqDoesNotExist,{path:t}),ss.seqDoesNotExist);u=new il.YAMLSeq,a.setIn(o,u)}let c=a.createNode(r);if(i&&(c.commentBefore=i),u.items.push(c),s&&s.length>0){if(typeof r!="object")throw new yi(Ao.scalarValuesDoNotHaveProperties,ss.scalarValuesDoNotHaveProperties);let l=u.items.length-1;for(let f of s){let p=this.toPathArray(f.path),d=a.getIn([...o,l,...p],!0);if(!d)throw new yi(nl(Ao.propertyNotFound,{path:f.path}),ss.propertyNotFound);d.comment=f.comment}}return this.documents[0]=a,this}updateAt({path:t,matcher:r,value:n,mode:i="merge"}){let s=this.toPathArray(t),o=this.documents[0].getIn(s);if(!o)throw new yi(nl(Ao.seqDoesNotExist,{path:t}),ss.seqDoesNotExist);let a=o.items.find(l=>l.toJSON()[r.key]===r.value);if(!a)throw new yi(nl(Ao.nodeNotFoundMatching,{path:t,key:r.key,value:r.value}),ss.nodeNotFoundMatching);let u=i==="merge"?(0,nvt.default)(a.toJSON(),n):n,c=this.documents[0].createNode(u);return o.items.splice(o.items.indexOf(a),1,c),this}delete(t){return this.documents[0].delete(t)}deleteAt({path:t,matcher:r}){let n=this.toPathArray(t),i=this.documents[0].getIn(n);if(!i?.items)throw new yi(nl(Ao.seqDoesNotExist,{path:t}),ss.seqDoesNotExist);if(!i.items.find((o,a)=>o.toJSON()[r.key]===r.value?(i.items.splice(a,1),!0):!1))throw new yi(nl(Ao.propertyNotFound,{path:t}),ss.propertyNotFound);return this}getNode({start:t,path:r}){if(t&&!((0,il.isSeq)(t)||(0,il.isMap)(t)))throw new yi(Ao.startNodeMustBeCollection,ss.startNodeMustBeCollection);let n=this.toPathArray(r),s=(t||this.documents[0])?.getIn(n);if(s)return s;throw new yi(nl(Ao.nodeNotFound,{path:r}),ss.nodeNotFound)}getSequence({start:t,path:r}){let n=this.getNode({start:t,path:r});if((0,il.isSeq)(n))return n;throw new yi(nl(Ao.seqDoesNotExist,{path:r}),ss.seqDoesNotExist)}getMap({start:t,path:r}){let n=this.getNode({start:t,path:r});if((0,il.isMap)(n))return n;throw new yi(nl(Ao.nodeNotAMap,{path:r}),ss.nodeNotAMap)}findItem(t,r){let n=i=>i!==void 0&&typeof i.toJSON=="function"&&i.toJSON.call(i)||{};return t.items.find(i=>r(n(i)))}toPathArray(t){let r=t?.toString().split(".").filter(n=>n!=="").map(n=>Number.isNaN(Number(n))?n:Number(n));if(!r||r.length===0)throw new yi(Ao.pathCannotBeEmpty,ss.pathCannotBeEmpty);return r}};var gh=require("node:path");function ivt(){return{name:"fiori-tools-appreload",afterMiddleware:"compression",configuration:{port:35729,path:"webapp",delay:300}}}function Q$(e,t){let r=[];return e.authenticationType==="reentranceTicket"&&r.push({path:`configuration.backend.${t}.authenticationType`,comment:" SAML support for vscode",key:"authenticationType"}),r}function svt(e,t,r="compression",n=!1){let i={name:"fiori-tools-proxy",afterMiddleware:r,configuration:{ignoreCertErrors:n}},s=[{path:"configuration.ignoreCertErrors",comment:" If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted"}];return e&&e.length>0&&(e.forEach((o,a)=>{o.path=o.path??"/";let u=Q$(o,a);u&&(s=[...s,...u])}),i.configuration.backend=e),t!==void 0&&(i.configuration.ui5={path:t.path??["/resources","/test-resources"],url:t.url??"https://ui5.sap.com"},t.version!==void 0&&(i.configuration.ui5.version=t.version),t.directLoad&&(i.configuration.ui5.directLoad=!0)),{config:i,comments:s}}var ovt=(e,t,r,n)=>{let i=[];return r.forEach(s=>{let o=`.${gh.posix.sep}${(0,gh.relative)(e,(0,gh.join)(t,"localService",s.serviceName)).replaceAll(gh.sep,gh.posix.sep)}`,a={urlPath:s.servicePath.replace(/\/$/,""),metadataPath:s.metadataPath??`${o}/metadata.xml`,mockdataPath:`${o}/data`,generateMockData:!0};s.resolveExternalServiceReferences===!0&&(a.resolveExternalServiceReferences=!0),i.push(a)}),{name:"sap-fe-mockserver",beforeMiddleware:"csp",configuration:{mountPath:"/",services:i,annotations:n}}};var ex="fiori-tools-servestatic",yh="fiori-tools-proxy";var GSt=be(k_t(),1),cl=require("node:path"),$St=require("node:url"),HSt=require("node:fs/promises");function eSt(e){return typeof e>"u"||e===null}function pmn(e){return typeof e=="object"&&e!==null}function dmn(e){return Array.isArray(e)?e:eSt(e)?[]:[e]}function hmn(e,t){var r,n,i,s;if(t)for(s=Object.keys(t),r=0,n=s.length;r<n;r+=1)i=s[r],e[i]=t[i];return e}function mmn(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function gmn(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var ymn=eSt,vmn=pmn,Emn=dmn,_mn=mmn,Smn=gmn,bmn=hmn,os={isNothing:ymn,isObject:vmn,toArray:Emn,repeat:_mn,isNegativeZero:Smn,extend:bmn};function tSt(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
|
|
662
662
|
|
|
663
663
|
`+e.mark.snippet),n+" "+r):n}function oI(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=tSt(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}oI.prototype=Object.create(Error.prototype);oI.prototype.constructor=oI;oI.prototype.toString=function(t){return this.name+": "+tSt(this,t)};var ca=oI;function Rhe(e,t,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-t>a&&(s=" ... ",t=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+e.slice(t,r).replace(/\t/g,"\u2192")+o,pos:n-t+s.length}}function Nhe(e,t){return os.repeat(" ",t-e.length)+e}function Tmn(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;s=r.exec(e.buffer);)i.push(s.index),n.push(s.index+s[0].length),e.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var a="",u,c,l=Math.min(e.line+t.linesAfter,i.length).toString().length,f=t.maxLength-(t.indent+l+3);for(u=1;u<=t.linesBefore&&!(o-u<0);u++)c=Rhe(e.buffer,n[o-u],i[o-u],e.position-(n[o]-n[o-u]),f),a=os.repeat(" ",t.indent)+Nhe((e.line-u+1).toString(),l)+" | "+c.str+`
|
|
@@ -689,7 +689,7 @@ PGHZoN9jcvvvWDLUGtJkEotMgdFpEA2XWR83H4fVFVc=
|
|
|
689
689
|
`+e.slice(i,s),i=s+1),o=a;return u+=`
|
|
690
690
|
`,e.length-i>t&&o>i?u+=e.slice(i,o)+`
|
|
691
691
|
`+e.slice(o+1):u+=e.slice(i),u.slice(1)}function cyn(e){for(var t="",r=0,n,i=0;i<e.length;r>=65536?i+=2:i++)r=sI(e,i),n=Oo[r],!n&&cI(r)?(t+=e[i],r>=65536&&(t+=e[i+1])):t+=n||eyn(r);return t}function lyn(e,t,r){var n="",i=e.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],e.replacer&&(a=e.replacer.call(r,String(s),a)),(bh(e,t,a,!1,!1)||typeof a>"u"&&bh(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function Q_t(e,t,r,n){var i="",s=e.tag,o,a,u;for(o=0,a=r.length;o<a;o+=1)u=r[o],e.replacer&&(u=e.replacer.call(r,String(o),u)),(bh(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&bh(e,t+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Fhe(e,t)),e.dump&&aI===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function fyn(e,t,r){var n="",i=e.tag,s=Object.keys(r),o,a,u,c,l;for(o=0,a=s.length;o<a;o+=1)l="",n!==""&&(l+=", "),e.condenseFlow&&(l+='"'),u=s[o],c=r[u],e.replacer&&(c=e.replacer.call(r,u,c)),bh(e,t,u,!1,!1)&&(e.dump.length>1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),bh(e,t,c,!1,!1)&&(l+=e.dump,n+=l));e.tag=i,e.dump="{"+n+"}"}function pyn(e,t,r,n){var i="",s=e.tag,o=Object.keys(r),a,u,c,l,f,p;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new ca("sortKeys must be a boolean or a function");for(a=0,u=o.length;a<u;a+=1)p="",(!n||i!=="")&&(p+=Fhe(e,t)),c=o[a],l=r[c],e.replacer&&(l=e.replacer.call(r,c,l)),bh(e,t+1,c,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&aI===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,f&&(p+=Fhe(e,t)),bh(e,t+1,l,!0,f)&&(e.dump&&aI===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=s,e.dump=i||"{}"}function Z_t(e,t,r){var n,i,s,o,a,u;for(i=r?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(r?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(u=e.styleMap[a.tag]||a.defaultStyle,RSt.call(a.represent)==="[object Function]")n=a.represent(t,u);else if(NSt.call(a.represent,u))n=a.represent[u](t,u);else throw new ca("!<"+a.tag+'> tag resolver accepts not "'+u+'" style');e.dump=n}return!0}return!1}function bh(e,t,r,n,i,s,o){e.tag=null,e.dump=r,Z_t(e,r,!1)||Z_t(e,r,!0);var a=RSt.call(e.dump),u=n,c;n&&(n=e.flowLevel<0||e.flowLevel>t);var l=a==="[object Object]"||a==="[object Array]",f,p;if(l&&(f=e.duplicates.indexOf(r),p=f!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(i=!1),p&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(l&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),a==="[object Object]")n&&Object.keys(e.dump).length!==0?(pyn(e,t,e.dump,i),p&&(e.dump="&ref_"+f+e.dump)):(fyn(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?Q_t(e,t-1,e.dump,i):Q_t(e,t,e.dump,i),p&&(e.dump="&ref_"+f+e.dump)):(lyn(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&ayn(e,e.dump,t,s,u);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new ca("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function dyn(e,t){var r=[],n=[],i,s;for(khe(e,r,n),i=0,s=n.length;i<s;i+=1)t.duplicates.push(r[n[i]]);t.usedDuplicates=new Array(s)}function khe(e,t,r){var n,i,s;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(t.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)khe(e[i],t,r);else for(n=Object.keys(e),i=0,s=n.length;i<s;i+=1)khe(e[n[i]],t,r)}function hyn(e,t){t=t||{};var r=new ryn(t);r.noRefs||dyn(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),bh(r,0,n,!0,!0)?r.dump+`
|
|
692
|
-
`:""}var myn=hyn,gyn={dump:myn};function $he(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var yyn=Ws,vyn=rSt,Eyn=oSt,_yn=fSt,Syn=pSt,byn=qhe,Tyn=DSt.load,Ayn=DSt.loadAll,xyn=gyn.dump,wyn=ca,Cyn={binary:ySt,float:lSt,map:sSt,null:aSt,pairs:ESt,set:_St,timestamp:mSt,bool:uSt,int:cSt,merge:gSt,omap:vSt,seq:iSt,str:nSt},Oyn=$he("safeLoad","load"),Pyn=$he("safeLoadAll","loadAll"),Dyn=$he("safeDump","dump"),VSt={Type:yyn,Schema:vyn,FAILSAFE_SCHEMA:Eyn,JSON_SCHEMA:_yn,CORE_SCHEMA:Syn,DEFAULT_SCHEMA:byn,load:Tyn,loadAll:Ayn,dump:xyn,YAMLException:wyn,types:Cyn,safeLoad:Oyn,safeLoadAll:Pyn,safeDump:Dyn};var Ryn=(0,cl.dirname)((0,$St.fileURLToPath)(__importMetaUrl)),Po=class e{document;static validate;async validateSchema(){if(!e.validate){let r=(0,cl.join)(Ryn,"..","dist","schema","ui5.yaml.json"),n=JSON.parse(await(0,HSt.readFile)(r,"utf8"));if(!n)throw Error("The schema file was not found. Validation is not possible.");e.validate=new GSt.Ajv({strict:!1}).compile(n)}let t=!1;try{t=VSt.loadAll(this.document.toString()).every(r=>e.validate(r))}catch(r){throw Error(`No validation possible. Error: ${r}`)}return t}static async newInstance(t,r){let n=new e;if(n.document=await DN.newInstance(t),(r?.validateSchema??!1)&&!await n.validateSchema())throw new Error("This file does not comply with the schema.");return n}getMetadata(){try{return this.document.getMap({path:"metadata"}).toJSON()}catch{return}}getConfiguration(){let t;try{t=this.document.getMap({path:"resources"}).toJSON()}catch{t={}}return t.configuration??{}}setConfiguration(t){return this.document.setIn({path:"resources",value:{configuration:t}}),this}setMetadata(t){return this.document.setIn({path:"metadata",value:t}),this}getType(){return this.document.getNode({path:"type"})}setType(t){return this.document.setIn({path:"type",value:t}),this}addCustomConfiguration(t,r){try{this.document.getMap({path:"customConfiguration"}).setIn([t],r)}catch{this.document.setIn({path:"customConfiguration",value:{[t]:r}})}}getCustomConfiguration(t){try{let r=this.document.getMap({path:"customConfiguration"}).get(t);return r?.toJSON?.()??r?.toString()}catch{return}}getUi5Framework(){return this.document.getMap({path:"framework"}).toJSON()}addUI5Framework(t,r,n,i="sap_fiori_3"){let s=[];for(let o of n)s.push({name:o});return s.push({name:`themelib_${i.replace(/_dark$|_hcw$|_hcb$/,"")}`}),this.document.setIn({path:"framework",value:{name:t,version:r,libraries:s}}),this}addCustomTasks(t,r){for(let n of t)this.document.appendTo({path:"builder.customTasks",value:n,comments:r});return this}addCustomMiddleware(t,r){for(let n of t)this.document.appendTo({path:"server.customMiddleware",value:n,comments:r});return this}addFioriToolsAppReloadMiddleware(){return this.document.appendTo({path:"server.customMiddleware",value:ivt()}),this}addFioriToolsProxyMiddleware(t,r){let n=t?.ignoreCertErrors??t?.ignoreCertError??!1,{config:i,comments:s}=svt(t.backend,t.ui5,r,n);return this.document.appendTo({path:"server.customMiddleware",value:i,comments:s}),this}getFioriToolsProxyMiddlewareConfiguration(){let t=this.document.getSequence({path:"server.customMiddleware"}),r=this.document.findItem(t,n=>n.name===yh);if(!r)throw new Error("Could not find fiori-tools-proxy");return this.document.getMap({start:r,path:"configuration"})}addBackendToFioriToolsProxyMiddleware(t,r=!1){let n=this.getFioriToolsProxyMiddlewareConfiguration(),i=n.toJSON(),s=Q$(t),o=this.document.createNode({value:t,comments:s});if((i?.ignoreCertErrors??i?.ignoreCertError??!1)!==r&&(n.set("ignoreCertErrors",r),i?.ignoreCertError!==void 0&&n.delete("ignoreCertError")),i?.backend){if(!i?.backend.find(u=>u.path===t.path)){let u=this.document.getSequence({start:n,path:"backend"});u.items.length===0?n.set("backend",[o]):u.add(o)}}else n.set("backend",[o]);return this}updateBackendToFioriToolsProxyMiddleware(t){let r=this.getFioriToolsProxyMiddlewareConfiguration(),n=r.toJSON(),i=Q$(t),s=this.document.createNode({value:t,comments:i});if(n?.backend){let o=n?.backend.findIndex(a=>a.path&&a.path===t.path);o!==-1&&this.document.getSequence({start:r,path:"backend"}).set(o,s)}return this}removeBackendFromFioriToolsProxyMiddleware(t){let r=this.findCustomMiddleware(yh);if(r){let n=r?.configuration;if(n?.backend){let i="/sap",s=n.backend.findIndex(o=>o.path===i);n.backend=n.backend.filter((o,a)=>a===s?!0:o.path!==t),this.updateCustomMiddleware(r)}}else throw new Error("Could not find fiori-tools-proxy");return this}getBackendConfigFromFioriToolsProxyMiddleware(t){return this.getBackendConfigsFromFioriToolsProxyMiddleware().find(n=>n.path===t)}getBackendConfigsFromFioriToolsProxyMiddleware(){let t;try{let r=this.document.getSequence({path:"server.customMiddleware"}),n=this.document.findItem(r,s=>s.name===yh),i=this.document.getMap({start:n,path:"configuration"});t=this.document.getSequence({start:i,path:"backend"}).toJSON()}catch{return[]}return t}addUi5ToFioriToolsProxyMiddleware(t){let r=this.document.getSequence({path:"server.customMiddleware"}),n=this.document.findItem(r,i=>i.name===yh);if(!n)throw new Error("Could not find fiori-tools-proxy");return this.document.getMap({start:n,path:"configuration"}).set("ui5",[t]),this}addMockServerMiddleware(t,r,n,i){return this.document.appendTo({path:"server.customMiddleware",value:ovt(t,r,n,i)}),this}addServiceToMockserverMiddleware(t,r,n,i=[]){let s=this.findCustomMiddleware("sap-fe-mockserver");if(s){let o=`.${cl.posix.sep}${(0,cl.relative)(t,(0,cl.join)(r,"localService",n.serviceName)).replaceAll(cl.sep,cl.posix.sep)}`,a=s?.configuration;if(a?.services){let u=n.servicePath.replace(/\/$/,""),c={urlPath:u,metadataPath:n.metadataPath??`${o}/metadata.xml`,mockdataPath:`${o}/data`,generateMockData:!0};n.resolveExternalServiceReferences===!0&&(c.resolveExternalServiceReferences=!0),a.services.findIndex(f=>f.urlPath===u)===-1&&(a.services=[...a.services,c])}if(a?.annotations){let u=a.annotations;i.forEach(c=>{u.find(l=>l.urlPath===c.urlPath)||u.push(c)})}this.updateCustomMiddleware(s)}else throw new Error("Could not find sap-fe-mockserver");return this}removeServiceFromMockServerMiddleware(t,r){let n=this.findCustomMiddleware("sap-fe-mockserver");if(n){let i=n?.configuration;if(i?.services&&(i.services=i?.services.filter(s=>s.urlPath!==t.replace(/\/$/,""))),i?.annotations){let s=i.annotations;r.forEach(o=>{i.annotations=s.filter(a=>a.urlPath!==o)})}this.updateCustomMiddleware(n)}else throw new Error("Could not find sap-fe-mockserver");return this}addAbapDeployTask(t,r,n=!0,i,s=!1,o,a=[]){this.document.appendTo({path:"builder.resources.excludes",value:"/test/**"}),this.document.appendTo({path:"builder.resources.excludes",value:"/localService/**"});let u=Array.from(new Set([...i??[],"/test/","/localService/"])),c={target:t,app:r,exclude:u,lrep:o};return s&&(c.index=!0),this.document.appendTo({path:"builder.customTasks",value:{name:n?"deploy-to-abap":"abap-deploy-task",afterTask:"generateCachebusterInfo",configuration:c},comments:a}),this}addCloudFoundryDeployTask(t,r=!1,n=!1){return this.document.appendTo({path:"builder.resources.excludes",value:"/test/**"}),this.document.appendTo({path:"builder.resources.excludes",value:"/localService/**"}),this.document.appendTo({path:"builder.customTasks",value:{name:"ui5-task-zipper",afterTask:"generateCachebusterInfo",configuration:{archiveName:t,relativePaths:!0,additionalFiles:["xs-app.json"]}}}),r&&this.document.appendTo({path:"builder.customTasks",value:{name:"ui5-tooling-modules-task",afterTask:"replaceVersion",configuration:{}}}),n&&this.document.appendTo({path:"builder.customTasks",value:{name:"ui5-tooling-transpile-task",afterTask:"replaceVersion",configuration:{debug:!0,removeConsoleStatements:!0,transpileAsync:!0,transpileTypeScript:!0}}}),this}removeCustomMiddleware(t){return this.document.deleteAt({path:"server.customMiddleware",matcher:{key:"name",value:t}}),this}removeCustomTask(t){return this.document.deleteAt({path:"builder.customTasks",matcher:{key:"name",value:t}}),this}removeConfig(t){return this.document.delete(t),this}addComment({comment:t,location:r="beginning"}){return this.document.addDocumentComment({comment:t,location:r}),this}findCustomActivity(t,r){let n;try{n=this.document.getSequence({path:r})}catch{}let i;return n&&(i=this.document.findItem(n,s=>s.name===t)),i?i.toJSON():void 0}findCustomMiddleware(t){return this.findCustomActivity(t,"server.customMiddleware")}findCustomTask(t){return this.findCustomActivity(t,"builder.customTasks")}updateCustomMiddleware(t){let r=t.name;return this.findCustomMiddleware(r)?this.document.updateAt({path:"server.customMiddleware",matcher:{key:"name",value:r},value:t,mode:"overwrite"}):this.addCustomMiddleware([t]),this}mergeCustomMiddleware(t){let r=t.name;return this.findCustomMiddleware(r)&&this.document.updateAt({path:"server.customMiddleware",matcher:{key:"name",value:r},value:t,mode:"merge"}),this}getServeStaticConfig(t,r){return t?{name:ex,beforeMiddleware:yh,configuration:{paths:r}}:{name:ex,afterMiddleware:"compression",configuration:{paths:r}}}addServeStaticConfig(t){let r=this.findCustomMiddleware(ex),n=this.findCustomMiddleware(yh);if(r)r.afterMiddleware==="compression"&&n?this.updateCustomMiddleware({name:ex,beforeMiddleware:yh,configuration:{paths:[...r.configuration.paths,...t]}}):this.mergeCustomMiddleware({name:ex,configuration:{paths:[...r.configuration.paths,...t]}});else{let i=this.getServeStaticConfig(!!n,t);this.addCustomMiddleware([i])}return this}toString(){return this.document.toString()}};var Fyn=be(YSt(),1),Uyn=be(ta(),1);var dl=be(require("node:fs"),1),$p=be(require("node:path"),1),oCt=be(kpe(),1);var zSt=require("node:os"),Hhe=require("node:path"),St={AdaptationConfig:"config.json",CapJavaApplicationYaml:"application.yaml",ExtConfigJson:".extconfig.json",IndexCds:"index.cds",Library:".library",Manifest:"manifest.json",ManifestAppDescrVar:"manifest.appdescr_variant",MtaYaml:"mta.yaml",Package:"package.json",Pom:"pom.xml",SpecificationDistTags:"specification-dist-tags.json",ServiceCds:"services.cds",Tsconfig:"tsconfig.json",Ui5Yaml:"ui5.yaml",Ui5LocalYaml:"ui5-local.yaml",Ui5MockYaml:"ui5-mock.yaml",UI5DeployYaml:"ui5-deploy.yaml",PackageLock:"package-lock.json",XSAppJson:"xs-app.json",XSSecurityJson:"xs-security.json",DotGitIgnore:".gitignore",MtaExtYaml:"mta-ext.mtaext"},ai={Changes:"changes",ModuleCache:"module-cache",Schemas:".schemas",Pages:"pages",Webapp:"webapp",Temp:".tmp",LocalService:"localService",Controller:"controller",View:"view",Fragment:"fragment",Fragments:"fragments",Ext:"ext",VSCode:".vscode",AppConfig:"appconfig",Db:"db",Csv:"csv",Data:"data",Mockdata:"mockdata",Dist:"dist",Coding:"coding",Manifest:"manifest",Annotations:"annotations"},KSt={dir:".fioritools",migrationSettingsFile:"migrationSettings.json"};var Sx=(0,Hhe.join)((0,zSt.homedir)(),KSt.dir),lI=(0,Hhe.join)(Sx,ai.ModuleCache);var fI=require("node:fs"),t0t=be(e0t(),1);async function hf(e,t){return t?t.read(e):fI.promises.readFile(e,{encoding:"utf8"})}async function zr(e,t){return t?t.readJSON(e):JSON.parse(await hf(e))}async function W_(e,t,r){return r?r.write(e,t):fI.promises.writeFile(e,t,{encoding:"utf8"})}async function as(e,t){try{return t?t.exists(e):(await fI.promises.access(e),!0)}catch{return!1}}async function bx(e,t,r){await r0t(e,t,r)}async function Yhe(e,t,r){await r0t(e,t,r)}async function r0t(e,t,r){let n=await hf(e,r),i=(0,t0t.default)(n),o=JSON.stringify(t,null,i[Symbol.for("indent")])+`
|
|
692
|
+
`:""}var myn=hyn,gyn={dump:myn};function $he(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var yyn=Ws,vyn=rSt,Eyn=oSt,_yn=fSt,Syn=pSt,byn=qhe,Tyn=DSt.load,Ayn=DSt.loadAll,xyn=gyn.dump,wyn=ca,Cyn={binary:ySt,float:lSt,map:sSt,null:aSt,pairs:ESt,set:_St,timestamp:mSt,bool:uSt,int:cSt,merge:gSt,omap:vSt,seq:iSt,str:nSt},Oyn=$he("safeLoad","load"),Pyn=$he("safeLoadAll","loadAll"),Dyn=$he("safeDump","dump"),VSt={Type:yyn,Schema:vyn,FAILSAFE_SCHEMA:Eyn,JSON_SCHEMA:_yn,CORE_SCHEMA:Syn,DEFAULT_SCHEMA:byn,load:Tyn,loadAll:Ayn,dump:xyn,YAMLException:wyn,types:Cyn,safeLoad:Oyn,safeLoadAll:Pyn,safeDump:Dyn};var Ryn=(0,cl.dirname)((0,$St.fileURLToPath)(__importMetaUrl)),Po=class e{document;static validate;async validateSchema(){if(!e.validate){let r=(0,cl.join)(Ryn,"..","dist","schema","ui5.yaml.json"),n=JSON.parse(await(0,HSt.readFile)(r,"utf8"));if(!n)throw Error("The schema file was not found. Validation is not possible.");e.validate=new GSt.Ajv({strict:!1}).compile(n)}let t=!1;try{t=VSt.loadAll(this.document.toString()).every(r=>e.validate(r))}catch(r){throw Error(`No validation possible. Error: ${r}`)}return t}static async newInstance(t,r){let n=new e;if(n.document=await DN.newInstance(t),(r?.validateSchema??!1)&&!await n.validateSchema())throw new Error("This file does not comply with the schema.");return n}getMetadata(){try{return this.document.getMap({path:"metadata"}).toJSON()}catch{return}}getConfiguration(){let t;try{t=this.document.getMap({path:"resources"}).toJSON()}catch{t={}}return t.configuration??{}}setConfiguration(t){return this.document.setIn({path:"resources",value:{configuration:t}}),this}setMetadata(t){return this.document.setIn({path:"metadata",value:t}),this}getType(){return this.document.getNode({path:"type"})}setType(t){return this.document.setIn({path:"type",value:t}),this}addCustomConfiguration(t,r){try{this.document.getMap({path:"customConfiguration"}).setIn([t],r)}catch{this.document.setIn({path:"customConfiguration",value:{[t]:r}})}}getCustomConfiguration(t){try{let r=this.document.getMap({path:"customConfiguration"}).get(t);return r?.toJSON?.()??r?.toString()}catch{return}}getUi5Framework(){return this.document.getMap({path:"framework"}).toJSON()}addUI5Framework(t,r,n,i="sap_fiori_3"){let s=[];for(let o of n)s.push({name:o});return s.push({name:`themelib_${i.replace(/_dark$|_hcw$|_hcb$/,"")}`}),this.document.setIn({path:"framework",value:{name:t,version:r,libraries:s}}),this}addCustomTasks(t,r){for(let n of t)this.document.appendTo({path:"builder.customTasks",value:n,comments:r});return this}addCustomMiddleware(t,r){for(let n of t)this.document.appendTo({path:"server.customMiddleware",value:n,comments:r});return this}addFioriToolsAppReloadMiddleware(){return this.document.appendTo({path:"server.customMiddleware",value:ivt()}),this}addFioriToolsProxyMiddleware(t,r){let n=t?.ignoreCertErrors??t?.ignoreCertError??!1,{config:i,comments:s}=svt(t.backend,t.ui5,r,n);return this.document.appendTo({path:"server.customMiddleware",value:i,comments:s}),this}getFioriToolsProxyMiddlewareConfiguration(){let t=this.document.getSequence({path:"server.customMiddleware"}),r=this.document.findItem(t,n=>n.name===yh);if(!r)throw new Error("Could not find fiori-tools-proxy");return this.document.getMap({start:r,path:"configuration"})}addBackendToFioriToolsProxyMiddleware(t,r=!1){let n=this.getFioriToolsProxyMiddlewareConfiguration(),i=n.toJSON(),s=Q$(t),o=this.document.createNode({value:t,comments:s});if((i?.ignoreCertErrors??i?.ignoreCertError??!1)!==r&&(n.set("ignoreCertErrors",r),i?.ignoreCertError!==void 0&&n.delete("ignoreCertError")),i?.backend){if(!i?.backend.find(u=>u.path===t.path)){let u=this.document.getSequence({start:n,path:"backend"});u.items.length===0?n.set("backend",[o]):u.add(o)}}else n.set("backend",[o]);return this}updateBackendToFioriToolsProxyMiddleware(t){let r=this.getFioriToolsProxyMiddlewareConfiguration(),n=r.toJSON(),i=Q$(t),s=this.document.createNode({value:t,comments:i});if(n?.backend){let o=n?.backend.findIndex(a=>a.path&&a.path===t.path);o!==-1&&this.document.getSequence({start:r,path:"backend"}).set(o,s)}return this}removeBackendFromFioriToolsProxyMiddleware(t){let r=this.findCustomMiddleware(yh);if(r){let n=r?.configuration;if(n?.backend){let i="/sap",s=n.backend.findIndex(o=>o.path===i);n.backend=n.backend.filter((o,a)=>a===s?!0:o.path!==t),this.updateCustomMiddleware(r)}}else throw new Error("Could not find fiori-tools-proxy");return this}getBackendConfigFromFioriToolsProxyMiddleware(t){return this.getBackendConfigsFromFioriToolsProxyMiddleware().find(n=>n.path===t)}getBackendConfigsFromFioriToolsProxyMiddleware(){let t;try{let r=this.document.getSequence({path:"server.customMiddleware"}),n=this.document.findItem(r,s=>s.name===yh),i=this.document.getMap({start:n,path:"configuration"});t=this.document.getSequence({start:i,path:"backend"}).toJSON()}catch{return[]}return t}addUi5ToFioriToolsProxyMiddleware(t){let r=this.document.getSequence({path:"server.customMiddleware"}),n=this.document.findItem(r,i=>i.name===yh);if(!n)throw new Error("Could not find fiori-tools-proxy");return this.document.getMap({start:n,path:"configuration"}).set("ui5",[t]),this}addMockServerMiddleware(t,r,n,i){return this.document.appendTo({path:"server.customMiddleware",value:ovt(t,r,n,i)}),this}addServiceToMockserverMiddleware(t,r,n,i=[]){let s=this.findCustomMiddleware("sap-fe-mockserver");if(s){let o=`.${cl.posix.sep}${(0,cl.relative)(t,(0,cl.join)(r,"localService",n.serviceName)).replaceAll(cl.sep,cl.posix.sep)}`,a=s?.configuration;if(a?.services){let u=n.servicePath.replace(/\/$/,""),c={urlPath:u,metadataPath:n.metadataPath??`${o}/metadata.xml`,mockdataPath:`${o}/data`,generateMockData:!0};n.resolveExternalServiceReferences===!0&&(c.resolveExternalServiceReferences=!0),a.services.findIndex(f=>f.urlPath===u)===-1&&(a.services=[...a.services,c])}if(a?.annotations){let u=a.annotations;i.forEach(c=>{u.find(l=>l.urlPath===c.urlPath)||u.push(c)})}this.updateCustomMiddleware(s)}else throw new Error("Could not find sap-fe-mockserver");return this}removeServiceFromMockServerMiddleware(t,r){let n=this.findCustomMiddleware("sap-fe-mockserver");if(n){let i=n?.configuration;if(i?.services&&(i.services=i?.services.filter(s=>s.urlPath!==t.replace(/\/$/,""))),i?.annotations){let s=i.annotations;r.forEach(o=>{i.annotations=s.filter(a=>a.urlPath!==o)})}this.updateCustomMiddleware(n)}else throw new Error("Could not find sap-fe-mockserver");return this}addBuilderResourceExcludes(){let t=["/test/**","/localService/**"],r=[];try{r=this.document.getSequence({path:"builder.resources.excludes"}).toJSON().filter(n=>typeof n=="string")}catch{}for(let n of t)r.includes(n)||(this.document.appendTo({path:"builder.resources.excludes",value:n}),r.push(n));return this}addAbapDeployTask(t,r,n=!0,i,s=!1,o,a=[]){this.addBuilderResourceExcludes();let u=Array.from(new Set([...i??[],"/test/","/localService/"])),c={target:t,app:r,exclude:u,lrep:o};return s&&(c.index=!0),this.document.appendTo({path:"builder.customTasks",value:{name:n?"deploy-to-abap":"abap-deploy-task",afterTask:"generateCachebusterInfo",configuration:c},comments:a}),this}addCloudFoundryDeployTask(t,r=!1,n=!1){return this.addBuilderResourceExcludes(),this.document.appendTo({path:"builder.customTasks",value:{name:"ui5-task-zipper",afterTask:"generateCachebusterInfo",configuration:{archiveName:t,relativePaths:!0,additionalFiles:["xs-app.json"]}}}),r&&this.document.appendTo({path:"builder.customTasks",value:{name:"ui5-tooling-modules-task",afterTask:"replaceVersion",configuration:{}}}),n&&this.document.appendTo({path:"builder.customTasks",value:{name:"ui5-tooling-transpile-task",afterTask:"replaceVersion",configuration:{debug:!0,removeConsoleStatements:!0,transpileAsync:!0,transpileTypeScript:!0}}}),this}removeCustomMiddleware(t){return this.document.deleteAt({path:"server.customMiddleware",matcher:{key:"name",value:t}}),this}removeCustomTask(t){return this.document.deleteAt({path:"builder.customTasks",matcher:{key:"name",value:t}}),this}removeConfig(t){return this.document.delete(t),this}addComment({comment:t,location:r="beginning"}){return this.document.addDocumentComment({comment:t,location:r}),this}findCustomActivity(t,r){let n;try{n=this.document.getSequence({path:r})}catch{}let i;return n&&(i=this.document.findItem(n,s=>s.name===t)),i?i.toJSON():void 0}findCustomMiddleware(t){return this.findCustomActivity(t,"server.customMiddleware")}findCustomTask(t){return this.findCustomActivity(t,"builder.customTasks")}updateCustomMiddleware(t){let r=t.name;return this.findCustomMiddleware(r)?this.document.updateAt({path:"server.customMiddleware",matcher:{key:"name",value:r},value:t,mode:"overwrite"}):this.addCustomMiddleware([t]),this}mergeCustomMiddleware(t){let r=t.name;return this.findCustomMiddleware(r)&&this.document.updateAt({path:"server.customMiddleware",matcher:{key:"name",value:r},value:t,mode:"merge"}),this}getServeStaticConfig(t,r){return t?{name:ex,beforeMiddleware:yh,configuration:{paths:r}}:{name:ex,afterMiddleware:"compression",configuration:{paths:r}}}addServeStaticConfig(t){let r=this.findCustomMiddleware(ex),n=this.findCustomMiddleware(yh);if(r)r.afterMiddleware==="compression"&&n?this.updateCustomMiddleware({name:ex,beforeMiddleware:yh,configuration:{paths:[...r.configuration.paths,...t]}}):this.mergeCustomMiddleware({name:ex,configuration:{paths:[...r.configuration.paths,...t]}});else{let i=this.getServeStaticConfig(!!n,t);this.addCustomMiddleware([i])}return this}toString(){return this.document.toString()}};var Fyn=be(YSt(),1),Uyn=be(ta(),1);var dl=be(require("node:fs"),1),$p=be(require("node:path"),1),oCt=be(kpe(),1);var zSt=require("node:os"),Hhe=require("node:path"),St={AdaptationConfig:"config.json",CapJavaApplicationYaml:"application.yaml",ExtConfigJson:".extconfig.json",IndexCds:"index.cds",Library:".library",Manifest:"manifest.json",ManifestAppDescrVar:"manifest.appdescr_variant",MtaYaml:"mta.yaml",Package:"package.json",Pom:"pom.xml",SpecificationDistTags:"specification-dist-tags.json",ServiceCds:"services.cds",Tsconfig:"tsconfig.json",Ui5Yaml:"ui5.yaml",Ui5LocalYaml:"ui5-local.yaml",Ui5MockYaml:"ui5-mock.yaml",UI5DeployYaml:"ui5-deploy.yaml",PackageLock:"package-lock.json",XSAppJson:"xs-app.json",XSSecurityJson:"xs-security.json",DotGitIgnore:".gitignore",MtaExtYaml:"mta-ext.mtaext"},ai={Changes:"changes",ModuleCache:"module-cache",Schemas:".schemas",Pages:"pages",Webapp:"webapp",Temp:".tmp",LocalService:"localService",Controller:"controller",View:"view",Fragment:"fragment",Fragments:"fragments",Ext:"ext",VSCode:".vscode",AppConfig:"appconfig",Db:"db",Csv:"csv",Data:"data",Mockdata:"mockdata",Dist:"dist",Coding:"coding",Manifest:"manifest",Annotations:"annotations"},KSt={dir:".fioritools",migrationSettingsFile:"migrationSettings.json"};var Sx=(0,Hhe.join)((0,zSt.homedir)(),KSt.dir),lI=(0,Hhe.join)(Sx,ai.ModuleCache);var fI=require("node:fs"),t0t=be(e0t(),1);async function hf(e,t){return t?t.read(e):fI.promises.readFile(e,{encoding:"utf8"})}async function zr(e,t){return t?t.readJSON(e):JSON.parse(await hf(e))}async function W_(e,t,r){return r?r.write(e,t):fI.promises.writeFile(e,t,{encoding:"utf8"})}async function as(e,t){try{return t?t.exists(e):(await fI.promises.access(e),!0)}catch{return!1}}async function bx(e,t,r){await r0t(e,t,r)}async function Yhe(e,t,r){await r0t(e,t,r)}async function r0t(e,t,r){let n=await hf(e,r),i=(0,t0t.default)(n),o=JSON.stringify(t,null,i[Symbol.for("indent")])+`
|
|
693
693
|
`;await W_(e,o,r)}async function qH(e){return fI.promises.readdir(e,{encoding:"utf8"})}var ws=require("node:path"),s0t=be(i0t(),1);function Xyn(e,t,r,n){let i=[],s=[],o=Object.keys(e).filter(a=>a.startsWith(n.replaceAll(ws.sep,ws.posix.sep))&&(t.includes((0,ws.basename)(a))||r.includes((0,ws.extname)(a))||t.length===0&&r.length===0));for(let a of o)e[a].state==="deleted"&&i.push((0,ws.join)(a)),e[a].state==="modified"&&s.push((0,ws.join)(a));return{deleted:i,modified:s}}function Jyn(e,t,r,n,i,s){let o=e,a=i;if(s){let{modified:u,deleted:c}=Xyn(s.dump(""),t,r,n);o=Array.from(new Set([...e,...u])).filter(f=>!c.includes(f)),a=i.filter(f=>f.code!=="ENOENT"||typeof f.path=="string"&&!u.some(p=>p.startsWith(f.path)))}return{searchResult:o,fatalErrors:a}}function Y_(e){return new Promise((t,r)=>{let n=[],i=Array.isArray(e.fileNames)?e.fileNames:[],s=Array.isArray(e.extensionNames)?e.extensionNames:[],o=Array.isArray(e.excludeFolders)?e.excludeFolders:[],a=e.noTraversal??!1,u=[],c=(0,s0t.default)(e.root);c.on("directory",(l,f,p)=>{let d=(0,ws.basename)(l);(o.includes(d)||a&&l!==e.root)&&p()}),c.on("file",l=>{(s.includes((0,ws.extname)(l))||i.includes((0,ws.basename)(l))||i.length===0&&s.length===0)&&n.push(l)}),c.on("end",()=>{let{searchResult:l,fatalErrors:f}=Jyn(n,i,s,e.root,u,e.memFs);f.length===0?t(l):r(f)}),c.on("error",l=>{u.push(l)})})}function Tx(e,t,r,n,i){return Y_({extensionNames:[e],root:t,excludeFolders:r,noTraversal:i,memFs:n})}async function mf(e,t,r){let n=(0,ws.join)(t,e);return await as(n,r)?n:(0,ws.dirname)(t)!==t?mf(e,(0,ws.dirname)(t),r):void 0}var o0t=require("node:fs"),zhe;function VH(e){if(process.platform==="win32"){if(zhe===void 0){let r=o0t.realpathSync.native("\\")[0];zhe=r===r.toUpperCase()}return(zhe?e.charAt(0).toUpperCase():e.charAt(0).toLowerCase())+e.slice(1)}return e}var wxt=require("node:child_process"),Do=require("node:path");var dI=require("node:fs"),mI=require("node:fs/promises"),hI=require("node:path"),c0t=require("node:module");var a0t=require("node:fs"),Th=require("node:path");var pI=(e,t)=>!!(e.dependencies?.[t]??e.devDependencies?.[t]);function GH(e,t){if(!(0,Th.isAbsolute)(e))return;let{root:r}=(0,Th.parse)(e),n=e,i;for(;n!==r;){let s=(0,Th.join)(n,"node_modules");if(t&&(s=(0,Th.join)(s,t,St.Package)),(0,a0t.existsSync)(s)){i=n;break}n=(0,Th.dirname)(n)}return i}var u0t=require("node:child_process");async function z_(e,t){return new Promise((r,n)=>{let i=process.platform.startsWith("win"),s=i?"npm.cmd":"npm",o=i?{windowsVerbatimArguments:!0,shell:!0}:{},a=t?.logger,u=t?.cwd,c=typeof u=="string"?{...o,cwd:u}:o,l=(0,u0t.spawn)(s,e,c),f="",p="";l.stdout.on("data",h=>{f+=h.toString()}),l.stderr.on("data",h=>{p+=h.toString()});let d=`${s} ${e.join(" ")}`;l.on("exit",(h,g)=>{if(h===null)a?.warn(`Command '${d}' was killed by signal: ${g}`);else if(h===0){let _=[f,p].filter(Boolean).join(`
|
|
694
694
|
`),S=_?`:
|
|
695
695
|
${_}`:"";a?.info(`Command '${d}' successful${S}`)}else if(t?.throwOnError){f&&a?.info(f),n(new Error(`Command '${d}' failed with exit code ${h}. Stderr: ${p}`));return}else a?.error(`Command '${d}' not successful, stderr: ${p}`);r(f)}),l.on("error",h=>{a?.error(`Error executing npm command '${d}': ${h}`),n(h)})})}var l0t=require("node:url"),rvn=(0,c0t.createRequire)(__importMetaUrl);async function f0t(e,t){if(!GH(e,t))throw Error("Path to module not found.");return rvn.resolve(t,{paths:[e]})}async function Ah(e,t){let r;try{let n=await f0t(e,t);r=await import((0,l0t.pathToFileURL)(n).href)}catch(n){throw Error(`Module '${t}' not installed in project '${e}'.
|
|
@@ -720,7 +720,7 @@ ${i}`),await pl(e,s.concat(i),n),!0}function Pbn(e,t){let r=Zu.create("","",0,e)
|
|
|
720
720
|
`).filter(i=>!!/^\s*at .*(\S+:\d+|\(native\))/m.exec(i));return n.length&&n.forEach(i=>{let s=i.replace(/^\s+/,""),a=/ (\((.+):(\d+):(\d+)\)$)/.exec(i);if(!a)return;let u=null,c=a[2].replace(/\\/g,"/");for(let h of t){let g=h.exec(c);if(g){u=g[0];break}}if(!u)return;s=s.replace(a[0],"");let l=s.split(/\s+/).slice(1).join(""),f=a[3],p=a[4],d=`${l} at (${u}:${f}:${p});`;r.push(d)}),r},e8,uCt=e=>{process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY?.trim()!=="true"&&(e8=new aCt.TelemetryClient(Eo.azureInstrumentationKey),fG(e8));let t={message:e.message};if(e.stack){let n=ETn(e.stack);n.length&&(t.stack=n.join(`
|
|
721
721
|
`))}let r={name:$x.TELEMETRY_SETTINGS_INIT_FAILED,properties:t,measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&e8.trackEvent(r)},cCt=(e,t)=>{let r={name:$x.DISABLE_TELEMETRY,properties:{disableTelemetry:`${!e}`,...t},measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&e8.trackEvent(r)};var dS;(function(e){e.BackendSystem="system",e.TelemetrySetting="telemetrySetting"})(dS||(dS={}));var lCt={error:{unsupportedEntity:"Unsupported entity - {{entityName}}",systemDoesNotExist:"System does not exist. URL: [{{system.url}}], client: [{{system.client}}]",parsingStore:"Cannot parse store for {{entityName}}",noPropertiesSpecified:"No properties specified for update",systemMigrationFailed:"Migrating systems from secure store failed",systemAlreadyExistsInHybridStore:"System with ID: [{{systemId}}] already exists in hybrid store. Not migrating",couldNotDeleteRefreshToken:"Could not delete refresh token for [{{- url}}]",backendSystemEntityKeyExists:"The 'BackendSystem' entity was not written because a 'BackendSystem' entity key already exists: {{entityKey}}.",systemsJsonMigrationFailed:"The migration of the systems.json file from .fioritools to .saptools failed: {{- error}}"},info:{foundRefreshToken:"Found refresh token for {{- systemId}}",tryingToUpdateAuthType:"Trying to update authentication type for {{- systemId}}",authTypeDetermined:"Authentication type [{{- authenticationType }}] determined for {{- systemId }}",authTypeNotDetermined:"Authentication type could not be determined for {{- systemId }}",updatingRefreshTokenInNewStore:"Update refresh token in new store for {{- systemId}}",deletingRefreshTokenFromOldStore:"Deleting refresh token in old store for {{- systemId}}",legacyApiHubKeyFound:"Legacy format API Hub Key found in secure store",legacyApiHubKeyDeleted:"Legacy format API Hub Key removed from secure store",legacyApiHubKeyMigrated:"Legacy format API Hub Key migrated to new format",legacyApiHubKeyNotMigrated:"Legacy format API Hub Key not migrated, new format already exits",noLegacyApiHubKeyFound:"No legacy format API Hub Key found in secure store"}};var mye="ux-store",gye=kr.createInstance();async function fCt(){gye=kr.createInstance({resources:{en:{[mye]:lCt}},lng:"en",fallbackLng:"en",defaultNS:mye,fallbackNS:"default",ns:[mye],interpolation:{escapeValue:!1},showSupportNotice:!1}),await gye.init()}function ec(e,t){return gye.t(e,typeof t=="string"?{defaultValue:t}:t)}var mS=be(require("node:path"),1),hl=be(require("node:fs"),1);var Sye=require("node:os"),bye=require("node:path"),hCt=be(pCt(),1);var Eye;(function(e){e.PROXY_URL="HTTP_PROXY",e.H2O_URL="H2O_URL"})(Eye||(Eye={}));function dCt(){return!!process.env[Eye.H2O_URL]}var hL={AbapCloud:"AbapCloud",AbapOnPrem:"OnPrem",Generic:"Generic"},mL={Basic:"basic",ReentranceTicket:"reentranceTicket",OAuth2RefreshToken:"oauth2",OAuth2ClientCredential:"oauth2ClientCredential"},_ye={AbapCatalog:"abap_catalog",GenericHost:"generic_host",ODataService:"odata_service"};function gL(e){let t;return e.authenticationType==="reentranceTicket"?t=hL.AbapCloud:e.serviceKeys?t=hL.AbapCloud:(e.authenticationType==="basic"||e.username)&&(t=hL.AbapOnPrem),t}var STn=hCt.default.plural,Tye=(e,...t)=>e&&t?.length>0&&t.reduce((r,n)=>(r[n]=e[n],r),{})||void 0;function yL(e,t){return e==null||typeof e!="object"?!1:t.some(r=>{let n=e[r];return n!=null})}function n8(e){return e instanceof Error?e:new Error(String(e))}function yf(e){return e instanceof Error?e.message:String(e)}var t8;(function(e){e.dir=".fioritools"})(t8||(t8={}));var r8;(function(e){e.dir=".saptools"})(r8||(r8={}));var vL=()=>(0,bye.join)((0,Sye.homedir)(),t8.dir),vy=()=>(0,bye.join)((0,Sye.homedir)(),r8.dir);function hS(e){let t=e?.trim().toLowerCase();return t&&STn(t)}function EL(e){return hS(e)+".json"}function Aye(e,t){return Object.entries(t).every(([r,n])=>Array.isArray(n)?n.includes(e[r]):n&&typeof n=="object"?Aye(e[r],n):e[r]===n)}var mCt=be(require("node:os"),1),gCt=({baseDirectory:e}={})=>e?mS.default.isAbsolute(e)?e:mS.default.join(mCt.default.homedir(),e):vL(),xye=class{logger;storeDirectory;constructor(t,r={}){this.logger=t,this.storeDirectory=gCt(r)}async read({entityName:t,id:r}){let n=hS(t);if(!n){this.logger.debug("read: Entity Type is falsy - "+t);return}let{entities:i,error:s}=this._readAll(n);if(s){if(s.code==="ENOENT")return;throw s}if(!i){this.logger.debug(`read: After parsing, entities is falsy. Entity: ${n}, parsed value: ${i}`);return}return i[r]}async getAll({entityName:t}){let r=hS(t);if(!r)return this.logger.debug("read: Entity Type is falsy - "+t),[];let{entities:n,error:i}=this._readAll(r);if(i){if(i.code==="ENOENT")return[];throw i}return n?Object.values(n):(this.logger.debug(`read: After parsing, entities is falsy. Entity: ${r}, parsed value: ${n}`),[])}async readAll({entityName:t}){let r=hS(t);if(!r)return this.logger.debug("read: Entity Type is falsy - "+t),{};let{entities:n,error:i}=this._readAll(r);if(i){if(i.code==="ENOENT")return{};throw i}return n||(this.logger.debug(`read: After parsing, entities is falsy. Entity: ${r}, parsed value: ${n}`),{})}async write({entityName:t,id:r,entity:n}){let i=hS(t);if(!i){this.logger.debug("write: Entity is falsy - "+i);return}let{entities:s={},error:o}=this._readAll(i);if(o&&o.code!=="ENOENT")throw o;return s[r]=n,this.writeToFile(i,s),n}async partialUpdate({entityName:t,id:r,entity:n}){if(!n||!Object.keys(n).length){this.logger.debug("partialUpdate: No properties specified for update");return}let i=await this.read({entityName:t,id:r});if(!i){this.logger.debug(`partialUpdate: Entity with id ${r} does not exist in ${t}. Cannot update.`);return}let s=this.mergeProperties(n,i);return this.write({entityName:t,id:r,entity:s})}mergeProperties(t,r){return{...{...r,...t}}}async del({entityName:t,id:r}){let n=hS(t);if(!n)return this.logger.debug("delete: Entity is falsy - "+n),!1;let{entities:i={},error:s}=this._readAll(n);if(s&&s.code!=="ENOENT")throw s;return i[r]?(this.logger.debug(`delete: entity found for id - ${r}. Deleting`),delete i[r],this.writeToFile(n,i),!0):(this.logger.debug("delete: entity not found"),!1)}_readAll(t){let r;try{let i=mS.default.join(this.storeDirectory,`${t}.json`);(0,hl.existsSync)(i)?r=(0,hl.readFileSync)(i).toString().trim():r=""}catch(i){let s=n8(i);return this.logger.debug(s.message),{error:s}}if(!r)return{entities:void 0};let n;try{n=JSON.parse(r)?.[t]}catch(i){return{error:n8(i)}}return{entities:n}}writeToFile(t,r){let n=JSON.stringify({[t]:r},null,2),i=EL(t);try{(0,hl.writeFileSync)(mS.default.join(this.storeDirectory,i),n)}catch(s){if(n8(s)?.code==="ENOENT")this.logger.debug(`Base directory [${this.storeDirectory}] does not exist, trying to create it`),(0,hl.mkdirSync)(this.storeDirectory,{recursive:!0}),(0,hl.writeFileSync)(mS.default.join(this.storeDirectory,i),n);else throw s}}};function i8(e,t,r={}){let n=mS.default.join(gCt(r),EL(e));if((0,hl.existsSync)(n))return hl.default.watch(n,void 0,()=>{t(e)});console.warn(`File Not Found: ${n}`)}function s8(e,t){return new xye(e,t)}var _L=class{log;constructor(t){this.log=t}async save(t,r,n){return this.log.warn(`Dummy store. Trying to save for service: ${t}, key: ${r}`),!0}async retrieve(t,r){this.log.warn(`Dummy store. Trying to retrieve for service: ${t}, key: ${r}`)}async delete(t,r){return this.log.warn(`Dummy store. Trying to delete for service: ${t}, key: ${r}`),!0}async getAll(t){return this.log.warn(`Dummy store. Trying to get all values for service: [${t}]`),{}}};var o8=class{log;keyring;constructor(t,r){this.log=t,this.keyring=r}serialize(t){try{return JSON.stringify(t)}catch{throw new Error("Failed to serialize value while storing credentials")}}deserialize(t){try{return JSON.parse(t)}catch{throw new Error("Failed to deserialize value while retrieving credentials")}}validateInput(t,r){return!t||!r?(this.log.error("Invalid input: Service or Key is missing."),!1):!0}async save(t,r,n){if(!this.validateInput(t,r))return!1;try{let i=this.serialize(n);return await this.keyring.setPassword(t,r,i),this.log.info(`Credential saved successfully. Service: [${t}], Key: [${r}]`),!0}catch(i){return this.log.error(`Failed to save credential. Service: [${t}], Key: [${r}]. Error: ${yf(i)}`),!1}}async retrieve(t,r){if(this.validateInput(t,r))try{let n=await this.keyring.getPassword(t,r);if(!n){this.log.warn(`No credential found. Service: [${t}], Key: [${r}]`);return}return this.deserialize(n)}catch(n){n instanceof Error?this.log.error(`Deserialization error for Service: [${t}], Key: [${r}]. Error: ${yf(n)}`):this.log.error(`Failed to retrieve credential. Service: [${t}], Key: [${r}]. Error: ${yf(n)}`);return}}async delete(t,r){if(!this.validateInput(t,r))return!1;try{let n=await this.keyring.deletePassword(t,r);return n?this.log.info(`Credential deleted. Service: [${t}], Key: [${r}]`):this.log.warn(`No credential to delete. Service: [${t}], Key: [${r}]`),n}catch(n){return this.log.error(`Failed to delete credential. Service: [${t}], Key: [${r}]. Error: ${yf(n)}`),!1}}async getAll(t){let r={};try{let n=await this.keyring.findCredentials(t);return!n||n.length===0?(this.log.warn(`No credentials found for Service: [${t}]`),r):(n.forEach(({account:i,password:s})=>{if(i)try{let o=this.deserialize(s);r[i]=o}catch(o){this.log.error(`Failed to parse credential for Account: [${i}]. Error: ${yf(o)}`)}}),this.log.info(`All credentials retrieved. Service: [${t}], Count: ${Object.keys(r).length}`),r)}catch(n){return this.log.error(`Failed to retrieve credentials for Service: [${t}]. Error: ${yf(n)}`),r}}};var Hx=require("node:path"),ECt=require("node:os"),_Ct=require("node:module"),a8=be(require("node:fs"),1),yCt=(0,_Ct.createRequire)(__importMetaUrl);function vCt(e){let t=e?".vscode-insiders":".vscode",r=(0,Hx.join)((0,ECt.homedir)(),t,"extensions");return a8.default.existsSync(r)?a8.default.readdirSync(r).filter(i=>i.startsWith("sapse.sap-ux-application-modeler-extension")).map(i=>{let s=(0,Hx.join)(r,i),o=(0,Hx.join)(s,"node_modules/@zowe/secrets-for-zowe-sdk/package.json");return a8.default.existsSync(o)?(0,Hx.dirname)(o):""}).filter(i=>i!==""):[]}function bTn(e){try{return yCt("@zowe/secrets-for-zowe-sdk").keyring}catch(t){e.warn(yf(t)),e.debug("Attempting to load Zowe secrets SDK from fallback locations.");try{let r=[...vCt(!1),...vCt(!0)];e.debug(`Discovered fallback directories: ${JSON.stringify(r)}`);for(let n of r)try{return e.debug(`Attempting to load Zowe secrets SDK from: ${n}`),typeof __non_webpack_require__=="function"?__non_webpack_require__(n):yCt(n)}catch(i){e.warn(`Failed to load Zowe secrets SDK from ${n}: ${yf(i)}`)}}catch(r){e.warn(`Error while discovering fallback paths: ${yf(r)}`)}e.warn("Unable to load Zowe secrets SDK from any location.");return}}var u8=e=>{if(dCt()||process.env.FIORI_TOOLS_DISABLE_SECURE_STORE)return e.debug("Secure store disabled, using DummyStore."),new _L(e);let t=bTn(e);return t?(e.debug("Using KeyStoreManager for secure storage."),new o8(e,t)):(e.debug("Falling back to DummyStore as secure storage could not be initialized."),new _L(e))};var a3i=be(bCt(),1),wye=Symbol("serializable");function ml(e,t){let r=Reflect.getOwnMetadata(wye,e.constructor)||new Set;Reflect.defineMetadata(wye,r.add(t),e.constructor)}function TCt(e){let t=Reflect.getOwnMetadata(wye,e.constructor);return t&&Array.from(t.values())||[]}var Cye=Symbol("sensitive");function gS(e,t){let r=Reflect.getOwnMetadata(Cye,e.constructor)||new Set;Reflect.defineMetadata(Cye,r.add(t),e.constructor)}function c8(e){let t=Reflect.getOwnMetadata(Cye,e.constructor);return t&&Array.from(t.values())||[]}var SL=require("node:util");function l8(e){return"fiori/v2/"+e}var Oye=class{logger;filesystem;secureStore;constructor(t,r={}){this.logger=t,this.filesystem=s8(this.logger,r),this.secureStore=u8(this.logger)}async read({entityName:t,id:r}){let n=await this.filesystem.read({entityName:t,id:r});n?this.logger.debug(`hybrid/read - id: [${r}], filesystem: ${(0,SL.inspect)(n)}`):this.logger.debug(`hybrid/read - id: [${r}], nothing on the filesystem`);let i=await this.secureStore.retrieve(l8(t),r);if(i?this.logger.debug(`hybrid/read - id: [${r}]. Found sensitive data in secure store`):this.logger.debug(`hybrid/read - id: [${r}], nothing in the secure store`),n||i)return{...n,...i}}async getAll({entityName:t,includeSensitiveData:r=!0}){return Object.values(await this.readAll({entityName:t,includeSensitiveData:r}))}async readAll({entityName:t,includeSensitiveData:r=!0}){let n={},i=await this.filesystem.readAll({entityName:t})||{},s=Object.keys(i).length===0;if(!r&&!s)return i;let o=await this.secureStore.getAll(l8(t))||{};for(let a of new Set([...Object.keys(i),...Object.keys(o)])){let u={...i[a],...o[a]};n[a]=u}return n}async write({entityName:t,id:r,entity:n}){let i=TCt(n),s=c8(n);if(i.length>0&&s.length>0)for(let u=0;u<i.length;u=u+1)s.indexOf(i[u])!==-1&&(this.logger.debug(`hybrid/write - [${String(i[u])}] is also marked as sensitive. Not writing to filesystem`),i.splice(u,1));let o=Tye(n,...i);yL(n,i)?(this.logger.debug(`hybrid/write - writing serializable properties: ${(0,SL.inspect)(o)}`),await this.filesystem.write({entityName:t,id:r,entity:o})):this.logger.debug(`hybrid/write - no serializable properties found in ${(0,SL.inspect)(o)}`);let a=Tye(n,...s);return yL(a,s)?(this.logger.debug(`hybrid/write - writing sensitive properties to secure store. ID: [${r}]`),await this.secureStore.save(l8(t),r,a)):this.logger.debug(`hybrid/write - no sensitive properties found in ${(0,SL.inspect)(n)}`),n}async del({entityName:t,id:r}){let n=await this.filesystem.del({entityName:t,id:r});this.logger.debug(`hybrid/del - delete result for id [${r}] on the filesystem: ${n}`);let i=await this.secureStore.delete(l8(t),r);return this.logger.debug(`hybrid/del - delete result for id [${r}] in the secure store: ${i}`),n||i}async partialUpdate({entityName:t,id:r,entity:n}){return this.filesystem.partialUpdate({entityName:t,id:r,entity:n})}};function f8(e,t){return new Oye(e,t)}var tc=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},rc=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},ui=class{name;url;client;userDisplayName;systemType;connectionType;authenticationType;hasSensitiveData;systemInfo;serviceKeys;refreshToken;username;password;constructor({name:t,url:r,client:n,systemType:i,serviceKeys:s,refreshToken:o,username:a,password:u,userDisplayName:c,authenticationType:l,connectionType:f,systemInfo:p}){this.name=t,this.url=r,this.client=n,this.systemType=i,this.serviceKeys=s,this.refreshToken=o,this.username=a,this.password=u,this.userDisplayName=c,this.authenticationType=l,this.connectionType=f;let d=c8(this);this.hasSensitiveData=yL(this,d),this.systemInfo=p}};tc([ml,rc("design:type",String)],ui.prototype,"name",void 0);tc([ml,rc("design:type",String)],ui.prototype,"url",void 0);tc([ml,rc("design:type",String)],ui.prototype,"client",void 0);tc([ml,rc("design:type",String)],ui.prototype,"userDisplayName",void 0);tc([ml,rc("design:type",String)],ui.prototype,"systemType",void 0);tc([ml,rc("design:type",String)],ui.prototype,"connectionType",void 0);tc([ml,rc("design:type",String)],ui.prototype,"authenticationType",void 0);tc([ml,rc("design:type",Boolean)],ui.prototype,"hasSensitiveData",void 0);tc([ml,rc("design:type",Object)],ui.prototype,"systemInfo",void 0);tc([gS,rc("design:type",Object)],ui.prototype,"serviceKeys",void 0);tc([gS,rc("design:type",String)],ui.prototype,"refreshToken",void 0);tc([gS,rc("design:type",String)],ui.prototype,"username",void 0);tc([gS,rc("design:type",String)],ui.prototype,"password",void 0);var fa=class e{url;client;static from(t){return new e({url:t.url,client:t.client})}constructor({url:t,client:r}){this.url=t.trim().replace(/\/$/,""),this.client=r?.trim()}getId(){return this.url+`${this.client?"/"+this.client:""}`}};var Ey;(function(e){e.BackendSystem="system",e.SystemMigrationStatus="systemMigrationStatus",e.TelemetrySetting="telemetrySetting",e.ApiHub="apiHub"})(Ey||(Ey={}));var Pye=require("node:path"),p8=require("node:fs"),ACt=class{dataAccessor;entityName=Ey.BackendSystem;logger;constructor(e,t={}){this.logger=e,this.dataAccessor=f8(this.logger,t)}async read(e){return this.dataAccessor.read({entityName:this.entityName,id:e.getId()})}async write(e){let t;return e instanceof ui?t=e:t=new ui({...e}),this.dataAccessor.write({entityName:this.entityName,id:fa.from(e).getId(),entity:t})}async delete(e){return this.dataAccessor.del({entityName:this.entityName,id:fa.from(e).getId()})}async getAll(e){let t=this.isMigrationRequired(),{includeSensitiveData:r=!0,backendSystemFilter:n}=e??{},i=await this.dataAccessor.readAll({entityName:this.entityName,includeSensitiveData:t?!0:r});return await this.migrateBackendSystems(i,r)||(i=await this.dataAccessor.readAll({entityName:this.entityName,includeSensitiveData:r})),this.applyFilters(Object.values(i),n)}isMigrationRequired(){let e=(0,Pye.join)(vy(),".systemsMigrated");try{let t=(0,p8.readFileSync)(e,"utf-8");return!JSON.parse(t)?.backendSystemMigrationV1}catch{return!0}}applyFilters(e,t={}){return t.connectionType||(t.connectionType="abap_catalog"),e.filter(r=>Aye(r,t))}async migrateBackendSystems(e,t){let r=!0;for(let[n,i]of Object.entries(e)){if(i?.hasSensitiveData!==void 0&&i?.systemType!==void 0&&i?.connectionType!==void 0)continue;r=!1;let o=await this.buildMigratedSystem(i,t,n);await this.dataAccessor.partialUpdate({entityName:this.entityName,id:n,entity:{hasSensitiveData:o.hasSensitiveData,systemType:o.systemType,connectionType:o.connectionType}})}if(!r){let n=(0,Pye.join)(vy(),".systemsMigrated"),i={backendSystemMigrationV1:new Date().toISOString()};(0,p8.writeFileSync)(n,JSON.stringify(i,null,2))}return r}async buildMigratedSystem(e,t,r){let n=e;t||(n=await this.dataAccessor.read({entityName:this.entityName,id:r}));let i=n.systemType??gL(n)??"OnPrem",s=n?.connectionType??_ye.AbapCatalog;return new ui({...n,systemType:i,connectionType:s})}};var nc=require("node:fs"),Wx=require("node:path");var Dye=class{dataProvider;logger;constructor(t,r={}){this.logger=t,this.dataProvider=new ACt(this.logger,r)}async partialUpdate(t,r){this.validatePartialUpdateInput(r);let n=await this.readOrThrow(t),i=this.mergeProperties(r,n);return this.write(i,{force:!0})}mergeProperties(t,r){let n={...t};delete n.url,delete n.client;let i={...r,...n};return new ui({...i})}async readOrThrow(t){let r=await this.read(t);if(!r)throw new Error(ec("error.systemDoesNotExist",{system:t}));return r}validatePartialUpdateInput(t){if(!t||!Object.keys(t).length)throw new Error(ec("error.noPropertiesSpecified"))}async read(t){return this.dataProvider.read(t)}async write(t,r){let n=fa.from(t),i=await this.read(fa.from(t));if(!r?.force&&i)throw new Error(ec("error.backendSystemEntityKeyExists",{entityKey:n.getId()}));return this.dataProvider.write(t)}async delete(t){return this.dataProvider.delete(t)}async getAll(t){return this.dataProvider.getAll(t)}};function xCt(e,t={}){if(!t.baseDirectory){try{TTn()}catch(r){e.error(ec("error.systemsJsonMigrationFailed",{error:r.message}))}t.baseDirectory=vy()}return new Dye(e,t)}function TTn(){let e=EL(dS.BackendSystem),t=(0,Wx.join)(vL(),e),r=(0,Wx.join)(vy(),e),n=(0,Wx.join)(vy(),".systemsMigrated");if(!(0,nc.existsSync)(t))return;let i=JSON.parse((0,nc.readFileSync)(t,"utf-8")).systems;(0,nc.existsSync)(n)?ATn(r,i):((0,nc.mkdirSync)((0,Wx.dirname)(r),{recursive:!0}),(0,nc.writeFileSync)(r,JSON.stringify({systems:i},null,2)),(0,nc.writeFileSync)(n,new Date().toISOString()));let s={};for(let[o,a]of Object.entries(i))s[o]={...a,_migrated:!0};(0,nc.writeFileSync)(t,JSON.stringify({systems:{...s}},null,2))}function ATn(e,t){let r=!1,n={};for(let[i,s]of Object.entries(t))s._migrated||(n[i]={...s},r=!0);if(r){let i=JSON.parse((0,nc.readFileSync)(e,"utf-8")).systems;(0,nc.writeFileSync)(e,JSON.stringify({systems:{...i,...n}},null,2))}}var xTn=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},wTn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},bL=class{enableTelemetry;constructor({enableTelemetry:t}){this.enableTelemetry=t}};xTn([ml,wTn("design:type",Boolean)],bL.prototype,"enableTelemetry",void 0);var _y=class{getId(){return"telemetrySetting"}};var wCt=class{dataAccessor;entityName=Ey.TelemetrySetting;logger;constructor(e){this.logger=e,this.dataAccessor=s8(this.logger)}read(e){return this.dataAccessor.read({entityName:this.entityName,id:e.getId()})}write(e){return this.dataAccessor.write({entityName:this.entityName,id:new _y().getId(),entity:e})}delete(e){return this.dataAccessor.del({entityName:this.entityName,id:new _y().getId()})}getAll(){return this.dataAccessor.getAll({entityName:this.entityName})}};var Rye=class{dataProvider;logger;constructor(t){this.logger=t,this.dataProvider=new wCt(this.logger)}async partialUpdate(){throw new Error("NOT IMPLEMENTED")}async read(t){return this.dataProvider.read(t)}async write(t){return this.dataProvider.write(t)}async delete(t){return this.dataProvider.delete(t)}async getAll(){return this.dataProvider.getAll()}};function CCt(e){return new Rye(e)}var CTn=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},OTn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},TL=class{apiKey;constructor({apiKey:t}){this.apiKey=t}};CTn([gS,OTn("design:type",String)],TL.prototype,"apiKey",void 0);var Ih=class e{static SINGLETON="API_HUB_API_KEY";getId(){return e.SINGLETON}};var OCt=class{dataAccessor;entityName=Ey.ApiHub;logger;constructor(e,t={}){this.logger=e,this.dataAccessor=f8(this.logger,t)}read(e){return this.dataAccessor.read({entityName:this.entityName,id:e.getId()})}write(e){return this.dataAccessor.write({entityName:this.entityName,id:Ih.SINGLETON,entity:e})}delete(e){return this.dataAccessor.del({entityName:this.entityName,id:Ih.SINGLETON})}getAll(){return this.dataAccessor.getAll({entityName:this.entityName})}};var PCt="fiori/system/apiHub",DCt="API_HUB_API_KEY";async function RCt({dataProvider:e,secureStore:t,logger:r}){let n=await t.retrieve(PCt,DCt);if(n)r.info(ec("info.legacyApiHubKeyFound"));else{r.debug(ec("info.noLegacyApiHubKeyFound"));return}await e.read(new Ih)?r.info(ec("info.legacyApiHubKeyNotMigrated")):(await e.write(new TL({apiKey:n})),r.info(ec("info.legacyApiHubKeyMigrated"))),await t.delete(PCt,DCt),r.info(ec("info.legacyApiHubKeyDeleted"))}var d8=class{dataProvider;logger;secureStore;migrationDone=!1;key=new Ih;constructor(t){this.logger=t,this.dataProvider=new OCt(this.logger)}async migrate(){this.migrationDone||(this.secureStore||(this.secureStore=u8(this.logger)),await RCt({logger:this.logger,secureStore:this.secureStore,dataProvider:this.dataProvider}),this.migrationDone=!0)}async partialUpdate(){throw await this.migrate(),new Error("NOT IMPLEMENTED")}async read(){return await this.migrate(),this.dataProvider.read(this.key)}async write(t){return await this.migrate(),this.dataProvider.write(t)}async delete(t){return await this.migrate(),this.dataProvider.delete(t)}async getAll(){return await this.migrate(),this.dataProvider.getAll()}};function NCt(e){return new d8(e)}var ICt=()=>new vs({transports:[new Pm]});var PTn={system:xCt,telemetrySetting:CCt,"api-hub":NCt};async function yS({logger:e=ICt(),entityName:t,options:r={}}){await fCt();let n=PTn[t];if(n)return n(e,r);throw new Error(ec("error.unsupportedEntity",{entityName:t}))}var LCt=be(require("node:os"),1),MCt=be(require("node:path"),1),FCt=be(require("node:fs"),1);var DTn={win32:"\\AppData\\Roaming\\Code\\User\\settings.json",darwin:"/Library/Application Support/Code/User/settings.json",linux:"/.config/Code/User/settings.json",theia:"/.theia/settings.json"},RTn=["sap.ux.annotation.lsp.enableTelemetry","sap.ux.applicationModeler.enableTelemetry","sap.ux.help.enableTelemetry","sap.ux.serviceModeler.enableTelemetry"],NTn=e=>{let t=process.platform,r=e[t];if(Vr()&&(r=e.theia),!r)return null;let n=LCt.default.homedir();return MCt.default.join(n,r)};async function ITn(e){let t;try{t=await e.read(new _y)}catch{}if(t)Eo.telemetryEnabled=t.enableTelemetry;else{let r=NTn(DTn);if(!r)await h8(!0);else{let n;try{n=await FCt.default.promises.readFile(r,"utf-8");let i=JSON.parse(n),o=RTn.map(a=>i[a]??!0).reduce((a,u)=>a&&u,!0);await h8(o)}catch{await h8(!0)}}}}function LTn(e){i8(dS.TelemetrySetting,()=>{e.read(new _y).then(t=>{t&&(Eo.telemetryEnabled=t.enableTelemetry)}).catch(()=>{})})}var AL=async e=>{try{Eo.consumerModuleName=e.consumerModule.name,Eo.consumerModuleVersion=e.consumerModule.version,Z5.internalFeature=e.internalFeature??!1,e.resourceId&&(Eo.azureInstrumentationKey=e.resourceId);let t=await yS({entityName:"telemetrySetting"});await ITn(t),e.watchTelemetrySettingStore&<n(t)}catch(t){uCt(t)}};async function h8(e){try{let r=await yS({entityName:"telemetrySetting"}),n=new bL({enableTelemetry:e});await r.write(n),Eo.telemetryEnabled=e}catch{}let t=await dye();cCt(e,t)}var ic=class e{static clientMap=new Map;static getTelemetryClient(){return e.getTelemetryClientByClass(BR)}static getTelemetryClientByClass(t){let r=e.clientMap.get(t.name);if(r)return r;let n=t;return r=new n(Eo.azureInstrumentationKey,Eo.consumerModuleName,Eo.consumerModuleVersion),e.clientMap.set(t.name,r),r}};var gl;(function(e){e.START_MARK="START_MARK",e.END_MARK="END_MARK",e.MEASUREMENT="MEASUREMENT"})(gl||(gl={}));var m8=class{static initTiming;static enteries;static initialize;static startMark;static endMark;static measure;static getEntries;static getEntriesByName;static getEntriesByType;static getEntriesByNameType;static getMeasurementDuration;static clearEntries};var xL=class{startTime;name;type;getStartTime(){return this.startTime}constructor(t,r,n){this.startTime=n,this.name=t,this.startTime=n,this.type=r}},g8=class extends xL{startTime;duration;constructor(t,r,n){super(t,gl.MEASUREMENT,r),this.startTime=r,this.duration=n,this.duration=n}getDurationTime(){return this.duration}};var UCt=require("node:perf_hooks"),MTn=()=>UCt.performance.now(),Cs=class e extends m8{static initTiming;static now=MTn;static entries=[];static initialize(){e.initTiming=e.now()}static mark(t,r,n){let i=new xL(t,r,n);e.entries.push(i)}static startMark(t){let r=e.now(),n=t+r;return e.mark(n,gl.START_MARK,r),n}static endMark(t){let r=e.now();e.mark(t,gl.END_MARK,r)}static measure(t){let r=e.getEntriesByNameType(t,gl.START_MARK).slice(-1)[0],n=e.getEntriesByNameType(t,gl.END_MARK).slice(-1)[0];if(!r&&!n)throw new Error(`Failed to execute 'measure': mark '${t}' doesn't exist.`);if(!r||!n){let u=r?gl.END_MARK:gl.START_MARK;throw new Error(`Failed to execute 'measure': mark '${t}'of type '${u}' doesn't exist.`)}let i=r.getStartTime(),o=n.getStartTime()-i,a=new g8(`${t}`,e.now(),o);e.entries.push(a)}static getEntries(){return e.entries}static getEntriesByName(t){return e.entries.filter(r=>r.name===t)}static getEntriesByNameType(t,r){return e.entries.filter(n=>n.name===t&&n.type===r)}static getEntriesByType(t){return e.entries.filter(r=>r.type===t)}static getMeasurementDuration(t){return e.getEntriesByNameType(t,gl.MEASUREMENT).slice(-1)[0].getDurationTime()}static clearEntries(){e.entries=[]}};Cs.initialize();var FTn=(e,t)=>new Error(`Wrong path for '${e}' field is specified in instructions with index - ${t}`),UTn=(e,t,r,n)=>{let i=t.split("/"),s=e,o=0;for(;o<i.length;){if(s=s[i[o]],s===void 0)throw FTn(r,n);o++}return s},kCt=(e,t)=>{let r={},n={},i=null;t.paramIndex!==void 0&&(i=e[t.paramIndex]);let s=t.key?t.key:"data",o="";return typeof t.value=="string"?o=t.value:t.value!==void 0&&t.paramIndex!==void 0?o=UTn(i,t.value.path,"val",t.paramIndex):o=i,typeof o=="number"&&!Number.isNaN(o)?n[s]=o:r[s]=o,[r,n]},Nye=(e,t)=>{let r,n,i={},s={};if(Array.isArray(t))for(let o of t)[r,n]=kCt(e,o),i={...i,...r},s={...s,...n};else[i,s]=kCt(e,t);return[i,s]};var BCt=(e,t,r,n)=>(...i)=>{let s=t.apply(e,i);return ic.getTelemetryClient().report(r,{},{},n),s},qCt=(e,t,r,n)=>async(...i)=>{let s=await t.apply(e,i);return ic.getTelemetryClient().report(r,{},{},n),s},jCt=(e,t,r,n)=>(...i)=>{let s=Cs.startMark("mark"),o=t.apply(e,i);Cs.endMark(s),Cs.measure(s);let a=Cs.getMeasurementDuration(s);return ic.getTelemetryClient().report(r,{},{ms:a},n),o},VCt=(e,t,r,n)=>async(...i)=>{let s=Cs.startMark("mark"),o=await t.apply(e,i);Cs.endMark(s),Cs.measure(s);let a=Cs.getMeasurementDuration(s);return ic.getTelemetryClient().report(r,{},{ms:a},n),o},GCt=(e,t,r,n,i)=>(...s)=>{let o=t.apply(e,s),[a,u]=Nye(s,i);return ic.getTelemetryClient().report(r,a,u,n),o},$Ct=(e,t,r,n,i)=>async(...s)=>{let o=await t.apply(e,s),[a,u]=Nye(s,i);return ic.getTelemetryClient().report(r,a,u,n),o};var Lh;(function(e){e.NOTIFICATION="notify",e.DURATION="duration",e.CAPTURE_PARAM="captureParam"})(Lh||(Lh={}));var y8=new Map;y8.set(Lh.NOTIFICATION,BCt);y8.set(Lh.DURATION,jCt);y8.set(Lh.CAPTURE_PARAM,GCt);var v8=new Map;v8.set(Lh.NOTIFICATION,qCt);v8.set(Lh.DURATION,VCt);v8.set(Lh.CAPTURE_PARAM,$Ct);var JOt=be(k8(),1);var SS=class e{static _telemetryData;static _previousEventTimestamp;static get telemetryData(){return this._telemetryData}static async initTelemetrySettings(t){await AL(t)}static createTelemetryData(t,r=!1){let n=new Date().getTime();if(this._previousEventTimestamp||(r=!1,this._previousEventTimestamp=n),!this._telemetryData){let i=rg("telemetry.unknownOs");try{i=(0,JOt.default)()}catch{}this._telemetryData={Platform:kc().technical,OperatingSystem:i}}if(r){let i={...this._telemetryData,...t};if(Math.abs(this._previousEventTimestamp-n)<1e3&&JSON.stringify(i)===JSON.stringify(this._telemetryData))return}return this._previousEventTimestamp=n,this._telemetryData=Object.assign(this._telemetryData,t),this._telemetryData}static markAppGenStartTime(){e.createTelemetryData({markName:Cs.startMark("LOADING_TIME")})}static markAppGenEndTime(){this._telemetryData?.markName&&(Cs.endMark(this._telemetryData.markName),Cs.measure(this._telemetryData.markName))}};var a1n=be(RIt(),1),f4=be(K0(),1);var{getExtensionLogger:u1n}=a1n,c1n="ApplicationWizard.loggingLevel",d4={fatal:e=>{console.log(e)},error:e=>{console.error(e)},warn:e=>{console.warn(e)},info:e=>{console.log(e)},debug:e=>{console.log(e)},trace:e=>{console.trace(e)},getChildLogger:()=>d4,getLogLevel:()=>"off",log:function(e){console.log(e instanceof Object?e.message:e)},add:function(){return console.warn("Log method `add(transport)` not implemented."),this},remove:function(){return console.warn("Log method `remove(transport)` not implemented."),this},transports:function(){return console.warn("Logger method `transports()` not implemented."),[]},child:function(){return console.warn("Log method `remove(transport)` not implemented. Returning current logger."),this}},NIt={off:-1,fatal:0,error:1,warn:2,info:3,debug:4,trace:5};function l1n(e,t="off"){return u1n({extName:e,level:t,logConsole:!0})}var p4=class e{static _vscodeLogger;static _yoLogger;static _logLevel;static consoleFormat=f4.format.combine(f4.format.timestamp({format:"YYYY-MM-DD HH:mm:ss"}),f4.format.printf(t=>`[${t.timestamp}] ${t.level.toUpperCase()}: ${t.message}`));constructor(t,r,n,i,s){e._yoLogger=r,i?(e._logLevel=s?s.workspace.getConfiguration().get(c1n):n??"info",e._vscodeLogger=i.getChildLogger({label:t})):(e._yoLogger||(e._vscodeLogger=l1n(t,n)),e._logLevel=n==="off"||!n?"info":n),e._vscodeLogger?.debug(rg("logMessages.debug.loggingConfigured",{logLevel:e._logLevel}))}static logAtLevel=(t,r,...n)=>{typeof r=="object"&&(r=JSON.stringify(r)),e._vscodeLogger&&t!=="off"&&e._vscodeLogger[t](r,...n),e._yoLogger?NIt[t]<=NIt[e._logLevel]&&e._yoLogger(e.consoleFormat.transform({level:t,message:r})[Symbol.for("message")]):d4.error(rg("logMessages.error.logWrapperNotInitialised"))};fatal(t,...r){e.logAtLevel("fatal",t,...r)}error(t,...r){e.logAtLevel("error",t,...r)}warn(t,...r){e.logAtLevel("warn",t,...r)}info(t,...r){e.logAtLevel("info",t,...r)}debug(t,...r){e.logAtLevel("debug",t,...r)}trace(t,...r){e.logAtLevel("trace",t,...r)}static log(t){e.logAtLevel("info",t)}getLogLevel(){return e._logLevel}getChildLogger(){return e.logAtLevel("trace","Log method `getChildLogger()` not implemented. Returning current logger."),this}log(t){e.logAtLevel("info",t.message??t)}add(){return e.logAtLevel("warn","Log method `add(transport)` not implemented."),this}remove(){return e.logAtLevel("warn","Log method `remove(transport)` not implemented."),this}transports(){return e.logAtLevel("warn","Log method `transports()` not implemented."),[]}child(){return e.logAtLevel("warn","Log method `child(options)` not implemented. Returning current logger."),this}};var IIt=be(require("node:os"),1),LIt=require("node:path"),MIt=be(ta(),1);var d8i=(0,LIt.join)(IIt.default.homedir(),"projects");var dEe=require("node:path"),FIt=require("node:url"),m8i=(0,dEe.dirname)((0,FIt.fileURLToPath)(__importMetaUrl));function hEe(e,t){e.conflicter&&(e.conflicter.force=t??!0),e.conflicterOptions&&(e.conflicterOptions.force=t??!0)}var F4=require("node:path"),pMt=require("node:url"),uNn=be(PI(),1),cNn=be(Fx(),1);var jIt=be(PI(),1),VIt=be(Fx(),1);var UIt=require("node:path");function kIt(e,t,r){let n=(0,UIt.join)(t,"package.json"),i=e.readJSON(n);f1n(i,r?.mockserverModule,r?.mockserverVersion),p1n(e,i),e.writeJSON(n,i)}function f1n(e,t="@sap-ux/ui5-middleware-fe-mockserver",r="2"){if(e.devDependencies=e.devDependencies??{},delete e.devDependencies["@sap/ux-ui5-fe-mockserver-middleware"],e.devDependencies[t]=r,h1n(e.devDependencies))g1n(e);else{e.ui5||={},e.ui5.dependencies||=[];let n=e.ui5.dependencies.filter(i=>i!=="@sap/ux-ui5-fe-mockserver-middleware");n.includes(t)||n.push(t),e.ui5.dependencies=n}}function p1n(e,t){t.scripts||={},t.scripts["start-mock"]=d1n(t.scripts.start)??t.scripts["start-mock"]??'fiori run --config ./ui5-mock.yaml --open "/"'}function d1n(e){if(typeof e!="string")return;let t="fiori run",r=e.indexOf(t);if(r<0)return;let n=e.indexOf("--config",r);return n<0?e.replace(t,`${t} --config ./ui5-mock.yaml`):m1n(e,n)}function h1n(e){let t=!1;try{let r=e["@ui5/cli"];typeof r=="string"&&(t=Number.parseInt(r.split(".")[0].match(/\d+/)?.[0]||"0",10)>2)}catch{}return t}function m1n(e,t){let r=t+8+1,n=e.slice(r).search(/[^\s]/)+r,i=" ",s=0;(e[n]==='"'||e[n]==="'")&&(i=e[n],s=1);let o=e.indexOf(i,n+s);return o=o===-1?e.length:o+s,`${e.substring(0,r)}./ui5-mock.yaml${e.substring(o)}`}function g1n(e){let t=new Set(["@sap/ux-ui5-fe-mockserver-middleware","@sap-ux/ui5-middleware-fe-mockserver"]);e.ui5?.dependencies&&Array.isArray(e.ui5.dependencies)&&(e.ui5.dependencies=e.ui5.dependencies.filter(r=>!t.has(r)),e.ui5.dependencies.length===0&&delete e.ui5.dependencies),e.ui5&&Object.keys(e.ui5).length===0&&delete e.ui5}var Xs=require("node:path");function h4(e,t="OData"){let r={},n=e["sap.app"]?.dataSources??{};for(let i in n)n[i].uri&&n[i].type===t&&(r[i]=n[i]);return r}async function BIt(e,t,r,n){let i=!!n?.overwrite,s=(0,Xs.join)(t,"ui5-mock.yaml"),o,a=e.readJSON((0,Xs.join)(r,"manifest.json")),u=Object.values(h4(a,"ODataAnnotation")),c=[];u.forEach(d=>{if(d.settings?.localUri!==d.uri){let h=d.settings?.localUri;c.push({localPath:h?`.${Xs.posix.sep}${(0,Xs.relative)(t,(0,Xs.join)(r,h)).replaceAll(Xs.sep,Xs.posix.sep)}`:void 0,urlPath:d.uri})}});let l=h4(a),f=[];for(let d in l){let h=l[d].settings?.localUri,g=n?.resolveExternalServiceReferences?.[d];f.push({serviceName:d,servicePath:l[d].uri,metadataPath:h?`.${Xs.posix.sep}${(0,Xs.relative)(t,(0,Xs.join)(r,h)).replaceAll(Xs.sep,Xs.posix.sep)}`:void 0,resolveExternalServiceReferences:g})}e.exists(s)?o=await y1n(e,t,r,s,f,c,i):o=e.exists((0,Xs.join)(t,"ui5.yaml"))?await v1n(e,t,r,f,c):await E1n(a["sap.app"]?.id||"",t,r,f,c);let p=o.toString();e.write(s,p)}async function y1n(e,t,r,n,i,s,o=!1){let a=await Po.newInstance(e.read(n));if(o){let u=await qIt(t,r,i,s);a.updateCustomMiddleware(u)}else for(let u in i)a.addServiceToMockserverMiddleware(t,r,i[u],s);return a}async function v1n(e,t,r,n,i){let s=await Ax(t,St.Ui5Yaml,e),o=await qIt(t,r,n,i);return s.updateCustomMiddleware(o),s}async function E1n(e,t,r,n,i){let s=await Po.newInstance(`# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
|
|
722
722
|
|
|
723
|
-
specVersion: "2.5"`);return s.setMetadata({name:e}),s.setType("application"),s.addFioriToolsProxyMiddleware({ui5:{}}),s.addFioriToolsAppReloadMiddleware(),s.addMockServerMiddleware(t,r,n,i),s}async function qIt(e,t,r,n){let i=await Po.newInstance("");i.addMockServerMiddleware(e,t,r,n);let s=i.findCustomMiddleware("sap-fe-mockserver");if(!s)throw Error("Could not create new mockserver config");return s}async function m4(e,t,r){return r||(r=(0,VIt.create)((0,jIt.create)())),t.packageJsonConfig?.skip||kIt(r,e,t.packageJsonConfig),await BIt(r,e,t.webappPath,t.ui5MockYamlConfig),r}var _1n=be(PI(),1),S1n=be(Fx(),1);var GIt={questions:{pathToMock:"Path to mocked service",overwrite:"Overwrite services"}};var mEe="mockserver-config-writer",$It;async function A1n(){$It=kr.createInstance({resources:{en:{[mEe]:GIt}},lng:"en",fallbackLng:"en",defaultNS:mEe,ns:[mEe],showSupportNotice:!1}),await $It.init()}A1n().catch(()=>{});var HIt={error:{requiredProjectFileNotFound:"Invalid project structure. Cannot find the required file: {{-path}}.",requiredProjectPropertyNotFound:"The required project property: {{-property}} was not found in the file: {{-path}}.",requiredServiceAlreadyExists:"A service with the {{-uri}} URI already exists. Choose another service.",unparseableXML:"Unparseable XML was specified: {{-error}}."}};var gEe="odata-service-writer",w1n=kr.createInstance();async function C1n(){await w1n.init({resources:{en:{[gEe]:HIt}},lng:"en",fallbackLng:"en",defaultNS:gEe,ns:[gEe],showSupportNotice:!1})}C1n().catch(()=>{});var D1n=be(g4(),1);var Kn;(function(e){e.v2="2",e.v4="4"})(Kn||(Kn={}));var oM;(function(e){e.EDMX="edmx",e.CDS="cds"})(oM||(oM={}));var yEe="mainService";var MEe=require("node:path"),uMt=require("node:path/posix"),cMt=be(g4(),1),lMt=be(Oy(),1),fMt=be(Dy(),1);var oMt=4;function M4(e,t,r,n=yEe,i){if(!r.length||!i)return;let s=new Set;for(let o of r){let a=rNn(i,o.path),u=[t,ai.LocalService,n,a],c=o.path.split(";")[0];if(o.entityData&&!s.has(c)){for(let f of o.entityData){let p=(0,MEe.join)(...u,`${f.entitySetName}.json`);e.write(p,JSON.stringify(f.items,void 0,oMt))}s.add(c)}o.type==="value-list"&&u.push(o.target),u.push("metadata.xml");let l=(0,MEe.join)(...u);o.metadata&&e.write(l,(0,cMt.default)(o.metadata,{indent:oMt}))}}function rNn(e,t){let[r]=t.split(";"),n=r.split("/"),i="/",s=n.shift();for(;s!==void 0;){let o=(0,uMt.join)(i,s);if(!e.startsWith(o))break;i=o,s=n.shift()}return r.replace(i,"")}var LEe={valueListReferences:!0,codeLists:!0};function nNn(e){return e?{valueListReferences:e.valueListReferences??LEe.valueListReferences,codeLists:e.codeLists??LEe.codeLists}:{...LEe}}function fM(e,t,r=[],n){let i=nNn(n);if(!t)return[];let s=[t,...r.map(a=>a.Definitions)],o=[];for(let a of s){let u=typeof a=="string"?(0,lMt.convert)((0,fMt.parse)(a)):a;for(let c of Object.values(u.annotations))for(let l of c){let f=l.target.replace(u.namespace+".","");iNn(i,o,f,l,e)}}return o}function iNn(e,t,r,n,i){for(let s of n.annotations)sNn(e,t,r,s,i),oNn(e,t,s,i)}function sNn(e,t,r,n,i){if(e.valueListReferences&&n.term==="com.sap.vocabularies.Common.v1.ValueListReferences"){for(let s of n.collection??[])if(s.type==="String"){let o=s;t.push({type:"value-list",serviceRootPath:i,target:r,value:o.String})}}}function oNn(e,t,r,n){if(e.codeLists&&(r.term==="com.sap.vocabularies.CodeList.v1.CurrencyCodes"||r.term==="com.sap.vocabularies.CodeList.v1.UnitsOfMeasure")&&r.record){let i=aMt(r.record,"CollectionPath"),s=aMt(r.record,"Url");s&&t.push({type:"code-list",serviceRootPath:n,value:s,collectionPath:i??void 0})}}function aMt(e,t){let r=e.propertyValues.find(n=>n.name===t);if(r?.value?.type==="String")return r.value.String}var aNn=be(ta(),1);var L6i=(0,F4.dirname)((0,pMt.fileURLToPath)(__importMetaUrl));var e0=require("node:path"),A4t=be(g4()),x4t=be(xUt());var wUt={errors:{odataQueryError:"An error occurred when querying for odata: {{error}}. $t(texts.seeLogForDetails)",dataNotFetched:"Data was not fetched",entityModelLoading:"An error occurred when reading the data model: {{- error}}. $t(texts.seeLogForDetails)"},info:{loggingInitialised:"Logger has been configure with level: {{logLevel}}",noServiceEntityData:"No service entity data to write.",noValueHelpData:"No Value Help service data to write.",entityFilesToBeGenerated:"The following entity files will be created: {{entities}}",noListEntityDefined:"No list entity defined. A main list entity is required to download data.",hierarchyEntityQuery:"Fetching hierarchy data for entity set: {{entitySetName}}...",hierarchyFilesGenerated:"The following hierarchy data files were created: {{entities}}"},texts:{seeLogForDetails:"For more information, view the logs.",rows_one:"{{count}} row",rows_other:"{{count}} rows",generatorTitle:"SAP Fiori Elements Data Downloader"},prompts:{appSelection:{message:"Select an application as data download target",breadcrumb:"Selected App",validation:{specficationApiVersionOutdated:"The found version of @sap/ux-specification {{specApiVersion}} is too old. Data download cannot proceed.",selectedPathDoesNotContainValidApp:"The selected path does not contain a valid application. {{- error}}",appMainServiceOdataVersionNotSupported:"The selected apps main service odata version is '{{serviceOdataVersion}}'. Please select an app with a main service odata version '4'."}},relatedEntitySelection:{message:"Select entities for data download (pre-selected entities are referenced by the application)"},toggleSelection:{message:"Reset selection",labelTrue:"Clear selected",labelFalse:"Restore default selection"},entityKey:{message:"Enter values for: {{keyName}}",hint:"For range selection use '-' between values. Use commas to select non-contiguous values.",validation:{invalidKeyValueChars:"Invalid key value contain not allowed characters: {{chars}}",invalidRangeSpecified:"Invalid range specified, only the lowest and highest values allowed. e.g. '1-10'",invalidBooleanValue:"Invalid Boolean value entered. Please enter true or false.",invalidGuidValue:"Invalid GUID format. Expected format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}},skipDataDownload:{message:"If data download is not required select this option and proceed to Value Help download",hint:"Use this to temporarily disable live queries when entering multiple inputs and re-enable when ready",labelTrue:"Execute the OData query (data files will be generated on finish)",labelFalse:"Suppress the OData query (prevents multiple queries during selections)",querySuccess:'OData query success. $t(texts.rows, {"count": "{{count}}") returned. $t(texts.seeLogForDetails)',validation:{keyRequired:"Please enter at least one key field value to run the OData query"},choiceLabel:"Skip data download"},updateMainServiceMetadata:{message:"Update local metadata file from backend (remote service metadata is always used for data download):",validation:{errorLoadingAppOrMainService:"An error occurred while loading the application. Please correct the issue to proceed: {{- error}}"}},valueHelpSelection:{message:"Select Value Help data"}},steps:{odataDownloader:{name:"Configure Data Download",description:"Download data from an OData service for use with the UX Tools Mockdata Server"},valueHelpSelection:{name:"Value Help selection",description:"Value Help selection"},addConstraints:{name:"Add Missing Constraints",description:"Add Missing Constraints"}},telemetry:{unknownOs:"Unknown"}};var CUt=kr.createInstance(),r6="odata-dowload-generator";async function S_e(){await CUt.init({resources:{en:{[r6]:wUt}},lng:"en",fallbackLng:"en",defaultNS:r6,ns:[r6],missingInterpolationHandler:()=>"",showSupportNotice:!1})}function It(e,t){return t?.ns||(t=Object.assign(t??{},{ns:r6})),CUt.t(e,t)}S_e().catch(e=>console.error("Failed to initialize i18n:",e));var vTe=require("@sap-devx/yeoman-ui-types");var b_e;(function(e){e.official="officialVersions",e.snapshot="snapshotsVersions",e.support="support"})(b_e||(b_e={}));var n6="1.65.0";var i6=be(ta(),1);var TM=be(ta(),1);var Ne={maintenance:"Maintenance",outOfMaintenance:"Out of maintenance",skipped:"Skipped"},ZLn=[{version:"1.147.*",support:Ne.maintenance},{version:"1.146.*",support:Ne.maintenance},{version:"1.145.*",support:Ne.maintenance},{version:"1.144.*",support:Ne.outOfMaintenance},{version:"1.143.*",support:Ne.outOfMaintenance},{version:"1.142.*",support:Ne.maintenance},{version:"1.141.*",support:Ne.outOfMaintenance},{version:"1.140.*",support:Ne.outOfMaintenance},{version:"1.139.*",support:Ne.outOfMaintenance},{version:"1.138.*",support:Ne.outOfMaintenance},{version:"1.136.*",support:Ne.maintenance},{version:"1.135.*",support:Ne.outOfMaintenance},{version:"1.134.*",support:Ne.outOfMaintenance},{version:"1.133.*",support:Ne.outOfMaintenance},{version:"1.132.*",support:Ne.outOfMaintenance},{version:"1.131.*",support:Ne.outOfMaintenance},{version:"1.130.*",support:Ne.outOfMaintenance},{version:"1.129.*",support:Ne.outOfMaintenance},{version:"1.128.*",support:Ne.outOfMaintenance},{version:"1.127.*",support:Ne.outOfMaintenance},{version:"1.126.*",support:Ne.outOfMaintenance},{version:"1.125.*",support:Ne.outOfMaintenance},{version:"1.124.*",support:Ne.outOfMaintenance},{version:"1.123.*",support:Ne.outOfMaintenance},{version:"1.122.*",support:Ne.outOfMaintenance},{version:"1.121.*",support:Ne.outOfMaintenance},{version:"1.120.*",support:Ne.maintenance},{version:"1.119.*",support:Ne.outOfMaintenance},{version:"1.118.*",support:Ne.outOfMaintenance},{version:"1.117.*",support:Ne.outOfMaintenance},{version:"1.116.*",support:Ne.outOfMaintenance},{version:"1.115.*",support:Ne.outOfMaintenance},{version:"1.114.*",support:Ne.outOfMaintenance},{version:"1.113.*",support:Ne.outOfMaintenance},{version:"1.112.*",support:Ne.outOfMaintenance},{version:"1.111.*",support:Ne.outOfMaintenance},{version:"1.110.*",support:Ne.outOfMaintenance},{version:"1.109.*",support:Ne.outOfMaintenance},{version:"1.108.*",support:Ne.maintenance},{version:"1.107.*",support:Ne.outOfMaintenance},{version:"1.106.*",support:Ne.outOfMaintenance},{version:"1.105.*",support:Ne.outOfMaintenance},{version:"1.104.*",support:Ne.outOfMaintenance},{version:"1.103.*",support:Ne.outOfMaintenance},{version:"1.102.*",support:Ne.outOfMaintenance},{version:"1.101.*",support:Ne.outOfMaintenance},{version:"1.100.*",support:Ne.outOfMaintenance},{version:"1.99.*",support:Ne.outOfMaintenance},{version:"1.98.*",support:Ne.outOfMaintenance},{version:"1.97.*",support:Ne.outOfMaintenance},{version:"1.96.*",support:Ne.maintenance},{version:"1.95.*",support:Ne.outOfMaintenance},{version:"1.94.*",support:Ne.outOfMaintenance},{version:"1.93.*",support:Ne.outOfMaintenance},{version:"1.92.*",support:Ne.outOfMaintenance},{version:"1.91.*",support:Ne.outOfMaintenance},{version:"1.90.*",support:Ne.outOfMaintenance},{version:"1.89.*",support:Ne.outOfMaintenance},{version:"1.88.*",support:Ne.outOfMaintenance},{version:"1.87.*",support:Ne.outOfMaintenance},{version:"1.86.*",support:Ne.outOfMaintenance},{version:"1.85.*",support:Ne.outOfMaintenance},{version:"1.84.*",support:Ne.outOfMaintenance},{version:"1.82.*",support:Ne.outOfMaintenance},{version:"1.81.*",support:Ne.outOfMaintenance},{version:"1.80.*",support:Ne.outOfMaintenance},{version:"1.79.*",support:Ne.outOfMaintenance},{version:"1.78.*",support:Ne.outOfMaintenance},{version:"1.77.*",support:Ne.outOfMaintenance},{version:"1.76.*",support:Ne.outOfMaintenance},{version:"1.75.*",support:Ne.outOfMaintenance},{version:"1.74.*",support:Ne.outOfMaintenance},{version:"1.73.*",support:Ne.outOfMaintenance},{version:"1.72.*",support:Ne.outOfMaintenance},{version:"1.71.*",support:Ne.maintenance},{version:"1.70.*",support:Ne.outOfMaintenance},{version:"1.69.*",support:Ne.outOfMaintenance},{version:"1.68.*",support:Ne.outOfMaintenance},{version:"1.67.*",support:Ne.outOfMaintenance},{version:"1.66.*",support:Ne.outOfMaintenance},{version:"1.65.*",support:Ne.outOfMaintenance},{version:"1.64.*",support:Ne.outOfMaintenance},{version:"1.63.*",support:Ne.outOfMaintenance},{version:"1.62.*",support:Ne.outOfMaintenance},{version:"1.61.*",support:Ne.outOfMaintenance},{version:"1.60.*",support:Ne.outOfMaintenance},{version:"1.58.*",support:Ne.outOfMaintenance},{version:"1.56.*",support:Ne.outOfMaintenance},{version:"1.54.*",support:Ne.outOfMaintenance},{version:"1.52.*",support:Ne.outOfMaintenance},{version:"1.50.*",support:Ne.outOfMaintenance},{version:"1.48.*",support:Ne.outOfMaintenance},{version:"1.46.*",support:Ne.outOfMaintenance},{version:"1.44.*",support:Ne.outOfMaintenance},{version:"1.42.*",support:Ne.outOfMaintenance},{version:"1.40.*",support:Ne.outOfMaintenance},{version:"1.38.*",support:Ne.maintenance},{version:"1.36.*",support:Ne.outOfMaintenance},{version:"1.34.*",support:Ne.outOfMaintenance},{version:"1.32.*",support:Ne.outOfMaintenance},{version:"1.30.*",support:Ne.outOfMaintenance},{version:"1.28.*",support:Ne.outOfMaintenance},{version:"1.26.*",support:Ne.outOfMaintenance},{version:"1.24.*",support:Ne.outOfMaintenance},{version:"1.22.*",support:Ne.outOfMaintenance},{version:"*",support:Ne.outOfMaintenance}],T_e=ZLn.filter(e=>e.support===Ne.maintenance&&(0,TM.gte)((0,TM.coerce)(e.version)??"0.0.0",n6)).map(e=>({version:(0,TM.coerce)(e.version)?.version??"0.0.0",support:Ne.maintenance})),eMn=[...T_e].map(e=>e.version);var A_e=be(ta(),1);var nMn="1.72.0",DUt="1.102.0",iMn="1.136.0",sMn="1.120.0",uc;(function(e){e.SAP_BELIZE="sap_belize",e.SAP_FIORI_3="sap_fiori_3",e.SAP_FIORI_3_DARK="sap_fiori_3_dark",e.SAP_HORIZON="sap_horizon",e.SAP_HORIZON_DARK="sap_horizon_dark"})(uc||(uc={}));var oMn={[uc.SAP_BELIZE]:{id:uc.SAP_BELIZE,label:"Belize",supportUntil:iMn,deprecateSince:sMn},[uc.SAP_FIORI_3]:{id:uc.SAP_FIORI_3,label:"Quartz Light"},[uc.SAP_FIORI_3_DARK]:{id:uc.SAP_FIORI_3_DARK,label:"Quartz Dark",supportSince:nMn},[uc.SAP_HORIZON]:{id:uc.SAP_HORIZON,label:"Morning Horizon",supportSince:DUt},[uc.SAP_HORIZON_DARK]:{id:uc.SAP_HORIZON_DARK,label:"Evening Horizon",supportSince:DUt}};var qUt=be(IUt(),1),w_e=be(ta(),1);var LUt={prompts:{username:{message:"Username"},password:{message:"Password"}},ui5VersionLabels:{maintained:"Maintained",outOfMaintenance:"Out of maintenance",version_one:"version",version_other:"versions"},errors:{destination:{unavailable:"The selected destination references an instance that is not available. Please check your destination configuration and try again.",notFound:"The destination target URL cannot be found. The request failed with status code 404. Please check the destination target URL connectivity in your SAP BTP cockpit.",notReachable:"The selected system is not reachable. System Name: {{systemName}}, Error: {{- error}}.",misconfigured:'The destination is misconfigured. $t(errors.destination.missingPropMsg, {"destinationProperty": "{{destinationProperty}}" })',missingPropMsg:"The property: `{{destinationProperty}}` is missing.",httpConnectionError:"A connection error occurred with the selected destination. HTTP Code: {{- code}}. $t(texts.seeLogForDetails)"},unknownError:"An error occurred{{- error, addMsgWithColonFormatter}}",servicesUnavailable:"An error occurred retrieving services for the SAP System.",certificateError:"A certificate error has occurred{{- errorMsg, addMsgWithColonFormatter}}",urlCertValidationError:"The system URL is using {{certErrorReason}} security certificate.",authenticationFailed:"Authentication incorrect. {{- error}}",authenticationTimeout:"Authorization was not verified within the allowed time. Please ensure you have authenticated using the associated browser window.",invalidUrl:"Invalid URL{{-input, addMsgWithColonFormatter}}",connectionError:"A connection error occurred. Please ensure the target host is available on the network: {{- error}}",timeout:"A connection timeout error occurred{{- errorMsg, addMsgWithColonFormatter}}",serverReturnedAnError:"The server returned an error. {{- errorDesc}}",serverUnableToCompleteRequest:"The server was unable to complete the request. Please try again.",catalogServiceNotActive:"Catalog service is not active.",urlNotFound:"URL not found.",odataServiceUrlNotFound:"The service URL you have provided is not a valid OData Service. SAP Fiori applications require an OData service as the data source.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",redirectError:"A redirect response was received from the server",abapEnvsUnavailable:"ABAP environments unavailable.",noSuchHostError:"No such host is known. Ensure the host is available.",noAbapEnvsInCFSpace:"No ABAP environments in CF space found. Ensure an ABAP environment exists.",abapEnvsCFDiscoveryFailed:"Discovering ABAP Environments failed. Please ensure you are logged into Cloud Foundry. For more information, see https://docs.cloudfoundry.org/cf-cli/getting-started.html#login.",systemConnectionValidationFailed:"A connection to the selected system cannot be established. Ensure the credentials are valid.",internalServerError:"Internal server error{{-errorMsg, addMsgWithColonFormatter}}",badGateway:"Bad gateway{{- errorMsg, addMsgWithColonFormatter}}",badRequest:"Bad request{{- errorMsg, addMsgWithColonFormatter}}",cannotBeEmpty:"{{- field}} cannot be empty.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata."},guidedAnswers:{validationErrorHelpText:"Need help with this error?"},texts:{anExpiredCert:"an expired",aSelfSignedCert:"a self-signed",anUnknownOrInvalidCert:"an unknown or invalid",anUntrustedRootCert:"an untrusted root",suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, see the log.",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration."}};var MUt="inquirer-common",x_e=kr.createInstance();function s6(){x_e.addResourceBundle("en",MUt,LUt)}async function cMn(){await x_e.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{format:function(e,t){return t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e}},showSupportNotice:!1}),s6()}function Xt(e,t){return t?.ns||(t=Object.assign(t??{},{ns:MUt})),x_e.t(e,t)}cMn().catch(()=>{});var dMn=be(u6(),1);function Cw(e,t){return e&&t?qUt.default.filter(e,t,{extract:r=>r.name??""}).map(r=>r.original):t}var c6=class{message;link;constructor(t){Object.assign(this,t)}toString(){return`${this.message} ${this.link.text}${this.link.url?" : "+this.link.url:""}`}};var AM=be(LF(),1);function hMn(e,t,r){let n=e.additionalMessages;return(i,s)=>{let o={...(0,AM.default)(s),...(0,AM.default)(r)},a=t(i,o);return a||(typeof n=="function"?n(i,s):void 0)}}function mMn(e,t,r){let n=e.validate;return(i,s)=>{let o={...(0,AM.default)(s),...(0,AM.default)(r)},a=t?.(i,o);return a!==!0?a:typeof n=="function"?n(i,s):!0}}function gMn(e,t,r,n){let i;return r==="validate"&&t.validate&&(i=mMn(e,t.validate,n)),r==="additionalMessages"&&t.additionalMessages&&(i=hMn(e,t.additionalMessages,n)),e=Object.assign(e,{[r]:i}),e}function Ds(e,t){return e.forEach(r=>{if(r.when!==void 0)if(typeof r.when=="function"){let n=r.when;r.when=i=>t(i)?n(i):!1}else{let n=r.when;r.when=i=>t(i)&&n}else r.when=t}),e}function C_e(e,t,r){return e.forEach(n=>{let i=n.name,s=t[n.name];if(s){let o=Object.keys(s);for(let a of o){(a==="validate"||a==="additionalMessages")&&(n=gMn(n,s,a,r));let u=t[i].default;u&&(n.default=u)}}}),e}var O_e="data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjMzc5NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iIzM3OTRGRiIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";var P_e={FIORI_TOOLS:3046},ko={FIORI_TOOLS:45995,DEV_PLATFORM:45996,FIORI_APP_GENERATOR:48363,BAS_CATALOG_SERVICES_REQUEST_FAILED:48366,APPLICATION_PREVIEW:52881,CERTIFICATE_ERROR:53643,DESTINATION_MISCONFIGURED:54336,DESTINATION_UNAVAILABLE:51208,DESTINATION_NOT_FOUND:51208,BAD_GATEWAY:48366,DESTINATION_SERVICE_UNAVAILBLE:52526,NO_V4_SERVICES:57573,NO_ADT_SERVICE_AUTH:57266,DESTINATION_CONNECTION_ERRORS:48366,UI_SERVICE_GENERATOR:63068,DESTINATION_GATEWAY_TIMEOUT:57914,ADT_APP_NOT_FOUND_ERROR:63911,DESTINATION_FULL_URL:68172};var jUt="sap.ux.guidedAnswer.openGuidedAnswer",yMn="https://ga.support.sap.com/dtp/viewer/index.html";function VUt(e,t){let r="";return t.length>0&&(r=`/actions/${t.join(":")}`),`${yMn}#/tree/${e}${r}`}var GUt=be(k8(),1);var R_e,D_e;function $Ut(){return R_e}function LS(e,t){let r=vMn(e,t);R_e&&R_e.reportEvent(r,Pi.NoSampling)}function vMn(e,t){D_e=D_e??(0,GUt.default)();let r=Object.assign(t,{OperatingSystem:D_e,Platform:t.Platform||kc().technical});return{eventName:e,properties:r,measurements:{}}}function l6(e){return cq(e)?"AbapODataCatalogDest":tg(e)?"GenericODataFullUrlDest":Kl(e)?"GenericODataPartialUrlDest":"Unknown"}var EMn="GA_LINK_CREATED",_Mn="SERVICE_INQUIRER_BAS_ERROR",pe;(function(e){e.AUTH="AUTH",e.AUTH_TIMEOUT="AUTH_TIMEOUT",e.REDIRECT="REDIRECT",e.CERT="CERT",e.CERT_SELF_SIGNED="CERT_SELF_SIGNED",e.CERT_UKNOWN_OR_INVALID="CERT_UKNOWN_OR_INVALID",e.CERT_EXPIRED="CERT_EXPIRED",e.CERT_SELF_SIGNED_CERT_IN_CHAIN="CERT_SELF_SIGNED_CERT_IN_CHAIN",e.INVALID_SSL_CERTIFICATE="INVALID_SSL_CERTIFICATE",e.UNKNOWN="UNKNOWN",e.INVALID_URL="INVALID_URL",e.TIMEOUT="TIMEOUT",e.CONNECTION="CONNECTION",e.SERVICES_UNAVAILABLE="SERVICES_UNAVAILABLE",e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.NO_ABAP_ENVS="NO_ABAP_ENVS",e.CATALOG_SERVICE_NOT_ACTIVE="CATALOG_SERVICE_NOT_ACTIVE",e.NO_SUCH_HOST="NO_SUCH_HOST",e.NOT_FOUND="NOT_FOUND",e.ODATA_URL_NOT_FOUND="ODATA_URL_NOT_FOUND",e.BAD_GATEWAY="BAD_GATEWAY",e.GATEWAY_TIMEOUT="GATEWAY_TIMEOUT",e.INTERNAL_SERVER_ERROR="INTERNAL_SERVER_ERROR",e.DESTINATION_SERVICE_UNAVAILABLE="DESTINATION_SERVICE_UNAVAILABLE",e.DESTINATION_UNAVAILABLE="DESTINATION_UNAVAILABLE",e.DESTINATION_NOT_FOUND="DESTINATION_NOT_FOUND",e.DESTINATION_MISCONFIGURED="DESTINATION_MISCONFIGURED",e.NO_V2_SERVICES="NO_V2_SERVICES",e.NO_V4_SERVICES="NO_V4_SERVICES",e.BAD_REQUEST="BAD_REQUEST",e.DESTINATION_CONNECTION_ERROR="DESTINATION_CONNECTION_ERROR",e.SERVER_HTTP_ERROR="SERVER_HTTP_ERROR"})(pe||(pe={}));var SMn={[pe.AUTH]:[/401/,/403/,/Incorrect credentials were provided to login/,/Unable to retrieve SAP Business Accelerator Hub key/],[pe.AUTH_TIMEOUT]:[/UAATimeoutError/],[pe.TIMEOUT]:[/Timeout/],[pe.CERT]:[],[pe.CERT_UKNOWN_OR_INVALID]:[/UNABLE_TO_GET_ISSUER_CERT/,/UNABLE_TO_GET_ISSUER_CERT_LOCALLY/,/unable to get local issuer certificate/,/UNABLE_TO_VERIFY_LEAF_SIGNATURE/,/ERR_TLS_CERT_ALTNAME_INVALID/],[pe.CERT_EXPIRED]:[/CERT_HAS_EXPIRED/],[pe.CERT_SELF_SIGNED]:[/DEPTH_ZERO_SELF_SIGNED_CERT/],[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:[/SELF_SIGNED_CERT_IN_CHAIN/],[pe.INVALID_SSL_CERTIFICATE]:[/526/,/Invalid SSL Certificate/],[pe.UNKNOWN]:[],[pe.CONNECTION]:[/ENOTFOUND/,/ECONNRESET/,/ECONNREFUSED/,/EPROTO/,/ConnectionError/],[pe.SERVICES_UNAVAILABLE]:[],[pe.SERVICE_UNAVAILABLE]:[/503/],[pe.INVALID_URL]:[/Invalid URL/,/ERR_INVALID_URL/],[pe.REDIRECT]:[/3\d\d/],[pe.NO_ABAP_ENVS]:[],[pe.CATALOG_SERVICE_NOT_ACTIVE]:[/\/IWBEP\/CM_V4_COS\/014/,/\/IWFND\/CM_V4_COS\/021/,/Service group '\/IWFND\/CONFIG' not published/],[pe.NO_SUCH_HOST]:[/no such host/],[pe.NOT_FOUND]:[/404/],[pe.ODATA_URL_NOT_FOUND]:[],[pe.INTERNAL_SERVER_ERROR]:[/500/],[pe.BAD_GATEWAY]:[/502/],[pe.GATEWAY_TIMEOUT]:[/504/],[pe.DESTINATION_SERVICE_UNAVAILABLE]:[],[pe.DESTINATION_UNAVAILABLE]:[],[pe.DESTINATION_NOT_FOUND]:[],[pe.DESTINATION_MISCONFIGURED]:[],[pe.NO_V2_SERVICES]:[],[pe.NO_V4_SERVICES]:[],[pe.BAD_REQUEST]:[/400/],[pe.DESTINATION_CONNECTION_ERROR]:[],[pe.SERVER_HTTP_ERROR]:[/5\d\d/]},pn=class e{currentErrorMsg;currentErrorType;static _guidedAnswersEnabled;static _logger;static _platform;static get platform(){return e._platform}static set platform(t){e._platform=t}static _guidedAnswersTrigger;static get guidedAnswersTrigger(){return e._guidedAnswersTrigger}static set guidedAnswersTrigger(t){e._guidedAnswersTrigger=t}static getMessageFromError=t=>t?.message||t?.status?.toString()||t?.response?.status?.toString()||(typeof t=="string"?t:JSON.stringify(t));static serverErrorMessage=(t,r)=>Xt("errors.serverReturnedAnError",{errorDesc:r?Xt(r,{errorMsg:e.getMessageFromError(t)}):e.getMessageFromError(t)});static _errorTypeToMsg={[pe.CERT]:t=>Xt("errors.certificateError",{errorMsg:e.getMessageFromError(t)}),[pe.CERT_EXPIRED]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.anExpiredCert")}),[pe.CERT_SELF_SIGNED]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.aSelfSignedCert")}),[pe.CERT_UKNOWN_OR_INVALID]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.anUnknownOrInvalidCert")}),[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.anUntrustedRootCert")}),[pe.INVALID_SSL_CERTIFICATE]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.anUnknownOrInvalidCert")}),[pe.AUTH]:t=>Xt("errors.authenticationFailed",{error:e.getMessageFromError(t)}),[pe.AUTH_TIMEOUT]:()=>Xt("errors.authenticationTimeout"),[pe.TIMEOUT]:t=>Xt("errors.timeout",{errorMsg:e.getMessageFromError(t)}),[pe.INVALID_URL]:()=>Xt("errors.invalidUrl"),[pe.CONNECTION]:t=>Xt("errors.connectionError",{error:e.getMessageFromError(t)}),[pe.UNKNOWN]:t=>Xt("errors.unknownError",{error:e.getMessageFromError(t)}),[pe.SERVICES_UNAVAILABLE]:()=>Xt("errors.servicesUnavailable"),[pe.SERVICE_UNAVAILABLE]:t=>e.serverErrorMessage(t),[pe.CATALOG_SERVICE_NOT_ACTIVE]:()=>Xt("errors.catalogServiceNotActive"),[pe.INTERNAL_SERVER_ERROR]:t=>e.serverErrorMessage(t,"errors.internalServerError"),[pe.NOT_FOUND]:()=>Xt("errors.urlNotFound"),[pe.ODATA_URL_NOT_FOUND]:()=>Xt("errors.odataServiceUrlNotFound"),[pe.BAD_GATEWAY]:t=>e.serverErrorMessage(t,"errors.badGateway"),[pe.DESTINATION_UNAVAILABLE]:()=>Xt("errors.destination.unavailable"),[pe.DESTINATION_NOT_FOUND]:()=>Xt("errors.destination.notFound"),[pe.DESTINATION_MISCONFIGURED]:t=>Xt("errors.destination.misconfigured",{destinationProperty:typeof t=="string"?t:""}),[pe.NO_V2_SERVICES]:()=>Xt("errors.noServicesAvailable",{version:"2"}),[pe.NO_V4_SERVICES]:()=>Xt("errors.noServicesAvailable",{version:"4"}),[pe.DESTINATION_SERVICE_UNAVAILABLE]:()=>Xt("errors.destination.unavailable"),[pe.REDIRECT]:()=>Xt("errors.redirectError"),[pe.NO_SUCH_HOST]:()=>Xt("errors.noSuchHostError"),[pe.NO_ABAP_ENVS]:()=>Xt("errors.abapEnvsUnavailable"),[pe.BAD_REQUEST]:t=>e.serverErrorMessage(t,"errors.badRequest"),[pe.DESTINATION_CONNECTION_ERROR]:()=>Xt("errors.systemConnectionValidationFailed"),[pe.SERVER_HTTP_ERROR]:t=>e.serverErrorMessage(t),[pe.GATEWAY_TIMEOUT]:t=>e.serverErrorMessage(t)};static _errorMsg=(t,r)=>e._errorTypeToMsg[t](r);static getHelpNode=t=>{let r=Vr();return{[pe.SERVICES_UNAVAILABLE]:r?ko.BAS_CATALOG_SERVICES_REQUEST_FAILED:void 0,[pe.CERT]:ko.CERTIFICATE_ERROR,[pe.CERT_EXPIRED]:ko.CERTIFICATE_ERROR,[pe.CERT_SELF_SIGNED]:ko.CERTIFICATE_ERROR,[pe.CERT_UKNOWN_OR_INVALID]:ko.CERTIFICATE_ERROR,[pe.INVALID_SSL_CERTIFICATE]:ko.CERTIFICATE_ERROR,[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:ko.CERTIFICATE_ERROR,[pe.DESTINATION_MISCONFIGURED]:ko.DESTINATION_MISCONFIGURED,[pe.DESTINATION_UNAVAILABLE]:ko.DESTINATION_UNAVAILABLE,[pe.DESTINATION_NOT_FOUND]:ko.DESTINATION_NOT_FOUND,[pe.BAD_GATEWAY]:ko.BAD_GATEWAY,[pe.DESTINATION_SERVICE_UNAVAILABLE]:ko.DESTINATION_SERVICE_UNAVAILBLE,[pe.NO_V4_SERVICES]:ko.NO_V4_SERVICES,[pe.GATEWAY_TIMEOUT]:r?ko.DESTINATION_GATEWAY_TIMEOUT:void 0,[pe.AUTH]:void 0,[pe.AUTH_TIMEOUT]:void 0,[pe.REDIRECT]:void 0,[pe.UNKNOWN]:void 0,[pe.INVALID_URL]:void 0,[pe.CONNECTION]:void 0,[pe.SERVICE_UNAVAILABLE]:void 0,[pe.NO_ABAP_ENVS]:void 0,[pe.CATALOG_SERVICE_NOT_ACTIVE]:void 0,[pe.NO_SUCH_HOST]:void 0,[pe.NOT_FOUND]:void 0,[pe.ODATA_URL_NOT_FOUND]:void 0,[pe.INTERNAL_SERVER_ERROR]:void 0,[pe.NO_V2_SERVICES]:void 0,[pe.TIMEOUT]:void 0,[pe.BAD_REQUEST]:void 0,[pe.DESTINATION_CONNECTION_ERROR]:ko.DESTINATION_CONNECTION_ERRORS,[pe.SERVER_HTTP_ERROR]:void 0}[t]};static findErrorValueForMapping=t=>t.response?.data?.error?.code||t.response?.status||t.response?.data||t.code||(["TypeError","Error"].includes(t.name)?t.message:t.name)||t.message||t;constructor(t,r=!1,n){e._logger=t??new vs({logPrefix:n??"@sap-ux/inquirer-common"}),e.guidedAnswersEnabled=r}static get guidedAnswersEnabled(){return e._guidedAnswersEnabled}static set guidedAnswersEnabled(t){e._guidedAnswersEnabled=t}static set logger(t){e._logger=t}static get logger(){return e._logger}static isCertError(t){return[pe.CERT,pe.CERT_EXPIRED,pe.CERT_SELF_SIGNED,pe.CERT_UKNOWN_OR_INVALID,pe.CERT_SELF_SIGNED_CERT_IN_CHAIN].includes(e.getErrorType(t))}static getErrorType(t){let r=t;return t instanceof Error&&(r=e.findErrorValueForMapping(t)),Object.keys(pe).find(n=>SMn[n].find(i=>i.test(r.toString())))}logErrorMsgs(t,r,n=!0){let i={errorMsg:"",errorType:pe.UNKNOWN};if(Object.values(pe).includes(t)){let s=t;i.errorMsg=e.getErrorMsgFromType(s)??s.toString(),i.errorType=s}else typeof t=="string"?i.errorMsg=t:i=e.mapErrorToMsg(t);return e._logger.error(r?`${r} ${i.errorMsg}`:i.errorMsg),n&&(this.currentErrorMsg=r??i.errorMsg,this.currentErrorType=i.errorType),i.errorMsg}static mapErrorToMsg(t){let r;return Object.values(pe).includes(t)?r=t:r=e.getErrorType(this.findErrorValueForMapping(t))??pe.UNKNOWN,{errorMsg:e._errorMsg(r,t),errorType:r}}getErrorMsg(t,r,n){let i;return t&&typeof t!="boolean"&&(i=e.mapErrorToMsg(t).errorMsg),i||(i=this.currentErrorMsg??(n?e.getErrorMsgFromType(n):void 0)),(t===!0||r)&&(this.currentErrorMsg=null,this.currentErrorType=null),i}resetErrorState(){this.currentErrorMsg=null,this.currentErrorType=null}getValidationErrorHelp(t,r=!1,n){let i,s,o;if(t?{errorMsg:s,errorType:o}=e.mapErrorToMsg(t):(s=this.currentErrorMsg??void 0,this.currentErrorType&&(o=this.currentErrorType)),o){if(n){let{errorType:a,errorMsg:u}=e.getDestinationSpecificError(o,n);s=u??s,o=a??o}o&&(i=e.getHelpForError(o,s))}return r&&(this.currentErrorMsg=null,this.currentErrorType=null),i??s}static getDestinationSpecificError(t,r){let n,i;return gHe(r)?t===pe.SERVICE_UNAVAILABLE?mHe(r)?n=pe.DESTINATION_SERVICE_UNAVAILABLE:n=pe.DESTINATION_CONNECTION_ERROR:t===pe.NOT_FOUND?(n=pe.DESTINATION_NOT_FOUND,i=this.getErrorMsgFromType(pe.DESTINATION_NOT_FOUND)):pe.INTERNAL_SERVER_ERROR===t||pe.SERVER_HTTP_ERROR===t?n=pe.DESTINATION_CONNECTION_ERROR:t===pe.AUTH&&r.Authentication!==op.NO_AUTHENTICATION&&(i=this.getErrorMsgFromType(pe.AUTH,Xt("texts.checkDestinationAuthConfig"))):(n=pe.DESTINATION_MISCONFIGURED,i=this.getErrorMsgFromType(n,"HTML5.DynamicDestination")),LS(_Mn,{basErrorType:n??t,destODataType:l6(r),Platform:this._platform??kc().technical}),{errorType:n??t,errorMsg:i}}static getErrorMsgFromType(t,r){if(pe[t])return e._errorMsg(pe[t],r)}hasError(t=!1){let r=!!this.currentErrorMsg;return t&&(this.currentErrorMsg=null,this.currentErrorType=null),r}setCurrentError(t,r){this.currentErrorMsg=e._errorMsg(pe[t],r),this.currentErrorType=t}getCurrentErrorType(t=!1){let r=this.currentErrorType;return t&&(this.currentErrorMsg=null,this.currentErrorType=null),r}static getHelpForError(t,r){let n=e.getHelpNode(t),i=r??e.getErrorMsgFromType(t);return n&&i?this.getHelpLink(n,t,i):i}static getHelpLink(t,r,n){let i={message:n,link:{text:Xt("guidedAnswers.validationErrorHelpText"),icon:O_e,url:VUt(P_e.FIORI_TOOLS,[t])}};return this.guidedAnswersEnabled&&(i.link.command={id:jUt,params:{treeId:P_e.FIORI_TOOLS,nodeIdPath:[t],trigger:this.guidedAnswersTrigger}}),LS(EMn,{errorType:r,isGuidedAnswersEnabled:this.guidedAnswersEnabled,nodeIdPath:`${t}`,Platform:this.platform??kc().technical}),new c6(i)}};var HUt=be(nq(),1);async function WUt(e){let t=[];try{let r=[Gd.ABAP,Gd.ABAP_TRIAL,Gd.ABAP_CANARY,Gd.ABAP_OEM,Gd.ABAP_OEM_CANARY,Gd.ABAP_HAAS,Gd.ABAP_STAGING,Gd.ABAP_INTERNAL_STAGING],n=process.env.ABAPEnvServiceTypes?process.env.ABAPEnvServiceTypes.split(",").map(s=>s.trim()):[],i=await(0,HUt.apiGetServicesInstancesFilteredByType)([...r,...n]);i.length>0?i.forEach(s=>{t.push({name:s.label,value:s})}):e.logErrorMsgs(pe.NO_ABAP_ENVS,Xt("errors.noAbapEnvsInCFSpace"))}catch{e.logErrorMsgs(pe.NO_ABAP_ENVS,Xt("errors.abapEnvsCFDiscoveryFailed"))}return t.sort((r,n)=>r.name?r.name.localeCompare(n.name??""):0)}var bMn=be(Oy(),1),TMn=be(Dy(),1);var pQn=be(eGt(),1);var tGt={deploy:{abapAppDescLength:"The deployment description cannot exceed 60 characters.",abapTransportNumRequired:"Provide a transport request for your application.",abapPackageWarn:"Provide a package.",abapAppNameRequired:"The application name is required.",abapInvalidNamespace:"The namespace is invalid because there are too many forward slashes.",abapInvalidNamespaceLength:"The namespace is limited to 10 characters. Entered {{length}}.",abapInvalidAppNameLength:"The application name is limited to 15 characters. Entered {{length}}.",abapInvalidAppName:"The application name must be prefixed with [{{prefix}}].",charactersForbiddenInAppName:"Only alphanumeric, underscore, and slash characters are allowed.",invalidAppNameMultipleReason:"The application name is invalid for multiple reasons:"},ui5:{namespaceMustStartWithLetter:"The namespace must start with a letter.",namespaceEndInPeriod:"The namespace cannot end with a period.",namespaceCannotBeSap:"The namespace cannot be {{str}}.",namespaceStartsWithNew:"The namespace cannot start with {{str}}.",namespaceNumberAfterPeriod:"A number cannot follow a period in the namespace.",lowerAlphaNumericOnly:"Only use lowercase alphanumeric characters.",lowerAlphaNumericDotsOnly:"Only use lowercase alphanumeric characters and dots for the namespace.",namespaceSpecialCharacter:"The namespace can only contain letters, digits, dots, and underscores.",moduleNameMustStartWithLetter:"The module name must start with a letter.",nameCombinedTooLong:"The combined length of the namespace and module name must not exceed {{length}} characters.",folderDoesNotExist:"This folder does not exist. Please enter the root folder for your project.",folderDoesNotHaveCorrectPermissions:"The selected folder does not have the required permissions. Please ensure you have permission to write to the selected folder and try again.",enterProjectFolder:"Please enter a project folder.",nameNull:"The module name cannot be null.",nameUndefined:"The module name cannot be undefined.",nameNotString:"The module name must be a string.",nameLengthZero:"The module name's length must be greater than zero.",nameStartsWithPeriod:"The module name cannot start with a period.",nameStartsWithUnderscore:"The module name cannot start with an underscore.",nameStartsOrEndsWithSpace:"The module name cannot contain leading or trailing spaces.",nameBlocklisted:"{{modName}} is a blocklisted module name. Choose a different name.",nameIsCoreModule:"{{modName}} is a core module name. Choose a different name.",nameTooLong:"The module name cannot exceed {{length}} characters.",nameTooShort:"The module name must be at least {{length}} characters.",inputValueContainsCapital:"{{promptName}} cannot contain capital letters",nameContainsSpecialCharacters:`The module name cannot contain special characters: ("~'!()*)`,nameNotUrlFriendly:"The module name can only contain URL-friendly characters.",invalidModuleName:"Invalid module name.",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path.",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must use the local CAP project as the data source."},general:{invalidUrl:"Invalid URL: [{{-input}}]",invalidClient:"[{{client}}] is invalid. Leave this field empty or enter a value between 000-999.",inputCannotBeEmpty:"The input cannot be empty.",inputCannotHaveSpaces:"The input cannot contain spaces.",invalidJSON:"Invalid JSON.",invalidValueForSpecialChars:"The input must only contain Latin alphanumeric characters or the following symbols: '-','_','$' and '.'.",maxLength:"The maximum length is: {{maxLength}} characters.",supportedFormats:"Only alphanumeric and '{{allowedCharacters}}' characters are allowed.",nameContainsSpecialCharacters:`Module name cannot contain special characters ("~'!()*)`,nameNotUrlFriendly:"Module name can only contain URL-friendly characters",invalidModuleName:"Invalid module name",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must therefore use the local CAP project as the data source.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",windowsFolderPathTooLong:"The combined length {{length}} of the target folder and module name exceeds the default Windows path length. This can cause issues with project generation."},adp:{projectNameUppercaseError:"The project name cannot contain uppercase letters.",projectNameLengthErrorExt:"The project name cannot exceed 61 characters or end with the word 'component'.",projectNameValidationErrorExt:"The project name must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",projectNameLengthErrorInt:"The project name cannot start with the word 'customer', exceed 61 characters, or end with the word 'component'.",projectNameValidationErrorInt:"The project name must only contain Latin alphanumeric characters and it must have at least two parts. The different parts must be separated by a period and every part must start with a letter.",duplicatedProjectName:"A project with this name already exists in your workspace. Please choose another name.",differentNamespaceThanProjectName:"The namespace must be the same as the project name.",namespaceSameAsProjectNameError:"The namespace must be the same as the project name.",namespaceLengthError:"The namespace cannot exceed 61 characters or end with the word 'component'.",namespaceValidationError:"The namespace must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",achMandatoryError:"The Application Component Hierarchy must only contain capital letters, digits, and dashes."}};var rGt="project-input-validator",Fbe=kr.createInstance();function XY(){Fbe.addResourceBundle("en",rGt,tGt)}async function nGt(){await Fbe.init({lng:"en",fallbackLng:"en",showSupportNotice:!1}),XY()}function YS(e,t){return t?.ns||(t=Object.assign(t??{},{ns:rGt})),Fbe.t(e,t)}nGt().catch(()=>{});var sJn=be(oGt(),1);function aGt(e){let t=e?.trim()||"";return t===""||/^\d{3}$/.test(t)?!0:YS("general.invalidClient",{client:e})}var uGt={prompts:{datasourceType:{message:"Data Source",projectSpecificDestName:"Project Specific Destination",businessHubName:"SAP Business Accelerator Hub",sapSystemName:"System",odataServiceUrlName:"OData Service",capProjectName:"Local CAP Project",metadataFileName:"Metadata Document",choiceNone:"$t(texts.choiceNameNone)",projectSpecificDestChoiceText:"Connect to a $t(prompts.datasourceType.projectSpecificDestName)",businessHubChoiceText:"Connect to $t(prompts.datasourceType.businessHubName)",sapSystemChoiceText:"Connect to a $t(prompts.datasourceType.sapSystemName)",odataServiceUrlChoiceText:"Connect to an $t(prompts.datasourceType.odataServiceUrlName)",capProjectChoiceText:"Use a $t(prompts.datasourceType.capProjectName)",metadataFileChoiceText:"Upload a $t(prompts.datasourceType.metadataFileName)",notYetImplementedWarningMessage:"The selected data source type: {{ datasourceType }} is not yet implemented."},metadataFile:{message:"Metadata File Path",description:"Upload a metadata file",placeholder_odata_service_url:"/here/goes/your/serviceurl/"},capProject:{message:"Choose a CAP Project",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capProjectPath:{message:"CAP Project Folder Path",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capService:{message:"OData Service",description:"Select a local CAP service",breadcrumb:"CAP Service",enterCapPathChoiceName:"Manually select CAP service folder path"},odataServiceUrl:{message:"OData{{odataVersion, odataVersionFormatter}} service URL"},ignoreCertErrors:{message:"Do you want to continue generation with the untrusted certificate?"},serviceUsername:{message:"Service username"},servicePassword:{message:"Service password"},validationMessages:{odataVersionMismatch:"The template you have chosen supports V{{requiredOdataVersion}} OData services only. The provided version is V{{providedOdataVersion}}.",metadataInvalid:"The service metadata is invalid.",metadataFilePathNotValid:"The metadata file does not exist or is not accessible. Please specify a valid file path.",capProjectNotFound:"The folder you have selected does not contain a valid CAP project. Please check and try again.",warningCertificateValidationDisabled:"Certificate validation has been disabled by the user.",annotationsNotFound:"Annotations not found for the specified service.",backendSystemExistsWarning:'A saved system connection entry: "{{- backendName}}" already exists with the same URL and client. Please reuse the existing entry or remove it, using the systems panel, before adding a new connection.',systemUrlOriginOnlyWarning:"System URLs must only contain the hostname and may also include the port, for example, 'https://abc.com:123/'."},warnings:{nonUIServiceTypeWarningMessage:"Services of service type: {{serviceType}} or without a service type are not intended to be used for generating SAP Fiori UI applications.",noServicesAvailable:"There are no services available for the selected system. For more information, see the logs.",noServicesAvailableForOdataVersion:"There are no OData V{{odataVersion}} services available from the selected system and the template you have chosen only supports OData V{{odataVersion}} services.",noAnnotations:"No back-end annotations associated with this service were retrieved. This can result in an invalid application.",collaborativeDraftMessage:"The selected service is draft-enabled but does not support collaborative draft."},systemUrl:{message:"System URL",description:"Enter the URL of the SAP System",placeholder:"https://<host>:<port>"},sapClient:{message:"SAP client (leave empty for default)",breadcrumb:"SAP Client"},systemUsername:{message:"Username"},systemPassword:{message:"Password"},storeSystemCredentials:{message:"Do you want to store the system credentials?",breadcrumb:"Store Credentials"},systemService:{message:"Service",breadcrumb:"Service",noServicesWarning:"No services available for the selected system. For more information, see the logs."},newSystemType:{choiceAbapOnPrem:"ABAP On Premise",choiceAbapOnBtp:"ABAP Environment on SAP Business Technology Platform",choiceCFAbapEnvServiceOnBtp:"Cloud Foundry ABAP environment on SAP Business Technology Platform",message:"System Type",notYetImplementedWarningMessage:"The selected system type: {{ systemType }} is not yet implemented."},systemName:{message:"System name",hint:"Entering a system name will save the connection for re-use.",systemNameExistsWarning:"A system with that name already exists in the secure storage. Please try a different name.",reservedSystemNameWarning:"'{{ systemName }}' is a reserved system name. Please try a different name.",emptySystemNameWarning:"System name cannot be empty."},systemSelection:{newSystemChoiceLabel:"New System",hint:"Select a system configuration.",message:"System",authenticationFailedUpdateCredentials:"$t(texts.authenticationFailed). Please try updating the credentials."},abapOnBTPType:{message:"ABAP environment definition source",choiceReentranceTicket:"Use Reentrance Ticket",choiceServiceKey:"Upload a Service Key File",choiceCloudFoundry:"Discover a Cloud Foundry Service"},serviceKey:{message:"Service Key File Path",hint:"Select a local file that defines the service connection for an ABAP Environment on SAP Business Technology Platform.",incompleteServiceKeyInfo:"The service keys file does not contain the required information. Check the file is valid and try again.",unparseableServiceKey:"The service keys file does not contain a valid JSON format. Check the formatting and try again."},cloudFoundryAbapSystem:{message:"ABAP environment",hint:"Enter the name of the Cloud Foundry service that contains the ABAP Environment instance."},destinationServicePath:{message:"Service Path",hint:"Enter the path to the OData service relative to the selected destination URL.",invalidServicePathWarning:"Please enter a valid service path"},mainEntitySelection:{message:"Main Entity",defaultEntityNameNotFoundWarning:"The supplied entity cannot be found in the service. Please choose from the list above.",noDraftEnabledEntitiesError:"The CAP service you have chosen does not have any entities that are draft enabled. To generate an OData V4 SAP Fiori application using this floorplan for a CAP project, the entity selected must be draft enabled.",mainEntityParameterFoundInfo:"The selected entity '{{entityName}}' requires a parameter which is set by the application filters. Navigation entities are not supported.",noEntitiesError:"$t(errors.noRelevantEntities)",noEntitiesAlpV4Error:"The OData V4 service you have provided is not suitable for use in an analytical list page application. The service must contain aggregate-based entities for this template.",requiredError:"Please select a main entity to continue."},navigationEntitySelection:{message:"Navigation Entity",choiceNone:"$t(texts.choiceNameNone)"},filterEntitySet:{message:"Filter Entity",noEntitiesError:"$t(errors.noRelevantEntities)"},pageBuildingBlock:{message:"Add a Page Building Block to the Application?",tooltip:"The Page building block is supported from SAPUI5 version 1.136. By choosing this option, you will be restricting the minimum SAPUI5 versions available for the application to be 1.136 and above.",warning:"The Page building block is supported with SAPUI5 version 1.136 and above.",titleMessage:"Page Title"},tableType:{message:"Table Type",hint:"Defines the table type for the list report page.",requiredError:"Please select a table type to continue.",choiceNone:"$t(texts.choiceNameNone)",choiceGrid:"Grid",choiceAnalytical:"Analytical",choiceResponsive:"Responsive",choiceTree:"Tree",analyticalTableDefault:"The 'Analytical' table type is chosen by default because the selected entity supports it.",treeTableDefault:"The 'Tree' table type is chosen by default because the selected entity supports it.",responsiveTableInfo:"Only use the responsive table if the total number of items in the table doesn't exceed 200."},hierarchyQualifier:{message:"Hierarchy Qualifier",hint:"Leading property that decides between either a recursive hierarchy or data aggregation.",qualifierRequiredForV4Warning:"Hierarchy qualifier is required for OData V4 services."},addFEOPAnnotations:{message:"Automatically add a form to the generated application if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations"},addLineItemAnnotations:{message:"Automatically add table columns to the list page and a section to the object page if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations",valueHelpsAnnotationsInfoMessage:"Basic value helps will also be created."},presentationQualifier:{message:"Qualifier",hint:"Represents the qualifier of the `SelectionPresentationVariant`. The analytical list page looks for a `SelectionPresentationVariant` with this qualifier and if not found, it looks for a `PresentationVariant` with this qualifier."},tableSelectionMode:{message:"Selection Mode",hint:"Defines different selection modes for the `SmartTable` in the analytical list page.",choiceNone:"$t(texts.choiceNameNone)",choiceSingle:"Single",choiceAuto:"Auto",choiceMulti:"Multi"},tableMultiSelect:{message:"Allow Multi Select",hint:"Allows you to show a checkbox for selecting multiple items in a table. This setting comes into effect only if there are actions defined either by using an annotation or a setting in the `manifest.json` file."},tableAutoHide:{message:"Auto Hide",hint:"Determines the chart or table interaction. If set to `true`, the chart acts as a filter for the table. If set to `false`, the matching table rows are highlighted but the table is not filtered."},smartVariantManagement:{message:"Enable Smart Variant Management",hint:"Enables page level variant."},valueHelpDownload:{message:"The service contains references to value help services. Do you want to download the associated metadata during generation? This may increase generation time.",hint:"Download metadata for value help to improve the user experience with dropdowns and search."}},errors:{destination:{authError:"The selected system: {{systemName}} returned an authentication error: {{- error}}.",listDestinations:"An error occurred when retrieving the list of destinations: {{- error}}."},cannotReadCapServiceMetadata:"An error occurred reading CAP service metadata: {{serviceName}}. $t(texts.seeLogForDetails).",capModelAndServicesLoadError:"An error occurred loading the CAP model and services: {{- error, addMsgWithColonFormatter}}.",capServiceUrlPathNotDefined:"An error occurred reading CAP service metadata: {{serviceName}}. The CAP service property: `urlPath` is not defined but it is required.",unknownError:"An error occurred: {{- error, addMsgWithColonFormatter}}.",authenticationFailed:"$t(texts.authenticationFailed): {{error}}.",authenticationFailedSpecificCatalog:"{{authFailType}}: Unable to access the OData V{{odataVersion}} service catalog",authenticationFailedAllCatalogs:"{{authFailType}}: Unable to access any service catalogs",invalidUrl:"Invalid URL: {{-input, addMsgWithColonFormatter}}.",connectionError:"A connection error occurred. Ensure the target host is available on the network: {{- error}}",urlNotFound:"URL not found.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",abapEnvsUnavailable:"ABAP environments unavailable.",systemOrServiceUrlNotFound:"Please verify the URL: {{- url}}, target system configuration and network connectivity.",urlRedirect:"The service URL is redirecting.",certValidationRequired:"Certificate validation is required to continue.",exitingGeneration:"Exiting generation. Exit: {{exitReason}}.",serviceMetadataError:"An error occurred when reading the service metadata for service: {{- servicePath}}. Error: {{errorText}}",serviceMetadataErrorUI:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" }) $t(texts.seeLogForDetails)',serviceMetadataErrorLog:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" })',serviceTypeRequestError:"An error occurred when retrieving the service type: {{- error}}.",abapServiceAuthenticationFailed:"ABAP environment authentication using UAA failed.",serviceCatalogRequest:"An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}: {{error}}.",storedSystemConnectionError:"An error occurred when validating the stored system connection info. System Name: {{-systemName}}. Error: {{- error}}.",noCatalogOrServiceAvailable:"No active system or OData service endpoint connection available to retrieve the server.",allCatalogServiceRequestsFailed:"All catalog service requests failed for the selected system. OData version: V{{version}}.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata.",unparseableXML:"Unparseable XML was specified: {{-error}}.",noRelevantEntities:"The template and service selected have no relevant entities that you can use.",cfInstanceCredentialsNotReturned:"Cannot not retrieve credentials to access: {{serviceInstanceName}}.",v2CatalogServiceNoAnnotations:"An error occurred when creating an OData V2 catalog service object. Annotations will not be available: {{-error}}",backendSystemRetrieval:"An error occurred when retrieving the backend systems from the store: {{-error}}"},warnings:{largeMetadataDocument:"The metadata for this OData service is very large. It may take some time before this operation completes.",warningCertificateValidationDisabled:"User has disabled certificate validation",nonUIServiceTypeWarningMessage:"Please note that {{serviceType}} services, or not classified services, are not intended to be used for the generation of SAP Fiori UI applications",noServicesAvailable:"No services available for the selected system, see logs for further details.",noServicesAvailableForOdataVersion:"There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only",noAnnotations:"No backend annotations associated with this service were retrieved and may result in an invalid application being created",collaborativeDraftMessage:"The selected service is draft enabled but does not support collaborative draft.",certificateErrors:"A certificate error occurred when connecting to the host: {{-url}}. Certificate error: {{error}}.",allowingUnauthorizedCertsNode:"Setting the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0` makes TLS connections and HTTPS requests insecure by disabling certificate verification. It is important to understand the security risks when using this setting.",certErrorIgnoredByNodeSetting:"An SSL certificate error is being ignored by the 'NODE_TLS_REJECT_UNAUTHORIZED=0' Node.js setting. This makes TLS connections and HTTPS requests insecure by disabling certificate verification. For details of the certification error, see the logs.",noExternalServiceMetdataFetched:"No external service metadata was fetched. $t(texts.seeLogForDetails)",missingServices:"OData V{{odataVersion}} services are not available.",specifiedServicesNotAvailable_one:"The required OData service: {{-service}} is not available from the {{odataVersion}}services catalog. Please ensure the service is available.",specifiedServicesNotAvailable_other:"The required OData services are not available from the {{odataVersion}}services catalog. Please ensure the services are available. $t(texts.seeLogForDetails)",storedSystemUrlPathNotSupported:"The stored cloud system URL '{{- systemUrl}}' contains a path which is not supported for reentrance ticket authentication. The path is ignored for this connection."},texts:{suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, view the logs.",forUserName:"(for user [{{username}}])",httpStatus:"HTTP Status {{httpStatus}}",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration.",choiceNameNone:"None",passwordStoreWarning:"Passwords are stored in your operating system's credential manager and are protected by its security policies.",authorizationFailed:"Authorization failed",authenticationFailed:"Authentication failed"}};var cGt="odata-service-inquirer";var Ube=kr.createInstance();async function lGt(){await Ube.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{format:function(e,t){return t==="odataVersionFormatter"?e?` V${e}`:"":t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e}},showSupportNotice:!1}),Ube.addResourceBundle("en",cGt,uGt),s6(),XY()}function we(e,t){return t?.ns||(t=Object.assign(t??{},{ns:cGt})),Ube.t(e,t)}lGt().catch(()=>{});var YM;(function(e){e.sapSystem="sapSystem",e.capProject="capProject",e.odataServiceUrl="odataServiceUrl",e.none="none",e.metadataFile="metadataFile",e.projectSpecificDestination="projectSpecificDestination",e.businessHub="businessHub"})(YM||(YM={}));var JY="sap-client";var Cn;(function(e){e.datasourceType="datasourceType",e.metadataFilePath="metadataFilePath",e.capProject="capProject",e.capService="capService",e.serviceUrl="serviceUrl",e.serviceUrlPassword="serviceUrlPassword",e.serviceSelection="serviceSelection",e.userSystemName="userSystemName",e.systemSelection="systemSelection",e.valueHelpDownload="valueHelpDownload"})(Cn||(Cn={}));var zS=be(bGt(),1),ut=class e{static _logger=new vs({logPrefix:"@sap-ux/odata-service-inquirer"});static get logger(){return e._logger}static set logger(t){e._logger=t}static attachAxiosLogger(t){let r=typeof e.logger.getLogLevel=="function"&&e.logger.getLogLevel()==="trace",n=e.logger.debug.bind(e.logger);t.request.use(i=>(i.url||n(`Request URL: ${i.baseURL}`),zS.requestLogger(i,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:n})),i=>zS.errorLogger(i,{logger:n})),t.response.use(i=>zS.responseLogger(i,{data:r,status:!0,headers:!0,logger:n}),i=>zS.errorLogger(i,{logger:n}))}};var yt=class e{static odataService={};static isYUI=!1;static backendSystemsCache=[];static reset(){Object.keys(e.odataService).forEach(t=>{e.odataService[t]=void 0})}static resetConnectedSystem(){e.odataService.connectedSystem=void 0}};var CGt=be(Oy(),1),OGt=be(Dy(),1),Vbe=be(wGt(),1);function qo(){return yt.isYUI?Vr()?cn.bas:cn.vscode:cn.cli}function PGt(e){try{let t=(0,CGt.convert)((0,OGt.parse)(e)),r=Number.parseInt(t?.version,10);if(Number.isNaN(r))throw ut.logger.error(we("errors.unparseableOdataVersion")),new Error(we("errors.unparseableOdataVersion"));return{odataVersion:r===4?Kn.v4:Kn.v2,convertedMetadata:t}}catch(t){throw ut.logger.error(t),new Error(we("prompts.validationMessages.metadataInvalid"))}}function Zh(e){if(e)return e===Kn.v2?Er.v2:Er.v4}function s7(e){if(e?.length===1)return 0}function em(e){for(let t in e.services)e.services?.[t].log&&(e.services[t].log=(0,Vbe.removeSync)(e.services[t]?.log,{setUndefined:!0}));return e.log&&(e.log=(0,Vbe.removeSync)(e.log,{setUndefined:!0})),e}function wC(e,t,r){let n=new fa({url:t,client:r}).getId();return e.find(i=>fa.from(i).getId()===n)}function DGt(e,t){return!e&&!t||e?.length===0&&t?.length===0||e===t?!0:!e||!t?!1:[...e].sort().toString()===[...t].sort().toString()}var Gr=new pn(void 0,void 0,"@sap-ux/odata-service-inquirer");var Gbe;(function(e){e.capProjectPath="capProjectPath",e.capCliStateSetter="capCliStateSetter"})(Gbe||(Gbe={}));function o7(e,t){try{let{convertedMetadata:r,odataVersion:n}=PGt(e);if(t&&t!==n){let i=we("prompts.validationMessages.odataVersionMismatch",{providedOdataVersion:n,requiredOdataVersion:t});return ut.logger.error(i),{validationMsg:i}}return{version:n,convertedMetadata:r}}catch(r){return{validationMsg:r.message}}}var tTe=require("@sap-devx/yeoman-ui-types");var RGt=new Set([pe.CERT_SELF_SIGNED,pe.CERT_SELF_SIGNED_CERT_IN_CHAIN,pe.CERT_EXPIRED,pe.CERT_UKNOWN_OR_INVALID,pe.INVALID_SSL_CERTIFICATE]),bl=class{validity={};_validatedUrl;_destinationUrl;_destination;_validatedClient;_odataService;_serviceProvider;_axiosConfig;_catalogV2;_catalogV4;_systemAuthType;_serviceInfo;_connectedUserName;_connectedSystemName;_refreshToken;_ignoreCertError;_connectType="abap_catalog";get ignoreCertError(){return this._ignoreCertError}get axiosConfig(){return this._axiosConfig}get odataService(){return this._odataService}get catalogs(){return{[Er.v2]:this._catalogV2,[Er.v4]:this._catalogV4}}get serviceProvider(){return this._serviceProvider}get systemAuthType(){return this._systemAuthType}set systemAuthType(t){this._systemAuthType=t}get validatedUrl(){return this._validatedUrl}get validatedClient(){return this._validatedClient}get serviceInfo(){return this._serviceInfo}set serviceInfo(t){this._serviceInfo=t}get connectedUserName(){return this._connectedUserName}get refreshToken(){return this._refreshToken}get destinationUrl(){return this._destinationUrl}get destination(){return this._destination}get connectType(){return this._connectType}get connectedSystemName(){return this._connectedSystemName?this._connectedSystemName:this.systemAuthType==="serviceKey"?this.serviceInfo?.systemid:this.validatedUrl}set connectedSystemName(t){this._connectedSystemName=t}setConnectedSystem({serviceProvider:t,backendSystem:r}){if(!t.catalog){ut.logger.debug("ConnectionValidator.setConnectedSystem(): Use of a cached connected system is only supported for AbapServiceProviders. Re-authorization will be required.");return}this._serviceProvider=t,this._catalogV2=this._serviceProvider.catalog(Er.v2),this._catalogV4=this._serviceProvider.catalog(Er.v4),this._validatedUrl=r?.serviceKeys?.url??r?.url,this._connectedUserName=r?.userDisplayName,this._validatedClient=r?.client,this._refreshToken=r?.refreshToken,this._serviceInfo=r?.serviceKeys,this.validity.authenticated=!0,this.validity.reachable=!0,this.validity.urlFormat=!0,this.validity.authRequired=!0,r?.authenticationType==="reentranceTicket"?this.systemAuthType="reentranceTicket":r?.serviceKeys?this.systemAuthType="serviceKey":this.systemAuthType="basic"}async checkUrl(t,r,n,{ignoreCertError:i=!1,isSystem:s=!1,odataVersion:o,connectType:a}={}){let u=Vr();try{t.pathname=t.pathname?.endsWith("/")?t.pathname:`${t.pathname}/`,i===!0&&VA(!i),u&&t.searchParams.append("saml2","disabled");let c=this.createAxiosConfig(t,i,r,n);if(s){if(await this.createSystemConnection({axiosConfig:c,url:t,odataVersion:o,connectType:a}),a!=="odata_path"){let l=await this.serviceProvider.getSystemInfo();this._connectedUserName=l?.userName,this._connectedSystemName=l?.systemID}}else await this.createOdataServiceConnection(c,t.pathname);return this._validatedClient=t.searchParams.get(JY)??void 0,200}catch(c){if(ut.logger.debug(`ConnectionValidator.checkUrl() - error: ${c.message}`),c?.isAxiosError){if(c?.response?.status.toString().match(/5\d\d/)&&u)throw c;return c?.response?.status||c?.code}else throw c}}createAxiosConfig(t,r,n,i){let s={params:Object.fromEntries(t.searchParams),ignoreCertErrors:r,cookies:"",baseURL:t.origin,url:t.pathname,logger:ut.logger};return n&&i&&(s=Object.assign(s,{auth:{username:n,password:i}})),s}async createOdataServiceConnection(t,r){await this.shouldIgnoreCertError(t)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,VA(!1)),this._axiosConfig=t,this._serviceProvider=$He(this._axiosConfig),this._odataService=this._serviceProvider.service(r),this._connectType="odata_path",ut.attachAxiosLogger(this._serviceProvider.interceptors),await this._odataService.get("")}resetConnectionState(t=!1){this._serviceProvider=void 0,this._odataService=void 0,this._catalogV2=void 0,this._catalogV4=void 0,this._serviceInfo=void 0,this._connectedUserName=void 0,this._refreshToken=void 0,this._connectedSystemName=void 0,this._ignoreCertError=void 0,this._connectType="abap_catalog",t&&this.resetValidity(),Gr.resetErrorState()}async shouldIgnoreCertError(t,r){ut.logger.debug(`ConnectionValidator.shouldIgnoreCertError() - url: ${t.baseURL}`);let n=!1;if(process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0")try{let s=!r||r===Er.v2?Er.v2:Er.v4,o=AE(t);ut.attachAxiosLogger(o.interceptors),await o.catalog(s).listServices()}catch(s){let o=pn.getErrorType(s?.response?.status??s?.code);s?.isAxiosError&&RGt.has(o)&&(ut.logger.warn(we("warnings.certificateErrors",{url:t?.baseURL,error:o})),ut.logger.warn(we("warnings.allowingUnauthorizedCertsNode")),n=!0)}return n}async createSystemConnection({axiosConfig:t,url:r,serviceInfo:n,destination:i,odataVersion:s,connectType:o=this._connectType}){if(this.resetConnectionState(!0),this.systemAuthType==="reentranceTicket"||this.systemAuthType==="serviceKey")this._serviceProvider=this.getAbapOnCloudServiceProvider(r,n);else if(i){let a=r?r.pathname:void 0;this._validatedUrl=rT(i.Name,a),this._destinationUrl=a?this._validatedUrl.replace(`https://${i.Name.toLowerCase()}.dest`,i.Host.replace(/\/{1,10}$/,"")):i.Host,this._serviceProvider=HHe({},i)}else t&&(await this.shouldIgnoreCertError(t,s)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,VA(!1)),this._axiosConfig=t,this._serviceProvider=AE(t));if(this._serviceProvider&&ut.attachAxiosLogger(this._serviceProvider.interceptors),o==="abap_catalog"){(!s||s===Er.v2)&&(this._catalogV2=this._serviceProvider.catalog(Er.v2)),(!s||s===Er.v4)&&(this._catalogV4=this._serviceProvider.catalog(Er.v4));let a=!1;try{this._catalogV2?await this._catalogV2?.listServices():this._catalogV4&&(a=!0,await this._catalogV4?.listServices())}catch(u){await this.handleCatalogError(u,a)}}else o==="odata_path"&&r&&(ut.logger.debug(`Using provided url path: ${r.pathname} to validate authentication.`),this._connectType="odata_path",this._odataService=this._serviceProvider.service(`${r?.pathname}`),await this._odataService.get(""))}async handleCatalogError(t,r){let n=t.response?.status,i=n?pn.getErrorType(n):void 0,s=n&&!r&&(i===pe.NOT_FOUND||i===pe.AUTH);if(this._catalogV4&&s){this._axiosConfig&&await this.shouldIgnoreCertError(this._axiosConfig,Er.v4)&&(this._ignoreCertError=!0,VA(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=AE(this._axiosConfig),this._catalogV4=this._serviceProvider.catalog(Er.v4),ut.attachAxiosLogger(this._serviceProvider.interceptors));try{await this._catalogV4.listServices()}catch(o){throw i===pe.AUTH?t:o}}else throw t}async refreshTokenChangedCb(t){ut.logger.debug("ConnectionValidator.refreshTokenChangedCb()"),this._refreshToken=t}getAbapOnCloudServiceProvider(t,r,n){if(this.systemAuthType==="reentranceTicket"&&t)return Tre({environment:TE.EmbeddedSteampunk,url:t.origin,logger:ut.logger});if(this.systemAuthType==="serviceKey"&&r)return Tre({environment:TE.Standalone,service:r,refreshToken:n,refreshTokenChangedCb:this.refreshTokenChangedCb.bind(this),logger:ut.logger});throw new Error("Invalid system auth type")}async validateServiceInfo(t,r){if(!t)return!1;if(t.url===this.validatedUrl&&JSON.stringify(t.uaa)===JSON.stringify(this.serviceInfo?.uaa))return this.getValidationResultFromStatusCode(200);try{return this.systemAuthType="serviceKey",await this.createSystemConnection({serviceInfo:t,odataVersion:r}),this._connectedUserName=await this.serviceProvider.user(),this._serviceInfo=t,this._validatedUrl=t.url,this.getValidationResultFromStatusCode(200)}catch(n){return ut.logger.debug(`ConnectionValidator.validateServiceInfo() - error: ${n.message}`),n?.isAxiosError&&this.getValidationResultFromStatusCode(n?.response?.status||n?.code),Gr.getErrorMsg(n)??!1}}async validateDestination(t,r,n){try{if(this.systemAuthType=t.Authentication===op.NO_AUTHENTICATION?"basic":"unknown",tg(t)||Kl(t))return await this.validateOdataServiceDestination(t,n);{let i;if(n){let s=rT(t.Name.toLowerCase(),n);i=new URL(s)}await this.createSystemConnection({destination:t,odataVersion:r,url:i,connectType:i?"odata_path":void 0})}return{valResult:this.getValidationResultFromStatusCode(200)}}catch(i){i?.isAxiosError&&this.getValidationResultFromStatusCode(i?.response?.status||i?.code);let s=Gr.logErrorMsgs(i);return{valResult:Gr.getValidationErrorHelp(i,!1,t)??s,errorType:Gr.getCurrentErrorType()??pe.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(t,r,n){this.resetConnectionState(!0);let i=rT(t.Name.toLowerCase(),r);this._destinationUrl=r?i.replace(`https://${t.Name.toLowerCase()}.dest`,t.Host.replace(/\/{1,10}$/,"")):t.Host,this._destination=t;let s=await this.checkUrl(new URL(i),void 0,void 0,{odataVersion:n}),o=this.getValidationResultFromStatusCode(s);if(this.validity.reachable&&(this._validatedUrl=i),!this.validity.reachable){let a=Gr.logErrorMsgs(s);return{valResult:Gr.getValidationErrorHelp(s,!1,t)??a,errorType:Gr.getCurrentErrorType()??pe.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:pn.getErrorMsgFromType(pe.AUTH,t.Authentication!==op.NO_AUTHENTICATION?we("texts.checkDestinationAuthConfig"):void 0),errorType:pe.AUTH}:{valResult:o}}async validateUrl(t,{ignoreCertError:r=!1,forceReValidation:n=!1,isSystem:i=!1,odataVersion:s,systemAuthType:o,connectType:a}={}){if(this.isEmptyString(t))return this.resetValidity(),this.validity.urlFormat=!1,!1;o&&(this.systemAuthType=o);let u;try{if(u=new URL(t),u.origin==="null")return we("errors.invalidUrl",{input:t});if(a!=="odata_path"&&(this.systemAuthType==="reentranceTicket"||i)&&!(u.pathname.length===0||u.pathname==="/"))return we("prompts.validationMessages.systemUrlOriginOnlyWarning")}catch{return we("errors.invalidUrl",{input:t})}try{if(!n&&this.isUrlValidated(t))return this.validity.reachable??!1;this.resetValidity();let c=await this.checkUrl(u,void 0,void 0,{ignoreCertError:r,isSystem:i,odataVersion:s,connectType:a});return ut.logger.debug(`ConnectionValidator.validateUrl() - status: ${c}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t,this.getValidationResultFromStatusCode(c)}catch(c){return this.resetValidity(),pn.getErrorType(c)===pe.CONNECTION?(this.validity.reachable=!1,Gr.logErrorMsgs(we("errors.systemOrServiceUrlNotFound",{url:t}))):Gr.getErrorMsg(c)??c.message}}getValidationResultFromStatusCode(t){return t===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):pn.getErrorType(t)===pe.NOT_FOUND?(this.validity.reachable=!1,pn.getErrorMsgFromType(pe.NOT_FOUND)??!1):pn.isCertError(t)?(this.validity.reachable=!0,this.validity.canSkipCertError=RGt.has(pn.getErrorType(t)),this.validity.authenticated=!1,Gr.getValidationErrorHelp(t,!1)??!1):pn.getErrorType(t)===pe.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):pn.getErrorType(t)===pe.REDIRECT?(this.validity.reachable=!0,we("errors.urlRedirect")):pn.getErrorType(t)===pe.CONNECTION?(this.validity.reachable=!1,pn.getErrorMsgFromType(pe.CONNECTION,we("texts.httpStatus",{httpStatus:t}))??!1):pn.getErrorType(t)===pe.BAD_REQUEST?(this.validity.reachable=!0,pn.getErrorMsgFromType(pe.BAD_REQUEST,we("texts.httpStatus",{httpStatus:t}))??!1):pn.getErrorType(t)===pe.BAD_GATEWAY?(this.validity.reachable=!1,pn.getErrorMsgFromType(pe.BAD_GATEWAY,we("texts.httpStatus",{httpStatus:t}))??!1):(this.validity.reachable=!0,pn.getErrorMsgFromType(pn.getErrorType(t),we("texts.httpStatus",{httpStatus:t}))??!0)}isEmptyString(t){return!t||t.trim().length===0}isUrlValidated(t){return this._validatedUrl===t}async isAuthRequired(){return ut.logger.debug(`ConnectionValidator.isAuthRequired() - validity: ${JSON.stringify(this.validity)}`),!this._validatedUrl||this.validity.authenticated?!1:this.validity.authRequired}async validateAuth(t,r,n,{ignoreCertError:i=!1,sapClient:s,odataVersion:o,isSystem:a=!1,connectType:u}={}){if(!t)return{valResult:!1};try{let c=new URL(t);s&&c.searchParams.append(JY,s),this.systemAuthType="basic";let l=await this.checkUrl(c,r,n,{ignoreCertError:i,isSystem:a,odataVersion:o,connectType:u});ut.logger.debug(`ConnectionValidator.validateAuth() - status: ${l}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t;let f=this.getValidationResultFromStatusCode(l);if(f===!0){if(this.validity.authenticated===!0)return this._connectedUserName=r,{valResult:!0};if(this.validity.authenticated===!1)return{valResult:this.getAuthFailureReasonText(l,o),errorType:pe.AUTH}}return{valResult:f}}catch(c){return{valResult:Gr.getValidationErrorHelp(c,!1,this.destination)??Gr.getErrorMsg(c)??we("errors.unknownError"),errorType:Gr.getCurrentErrorType()??void 0}}}resetValidity(){delete this.validity.urlFormat,delete this.validity.reachable,delete this.validity.authRequired,delete this.validity.authenticated,delete this.validity.canSkipCertError,this._validatedUrl=void 0,this._destinationUrl=void 0,this._destination=void 0}getAuthFailureReasonText(t,r){let n;[403,"403"].includes(t)?n=we("texts.authorizationFailed"):[401,"401"].includes(t)&&(n=we("texts.authenticationFailed"));let i;return r?i=we("errors.authenticationFailedSpecificCatalog",{odataVersion:r,authFailType:n}):i=we("errors.authenticationFailedAllCatalogs",{authFailType:n}),i}};var WGt=be(nq(),1);var sv={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var ov=require("@sap-devx/yeoman-ui-types");var qJn=be(Oy(),1),jJn=be(Dy(),1);function NGt(e){return e.filter(t=>!!t.entityType.entityProperties.find(n=>n.name==="HasDraftEntity"))}var IGt=be(Oy(),1),LGt=be(Dy(),1);function VJn(e){return!!e.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}function $be(e){let t=!1;try{let r;typeof e=="string"?r=(0,IGt.convert)((0,LGt.parse)(e)):r=e;let n=NGt(r.entitySets)??[];n?.length>0&&(t=!VJn(n))}catch(r){ut.logger.error(we("errors.unparseableMetadata",{error:r.message}))}return t}var GJn=["/IWBEP/COMMON"],$Jn="SERVICE_INQUIRER_BAS_SUCCESS",HJn=e=>{let t=[],r=!1;return typeof ut.logger.getLogLevel=="function"&&(r=ut.logger.getLogLevel()==="trace"),e?.filter(n=>!GJn.some(i=>n.id.includes(i))).forEach(n=>{let i=n.name,s=n.path;i=`${i} (${n.serviceVersion}) - OData V${n.odataVersion}`,r&&(i=`${i} Service Type: ${n.serviceType}`),t.push({name:i,value:{servicePath:s,serviceODataVersion:n.odataVersion,toString:()=>i,serviceType:n.serviceType,serviceId:n.id}})}),ut.logger.debug(`Number of unique service choices: ${t.length}`),t.sort((n,i)=>n.name?n.name.localeCompare(i.name??""):0)};function WJn(e,t){let r=Object.entries(e);r.forEach(([n,i])=>{Gr.logErrorMsgs(i,we("warnings.missingServices",{odataVersion:n}))}),t===r.length&&Gr.logErrorMsgs(we("errors.allCatalogServiceRequestsFailed",{version:Object.keys(e).join(", ")}))}async function MGt(e,t){let r={},n={},i=[];for(let o of e){let a=o instanceof qm?Er.v2:Er.v4;try{let u=Date.now(),c=await o.listServices(),l=Date.now(),f=l-u===0?"<1 ms":`${l-u}ms`;n[`v${a}`]={serviceCount:c.length,duration:f},ut.logger.debug(`Number of service${a===Er.v4?" groups":"s"}: ${c.length} returned in: ${f}}`),i.push(c)}catch(u){ut.logger.error(we("errors.serviceCatalogRequest",{catalogRequestUri:o.getUri(),entitySet:o.entitySet,error:u})),Object.assign(r,{[a]:u}),i.push([])}}ut.logger.debug(`Service catalog request times: ${JSON.stringify(n,void 0," ")}`);let s=i?.flat()??[];return ut.logger.debug(`Number of services available: ${s.length}`),(s.length===0||Object.keys(r).length>0)&&WJn(r,e.length),t&&(s=s.filter(o=>t.includes(o.id)||t.includes(o.path))),HJn(s)}function Hbe(e){let t=SS.createTelemetryData({destODataType:l6(e)})??{};LS($Jn,t)}async function YJn(e,t,r,n,i){let s=[];try{let o=await t.metadata(),{validationMsg:a,version:u,convertedMetadata:c}=o7(o,i);if(a)return{validationMsg:a};if(!r&&u===Kn.v2&&n)try{ut.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=AE(n).catalog(Er.v2),ut.attachAxiosLogger(r.interceptors)}catch(l){ut.logger.warn(we("error.v2CatalogServiceNoAnnotations",l))}if(r)try{s=await r.getAnnotations({path:e})}catch{ut.logger.info(we("prompts.validationMessages.noAnnotations"))}return{annotations:s,metadata:o,version:u,convertedMetadata:c}}catch(o){let a=Gr.getErrorMsg(o);return ut.logger.error(we("errors.serviceMetadataErrorLog",{servicePath:e,errorText:a})),{validationMsg:we("errors.serviceMetadataErrorUI",{servicePath:e,errorText:a})}}}async function zJn(e,t,r){let n;if(t===RP.NotDetermined)try{n=await r.getServiceType(e)??RP.NotDetermined}catch(i){ut.logger.error(we("errors.serviceTypeRequestError",{error:i.message}))}return n??t}async function Wbe(e,t,r){let n=t.catalogs?.[e.serviceODataVersion];if(!t.serviceProvider)return ut.logger.error("ConnectionValidator connection is not initialized"),{validationResult:!1};let i=t.odataService;i||(i=t.serviceProvider.service(e.servicePath));let{validationMsg:s,version:o,convertedMetadata:a,annotations:u,metadata:c}=await YJn(e.servicePath,i,n,t.axiosConfig,r);if(s)return{validationResult:s};let l=t.destinationUrl??t.validatedUrl,f;return l&&(f=new URL(l).origin),yt.odataService.annotations=u,yt.odataService.metadata=c,yt.odataService.odataVersion=o??(e.serviceODataVersion===Er.v2?Kn.v2:Kn.v4),yt.odataService.servicePath=e.servicePath,yt.odataService.serviceId=e.serviceId,yt.odataService.origin=f,yt.odataService.sapClient=t.validatedClient,yt.odataService.ignoreCertError=t.ignoreCertError,{validationResult:!0,hasAnnotations:!!yt.odataService.annotations&&yt.odataService.annotations.length>0,convertedMetadata:a}}function FGt(e){let t=we("prompts.systemService.message");return e&&(t=t.concat(` ${we("texts.forUserName",{username:e})}`)),t}async function UGt(e,t,r,{requiredOdataVersion:n,hasAnnotations:i=!0,showCollabDraftWarnOptions:s,serviceFilter:o}){if(e?.length===0)return o&&o.length>0?{message:we("warnings.specifiedServicesNotAvailable",{odataVersion:n?`V${n} `:void 0,service:o[0],count:o.length}),severity:ov.Severity.warning}:n?{message:we("warnings.noServicesAvailableForOdataVersion",{odataVersion:n}),severity:ov.Severity.warning}:{message:we("warnings.noServicesAvailable"),severity:ov.Severity.warning};if(t){let a=t.serviceType;if(t.serviceODataVersion===Er.v2){if(!i)return{message:we("warnings.noAnnotations"),severity:ov.Severity.warning};a=await zJn(t.servicePath,t.serviceType,r.catalogs[Er.v2])}else if(s?.showCollabDraftWarning&&t.serviceODataVersion===Er.v4&&$be(s.edmx))return{message:we("warnings.collaborativeDraftMessage"),severity:ov.Severity.warning};if(a&&a!==RP.UI)return{message:we("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:ov.Severity.warning}}else if(Gr.getErrorMsg())return{message:`${Gr.getErrorMsg()} ${we("texts.seeLogForDetails")}`,severity:ov.Severity.information}}var KJn="VALUE_HELP_DOWNLOAD_PROMPTED",XJn="VALUE_HELP_DOWNLOAD_SUCCESS",JJn="VALUE_HELP_DOWNLOAD_FAILED";async function Ybe(e,t,r){let n=SS.createTelemetryData(t)??{};if(r&&Object.keys(r).length>0){let i=$Ut();i&&await i.reportEvent({eventName:e,properties:n,measurements:r},Pi.NoSampling)}else LS(e,n)}async function kGt(e,t,r){if(delete yt.odataService.valueListMetadata,await Ybe(KJn,{userChoseToDownload:e}),e&&t.serviceProvider instanceof Va){let n=Date.now();try{let i=await t.serviceProvider.fetchExternalServices(r),s=Date.now()-n;i.length>0?yt.odataService.valueListMetadata=i:ut.logger.info(we("warnings.noExternalServiceMetdataFetched")),await Ybe(XJn,{userChoseToDownload:!0,valueHelpCount:i.length},{downloadTimeMs:s})}catch(i){let s=Date.now()-n;ut.logger.error(`Failed to fetch external service metadata: ${i}`),await Ybe(JJn,{userChoseToDownload:!0,error:i instanceof Error?i.message:"Unknown error"},{downloadTimeMs:s})}}}function BGt(e,t,r){let n=`${t?t+":":""}`,i=`${n}${Cn.valueHelpDownload}`,s=`${n}${Cn.serviceSelection}`,o=`${n}cliValueHelpDownload`,a,c=[{when:l=>{let p=l?.[s]?.servicePath;return p&&r?.convertedMetadata?(a=fM(p,r?.convertedMetadata),a.length>0):!1},name:i,type:"confirm",message:we("prompts.valueHelpDownload.message"),validate:async l=>(qo()!==cn.cli&&await kGt(l,e,a),!0)}];return qo()===cn.cli&&c.push({when:async l=>{let f=l?.[i];return f!==void 0&&a&&await kGt(f,e,a),!1},name:o,type:"input"}),c}var QJn="cliServiceSelection";function av(e,t,r,n=!0){let i=[],s,o,a,u,c,l={convertedMetadata:void 0},f=r?.requiredOdataVersion,p=`${t}:${Cn.serviceSelection}`,d={when:()=>e.validity.authenticated||e.validity.authRequired===!1,name:p,type:r?.useAutoComplete?"autocomplete":"list",message:()=>FGt(e.connectedUserName),guiOptions:{breadcrumb:we("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:(g,_)=>Cw(_,i),choices:async g=>{if(i.length===0||s!==e.validatedUrl||o!==e.validatedClient||!DGt(u,r?.serviceFilter))if(e.catalogs[Kn.v2]||e.catalogs[Kn.v4])i=await ZJn(e.catalogs,f,r?.serviceFilter),s=e.validatedUrl,o=e.validatedClient,u=r?.serviceFilter?[...r.serviceFilter]:void 0,g?.[`${Cn.systemSelection}`]?.type==="destination"&&Hbe(g?.[`${Cn.systemSelection}`]?.system);else if(e.odataService&&e.validatedUrl&&!await e.isAuthRequired()){let _=new URL(e.destinationUrl??e.validatedUrl);i=[{name:_.toString(),value:{servicePath:_.pathname}}],g?.[`${Cn.systemSelection}`]?.type==="destination"&&Hbe(g?.[`${Cn.systemSelection}`]?.system)}else ut.logger.error(we("errors.noCatalogOrServiceAvailable"));return i},additionalMessages:g=>UGt(i,g,e,{requiredOdataVersion:f,hasAnnotations:c,showCollabDraftWarnOptions:l.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:l.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),default:()=>s7(i),validate:async g=>{let _=g;if(r?.useAutoComplete&&g.value&&(_=g.value),!e.validatedUrl)return!1;if(i.length===0&&Gr.hasError())return pn.getHelpForError(pe.SERVICES_UNAVAILABLE)??!1;if(_&&(a?.servicePath!==_.servicePath||a?.servicePath!==yt.odataService.servicePath)){c=void 0,l.convertedMetadata=void 0,a=_;let S=await Wbe(_,e,f);return c=S.hasAnnotations,l.convertedMetadata=S.convertedMetadata,S.validationResult}return!0}};if(r?.additionalMessages){let g={[p]:{additionalMessages:r.additionalMessages}};d=C_e([d],g,yt.odataService)[0]}let h=[d];return qo()===cn.cli&&!r?.useAutoComplete&&h.push({when:async g=>{let _=g?.[`${t}:${Cn.serviceSelection}`];if(_&&e.validatedUrl){let{validationResult:S,hasAnnotations:T,convertedMetadata:A}=await Wbe(_,e);if(typeof S=="string")throw ut.logger.error(S),new Error(S);c=T,l.convertedMetadata=A}if(i.length===0&&Gr.hasError()){let S=pn.getHelpForError(pe.SERVICES_UNAVAILABLE).toString();throw new Error(S)}return!1},name:`${t}:${QJn}`}),n||h.push(...Ds(BGt(e,t,l),g=>e.serviceProvider instanceof Va&&!!l.convertedMetadata&&g?.[p]?.serviceODataVersion===Er.v4)),h}async function ZJn(e,t,r){let n=[];return t&&e[t]?n.push(e[t]):n=Object.values(e).filter(i=>i!==void 0),await MGt(n,r)}async function zbe(){return await yS({entityName:"system"})}async function a7(e=!1){let t=[];try{t=await(await zbe()).getAll({includeSensitiveData:e,backendSystemFilter:{connectionType:["abap_catalog","odata_service"]}})}catch(r){ut.logger.error(we("errors.backendSystemRetrieval",{error:r.message}))}return t}async function eQn(e){return!!(await a7(!1)).find(r=>r.name===e)}async function XM(e){return e?await eQn(e)?we("prompts.systemName.systemNameExistsWarning"):!0:we("prompts.systemName.emptySystemNameWarning")}function qGt(e,t){try{return new URL(t,e),!0}catch{return we("errors.invalidUrl",{input:`${e}${t}`})}}async function jGt(e,t){let r=e+(t?we("texts.suggestedSystemNameClient",{client:t}):"");return await XM(r)===!0?r:tQn(r)}async function tQn(e){let t=1,r=`${e} (${t})`;for(;await XM(r)!==!0;)r=`${e} (${t})`,t++;return r}var VGt=require("@sap-devx/yeoman-ui-types");var Kbe=require("@sap-devx/yeoman-ui-types");var lc;(function(e){e.systemUsername="systemUsername",e.systemPassword="systemPassword",e.storeSystemCredentials="storeSystemCredentials"})(lc||(lc={}));function u7(e,t,r,n){let i=`${t?t+":":""}${lc.systemUsername}`,s=`${t?t+":":""}${lc.systemPassword}`,o=`${t?t+":":""}${lc.storeSystemCredentials}`,a,u=[{when:async()=>(a=await e.isAuthRequired(),e.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"input",name:i,message:we("prompts.systemUsername.message"),guiOptions:{mandatory:!0},default:"",validate:l=>l?.length>0},{when:()=>!!(e.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"password",guiOptions:{mandatory:!0,applyDefaultWhenDirty:!0},guiType:"login",showOutputTabLink:"validationMessageOverflow",name:s,message:we("prompts.systemPassword.message"),mask:"*",default:"",validate:async(l,f)=>{if(!(e.validatedUrl&&f?.[i]&&l&&(!r||r.isValid)))return!1;let p=f?.[Cn.systemSelection],d,h=!0;if(p?.type==="backendSystem")d=p.system?.client;else if(p?.type==="destination"){let _=p.system;(tg(_)||Kl(_))&&(h=!1)}let{valResult:g}=await e.validateAuth(e.validatedUrl,f?.[i],l,{sapClient:r?.sapClient||d,isSystem:h,odataVersion:Zh(n)});return g===!0&&e.serviceProvider?(rQn(e.serviceProvider,p,{username:f?.[i],password:l}),!0):g},additionalMessages:(l,f)=>{if(e.ignoreCertError&&f?.newSystemType!=="abapOnPrem")return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:Kbe.Severity.warning}}}],c={when:l=>!!(e.systemAuthType==="basic"&&a&&e.validity.authenticated&&l[s]),type:"confirm",name:o,message:we("prompts.storeSystemCredentials.message"),default:!1,guiOptions:{breadcrumb:we("prompts.storeSystemCredentials.breadcrumb")},validate:async l=>{if(yt.odataService.connectedSystem?.backendSystem){let f=yt.odataService.connectedSystem.backendSystem;yt.odataService.connectedSystem.backendSystem=Object.assign(f,{newOrUpdated:l})}return!0},additionalMessages:l=>{if(l===!0)return{message:we("texts.passwordStoreWarning"),severity:Kbe.Severity.warning}}};return Vr()||u.push(c),u}function rQn(e,t,{username:r,password:n}){if(yt.odataService.connectedSystem={serviceProvider:em(e)},t?.type==="backendSystem"){let i=t.system;(i.username!==r||i.password!==n)&&(yt.odataService.connectedSystem.backendSystem=Object.assign(i,{username:r,password:n,userDisplayName:r}))}else t?.type==="destination"&&(yt.odataService.connectedSystem.destination=t.system)}function nQn(e){switch(e){case"serviceKey":return mL.ReentranceTicket;case"reentranceTicket":return mL.ReentranceTicket;case"basic":return mL.Basic;default:return}}function c7(e,t,r,n,i=!0){return{type:"input",name:`${t?t+":":""}${sv.newSystemUrl}`,message:we("prompts.systemUrl.message"),guiOptions:{hint:we("prompts.systemUrl.description"),mandatory:!0,breadcrumb:!0},validate:async a=>{if(yt.resetConnectedSystem(),n&&n.backendSystem?.url===a&&n.backendSystem?.authenticationType==="reentranceTicket")e.setConnectedSystem(n);else if(i){let c=wC(yt.backendSystemsCache,a);if(c)return we("prompts.validationMessages.backendSystemExistsWarning",{backendName:c.name})}let u=await e.validateUrl(a,{isSystem:!0,odataVersion:Zh(r)});return u===!0&&(e.validity.authenticated&&e.serviceProvider?yt.odataService.connectedSystem={serviceProvider:em(e.serviceProvider)}:e.systemAuthType="basic"),u},additionalMessages:()=>{if(e.ignoreCertError)return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:VGt.Severity.warning}}}}function l7(e,t){let r,n=!1,i=`${t?t+":":""}`,s=`${i}${Cn.userSystemName}`;return{type:"input",guiOptions:{hint:we("prompts.systemName.hint"),applyDefaultWhenDirty:!0,breadcrumb:!0,mandatory:!0},name:s,message:we("prompts.systemName.message"),default:async()=>{let a=e.connectedSystemName;return a&&!n&&(r=await jGt(a,e.validatedClient)),r},validate:async(a,u)=>{if(!a)return!1;let c=!1;a===r?c=!0:(n=!0,r=a,c=await XM(a));let l=!!u?.[`${i}${lc.storeSystemCredentials}`];if(c===!0&&e.validatedUrl&&yt.odataService.connectedSystem){let f=new ui({authenticationType:nQn(e.systemAuthType),name:a,url:e.validatedUrl,client:e.validatedClient,username:l?e.axiosConfig?.auth?.username:void 0,password:l?e.axiosConfig?.auth?.password:void 0,serviceKeys:e.serviceInfo,userDisplayName:e.connectedUserName,systemType:gL({serviceKeys:e.serviceInfo,authenticationType:e.systemAuthType}),connectionType:"abap_catalog"});yt.odataService.connectedSystem.backendSystem=f,yt.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return c}}}var Xbe="!@\xA3*&937newSystem*X~qy^",f7="cfAbapEnvService";async function GGt(e,t,r,n,i){yt.resetConnectedSystem();let s=!1,a=await(await zbe()).read(e);if(a){n&&n.backendSystem?.url===a.url&&t.setConnectedSystem(n);let u=new URL(a.url),c=u.origin;if(i&&(c=new URL(i,u.origin).toString()),a.authenticationType==="reentranceTicket")u.pathname!=="/"&&ut.logger.warn(we("warnings.storedSystemUrlPathNotSupported",{systemUrl:a.url})),s=await t.validateUrl(c,{isSystem:!0,odataVersion:Zh(r),systemAuthType:"reentranceTicket",connectType:i?"odata_path":void 0});else if(a.serviceKeys)s=await t.validateServiceInfo(a.serviceKeys,Zh(r));else if(a.authenticationType==="basic"||!a.authenticationType){let l;if({valResult:s,errorType:l}=await t.validateAuth(c,a.username,a.password,{isSystem:!0,odataVersion:Zh(r),sapClient:a.client,connectType:i?"odata_path":void 0}),l===pe.AUTH)return ut.logger.error(we("errors.storedSystemConnectionError",{systemName:a.name,error:s})),!0}s===!0&&t.serviceProvider&&(yt.odataService.connectedSystem={serviceProvider:em(t.serviceProvider),backendSystem:a})}return s}async function JM(e,t,r,n){yt.resetConnectedSystem();let{valResult:i,errorType:s}=await t.validateDestination(e,Zh(r),n);return s===pe.AUTH&&t.systemAuthType==="basic"?(ut.logger.error(we("errors.destination.authError",{systemName:e.Name,error:i})),!0):(i===!0&&t.serviceProvider&&(yt.odataService.connectedSystem={serviceProvider:em(t.serviceProvider),destination:e}),i)}function iQn(e,t){return!t||t.odata_abap&&cq(e)||t.odata_generic&&uq(e)||t.full_service_url&&tg(e)||t.partial_service_url&&Kl(e)?!0:(ut.logger.debug(`Destination: ${e.Name} does not match any filters and will be excluded as a prompt choice. Destination configuration: ${JSON.stringify(e)}`),!1)}async function $Gt(e,t=!1,r=!1){let n=[],i;if(Vr()){let s={};try{s=await gre({stripS4HCApiHosts:!0})}catch(o){ut.logger.error(we("errors.destination.listDestinations",{error:o.message}))}n=Object.values(s).filter(o=>iQn(o,e)).map(o=>({name:yHe(o),value:{type:"destination",system:o}})),t&&(i={name:we("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:f7,system:f7}})}else{let s=await a7(!1);yt.backendSystemsCache=s,n=s.map(o=>({name:f5e(o),value:{system:o,type:"backendSystem"}})),r||(i={name:we("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:Xbe}})}return n.sort(({name:s},{name:o})=>s.localeCompare(o,void 0,{numeric:!0,caseFirst:"lower"})),i&&n.unshift(i),n}function Jbe(e,t){let r=typeof t=="string"?t:t?.value;return r?e.findIndex(i=>{let{type:s,system:o}=i.value;if(s==="destination")return o.Name===r;if(s==="backendSystem")return o.name===r;if(s==="newSystemChoice")return r===Xbe;if(s==="cfAbapEnvService")return r===f7}):-1}var p7="abapOnBtp",ens=`${p7}:${sv.newSystemUrl}`,sQn="cliCfAbapService",Qbe={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function YGt(e,t){yt.reset();let r=new bl,n=[];return n.push({type:"list",name:Qbe.abapOnBtpAuthType,choices:[{name:we("prompts.abapOnBTPType.choiceCloudFoundry"),value:"cloudFoundry"},{name:we("prompts.abapOnBTPType.choiceReentranceTicket"),value:"reentranceTicket"}],message:we("prompts.abapOnBTPType.message"),validate:()=>(r.resetConnectionState(!0),yt.resetConnectedSystem(),!0)}),n.push(Ds([c7(r,p7,e?.serviceSelection?.requiredOdataVersion,t)],i=>i?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=i.abapOnBtpAuthType,!0):!1)[0],...Ds([...Zbe(r,void 0,void 0,t)],i=>i?.abapOnBtpAuthType==="cloudFoundry")),e?.userSystemName?.hide!==!0&&n.push(Ds([l7(r,p7)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),n.push(...av(r,p7,e?.serviceSelection,e?.valueHelpDownload?.hide)),n}async function HGt(e,t,r,n=!1,i){yt.resetConnectedSystem();let s=e.label,o=await(0,WGt.apiGetInstanceCredentials)(s);if(!o?.credentials?.uaa)return we("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:s});let a=!0,u;if(qo()===cn.bas)try{u=await SHe(s,{uaaCredentials:o.credentials.uaa,hostUrl:o.credentials.url},ut.logger),a=await JM(u,t,r)}catch(c){a=c.message}else i&&i.backendSystem?.url===o.credentials.url&&JSON.stringify(i.backendSystem.serviceKeys?.uaa)===JSON.stringify(o.credentials.uaa)&&t.setConnectedSystem(i),a=await t.validateServiceInfo(o.credentials);if(!n&&a!==!0)return a;if(n&&typeof a=="string")throw ut.logger.error(a),new Error(a);if(n&&a===!1)throw ut.logger.error(Gr.getErrorMsg()??we("errors.abapServiceAuthenticationFailed")),new Error(we("errors.abapServiceAuthenticationFailed"));return t.serviceProvider&&qo()!==cn.bas&&(t.connectedSystemName=await yre(s),yt.odataService.connectedSystem={serviceProvider:em(t.serviceProvider)}),!0}function Zbe(e,t,r,n){let i=[],o=[{type:"list",name:`${t?t+":":""}${Qbe.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:async()=>{if(i=await WUt(Gr),i.length===0&&qo()===cn.cli)throw new Error(we("errors.abapEnvsUnavailable"));return i},default:()=>s7(i),message:we("prompts.cloudFoundryAbapSystem.message"),validate:async a=>{if(a){let c=await HGt(a,e,r,qo()===cn.cli,n);if(!Vr()&&c===!0&&e.validatedUrl){let l=wC(yt.backendSystemsCache,e.validatedUrl,e.validatedClient);if(l)return e.resetConnectionState(!0),we("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return c}if(Gr.getCurrentErrorType()===pe.NO_ABAP_ENVS){let c=Gr.getErrorMsg(!0),l=we("texts.seeLogForDetails");return`${c} ${l}`}return!1}}];return qo()===cn.cli&&o.push({when:async a=>{let u=a?.[Qbe.cloudFoundryAbapSystem];return u&&await HGt(u,e,r,!0),!1},name:sQn}),o}function zGt(e){let t="cfAbapBas",r=new bl;return[...Zbe(r,t,e?.serviceSelection?.requiredOdataVersion),...av(r,t,e?.serviceSelection,e?.valueHelpDownload?.hide)]}var KS="abapOnPrem",eTe=`${KS}:${sv.newSystemUrl}`,mns=`${KS}:${lc.systemUsername}`,gns=`${KS}:${lc.systemPassword}`,oQn={sapClient:"sapClient"};function KGt(e){yt.reset();let t=new bl,r=e?.serviceSelection?.requiredOdataVersion,n=aQn(e?.userSystemName,t,r);return n.push(...av(t,KS,e?.serviceSelection,e?.valueHelpDownload?.hide)),n}function aQn(e,t,r){let n=t??new bl,i={sapClient:void 0,isValid:!0},s=[c7(n,KS,r,void 0,!1),{type:"input",name:oQn.sapClient,message:we("prompts.sapClient.message"),guiOptions:{breadcrumb:we("prompts.sapClient.breadcrumb")},validate:(o,a)=>{let u=aGt(o);if(u===!0){if(i.sapClient=o,i.isValid=!0,a?.[eTe]){let c=wC(yt.backendSystemsCache,a[eTe],o);if(c)return i.isValid=!1,we("prompts.validationMessages.backendSystemExistsWarning",{backendName:c.name})}return!0}return i.sapClient=void 0,i.isValid=!1,u}},...u7(n,KS,i,r)];return e?.hide!==!0&&s.push(Ds([l7(n,KS)],o=>!!o?.[eTe]&&n.validity.reachable===!0&&(n.validity.authenticated||n.validity.authRequired===!1))[0]),s}function XGt(e,t){let r=[{type:"list",name:sv.newSystemType,choices:[{name:we("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:we("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:we("prompts.newSystemType.message")}];return r.push(...Ds(KGt(e),n=>n.newSystemType==="abapOnPrem")),r.push(...Ds(YGt(e,t),n=>n.newSystemType==="abapOnBtp")),r}var d7="systemSelection",Bns=`${d7}:${lc.systemUsername}`,qns=`${d7}:${lc.systemPassword}`,JGt={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function QGt(e,t,r,n,i){if(yt.reset(),e.type==="newSystemChoice"||e.type==="cfAbapEnvService")return t.resetConnectionState(!0),!0;let s=!1;if(e.type==="backendSystem"){e.system.connectionType==="odata_service"&&(i=e.system.url);let o=fa.from(e.system);s=await GGt(o,t,r,n,i)}else if(e.type==="destination"){if(Kl(e.system))return!0;s=await JM(e.system,t,r,i)}return s}async function rTe(e,t){yt.reset();let r=new bl,n=await uQn(r,e,t);return e?.serviceSelection?.hide||n.push(...Ds(av(r,d7,e?.serviceSelection,e?.valueHelpDownload?.hide),i=>i.systemSelection?.type!=="newSystemChoice")),Vr()?n.push(...Ds(zGt(e),i=>i.systemSelection?.type==="cfAbapEnvService")):n.push(...Ds(XGt(e,t),i=>i.systemSelection?.type==="newSystemChoice")),n}async function uQn(e,t,r){let n=t?.serviceSelection?.requiredOdataVersion,i=t?.systemSelection?.destinationFilters,s=await $Gt(i,t?.systemSelection?.includeCloudFoundryAbapEnvChoice,t?.systemSelection?.hideNewSystem),o=Jbe(s,t?.systemSelection?.defaultChoice),a=t?.systemSelection?.connectPath,u=t?.systemSelection?.onlyShowDefaultChoice&&t?.systemSelection?.defaultChoice,c=[{type:t?.systemSelection?.useAutoComplete?"autocomplete":"list",name:Cn.systemSelection,message:we("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:we("prompts.systemSelection.hint")},source:(l,f)=>Cw(f,s),choices:u?[s[o]]:s,default:()=>u?0:(o=Jbe(s,t?.systemSelection?.defaultChoice),typeof t?.systemSelection?.connectPath=="object"&&(a=t?.systemSelection.connectPath),o),validate:async l=>{if(!l)return!1;let f=l;return t?.systemSelection?.useAutoComplete&&l.value&&(f=l.value),QGt(f,e,n,r,a?.value)??!1},additionalMessages:async l=>{if(l.type==="backendSystem"&&e.systemAuthType==="basic"&&await e.isAuthRequired())return{message:we("prompts.systemSelection.authenticationFailedUpdateCredentials"),severity:tTe.Severity.information};if(e.ignoreCertError)return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:tTe.Severity.warning}}}];if(Vr()){let l={when:f=>{let p=f?.[Cn.systemSelection];return p?.type==="destination"?Kl(p.system):!1},type:"input",name:JGt.destinationServicePath,message:we("prompts.destinationServicePath.message"),guiOptions:{hint:we("prompts.destinationServicePath.hint"),mandatory:!0,breadcrumb:!0,applyDefaultWhenDirty:!0},default:"",validate:async(f,p)=>{if(!f||f.trim().length<2||f.startsWith("//"))return e.resetConnectionState(!0),we("prompts.destinationServicePath.invalidServicePathWarning");let d=p?.[Cn.systemSelection]?.system,h=qGt(d.Host,f);return h!==!0?(e.resetConnectionState(!0),h):await JM(d,e,n,f)}};c.push(l)}return qo()===cn.cli&&!t?.systemSelection?.useAutoComplete&&c.push({when:async l=>{let f=l?.[Cn.systemSelection];if(!f)return!1;let p=await QGt(f,e,n,void 0,a?.value);if(p!==!0)throw ut.logger.error(p.toString),new Error(p.toString());return!1},name:`${JGt.systemSelectionCli}`}),c.push(...u7(e,d7,void 0,n)),c}var cQn=require("@sap-devx/yeoman-ui-types");var nTe;(function(e){e.ignoreCertError="ignoreCertError",e.username="username",e.cliIgnoreCertValidate="cliIgnoreCertValidate"})(nTe||(nTe={}));var fQn=require("@sap-devx/yeoman-ui-types");async function ZGt(e,t,r){return t!==void 0&&(yt.isYUI=t),r&&(ut.logger=r),{prompts:await rTe(e),answers:yt.odataService}}var k8t=be(Oy()),RC=be(Dy()),dTe=require("node:fs"),B8t=require("node:fs/promises"),q8t=require("node:module"),C7=require("node:path");var ZM=be(L8t());var M8t=["DraftAdministrativeData","SiblingEntity"],F8t=["I_DraftAdministrativeData"];function DQn(e,t){for(let r of Object.keys(t))if(e[r]){let n=new Set(e[r].map(i=>JSON.stringify(i)));for(let i of t[r]){let s=JSON.stringify(i);n.has(s)||(n.add(s),e[r].push(i))}}else e[r]=t[r];return e}function hTe(e,t,r,n,i=""){let s={},o=Array.isArray(e)?e:[e],a={};return o.forEach(u=>{for(let l of Object.keys(u)){let f=i?`${i}/${l}`:l,p=t[f]??t[l];if(!p||!u[l])continue;let d=hTe(u[l],t,p,void 0,f);DQn(s,d),delete u[l]}a[r]||(a[r]=new Set((s[r]??[]).map(l=>JSON.stringify(l))));let c=JSON.stringify(u);a[r].has(c)||(a[r].add(c),s[r]?s[r].push(u):s[r]=[u])}),n?.length&&(IQn(s,n),LQn(s,n)),s}var RQn=/^[0-9A-F]{32}$/,U8t=/^0\d+$/;function NQn(e){let t=e.toLowerCase();return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function IQn(e,t){for(let r of t){let n=r.nodeProperty.split("/");for(let i of Object.values(e))for(let s of i){let o=s,a;if(n.length>1?a=o[n[0]]?.[n[1]]:a=o[n[0]],typeof a=="string"){if(r.parentPropertyType&&["Edm.Guid","Edm.UUID"].includes(r.parentPropertyType)&&RQn.test(a)){let u=NQn(a);n.length>1?o[n[0]][n[1]]=u:o[n[0]]=u}else if(r.parentProperty&&U8t.test(a)){let u=Number.parseInt(a,10).toString();n.length>1?o[n[0]][n[1]]=u:o[n[0]]=u;let c=o[r.parentProperty];typeof c=="string"&&U8t.test(c)&&(o[r.parentProperty]=Number.parseInt(c,10).toString())}}}}}function LQn(e,t){for(let r of t){let n=r.nodeProperty.split("/");for(let i of Object.values(e))for(let s of i){let o=s;if(!r.parentProperty||!(r.parentProperty in o))continue;(n.length>1?o[n[0]]?.DistanceFromRoot:o.DistanceFromRoot)===0&&(o[r.parentProperty]="")}}}async function j8t(e,t){let r=await yS({logger:lr.logger,entityName:"system"});return typeof t=="number"&&(t=String(t)),(await r.read(new fa({url:e,client:t})))?.name??"NewSystemChoice"}function MQn(e){let t=[],r=new Set(["DraftUUID","IsActiveEntity"]),n=e.keys.filter(i=>!r.has(i.name));if(e?.annotations.Common?.SemanticKey){e.annotations.Common.SemanticKey.forEach((o,a)=>{let u=o.value,l=n.some(f=>f.name===u)?void 0:n[a]?.name;l&&lr.logger.debug(`Semantic key '${u}' mapped to actual entity key '${l}'`),t.push({name:u,keyName:l,type:o.$target?.type??"Edm.String",value:void 0})});let s=new Set(t.map(o=>o.name));e.keys.filter(o=>r.has(o.name)&&!s.has(o.name)).forEach(o=>{t.push({name:o.name,type:o.type,value:o.name==="IsActiveEntity"?"true":void 0})})}return t.length===0&&e.keys.forEach(i=>{t.push({name:i.name,type:i.type,value:i.name==="IsActiveEntity"?"true":void 0})}),t}function FQn(e,t){return e.find(r=>r.entityTypeName===t)}function V8t(e,t,r,n=4){let i=[];return--n>0&&e.navigationProperties.forEach(s=>{if(!M8t.includes(s.name)){let o=[];s.targetType.navigationProperties.length>0&&n>0&&(o=V8t(s.targetType,t,r,n)),i.push({entityType:s.targetType,entityPath:s.name,entitySetName:t.entitySets.find(a=>a.entityTypeName===s.targetTypeName)?.name??"Unknown",navPropEntities:[...o]})}}),i}function UQn(e,t,r){let n=r?(0,C7.join)(r,`${e}.js`):void 0;if(!n||!(0,dTe.existsSync)(n))return;let s=(0,q8t.createRequire)(__importMetaUrl)(n).getReferentialConstraints?.({name:t,referentialConstraint:[]})??[];return lr.logger.debug(`getHierarchyEntities: '${e}' loaded constraints from existing file: ${JSON.stringify(s)}`),s[0]?.targetProperty}function kQn(e,t,r,n){if(r)return{parentProperty:t?.$target?.referentialConstraint?.[0]?.sourceProperty,missingReferentialConstraints:void 0};let i=t?.value;if(!i)return{parentProperty:void 0,missingReferentialConstraints:void 0};let s=UQn(e,i,n);return s?{parentProperty:s,missingReferentialConstraints:void 0}:(lr.logger.debug(`getHierarchyEntities: '${e}' nav prop '${i}' has no referentialConstraint in metadata \u2014 will prompt user`),{parentProperty:void 0,missingReferentialConstraints:{navPropName:i,constraints:[]}})}function BQn(e,t){let r=[];for(let n of e.entitySets){let i=n.entityType?.annotations?.Aggregation,s=Object.keys(i??{}).find(d=>d.startsWith("RecursiveHierarchy"));if(!s)continue;let o=i[s],a=o.NodeProperty?.value;if(!a)continue;lr.logger.debug(`Number of hierarchy annotations entity type: ${n.entityType.name} - ${Object.keys(i).filter(d=>d.startsWith("RecursiveHierarchy")).length}`);let u=s.split("#")[1]??"",c=o.ParentNavigationProperty,l=(c?.$target?.referentialConstraint?.length??0)>0,{parentProperty:f,missingReferentialConstraints:p}=kQn(n.name,c,l,t);r.push({entitySetName:n.name,entityTypeName:n.entityType.fullyQualifiedName,qualifier:u,nodeProperty:a,parentProperty:f,parentPropertyType:f?n.entityType.entityProperties.find(d=>d.name===f)?.type??"Edm.String":void 0,isDraft:!!(n.annotations?.Common?.DraftRoot??n.annotations?.Common?.DraftNode),entityTypeKeys:n.entityType.keys.map(d=>d.name),entityProperties:n.entityType.entityProperties.map(d=>d.name),missingReferentialConstraints:p})}return r.length&&lr.logger.debug(`Hierarchy entities found: ${r.map(n=>n.entitySetName).join(", ")}`),r}async function G8t(e,t,r){let n,i=e.app.services.mainService;try{if(i.local){let s=(i.annotations??[]).map(f=>f.local).filter(f=>!!f&&(0,dTe.existsSync)(f)),a=(await Promise.all(s.map(f=>(0,B8t.readFile)(f,"utf-8")))).map((f,p)=>(0,RC.parse)(f,s[p])),u=a.length>0?(0,RC.merge)((0,RC.parse)(r),...a):(0,RC.parse)(r),c=(0,k8t.convert)(u),l=await t.readApp({app:e});if(l.applicationModel&&l.applicationModel?.target?.fioriElements==ZM.FioriElementsVersion.v4){let p=l.applicationModel.pages,d,h=[];if(Object.values(p).forEach(A=>{if(A.pageType===ZM.PageTypeV4.ListReport&&A.entityType&&A.entitySet){if(d=c.entityTypes.find(w=>w.fullyQualifiedName===A.entityType),d){let w=MQn(d);n={listEntity:{entitySetName:A.entitySet,semanticKeys:w,entityPath:A.entitySet,entityType:d}},n.listEntity.navPropEntities=V8t(d,c)}}else if(A.pageType===ZM.PageTypeV4.ObjectPage&&A.entityType&&A.entitySet&&A.entitySet&&A.entityType&&A.entityType!==d?.fullyQualifiedName){let w=FQn(c.entitySets,A.entityType),x={entityPath:A.navigationProperty,entitySetName:A.entitySet,entityType:w?.entityType,page:A};h.push(x)}}),!n?.listEntity)return lr.logger.info(It("info.noListEntityDefined")),It("info.noListEntityDefined");n.pageObjectEntities=h;let g=e.getAppRoot(),S=(await xx(g))?.services?.find(A=>A.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===i.uri?.replaceAll(/(^\/)|(\/$)/g,"")),T=(0,C7.join)(g,S?.mockdataPath??(0,C7.join)(ai.Webapp,ai.LocalService,ai.Mockdata));n.hierarchyEntities=BQn(c,T)}}return n}catch(s){let o=It("errors.entityModelLoading",{error:s});return lr.logger.error(o),o}}function $8t(e,t){let r=JSON.stringify(t,null,4).replaceAll(`
|
|
723
|
+
specVersion: "2.5"`);return s.setMetadata({name:e}),s.setType("application"),s.addFioriToolsProxyMiddleware({ui5:{}}),s.addFioriToolsAppReloadMiddleware(),s.addMockServerMiddleware(t,r,n,i),s}async function qIt(e,t,r,n){let i=await Po.newInstance("");i.addMockServerMiddleware(e,t,r,n);let s=i.findCustomMiddleware("sap-fe-mockserver");if(!s)throw Error("Could not create new mockserver config");return s}async function m4(e,t,r){return r||(r=(0,VIt.create)((0,jIt.create)())),t.packageJsonConfig?.skip||kIt(r,e,t.packageJsonConfig),await BIt(r,e,t.webappPath,t.ui5MockYamlConfig),r}var _1n=be(PI(),1),S1n=be(Fx(),1);var GIt={questions:{pathToMock:"Path to mocked service",overwrite:"Overwrite services"}};var mEe="mockserver-config-writer",$It;async function A1n(){$It=kr.createInstance({resources:{en:{[mEe]:GIt}},lng:"en",fallbackLng:"en",defaultNS:mEe,ns:[mEe],showSupportNotice:!1}),await $It.init()}A1n().catch(()=>{});var HIt={error:{requiredProjectFileNotFound:"Invalid project structure. Cannot find the required file: {{-path}}.",requiredProjectPropertyNotFound:"The required project property: {{-property}} was not found in the file: {{-path}}.",requiredServiceAlreadyExists:"A service with the {{-uri}} URI already exists. Choose another service.",unparseableXML:"Unparseable XML was specified: {{-error}}."}};var gEe="odata-service-writer",w1n=kr.createInstance();async function C1n(){await w1n.init({resources:{en:{[gEe]:HIt}},lng:"en",fallbackLng:"en",defaultNS:gEe,ns:[gEe],showSupportNotice:!1})}C1n().catch(()=>{});var D1n=be(g4(),1);var Kn;(function(e){e.v2="2",e.v4="4"})(Kn||(Kn={}));var oM;(function(e){e.EDMX="edmx",e.CDS="cds"})(oM||(oM={}));var yEe="mainService";var MEe=require("node:path"),uMt=require("node:path/posix"),cMt=be(g4(),1),lMt=be(Oy(),1),fMt=be(Dy(),1);var oMt=4;function M4(e,t,r,n=yEe,i){if(!r.length||!i)return;let s=new Set;for(let o of r){let a=rNn(i,o.path),u=[t,ai.LocalService,n,a],c=o.path.split(";")[0];if(o.entityData&&!s.has(c)){for(let f of o.entityData){let p=(0,MEe.join)(...u,`${f.entitySetName}.json`);e.write(p,JSON.stringify(f.items,void 0,oMt))}s.add(c)}o.type==="value-list"&&u.push(o.target),u.push("metadata.xml");let l=(0,MEe.join)(...u);o.metadata&&e.write(l,(0,cMt.default)(o.metadata,{indent:oMt}))}}function rNn(e,t){let[r]=t.split(";"),n=r.split("/"),i="/",s=n.shift();for(;s!==void 0;){let o=(0,uMt.join)(i,s);if(!e.startsWith(o))break;i=o,s=n.shift()}return r.replace(i,"")}var LEe={valueListReferences:!0,codeLists:!0};function nNn(e){return e?{valueListReferences:e.valueListReferences??LEe.valueListReferences,codeLists:e.codeLists??LEe.codeLists}:{...LEe}}function fM(e,t,r=[],n){let i=nNn(n);if(!t)return[];let s=[t,...r.map(a=>a.Definitions)],o=[];for(let a of s){let u=typeof a=="string"?(0,lMt.convert)((0,fMt.parse)(a)):a;for(let c of Object.values(u.annotations))for(let l of c){let f=l.target.replace(u.namespace+".","");iNn(i,o,f,l,e)}}return o}function iNn(e,t,r,n,i){for(let s of n.annotations)sNn(e,t,r,s,i),oNn(e,t,s,i)}function sNn(e,t,r,n,i){if(e.valueListReferences&&n.term==="com.sap.vocabularies.Common.v1.ValueListReferences"){for(let s of n.collection??[])if(s.type==="String"){let o=s;t.push({type:"value-list",serviceRootPath:i,target:r,value:o.String})}}}function oNn(e,t,r,n){if(e.codeLists&&(r.term==="com.sap.vocabularies.CodeList.v1.CurrencyCodes"||r.term==="com.sap.vocabularies.CodeList.v1.UnitsOfMeasure")&&r.record){let i=aMt(r.record,"CollectionPath"),s=aMt(r.record,"Url");s&&t.push({type:"code-list",serviceRootPath:n,value:s,collectionPath:i??void 0})}}function aMt(e,t){let r=e.propertyValues.find(n=>n.name===t);if(r?.value?.type==="String")return r.value.String}var aNn=be(ta(),1);var L6i=(0,F4.dirname)((0,pMt.fileURLToPath)(__importMetaUrl));var e0=require("node:path"),A4t=be(g4()),x4t=be(xUt());var wUt={errors:{odataQueryError:"An error occurred when querying for odata: {{error}}. $t(texts.seeLogForDetails)",dataNotFetched:"Data was not fetched",entityModelLoading:"An error occurred when reading the data model: {{- error}}. $t(texts.seeLogForDetails)"},info:{loggingInitialised:"Logger has been configure with level: {{logLevel}}",noServiceEntityData:"No service entity data to write.",noValueHelpData:"No Value Help service data to write.",entityFilesToBeGenerated:"The following entity files will be created: {{entities}}",noListEntityDefined:"No list entity defined. A main list entity is required to download data.",hierarchyEntityQuery:"Fetching hierarchy data for entity set: {{entitySetName}}...",hierarchyFilesGenerated:"The following hierarchy data files were created: {{entities}}"},texts:{seeLogForDetails:"For more information, view the logs.",rows_one:"{{count}} row",rows_other:"{{count}} rows",generatorTitle:"SAP Fiori Elements Data Downloader"},prompts:{appSelection:{message:"Select an application as data download target",breadcrumb:"Selected App",validation:{specficationApiVersionOutdated:"The found version of @sap/ux-specification {{specApiVersion}} is too old. Data download cannot proceed.",selectedPathDoesNotContainValidApp:"The selected path does not contain a valid application. {{- error}}",appMainServiceOdataVersionNotSupported:"The selected apps main service odata version is '{{serviceOdataVersion}}'. Please select an app with a main service odata version '4'."}},relatedEntitySelection:{message:"Select entities for data download (pre-selected entities are referenced by the application)",openLogs:"Show Logs"},toggleSelection:{message:"Reset selection",labelTrue:"Clear selected",labelFalse:"Restore default selection"},entityKey:{message:"Enter values for: {{keyName}}",hint:"For range selection use '-' between values. Use commas to select non-contiguous values.",validation:{invalidKeyValueChars:"Invalid key value contain not allowed characters: {{chars}}",invalidRangeSpecified:"Invalid range specified, only the lowest and highest values allowed. e.g. '1-10'",invalidBooleanValue:"Invalid Boolean value entered. Please enter true or false.",invalidGuidValue:"Invalid GUID format. Expected format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}},skipDataDownload:{message:"If data download is not required select this option and proceed to Value Help download",hint:"Use this to temporarily disable live queries when entering multiple inputs and re-enable when ready",labelTrue:"Execute the OData query (data files will be generated on finish)",labelFalse:"Suppress the OData query (prevents multiple queries during selections)",querySuccess:'OData query success. $t(texts.rows, {"count": "{{count}}") returned. $t(texts.seeLogForDetails)',validation:{keyRequired:"Please enter at least one key field value to run the OData query"},choiceLabel:"Skip data download"},updateMainServiceMetadata:{message:"Update local metadata file from backend (remote service metadata is always used for data download):",validation:{errorLoadingAppOrMainService:"An error occurred while loading the application. Please correct the issue to proceed: {{- error}}"}},valueHelpSelection:{message:"Select Value Help data"}},steps:{odataDownloader:{name:"Configure Data Download",description:"Download data from an OData service for use with the UX Tools Mockdata Server"},valueHelpSelection:{name:"Value Help selection",description:"Value Help selection"},addConstraints:{name:"Add Missing Constraints",description:"Add Missing Constraints"}},telemetry:{unknownOs:"Unknown"}};var CUt=kr.createInstance(),r6="odata-dowload-generator";async function S_e(){await CUt.init({resources:{en:{[r6]:wUt}},lng:"en",fallbackLng:"en",defaultNS:r6,ns:[r6],missingInterpolationHandler:()=>"",showSupportNotice:!1})}function It(e,t){return t?.ns||(t=Object.assign(t??{},{ns:r6})),CUt.t(e,t)}S_e().catch(e=>console.error("Failed to initialize i18n:",e));var vTe=require("@sap-devx/yeoman-ui-types");var b_e;(function(e){e.official="officialVersions",e.snapshot="snapshotsVersions",e.support="support"})(b_e||(b_e={}));var n6="1.65.0";var i6=be(ta(),1);var TM=be(ta(),1);var Ne={maintenance:"Maintenance",outOfMaintenance:"Out of maintenance",skipped:"Skipped"},ZLn=[{version:"1.147.*",support:Ne.maintenance},{version:"1.146.*",support:Ne.maintenance},{version:"1.145.*",support:Ne.maintenance},{version:"1.144.*",support:Ne.outOfMaintenance},{version:"1.143.*",support:Ne.outOfMaintenance},{version:"1.142.*",support:Ne.maintenance},{version:"1.141.*",support:Ne.outOfMaintenance},{version:"1.140.*",support:Ne.outOfMaintenance},{version:"1.139.*",support:Ne.outOfMaintenance},{version:"1.138.*",support:Ne.outOfMaintenance},{version:"1.136.*",support:Ne.maintenance},{version:"1.135.*",support:Ne.outOfMaintenance},{version:"1.134.*",support:Ne.outOfMaintenance},{version:"1.133.*",support:Ne.outOfMaintenance},{version:"1.132.*",support:Ne.outOfMaintenance},{version:"1.131.*",support:Ne.outOfMaintenance},{version:"1.130.*",support:Ne.outOfMaintenance},{version:"1.129.*",support:Ne.outOfMaintenance},{version:"1.128.*",support:Ne.outOfMaintenance},{version:"1.127.*",support:Ne.outOfMaintenance},{version:"1.126.*",support:Ne.outOfMaintenance},{version:"1.125.*",support:Ne.outOfMaintenance},{version:"1.124.*",support:Ne.outOfMaintenance},{version:"1.123.*",support:Ne.outOfMaintenance},{version:"1.122.*",support:Ne.outOfMaintenance},{version:"1.121.*",support:Ne.outOfMaintenance},{version:"1.120.*",support:Ne.maintenance},{version:"1.119.*",support:Ne.outOfMaintenance},{version:"1.118.*",support:Ne.outOfMaintenance},{version:"1.117.*",support:Ne.outOfMaintenance},{version:"1.116.*",support:Ne.outOfMaintenance},{version:"1.115.*",support:Ne.outOfMaintenance},{version:"1.114.*",support:Ne.outOfMaintenance},{version:"1.113.*",support:Ne.outOfMaintenance},{version:"1.112.*",support:Ne.outOfMaintenance},{version:"1.111.*",support:Ne.outOfMaintenance},{version:"1.110.*",support:Ne.outOfMaintenance},{version:"1.109.*",support:Ne.outOfMaintenance},{version:"1.108.*",support:Ne.maintenance},{version:"1.107.*",support:Ne.outOfMaintenance},{version:"1.106.*",support:Ne.outOfMaintenance},{version:"1.105.*",support:Ne.outOfMaintenance},{version:"1.104.*",support:Ne.outOfMaintenance},{version:"1.103.*",support:Ne.outOfMaintenance},{version:"1.102.*",support:Ne.outOfMaintenance},{version:"1.101.*",support:Ne.outOfMaintenance},{version:"1.100.*",support:Ne.outOfMaintenance},{version:"1.99.*",support:Ne.outOfMaintenance},{version:"1.98.*",support:Ne.outOfMaintenance},{version:"1.97.*",support:Ne.outOfMaintenance},{version:"1.96.*",support:Ne.maintenance},{version:"1.95.*",support:Ne.outOfMaintenance},{version:"1.94.*",support:Ne.outOfMaintenance},{version:"1.93.*",support:Ne.outOfMaintenance},{version:"1.92.*",support:Ne.outOfMaintenance},{version:"1.91.*",support:Ne.outOfMaintenance},{version:"1.90.*",support:Ne.outOfMaintenance},{version:"1.89.*",support:Ne.outOfMaintenance},{version:"1.88.*",support:Ne.outOfMaintenance},{version:"1.87.*",support:Ne.outOfMaintenance},{version:"1.86.*",support:Ne.outOfMaintenance},{version:"1.85.*",support:Ne.outOfMaintenance},{version:"1.84.*",support:Ne.outOfMaintenance},{version:"1.82.*",support:Ne.outOfMaintenance},{version:"1.81.*",support:Ne.outOfMaintenance},{version:"1.80.*",support:Ne.outOfMaintenance},{version:"1.79.*",support:Ne.outOfMaintenance},{version:"1.78.*",support:Ne.outOfMaintenance},{version:"1.77.*",support:Ne.outOfMaintenance},{version:"1.76.*",support:Ne.outOfMaintenance},{version:"1.75.*",support:Ne.outOfMaintenance},{version:"1.74.*",support:Ne.outOfMaintenance},{version:"1.73.*",support:Ne.outOfMaintenance},{version:"1.72.*",support:Ne.outOfMaintenance},{version:"1.71.*",support:Ne.maintenance},{version:"1.70.*",support:Ne.outOfMaintenance},{version:"1.69.*",support:Ne.outOfMaintenance},{version:"1.68.*",support:Ne.outOfMaintenance},{version:"1.67.*",support:Ne.outOfMaintenance},{version:"1.66.*",support:Ne.outOfMaintenance},{version:"1.65.*",support:Ne.outOfMaintenance},{version:"1.64.*",support:Ne.outOfMaintenance},{version:"1.63.*",support:Ne.outOfMaintenance},{version:"1.62.*",support:Ne.outOfMaintenance},{version:"1.61.*",support:Ne.outOfMaintenance},{version:"1.60.*",support:Ne.outOfMaintenance},{version:"1.58.*",support:Ne.outOfMaintenance},{version:"1.56.*",support:Ne.outOfMaintenance},{version:"1.54.*",support:Ne.outOfMaintenance},{version:"1.52.*",support:Ne.outOfMaintenance},{version:"1.50.*",support:Ne.outOfMaintenance},{version:"1.48.*",support:Ne.outOfMaintenance},{version:"1.46.*",support:Ne.outOfMaintenance},{version:"1.44.*",support:Ne.outOfMaintenance},{version:"1.42.*",support:Ne.outOfMaintenance},{version:"1.40.*",support:Ne.outOfMaintenance},{version:"1.38.*",support:Ne.maintenance},{version:"1.36.*",support:Ne.outOfMaintenance},{version:"1.34.*",support:Ne.outOfMaintenance},{version:"1.32.*",support:Ne.outOfMaintenance},{version:"1.30.*",support:Ne.outOfMaintenance},{version:"1.28.*",support:Ne.outOfMaintenance},{version:"1.26.*",support:Ne.outOfMaintenance},{version:"1.24.*",support:Ne.outOfMaintenance},{version:"1.22.*",support:Ne.outOfMaintenance},{version:"*",support:Ne.outOfMaintenance}],T_e=ZLn.filter(e=>e.support===Ne.maintenance&&(0,TM.gte)((0,TM.coerce)(e.version)??"0.0.0",n6)).map(e=>({version:(0,TM.coerce)(e.version)?.version??"0.0.0",support:Ne.maintenance})),eMn=[...T_e].map(e=>e.version);var A_e=be(ta(),1);var nMn="1.72.0",DUt="1.102.0",iMn="1.136.0",sMn="1.120.0",uc;(function(e){e.SAP_BELIZE="sap_belize",e.SAP_FIORI_3="sap_fiori_3",e.SAP_FIORI_3_DARK="sap_fiori_3_dark",e.SAP_HORIZON="sap_horizon",e.SAP_HORIZON_DARK="sap_horizon_dark"})(uc||(uc={}));var oMn={[uc.SAP_BELIZE]:{id:uc.SAP_BELIZE,label:"Belize",supportUntil:iMn,deprecateSince:sMn},[uc.SAP_FIORI_3]:{id:uc.SAP_FIORI_3,label:"Quartz Light"},[uc.SAP_FIORI_3_DARK]:{id:uc.SAP_FIORI_3_DARK,label:"Quartz Dark",supportSince:nMn},[uc.SAP_HORIZON]:{id:uc.SAP_HORIZON,label:"Morning Horizon",supportSince:DUt},[uc.SAP_HORIZON_DARK]:{id:uc.SAP_HORIZON_DARK,label:"Evening Horizon",supportSince:DUt}};var qUt=be(IUt(),1),w_e=be(ta(),1);var LUt={prompts:{username:{message:"Username"},password:{message:"Password"}},ui5VersionLabels:{maintained:"Maintained",outOfMaintenance:"Out of maintenance",version_one:"version",version_other:"versions"},errors:{destination:{unavailable:"The selected destination references an instance that is not available. Please check your destination configuration and try again.",notFound:"The destination target URL cannot be found. The request failed with status code 404. Please check the destination target URL connectivity in your SAP BTP cockpit.",notReachable:"The selected system is not reachable. System Name: {{systemName}}, Error: {{- error}}.",misconfigured:'The destination is misconfigured. $t(errors.destination.missingPropMsg, {"destinationProperty": "{{destinationProperty}}" })',missingPropMsg:"The property: `{{destinationProperty}}` is missing.",httpConnectionError:"A connection error occurred with the selected destination. HTTP Code: {{- code}}. $t(texts.seeLogForDetails)"},unknownError:"An error occurred{{- error, addMsgWithColonFormatter}}",servicesUnavailable:"An error occurred retrieving services for the SAP System.",certificateError:"A certificate error has occurred{{- errorMsg, addMsgWithColonFormatter}}",urlCertValidationError:"The system URL is using {{certErrorReason}} security certificate.",authenticationFailed:"Authentication incorrect. {{- error}}",authenticationTimeout:"Authorization was not verified within the allowed time. Please ensure you have authenticated using the associated browser window.",invalidUrl:"Invalid URL{{-input, addMsgWithColonFormatter}}",connectionError:"A connection error occurred. Please ensure the target host is available on the network: {{- error}}",timeout:"A connection timeout error occurred{{- errorMsg, addMsgWithColonFormatter}}",serverReturnedAnError:"The server returned an error. {{- errorDesc}}",serverUnableToCompleteRequest:"The server was unable to complete the request. Please try again.",catalogServiceNotActive:"Catalog service is not active.",urlNotFound:"URL not found.",odataServiceUrlNotFound:"The service URL you have provided is not a valid OData Service. SAP Fiori applications require an OData service as the data source.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",redirectError:"A redirect response was received from the server",abapEnvsUnavailable:"ABAP environments unavailable.",noSuchHostError:"No such host is known. Ensure the host is available.",noAbapEnvsInCFSpace:"No ABAP environments in CF space found. Ensure an ABAP environment exists.",abapEnvsCFDiscoveryFailed:"Discovering ABAP Environments failed. Please ensure you are logged into Cloud Foundry. For more information, see https://docs.cloudfoundry.org/cf-cli/getting-started.html#login.",systemConnectionValidationFailed:"A connection to the selected system cannot be established. Ensure the credentials are valid.",internalServerError:"Internal server error{{-errorMsg, addMsgWithColonFormatter}}",badGateway:"Bad gateway{{- errorMsg, addMsgWithColonFormatter}}",badRequest:"Bad request{{- errorMsg, addMsgWithColonFormatter}}",cannotBeEmpty:"{{- field}} cannot be empty.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata."},guidedAnswers:{validationErrorHelpText:"Need help with this error?"},texts:{anExpiredCert:"an expired",aSelfSignedCert:"a self-signed",anUnknownOrInvalidCert:"an unknown or invalid",anUntrustedRootCert:"an untrusted root",suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, see the log.",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration."}};var MUt="inquirer-common",x_e=kr.createInstance();function s6(){x_e.addResourceBundle("en",MUt,LUt)}async function cMn(){await x_e.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{format:function(e,t){return t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e}},showSupportNotice:!1}),s6()}function Xt(e,t){return t?.ns||(t=Object.assign(t??{},{ns:MUt})),x_e.t(e,t)}cMn().catch(()=>{});var dMn=be(u6(),1);function Cw(e,t){return e&&t?qUt.default.filter(e,t,{extract:r=>r.name??""}).map(r=>r.original):t}var c6=class{message;link;constructor(t){Object.assign(this,t)}toString(){return`${this.message} ${this.link.text}${this.link.url?" : "+this.link.url:""}`}};var AM=be(LF(),1);function hMn(e,t,r){let n=e.additionalMessages;return(i,s)=>{let o={...(0,AM.default)(s),...(0,AM.default)(r)},a=t(i,o);return a||(typeof n=="function"?n(i,s):void 0)}}function mMn(e,t,r){let n=e.validate;return(i,s)=>{let o={...(0,AM.default)(s),...(0,AM.default)(r)},a=t?.(i,o);return a!==!0?a:typeof n=="function"?n(i,s):!0}}function gMn(e,t,r,n){let i;return r==="validate"&&t.validate&&(i=mMn(e,t.validate,n)),r==="additionalMessages"&&t.additionalMessages&&(i=hMn(e,t.additionalMessages,n)),e=Object.assign(e,{[r]:i}),e}function Ds(e,t){return e.forEach(r=>{if(r.when!==void 0)if(typeof r.when=="function"){let n=r.when;r.when=i=>t(i)?n(i):!1}else{let n=r.when;r.when=i=>t(i)&&n}else r.when=t}),e}function C_e(e,t,r){return e.forEach(n=>{let i=n.name,s=t[n.name];if(s){let o=Object.keys(s);for(let a of o){(a==="validate"||a==="additionalMessages")&&(n=gMn(n,s,a,r));let u=t[i].default;u&&(n.default=u)}}}),e}var O_e="data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjMzc5NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iIzM3OTRGRiIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";var P_e={FIORI_TOOLS:3046},ko={FIORI_TOOLS:45995,DEV_PLATFORM:45996,FIORI_APP_GENERATOR:48363,BAS_CATALOG_SERVICES_REQUEST_FAILED:48366,APPLICATION_PREVIEW:52881,CERTIFICATE_ERROR:53643,DESTINATION_MISCONFIGURED:54336,DESTINATION_UNAVAILABLE:51208,DESTINATION_NOT_FOUND:51208,BAD_GATEWAY:48366,DESTINATION_SERVICE_UNAVAILBLE:52526,NO_V4_SERVICES:57573,NO_ADT_SERVICE_AUTH:57266,DESTINATION_CONNECTION_ERRORS:48366,UI_SERVICE_GENERATOR:63068,DESTINATION_GATEWAY_TIMEOUT:57914,ADT_APP_NOT_FOUND_ERROR:63911,DESTINATION_FULL_URL:68172};var jUt="sap.ux.guidedAnswer.openGuidedAnswer",yMn="https://ga.support.sap.com/dtp/viewer/index.html";function VUt(e,t){let r="";return t.length>0&&(r=`/actions/${t.join(":")}`),`${yMn}#/tree/${e}${r}`}var GUt=be(k8(),1);var R_e,D_e;function $Ut(){return R_e}function LS(e,t){let r=vMn(e,t);R_e&&R_e.reportEvent(r,Pi.NoSampling)}function vMn(e,t){D_e=D_e??(0,GUt.default)();let r=Object.assign(t,{OperatingSystem:D_e,Platform:t.Platform||kc().technical});return{eventName:e,properties:r,measurements:{}}}function l6(e){return cq(e)?"AbapODataCatalogDest":tg(e)?"GenericODataFullUrlDest":Kl(e)?"GenericODataPartialUrlDest":"Unknown"}var EMn="GA_LINK_CREATED",_Mn="SERVICE_INQUIRER_BAS_ERROR",pe;(function(e){e.AUTH="AUTH",e.AUTH_TIMEOUT="AUTH_TIMEOUT",e.REDIRECT="REDIRECT",e.CERT="CERT",e.CERT_SELF_SIGNED="CERT_SELF_SIGNED",e.CERT_UKNOWN_OR_INVALID="CERT_UKNOWN_OR_INVALID",e.CERT_EXPIRED="CERT_EXPIRED",e.CERT_SELF_SIGNED_CERT_IN_CHAIN="CERT_SELF_SIGNED_CERT_IN_CHAIN",e.INVALID_SSL_CERTIFICATE="INVALID_SSL_CERTIFICATE",e.UNKNOWN="UNKNOWN",e.INVALID_URL="INVALID_URL",e.TIMEOUT="TIMEOUT",e.CONNECTION="CONNECTION",e.SERVICES_UNAVAILABLE="SERVICES_UNAVAILABLE",e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.NO_ABAP_ENVS="NO_ABAP_ENVS",e.CATALOG_SERVICE_NOT_ACTIVE="CATALOG_SERVICE_NOT_ACTIVE",e.NO_SUCH_HOST="NO_SUCH_HOST",e.NOT_FOUND="NOT_FOUND",e.ODATA_URL_NOT_FOUND="ODATA_URL_NOT_FOUND",e.BAD_GATEWAY="BAD_GATEWAY",e.GATEWAY_TIMEOUT="GATEWAY_TIMEOUT",e.INTERNAL_SERVER_ERROR="INTERNAL_SERVER_ERROR",e.DESTINATION_SERVICE_UNAVAILABLE="DESTINATION_SERVICE_UNAVAILABLE",e.DESTINATION_UNAVAILABLE="DESTINATION_UNAVAILABLE",e.DESTINATION_NOT_FOUND="DESTINATION_NOT_FOUND",e.DESTINATION_MISCONFIGURED="DESTINATION_MISCONFIGURED",e.NO_V2_SERVICES="NO_V2_SERVICES",e.NO_V4_SERVICES="NO_V4_SERVICES",e.BAD_REQUEST="BAD_REQUEST",e.DESTINATION_CONNECTION_ERROR="DESTINATION_CONNECTION_ERROR",e.SERVER_HTTP_ERROR="SERVER_HTTP_ERROR"})(pe||(pe={}));var SMn={[pe.AUTH]:[/401/,/403/,/Incorrect credentials were provided to login/,/Unable to retrieve SAP Business Accelerator Hub key/],[pe.AUTH_TIMEOUT]:[/UAATimeoutError/],[pe.TIMEOUT]:[/Timeout/],[pe.CERT]:[],[pe.CERT_UKNOWN_OR_INVALID]:[/UNABLE_TO_GET_ISSUER_CERT/,/UNABLE_TO_GET_ISSUER_CERT_LOCALLY/,/unable to get local issuer certificate/,/UNABLE_TO_VERIFY_LEAF_SIGNATURE/,/ERR_TLS_CERT_ALTNAME_INVALID/],[pe.CERT_EXPIRED]:[/CERT_HAS_EXPIRED/],[pe.CERT_SELF_SIGNED]:[/DEPTH_ZERO_SELF_SIGNED_CERT/],[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:[/SELF_SIGNED_CERT_IN_CHAIN/],[pe.INVALID_SSL_CERTIFICATE]:[/526/,/Invalid SSL Certificate/],[pe.UNKNOWN]:[],[pe.CONNECTION]:[/ENOTFOUND/,/ECONNRESET/,/ECONNREFUSED/,/EPROTO/,/ConnectionError/],[pe.SERVICES_UNAVAILABLE]:[],[pe.SERVICE_UNAVAILABLE]:[/503/],[pe.INVALID_URL]:[/Invalid URL/,/ERR_INVALID_URL/],[pe.REDIRECT]:[/3\d\d/],[pe.NO_ABAP_ENVS]:[],[pe.CATALOG_SERVICE_NOT_ACTIVE]:[/\/IWBEP\/CM_V4_COS\/014/,/\/IWFND\/CM_V4_COS\/021/,/Service group '\/IWFND\/CONFIG' not published/],[pe.NO_SUCH_HOST]:[/no such host/],[pe.NOT_FOUND]:[/404/],[pe.ODATA_URL_NOT_FOUND]:[],[pe.INTERNAL_SERVER_ERROR]:[/500/],[pe.BAD_GATEWAY]:[/502/],[pe.GATEWAY_TIMEOUT]:[/504/],[pe.DESTINATION_SERVICE_UNAVAILABLE]:[],[pe.DESTINATION_UNAVAILABLE]:[],[pe.DESTINATION_NOT_FOUND]:[],[pe.DESTINATION_MISCONFIGURED]:[],[pe.NO_V2_SERVICES]:[],[pe.NO_V4_SERVICES]:[],[pe.BAD_REQUEST]:[/400/],[pe.DESTINATION_CONNECTION_ERROR]:[],[pe.SERVER_HTTP_ERROR]:[/5\d\d/]},pn=class e{currentErrorMsg;currentErrorType;static _guidedAnswersEnabled;static _logger;static _platform;static get platform(){return e._platform}static set platform(t){e._platform=t}static _guidedAnswersTrigger;static get guidedAnswersTrigger(){return e._guidedAnswersTrigger}static set guidedAnswersTrigger(t){e._guidedAnswersTrigger=t}static getMessageFromError=t=>t?.message||t?.status?.toString()||t?.response?.status?.toString()||(typeof t=="string"?t:JSON.stringify(t));static serverErrorMessage=(t,r)=>Xt("errors.serverReturnedAnError",{errorDesc:r?Xt(r,{errorMsg:e.getMessageFromError(t)}):e.getMessageFromError(t)});static _errorTypeToMsg={[pe.CERT]:t=>Xt("errors.certificateError",{errorMsg:e.getMessageFromError(t)}),[pe.CERT_EXPIRED]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.anExpiredCert")}),[pe.CERT_SELF_SIGNED]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.aSelfSignedCert")}),[pe.CERT_UKNOWN_OR_INVALID]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.anUnknownOrInvalidCert")}),[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.anUntrustedRootCert")}),[pe.INVALID_SSL_CERTIFICATE]:()=>Xt("errors.urlCertValidationError",{certErrorReason:Xt("texts.anUnknownOrInvalidCert")}),[pe.AUTH]:t=>Xt("errors.authenticationFailed",{error:e.getMessageFromError(t)}),[pe.AUTH_TIMEOUT]:()=>Xt("errors.authenticationTimeout"),[pe.TIMEOUT]:t=>Xt("errors.timeout",{errorMsg:e.getMessageFromError(t)}),[pe.INVALID_URL]:()=>Xt("errors.invalidUrl"),[pe.CONNECTION]:t=>Xt("errors.connectionError",{error:e.getMessageFromError(t)}),[pe.UNKNOWN]:t=>Xt("errors.unknownError",{error:e.getMessageFromError(t)}),[pe.SERVICES_UNAVAILABLE]:()=>Xt("errors.servicesUnavailable"),[pe.SERVICE_UNAVAILABLE]:t=>e.serverErrorMessage(t),[pe.CATALOG_SERVICE_NOT_ACTIVE]:()=>Xt("errors.catalogServiceNotActive"),[pe.INTERNAL_SERVER_ERROR]:t=>e.serverErrorMessage(t,"errors.internalServerError"),[pe.NOT_FOUND]:()=>Xt("errors.urlNotFound"),[pe.ODATA_URL_NOT_FOUND]:()=>Xt("errors.odataServiceUrlNotFound"),[pe.BAD_GATEWAY]:t=>e.serverErrorMessage(t,"errors.badGateway"),[pe.DESTINATION_UNAVAILABLE]:()=>Xt("errors.destination.unavailable"),[pe.DESTINATION_NOT_FOUND]:()=>Xt("errors.destination.notFound"),[pe.DESTINATION_MISCONFIGURED]:t=>Xt("errors.destination.misconfigured",{destinationProperty:typeof t=="string"?t:""}),[pe.NO_V2_SERVICES]:()=>Xt("errors.noServicesAvailable",{version:"2"}),[pe.NO_V4_SERVICES]:()=>Xt("errors.noServicesAvailable",{version:"4"}),[pe.DESTINATION_SERVICE_UNAVAILABLE]:()=>Xt("errors.destination.unavailable"),[pe.REDIRECT]:()=>Xt("errors.redirectError"),[pe.NO_SUCH_HOST]:()=>Xt("errors.noSuchHostError"),[pe.NO_ABAP_ENVS]:()=>Xt("errors.abapEnvsUnavailable"),[pe.BAD_REQUEST]:t=>e.serverErrorMessage(t,"errors.badRequest"),[pe.DESTINATION_CONNECTION_ERROR]:()=>Xt("errors.systemConnectionValidationFailed"),[pe.SERVER_HTTP_ERROR]:t=>e.serverErrorMessage(t),[pe.GATEWAY_TIMEOUT]:t=>e.serverErrorMessage(t)};static _errorMsg=(t,r)=>e._errorTypeToMsg[t](r);static getHelpNode=t=>{let r=Vr();return{[pe.SERVICES_UNAVAILABLE]:r?ko.BAS_CATALOG_SERVICES_REQUEST_FAILED:void 0,[pe.CERT]:ko.CERTIFICATE_ERROR,[pe.CERT_EXPIRED]:ko.CERTIFICATE_ERROR,[pe.CERT_SELF_SIGNED]:ko.CERTIFICATE_ERROR,[pe.CERT_UKNOWN_OR_INVALID]:ko.CERTIFICATE_ERROR,[pe.INVALID_SSL_CERTIFICATE]:ko.CERTIFICATE_ERROR,[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:ko.CERTIFICATE_ERROR,[pe.DESTINATION_MISCONFIGURED]:ko.DESTINATION_MISCONFIGURED,[pe.DESTINATION_UNAVAILABLE]:ko.DESTINATION_UNAVAILABLE,[pe.DESTINATION_NOT_FOUND]:ko.DESTINATION_NOT_FOUND,[pe.BAD_GATEWAY]:ko.BAD_GATEWAY,[pe.DESTINATION_SERVICE_UNAVAILABLE]:ko.DESTINATION_SERVICE_UNAVAILBLE,[pe.NO_V4_SERVICES]:ko.NO_V4_SERVICES,[pe.GATEWAY_TIMEOUT]:r?ko.DESTINATION_GATEWAY_TIMEOUT:void 0,[pe.AUTH]:void 0,[pe.AUTH_TIMEOUT]:void 0,[pe.REDIRECT]:void 0,[pe.UNKNOWN]:void 0,[pe.INVALID_URL]:void 0,[pe.CONNECTION]:void 0,[pe.SERVICE_UNAVAILABLE]:void 0,[pe.NO_ABAP_ENVS]:void 0,[pe.CATALOG_SERVICE_NOT_ACTIVE]:void 0,[pe.NO_SUCH_HOST]:void 0,[pe.NOT_FOUND]:void 0,[pe.ODATA_URL_NOT_FOUND]:void 0,[pe.INTERNAL_SERVER_ERROR]:void 0,[pe.NO_V2_SERVICES]:void 0,[pe.TIMEOUT]:void 0,[pe.BAD_REQUEST]:void 0,[pe.DESTINATION_CONNECTION_ERROR]:ko.DESTINATION_CONNECTION_ERRORS,[pe.SERVER_HTTP_ERROR]:void 0}[t]};static findErrorValueForMapping=t=>t.response?.data?.error?.code||t.response?.status||t.response?.data||t.code||(["TypeError","Error"].includes(t.name)?t.message:t.name)||t.message||t;constructor(t,r=!1,n){e._logger=t??new vs({logPrefix:n??"@sap-ux/inquirer-common"}),e.guidedAnswersEnabled=r}static get guidedAnswersEnabled(){return e._guidedAnswersEnabled}static set guidedAnswersEnabled(t){e._guidedAnswersEnabled=t}static set logger(t){e._logger=t}static get logger(){return e._logger}static isCertError(t){return[pe.CERT,pe.CERT_EXPIRED,pe.CERT_SELF_SIGNED,pe.CERT_UKNOWN_OR_INVALID,pe.CERT_SELF_SIGNED_CERT_IN_CHAIN].includes(e.getErrorType(t))}static getErrorType(t){let r=t;return t instanceof Error&&(r=e.findErrorValueForMapping(t)),Object.keys(pe).find(n=>SMn[n].find(i=>i.test(r.toString())))}logErrorMsgs(t,r,n=!0){let i={errorMsg:"",errorType:pe.UNKNOWN};if(Object.values(pe).includes(t)){let s=t;i.errorMsg=e.getErrorMsgFromType(s)??s.toString(),i.errorType=s}else typeof t=="string"?i.errorMsg=t:i=e.mapErrorToMsg(t);return e._logger.error(r?`${r} ${i.errorMsg}`:i.errorMsg),n&&(this.currentErrorMsg=r??i.errorMsg,this.currentErrorType=i.errorType),i.errorMsg}static mapErrorToMsg(t){let r;return Object.values(pe).includes(t)?r=t:r=e.getErrorType(this.findErrorValueForMapping(t))??pe.UNKNOWN,{errorMsg:e._errorMsg(r,t),errorType:r}}getErrorMsg(t,r,n){let i;return t&&typeof t!="boolean"&&(i=e.mapErrorToMsg(t).errorMsg),i||(i=this.currentErrorMsg??(n?e.getErrorMsgFromType(n):void 0)),(t===!0||r)&&(this.currentErrorMsg=null,this.currentErrorType=null),i}resetErrorState(){this.currentErrorMsg=null,this.currentErrorType=null}getValidationErrorHelp(t,r=!1,n){let i,s,o;if(t?{errorMsg:s,errorType:o}=e.mapErrorToMsg(t):(s=this.currentErrorMsg??void 0,this.currentErrorType&&(o=this.currentErrorType)),o){if(n){let{errorType:a,errorMsg:u}=e.getDestinationSpecificError(o,n);s=u??s,o=a??o}o&&(i=e.getHelpForError(o,s))}return r&&(this.currentErrorMsg=null,this.currentErrorType=null),i??s}static getDestinationSpecificError(t,r){let n,i;return gHe(r)?t===pe.SERVICE_UNAVAILABLE?mHe(r)?n=pe.DESTINATION_SERVICE_UNAVAILABLE:n=pe.DESTINATION_CONNECTION_ERROR:t===pe.NOT_FOUND?(n=pe.DESTINATION_NOT_FOUND,i=this.getErrorMsgFromType(pe.DESTINATION_NOT_FOUND)):pe.INTERNAL_SERVER_ERROR===t||pe.SERVER_HTTP_ERROR===t?n=pe.DESTINATION_CONNECTION_ERROR:t===pe.AUTH&&r.Authentication!==op.NO_AUTHENTICATION&&(i=this.getErrorMsgFromType(pe.AUTH,Xt("texts.checkDestinationAuthConfig"))):(n=pe.DESTINATION_MISCONFIGURED,i=this.getErrorMsgFromType(n,"HTML5.DynamicDestination")),LS(_Mn,{basErrorType:n??t,destODataType:l6(r),Platform:this._platform??kc().technical}),{errorType:n??t,errorMsg:i}}static getErrorMsgFromType(t,r){if(pe[t])return e._errorMsg(pe[t],r)}hasError(t=!1){let r=!!this.currentErrorMsg;return t&&(this.currentErrorMsg=null,this.currentErrorType=null),r}setCurrentError(t,r){this.currentErrorMsg=e._errorMsg(pe[t],r),this.currentErrorType=t}getCurrentErrorType(t=!1){let r=this.currentErrorType;return t&&(this.currentErrorMsg=null,this.currentErrorType=null),r}static getHelpForError(t,r){let n=e.getHelpNode(t),i=r??e.getErrorMsgFromType(t);return n&&i?this.getHelpLink(n,t,i):i}static getHelpLink(t,r,n){let i={message:n,link:{text:Xt("guidedAnswers.validationErrorHelpText"),icon:O_e,url:VUt(P_e.FIORI_TOOLS,[t])}};return this.guidedAnswersEnabled&&(i.link.command={id:jUt,params:{treeId:P_e.FIORI_TOOLS,nodeIdPath:[t],trigger:this.guidedAnswersTrigger}}),LS(EMn,{errorType:r,isGuidedAnswersEnabled:this.guidedAnswersEnabled,nodeIdPath:`${t}`,Platform:this.platform??kc().technical}),new c6(i)}};var HUt=be(nq(),1);async function WUt(e){let t=[];try{let r=[Gd.ABAP,Gd.ABAP_TRIAL,Gd.ABAP_CANARY,Gd.ABAP_OEM,Gd.ABAP_OEM_CANARY,Gd.ABAP_HAAS,Gd.ABAP_STAGING,Gd.ABAP_INTERNAL_STAGING],n=process.env.ABAPEnvServiceTypes?process.env.ABAPEnvServiceTypes.split(",").map(s=>s.trim()):[],i=await(0,HUt.apiGetServicesInstancesFilteredByType)([...r,...n]);i.length>0?i.forEach(s=>{t.push({name:s.label,value:s})}):e.logErrorMsgs(pe.NO_ABAP_ENVS,Xt("errors.noAbapEnvsInCFSpace"))}catch{e.logErrorMsgs(pe.NO_ABAP_ENVS,Xt("errors.abapEnvsCFDiscoveryFailed"))}return t.sort((r,n)=>r.name?r.name.localeCompare(n.name??""):0)}var bMn=be(Oy(),1),TMn=be(Dy(),1);var pQn=be(eGt(),1);var tGt={deploy:{abapAppDescLength:"The deployment description cannot exceed 60 characters.",abapTransportNumRequired:"Provide a transport request for your application.",abapPackageWarn:"Provide a package.",abapAppNameRequired:"The application name is required.",abapInvalidNamespace:"The namespace is invalid because there are too many forward slashes.",abapInvalidNamespaceLength:"The namespace is limited to 10 characters. Entered {{length}}.",abapInvalidAppNameLength:"The application name is limited to 15 characters. Entered {{length}}.",abapInvalidAppName:"The application name must be prefixed with [{{prefix}}].",charactersForbiddenInAppName:"Only alphanumeric, underscore, and slash characters are allowed.",invalidAppNameMultipleReason:"The application name is invalid for multiple reasons:"},ui5:{namespaceMustStartWithLetter:"The namespace must start with a letter.",namespaceEndInPeriod:"The namespace cannot end with a period.",namespaceCannotBeSap:"The namespace cannot be {{str}}.",namespaceStartsWithNew:"The namespace cannot start with {{str}}.",namespaceNumberAfterPeriod:"A number cannot follow a period in the namespace.",lowerAlphaNumericOnly:"Only use lowercase alphanumeric characters.",lowerAlphaNumericDotsOnly:"Only use lowercase alphanumeric characters and dots for the namespace.",namespaceSpecialCharacter:"The namespace can only contain letters, digits, dots, and underscores.",moduleNameMustStartWithLetter:"The module name must start with a letter.",nameCombinedTooLong:"The combined length of the namespace and module name must not exceed {{length}} characters.",folderDoesNotExist:"This folder does not exist. Please enter the root folder for your project.",folderDoesNotHaveCorrectPermissions:"The selected folder does not have the required permissions. Please ensure you have permission to write to the selected folder and try again.",enterProjectFolder:"Please enter a project folder.",nameNull:"The module name cannot be null.",nameUndefined:"The module name cannot be undefined.",nameNotString:"The module name must be a string.",nameLengthZero:"The module name's length must be greater than zero.",nameStartsWithPeriod:"The module name cannot start with a period.",nameStartsWithUnderscore:"The module name cannot start with an underscore.",nameStartsOrEndsWithSpace:"The module name cannot contain leading or trailing spaces.",nameBlocklisted:"{{modName}} is a blocklisted module name. Choose a different name.",nameIsCoreModule:"{{modName}} is a core module name. Choose a different name.",nameTooLong:"The module name cannot exceed {{length}} characters.",nameTooShort:"The module name must be at least {{length}} characters.",inputValueContainsCapital:"{{promptName}} cannot contain capital letters",nameContainsSpecialCharacters:`The module name cannot contain special characters: ("~'!()*)`,nameNotUrlFriendly:"The module name can only contain URL-friendly characters.",invalidModuleName:"Invalid module name.",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path.",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must use the local CAP project as the data source."},general:{invalidUrl:"Invalid URL: [{{-input}}]",invalidClient:"[{{client}}] is invalid. Leave this field empty or enter a value between 000-999.",inputCannotBeEmpty:"The input cannot be empty.",inputCannotHaveSpaces:"The input cannot contain spaces.",invalidJSON:"Invalid JSON.",invalidValueForSpecialChars:"The input must only contain Latin alphanumeric characters or the following symbols: '-','_','$' and '.'.",maxLength:"The maximum length is: {{maxLength}} characters.",supportedFormats:"Only alphanumeric and '{{allowedCharacters}}' characters are allowed.",nameContainsSpecialCharacters:`Module name cannot contain special characters ("~'!()*)`,nameNotUrlFriendly:"Module name can only contain URL-friendly characters",invalidModuleName:"Invalid module name",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must therefore use the local CAP project as the data source.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",windowsFolderPathTooLong:"The combined length {{length}} of the target folder and module name exceeds the default Windows path length. This can cause issues with project generation."},adp:{projectNameUppercaseError:"The project name cannot contain uppercase letters.",projectNameLengthErrorExt:"The project name cannot exceed 61 characters or end with the word 'component'.",projectNameValidationErrorExt:"The project name must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",projectNameLengthErrorInt:"The project name cannot start with the word 'customer', exceed 61 characters, or end with the word 'component'.",projectNameValidationErrorInt:"The project name must only contain Latin alphanumeric characters and it must have at least two parts. The different parts must be separated by a period and every part must start with a letter.",duplicatedProjectName:"A project with this name already exists in your workspace. Please choose another name.",differentNamespaceThanProjectName:"The namespace must be the same as the project name.",namespaceSameAsProjectNameError:"The namespace must be the same as the project name.",namespaceLengthError:"The namespace cannot exceed 61 characters or end with the word 'component'.",namespaceValidationError:"The namespace must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",achMandatoryError:"The Application Component Hierarchy must only contain capital letters, digits, and dashes."}};var rGt="project-input-validator",Fbe=kr.createInstance();function XY(){Fbe.addResourceBundle("en",rGt,tGt)}async function nGt(){await Fbe.init({lng:"en",fallbackLng:"en",showSupportNotice:!1}),XY()}function YS(e,t){return t?.ns||(t=Object.assign(t??{},{ns:rGt})),Fbe.t(e,t)}nGt().catch(()=>{});var sJn=be(oGt(),1);function aGt(e){let t=e?.trim()||"";return t===""||/^\d{3}$/.test(t)?!0:YS("general.invalidClient",{client:e})}var uGt={prompts:{datasourceType:{message:"Data Source",projectSpecificDestName:"Project Specific Destination",businessHubName:"SAP Business Accelerator Hub",sapSystemName:"System",odataServiceUrlName:"OData Service",capProjectName:"Local CAP Project",metadataFileName:"Metadata Document",choiceNone:"$t(texts.choiceNameNone)",projectSpecificDestChoiceText:"Connect to a $t(prompts.datasourceType.projectSpecificDestName)",businessHubChoiceText:"Connect to $t(prompts.datasourceType.businessHubName)",sapSystemChoiceText:"Connect to a $t(prompts.datasourceType.sapSystemName)",odataServiceUrlChoiceText:"Connect to an $t(prompts.datasourceType.odataServiceUrlName)",capProjectChoiceText:"Use a $t(prompts.datasourceType.capProjectName)",metadataFileChoiceText:"Upload a $t(prompts.datasourceType.metadataFileName)",notYetImplementedWarningMessage:"The selected data source type: {{ datasourceType }} is not yet implemented."},metadataFile:{message:"Metadata File Path",description:"Upload a metadata file",placeholder_odata_service_url:"/here/goes/your/serviceurl/"},capProject:{message:"Choose a CAP Project",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capProjectPath:{message:"CAP Project Folder Path",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capService:{message:"OData Service",description:"Select a local CAP service",breadcrumb:"CAP Service",enterCapPathChoiceName:"Manually select CAP service folder path"},odataServiceUrl:{message:"OData{{odataVersion, odataVersionFormatter}} service URL"},ignoreCertErrors:{message:"Do you want to continue generation with the untrusted certificate?"},serviceUsername:{message:"Service username"},servicePassword:{message:"Service password"},validationMessages:{odataVersionMismatch:"The template you have chosen supports V{{requiredOdataVersion}} OData services only. The provided version is V{{providedOdataVersion}}.",metadataInvalid:"The service metadata is invalid.",metadataFilePathNotValid:"The metadata file does not exist or is not accessible. Please specify a valid file path.",capProjectNotFound:"The folder you have selected does not contain a valid CAP project. Please check and try again.",warningCertificateValidationDisabled:"Certificate validation has been disabled by the user.",annotationsNotFound:"Annotations not found for the specified service.",backendSystemExistsWarning:'A saved system connection entry: "{{- backendName}}" already exists with the same URL and client. Please reuse the existing entry or remove it, using the systems panel, before adding a new connection.',systemUrlOriginOnlyWarning:"System URLs must only contain the hostname and may also include the port, for example, 'https://abc.com:123/'."},warnings:{nonUIServiceTypeWarningMessage:"Services of service type: {{serviceType}} or without a service type are not intended to be used for generating SAP Fiori UI applications.",noServicesAvailable:"There are no services available for the selected system. For more information, see the logs.",noServicesAvailableForOdataVersion:"There are no OData V{{odataVersion}} services available from the selected system and the template you have chosen only supports OData V{{odataVersion}} services.",noAnnotations:"No back-end annotations associated with this service were retrieved. This can result in an invalid application.",collaborativeDraftMessage:"The selected service is draft-enabled but does not support collaborative draft."},systemUrl:{message:"System URL",description:"Enter the URL of the SAP System",placeholder:"https://<host>:<port>"},sapClient:{message:"SAP client (leave empty for default)",breadcrumb:"SAP Client"},systemUsername:{message:"Username"},systemPassword:{message:"Password"},storeSystemCredentials:{message:"Do you want to store the system credentials?",breadcrumb:"Store Credentials"},systemService:{message:"Service",breadcrumb:"Service",noServicesWarning:"No services available for the selected system. For more information, see the logs."},newSystemType:{choiceAbapOnPrem:"ABAP On Premise",choiceAbapOnBtp:"ABAP Environment on SAP Business Technology Platform",choiceCFAbapEnvServiceOnBtp:"Cloud Foundry ABAP environment on SAP Business Technology Platform",message:"System Type",notYetImplementedWarningMessage:"The selected system type: {{ systemType }} is not yet implemented."},systemName:{message:"System name",hint:"Entering a system name will save the connection for re-use.",systemNameExistsWarning:"A system with that name already exists in the secure storage. Please try a different name.",reservedSystemNameWarning:"'{{ systemName }}' is a reserved system name. Please try a different name.",emptySystemNameWarning:"System name cannot be empty."},systemSelection:{newSystemChoiceLabel:"New System",hint:"Select a system configuration.",message:"System",authenticationFailedUpdateCredentials:"$t(texts.authenticationFailed). Please try updating the credentials."},abapOnBTPType:{message:"ABAP environment definition source",choiceReentranceTicket:"Use Reentrance Ticket",choiceServiceKey:"Upload a Service Key File",choiceCloudFoundry:"Discover a Cloud Foundry Service"},serviceKey:{message:"Service Key File Path",hint:"Select a local file that defines the service connection for an ABAP Environment on SAP Business Technology Platform.",incompleteServiceKeyInfo:"The service keys file does not contain the required information. Check the file is valid and try again.",unparseableServiceKey:"The service keys file does not contain a valid JSON format. Check the formatting and try again."},cloudFoundryAbapSystem:{message:"ABAP environment",hint:"Enter the name of the Cloud Foundry service that contains the ABAP Environment instance."},destinationServicePath:{message:"Service Path",hint:"Enter the path to the OData service relative to the selected destination URL.",invalidServicePathWarning:"Please enter a valid service path"},mainEntitySelection:{message:"Main Entity",defaultEntityNameNotFoundWarning:"The supplied entity cannot be found in the service. Please choose from the list above.",noDraftEnabledEntitiesError:"The CAP service you have chosen does not have any entities that are draft enabled. To generate an OData V4 SAP Fiori application using this floorplan for a CAP project, the entity selected must be draft enabled.",mainEntityParameterFoundInfo:"The selected entity '{{entityName}}' requires a parameter which is set by the application filters. Navigation entities are not supported.",noEntitiesError:"$t(errors.noRelevantEntities)",noEntitiesAlpV4Error:"The OData V4 service you have provided is not suitable for use in an analytical list page application. The service must contain aggregate-based entities for this template.",requiredError:"Please select a main entity to continue."},navigationEntitySelection:{message:"Navigation Entity",choiceNone:"$t(texts.choiceNameNone)"},filterEntitySet:{message:"Filter Entity",noEntitiesError:"$t(errors.noRelevantEntities)"},pageBuildingBlock:{message:"Add a Page Building Block to the Application?",tooltip:"The Page building block is supported from SAPUI5 version 1.136. By choosing this option, you will be restricting the minimum SAPUI5 versions available for the application to be 1.136 and above.",warning:"The Page building block is supported with SAPUI5 version 1.136 and above.",titleMessage:"Page Title"},tableType:{message:"Table Type",hint:"Defines the table type for the list report page.",requiredError:"Please select a table type to continue.",choiceNone:"$t(texts.choiceNameNone)",choiceGrid:"Grid",choiceAnalytical:"Analytical",choiceResponsive:"Responsive",choiceTree:"Tree",analyticalTableDefault:"The 'Analytical' table type is chosen by default because the selected entity supports it.",treeTableDefault:"The 'Tree' table type is chosen by default because the selected entity supports it.",responsiveTableInfo:"Only use the responsive table if the total number of items in the table doesn't exceed 200."},hierarchyQualifier:{message:"Hierarchy Qualifier",hint:"Leading property that decides between either a recursive hierarchy or data aggregation.",qualifierRequiredForV4Warning:"Hierarchy qualifier is required for OData V4 services."},addFEOPAnnotations:{message:"Automatically add a form to the generated application if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations"},addLineItemAnnotations:{message:"Automatically add table columns to the list page and a section to the object page if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations",valueHelpsAnnotationsInfoMessage:"Basic value helps will also be created."},presentationQualifier:{message:"Qualifier",hint:"Represents the qualifier of the `SelectionPresentationVariant`. The analytical list page looks for a `SelectionPresentationVariant` with this qualifier and if not found, it looks for a `PresentationVariant` with this qualifier."},tableSelectionMode:{message:"Selection Mode",hint:"Defines different selection modes for the `SmartTable` in the analytical list page.",choiceNone:"$t(texts.choiceNameNone)",choiceSingle:"Single",choiceAuto:"Auto",choiceMulti:"Multi"},tableMultiSelect:{message:"Allow Multi Select",hint:"Allows you to show a checkbox for selecting multiple items in a table. This setting comes into effect only if there are actions defined either by using an annotation or a setting in the `manifest.json` file."},tableAutoHide:{message:"Auto Hide",hint:"Determines the chart or table interaction. If set to `true`, the chart acts as a filter for the table. If set to `false`, the matching table rows are highlighted but the table is not filtered."},smartVariantManagement:{message:"Enable Smart Variant Management",hint:"Enables page level variant."},valueHelpDownload:{message:"The service contains references to value help services. Do you want to download the associated metadata during generation? This may increase generation time.",hint:"Download metadata for value help to improve the user experience with dropdowns and search."}},errors:{destination:{authError:"The selected system: {{systemName}} returned an authentication error: {{- error}}.",listDestinations:"An error occurred when retrieving the list of destinations: {{- error}}."},cannotReadCapServiceMetadata:"An error occurred reading CAP service metadata: {{serviceName}}. $t(texts.seeLogForDetails).",capModelAndServicesLoadError:"An error occurred loading the CAP model and services: {{- error, addMsgWithColonFormatter}}.",capServiceUrlPathNotDefined:"An error occurred reading CAP service metadata: {{serviceName}}. The CAP service property: `urlPath` is not defined but it is required.",unknownError:"An error occurred: {{- error, addMsgWithColonFormatter}}.",authenticationFailed:"$t(texts.authenticationFailed): {{error}}.",authenticationFailedSpecificCatalog:"{{authFailType}}: Unable to access the OData V{{odataVersion}} service catalog",authenticationFailedAllCatalogs:"{{authFailType}}: Unable to access any service catalogs",invalidUrl:"Invalid URL: {{-input, addMsgWithColonFormatter}}.",connectionError:"A connection error occurred. Ensure the target host is available on the network: {{- error}}",urlNotFound:"URL not found.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",abapEnvsUnavailable:"ABAP environments unavailable.",systemOrServiceUrlNotFound:"Please verify the URL: {{- url}}, target system configuration and network connectivity.",urlRedirect:"The service URL is redirecting.",certValidationRequired:"Certificate validation is required to continue.",exitingGeneration:"Exiting generation. Exit: {{exitReason}}.",serviceMetadataError:"An error occurred when reading the service metadata for service: {{- servicePath}}. Error: {{errorText}}",serviceMetadataErrorUI:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" }) $t(texts.seeLogForDetails)',serviceMetadataErrorLog:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" })',serviceTypeRequestError:"An error occurred when retrieving the service type: {{- error}}.",abapServiceAuthenticationFailed:"ABAP environment authentication using UAA failed.",serviceCatalogRequest:"An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}: {{error}}.",storedSystemConnectionError:"An error occurred when validating the stored system connection info. System Name: {{-systemName}}. Error: {{- error}}.",noCatalogOrServiceAvailable:"No active system or OData service endpoint connection available to retrieve the server.",allCatalogServiceRequestsFailed:"All catalog service requests failed for the selected system. OData version: V{{version}}.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata.",unparseableXML:"Unparseable XML was specified: {{-error}}.",noRelevantEntities:"The template and service selected have no relevant entities that you can use.",cfInstanceCredentialsNotReturned:"Cannot not retrieve credentials to access: {{serviceInstanceName}}.",v2CatalogServiceNoAnnotations:"An error occurred when creating an OData V2 catalog service object. Annotations will not be available: {{-error}}",backendSystemRetrieval:"An error occurred when retrieving the backend systems from the store: {{-error}}"},warnings:{largeMetadataDocument:"The metadata for this OData service is very large. It may take some time before this operation completes.",warningCertificateValidationDisabled:"User has disabled certificate validation",nonUIServiceTypeWarningMessage:"Please note that {{serviceType}} services, or not classified services, are not intended to be used for the generation of SAP Fiori UI applications",noServicesAvailable:"No services available for the selected system, see logs for further details.",noServicesAvailableForOdataVersion:"There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only",noAnnotations:"No backend annotations associated with this service were retrieved and may result in an invalid application being created",collaborativeDraftMessage:"The selected service is draft enabled but does not support collaborative draft.",certificateErrors:"A certificate error occurred when connecting to the host: {{-url}}. Certificate error: {{error}}.",allowingUnauthorizedCertsNode:"Setting the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0` makes TLS connections and HTTPS requests insecure by disabling certificate verification. It is important to understand the security risks when using this setting.",certErrorIgnoredByNodeSetting:"An SSL certificate error is being ignored by the 'NODE_TLS_REJECT_UNAUTHORIZED=0' Node.js setting. This makes TLS connections and HTTPS requests insecure by disabling certificate verification. For details of the certification error, see the logs.",noExternalServiceMetdataFetched:"No external service metadata was fetched. $t(texts.seeLogForDetails)",missingServices:"OData V{{odataVersion}} services are not available.",specifiedServicesNotAvailable_one:"The required OData service: {{-service}} is not available from the {{odataVersion}}services catalog. Please ensure the service is available.",specifiedServicesNotAvailable_other:"The required OData services are not available from the {{odataVersion}}services catalog. Please ensure the services are available. $t(texts.seeLogForDetails)",storedSystemUrlPathNotSupported:"The stored cloud system URL '{{- systemUrl}}' contains a path which is not supported for reentrance ticket authentication. The path is ignored for this connection."},texts:{suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, view the logs.",forUserName:"(for user [{{username}}])",httpStatus:"HTTP Status {{httpStatus}}",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration.",choiceNameNone:"None",passwordStoreWarning:"Passwords are stored in your operating system's credential manager and are protected by its security policies.",authorizationFailed:"Authorization failed",authenticationFailed:"Authentication failed"}};var cGt="odata-service-inquirer";var Ube=kr.createInstance();async function lGt(){await Ube.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{format:function(e,t){return t==="odataVersionFormatter"?e?` V${e}`:"":t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e}},showSupportNotice:!1}),Ube.addResourceBundle("en",cGt,uGt),s6(),XY()}function we(e,t){return t?.ns||(t=Object.assign(t??{},{ns:cGt})),Ube.t(e,t)}lGt().catch(()=>{});var YM;(function(e){e.sapSystem="sapSystem",e.capProject="capProject",e.odataServiceUrl="odataServiceUrl",e.none="none",e.metadataFile="metadataFile",e.projectSpecificDestination="projectSpecificDestination",e.businessHub="businessHub"})(YM||(YM={}));var JY="sap-client";var Cn;(function(e){e.datasourceType="datasourceType",e.metadataFilePath="metadataFilePath",e.capProject="capProject",e.capService="capService",e.serviceUrl="serviceUrl",e.serviceUrlPassword="serviceUrlPassword",e.serviceSelection="serviceSelection",e.userSystemName="userSystemName",e.systemSelection="systemSelection",e.valueHelpDownload="valueHelpDownload"})(Cn||(Cn={}));var zS=be(bGt(),1),ut=class e{static _logger=new vs({logPrefix:"@sap-ux/odata-service-inquirer"});static get logger(){return e._logger}static set logger(t){e._logger=t}static attachAxiosLogger(t){let r=typeof e.logger.getLogLevel=="function"&&e.logger.getLogLevel()==="trace",n=e.logger.debug.bind(e.logger);t.request.use(i=>(i.url||n(`Request URL: ${i.baseURL}`),zS.requestLogger(i,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:n})),i=>zS.errorLogger(i,{logger:n})),t.response.use(i=>zS.responseLogger(i,{data:r,status:!0,headers:!0,logger:n}),i=>zS.errorLogger(i,{logger:n}))}};var yt=class e{static odataService={};static isYUI=!1;static backendSystemsCache=[];static reset(){Object.keys(e.odataService).forEach(t=>{e.odataService[t]=void 0})}static resetConnectedSystem(){e.odataService.connectedSystem=void 0}};var CGt=be(Oy(),1),OGt=be(Dy(),1),Vbe=be(wGt(),1);function qo(){return yt.isYUI?Vr()?cn.bas:cn.vscode:cn.cli}function PGt(e){try{let t=(0,CGt.convert)((0,OGt.parse)(e)),r=Number.parseInt(t?.version,10);if(Number.isNaN(r))throw ut.logger.error(we("errors.unparseableOdataVersion")),new Error(we("errors.unparseableOdataVersion"));return{odataVersion:r===4?Kn.v4:Kn.v2,convertedMetadata:t}}catch(t){throw ut.logger.error(t),new Error(we("prompts.validationMessages.metadataInvalid"))}}function Zh(e){if(e)return e===Kn.v2?Er.v2:Er.v4}function s7(e){if(e?.length===1)return 0}function em(e){for(let t in e.services)e.services?.[t].log&&(e.services[t].log=(0,Vbe.removeSync)(e.services[t]?.log,{setUndefined:!0}));return e.log&&(e.log=(0,Vbe.removeSync)(e.log,{setUndefined:!0})),e}function wC(e,t,r){let n=new fa({url:t,client:r}).getId();return e.find(i=>fa.from(i).getId()===n)}function DGt(e,t){return!e&&!t||e?.length===0&&t?.length===0||e===t?!0:!e||!t?!1:[...e].sort().toString()===[...t].sort().toString()}var Gr=new pn(void 0,void 0,"@sap-ux/odata-service-inquirer");var Gbe;(function(e){e.capProjectPath="capProjectPath",e.capCliStateSetter="capCliStateSetter"})(Gbe||(Gbe={}));function o7(e,t){try{let{convertedMetadata:r,odataVersion:n}=PGt(e);if(t&&t!==n){let i=we("prompts.validationMessages.odataVersionMismatch",{providedOdataVersion:n,requiredOdataVersion:t});return ut.logger.error(i),{validationMsg:i}}return{version:n,convertedMetadata:r}}catch(r){return{validationMsg:r.message}}}var tTe=require("@sap-devx/yeoman-ui-types");var RGt=new Set([pe.CERT_SELF_SIGNED,pe.CERT_SELF_SIGNED_CERT_IN_CHAIN,pe.CERT_EXPIRED,pe.CERT_UKNOWN_OR_INVALID,pe.INVALID_SSL_CERTIFICATE]),bl=class{validity={};_validatedUrl;_destinationUrl;_destination;_validatedClient;_odataService;_serviceProvider;_axiosConfig;_catalogV2;_catalogV4;_systemAuthType;_serviceInfo;_connectedUserName;_connectedSystemName;_refreshToken;_ignoreCertError;_connectType="abap_catalog";get ignoreCertError(){return this._ignoreCertError}get axiosConfig(){return this._axiosConfig}get odataService(){return this._odataService}get catalogs(){return{[Er.v2]:this._catalogV2,[Er.v4]:this._catalogV4}}get serviceProvider(){return this._serviceProvider}get systemAuthType(){return this._systemAuthType}set systemAuthType(t){this._systemAuthType=t}get validatedUrl(){return this._validatedUrl}get validatedClient(){return this._validatedClient}get serviceInfo(){return this._serviceInfo}set serviceInfo(t){this._serviceInfo=t}get connectedUserName(){return this._connectedUserName}get refreshToken(){return this._refreshToken}get destinationUrl(){return this._destinationUrl}get destination(){return this._destination}get connectType(){return this._connectType}get connectedSystemName(){return this._connectedSystemName?this._connectedSystemName:this.systemAuthType==="serviceKey"?this.serviceInfo?.systemid:this.validatedUrl}set connectedSystemName(t){this._connectedSystemName=t}setConnectedSystem({serviceProvider:t,backendSystem:r}){if(!t.catalog){ut.logger.debug("ConnectionValidator.setConnectedSystem(): Use of a cached connected system is only supported for AbapServiceProviders. Re-authorization will be required.");return}this._serviceProvider=t,this._catalogV2=this._serviceProvider.catalog(Er.v2),this._catalogV4=this._serviceProvider.catalog(Er.v4),this._validatedUrl=r?.serviceKeys?.url??r?.url,this._connectedUserName=r?.userDisplayName,this._validatedClient=r?.client,this._refreshToken=r?.refreshToken,this._serviceInfo=r?.serviceKeys,this.validity.authenticated=!0,this.validity.reachable=!0,this.validity.urlFormat=!0,this.validity.authRequired=!0,r?.authenticationType==="reentranceTicket"?this.systemAuthType="reentranceTicket":r?.serviceKeys?this.systemAuthType="serviceKey":this.systemAuthType="basic"}async checkUrl(t,r,n,{ignoreCertError:i=!1,isSystem:s=!1,odataVersion:o,connectType:a}={}){let u=Vr();try{t.pathname=t.pathname?.endsWith("/")?t.pathname:`${t.pathname}/`,i===!0&&VA(!i),u&&t.searchParams.append("saml2","disabled");let c=this.createAxiosConfig(t,i,r,n);if(s){if(await this.createSystemConnection({axiosConfig:c,url:t,odataVersion:o,connectType:a}),a!=="odata_path"){let l=await this.serviceProvider.getSystemInfo();this._connectedUserName=l?.userName,this._connectedSystemName=l?.systemID}}else await this.createOdataServiceConnection(c,t.pathname);return this._validatedClient=t.searchParams.get(JY)??void 0,200}catch(c){if(ut.logger.debug(`ConnectionValidator.checkUrl() - error: ${c.message}`),c?.isAxiosError){if(c?.response?.status.toString().match(/5\d\d/)&&u)throw c;return c?.response?.status||c?.code}else throw c}}createAxiosConfig(t,r,n,i){let s={params:Object.fromEntries(t.searchParams),ignoreCertErrors:r,cookies:"",baseURL:t.origin,url:t.pathname,logger:ut.logger};return n&&i&&(s=Object.assign(s,{auth:{username:n,password:i}})),s}async createOdataServiceConnection(t,r){await this.shouldIgnoreCertError(t)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,VA(!1)),this._axiosConfig=t,this._serviceProvider=$He(this._axiosConfig),this._odataService=this._serviceProvider.service(r),this._connectType="odata_path",ut.attachAxiosLogger(this._serviceProvider.interceptors),await this._odataService.get("")}resetConnectionState(t=!1){this._serviceProvider=void 0,this._odataService=void 0,this._catalogV2=void 0,this._catalogV4=void 0,this._serviceInfo=void 0,this._connectedUserName=void 0,this._refreshToken=void 0,this._connectedSystemName=void 0,this._ignoreCertError=void 0,this._connectType="abap_catalog",t&&this.resetValidity(),Gr.resetErrorState()}async shouldIgnoreCertError(t,r){ut.logger.debug(`ConnectionValidator.shouldIgnoreCertError() - url: ${t.baseURL}`);let n=!1;if(process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0")try{let s=!r||r===Er.v2?Er.v2:Er.v4,o=AE(t);ut.attachAxiosLogger(o.interceptors),await o.catalog(s).listServices()}catch(s){let o=pn.getErrorType(s?.response?.status??s?.code);s?.isAxiosError&&RGt.has(o)&&(ut.logger.warn(we("warnings.certificateErrors",{url:t?.baseURL,error:o})),ut.logger.warn(we("warnings.allowingUnauthorizedCertsNode")),n=!0)}return n}async createSystemConnection({axiosConfig:t,url:r,serviceInfo:n,destination:i,odataVersion:s,connectType:o=this._connectType}){if(this.resetConnectionState(!0),this.systemAuthType==="reentranceTicket"||this.systemAuthType==="serviceKey")this._serviceProvider=this.getAbapOnCloudServiceProvider(r,n);else if(i){let a=r?r.pathname:void 0;this._validatedUrl=rT(i.Name,a),this._destinationUrl=a?this._validatedUrl.replace(`https://${i.Name.toLowerCase()}.dest`,i.Host.replace(/\/{1,10}$/,"")):i.Host,this._serviceProvider=HHe({},i)}else t&&(await this.shouldIgnoreCertError(t,s)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,VA(!1)),this._axiosConfig=t,this._serviceProvider=AE(t));if(this._serviceProvider&&ut.attachAxiosLogger(this._serviceProvider.interceptors),o==="abap_catalog"){(!s||s===Er.v2)&&(this._catalogV2=this._serviceProvider.catalog(Er.v2)),(!s||s===Er.v4)&&(this._catalogV4=this._serviceProvider.catalog(Er.v4));let a=!1;try{this._catalogV2?await this._catalogV2?.listServices():this._catalogV4&&(a=!0,await this._catalogV4?.listServices())}catch(u){await this.handleCatalogError(u,a)}}else o==="odata_path"&&r&&(ut.logger.debug(`Using provided url path: ${r.pathname} to validate authentication.`),this._connectType="odata_path",this._odataService=this._serviceProvider.service(`${r?.pathname}`),await this._odataService.get(""))}async handleCatalogError(t,r){let n=t.response?.status,i=n?pn.getErrorType(n):void 0,s=n&&!r&&(i===pe.NOT_FOUND||i===pe.AUTH);if(this._catalogV4&&s){this._axiosConfig&&await this.shouldIgnoreCertError(this._axiosConfig,Er.v4)&&(this._ignoreCertError=!0,VA(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=AE(this._axiosConfig),this._catalogV4=this._serviceProvider.catalog(Er.v4),ut.attachAxiosLogger(this._serviceProvider.interceptors));try{await this._catalogV4.listServices()}catch(o){throw i===pe.AUTH?t:o}}else throw t}async refreshTokenChangedCb(t){ut.logger.debug("ConnectionValidator.refreshTokenChangedCb()"),this._refreshToken=t}getAbapOnCloudServiceProvider(t,r,n){if(this.systemAuthType==="reentranceTicket"&&t)return Tre({environment:TE.EmbeddedSteampunk,url:t.origin,logger:ut.logger});if(this.systemAuthType==="serviceKey"&&r)return Tre({environment:TE.Standalone,service:r,refreshToken:n,refreshTokenChangedCb:this.refreshTokenChangedCb.bind(this),logger:ut.logger});throw new Error("Invalid system auth type")}async validateServiceInfo(t,r){if(!t)return!1;if(t.url===this.validatedUrl&&JSON.stringify(t.uaa)===JSON.stringify(this.serviceInfo?.uaa))return this.getValidationResultFromStatusCode(200);try{return this.systemAuthType="serviceKey",await this.createSystemConnection({serviceInfo:t,odataVersion:r}),this._connectedUserName=await this.serviceProvider.user(),this._serviceInfo=t,this._validatedUrl=t.url,this.getValidationResultFromStatusCode(200)}catch(n){return ut.logger.debug(`ConnectionValidator.validateServiceInfo() - error: ${n.message}`),n?.isAxiosError&&this.getValidationResultFromStatusCode(n?.response?.status||n?.code),Gr.getErrorMsg(n)??!1}}async validateDestination(t,r,n){try{if(this.systemAuthType=t.Authentication===op.NO_AUTHENTICATION?"basic":"unknown",tg(t)||Kl(t))return await this.validateOdataServiceDestination(t,n);{let i;if(n){let s=rT(t.Name.toLowerCase(),n);i=new URL(s)}await this.createSystemConnection({destination:t,odataVersion:r,url:i,connectType:i?"odata_path":void 0})}return{valResult:this.getValidationResultFromStatusCode(200)}}catch(i){i?.isAxiosError&&this.getValidationResultFromStatusCode(i?.response?.status||i?.code);let s=Gr.logErrorMsgs(i);return{valResult:Gr.getValidationErrorHelp(i,!1,t)??s,errorType:Gr.getCurrentErrorType()??pe.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(t,r,n){this.resetConnectionState(!0);let i=rT(t.Name.toLowerCase(),r);this._destinationUrl=r?i.replace(`https://${t.Name.toLowerCase()}.dest`,t.Host.replace(/\/{1,10}$/,"")):t.Host,this._destination=t;let s=await this.checkUrl(new URL(i),void 0,void 0,{odataVersion:n}),o=this.getValidationResultFromStatusCode(s);if(this.validity.reachable&&(this._validatedUrl=i),!this.validity.reachable){let a=Gr.logErrorMsgs(s);return{valResult:Gr.getValidationErrorHelp(s,!1,t)??a,errorType:Gr.getCurrentErrorType()??pe.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:pn.getErrorMsgFromType(pe.AUTH,t.Authentication!==op.NO_AUTHENTICATION?we("texts.checkDestinationAuthConfig"):void 0),errorType:pe.AUTH}:{valResult:o}}async validateUrl(t,{ignoreCertError:r=!1,forceReValidation:n=!1,isSystem:i=!1,odataVersion:s,systemAuthType:o,connectType:a}={}){if(this.isEmptyString(t))return this.resetValidity(),this.validity.urlFormat=!1,!1;o&&(this.systemAuthType=o);let u;try{if(u=new URL(t),u.origin==="null")return we("errors.invalidUrl",{input:t});if(a!=="odata_path"&&(this.systemAuthType==="reentranceTicket"||i)&&!(u.pathname.length===0||u.pathname==="/"))return we("prompts.validationMessages.systemUrlOriginOnlyWarning")}catch{return we("errors.invalidUrl",{input:t})}try{if(!n&&this.isUrlValidated(t))return this.validity.reachable??!1;this.resetValidity();let c=await this.checkUrl(u,void 0,void 0,{ignoreCertError:r,isSystem:i,odataVersion:s,connectType:a});return ut.logger.debug(`ConnectionValidator.validateUrl() - status: ${c}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t,this.getValidationResultFromStatusCode(c)}catch(c){return this.resetValidity(),pn.getErrorType(c)===pe.CONNECTION?(this.validity.reachable=!1,Gr.logErrorMsgs(we("errors.systemOrServiceUrlNotFound",{url:t}))):Gr.getErrorMsg(c)??c.message}}getValidationResultFromStatusCode(t){return t===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):pn.getErrorType(t)===pe.NOT_FOUND?(this.validity.reachable=!1,pn.getErrorMsgFromType(pe.NOT_FOUND)??!1):pn.isCertError(t)?(this.validity.reachable=!0,this.validity.canSkipCertError=RGt.has(pn.getErrorType(t)),this.validity.authenticated=!1,Gr.getValidationErrorHelp(t,!1)??!1):pn.getErrorType(t)===pe.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):pn.getErrorType(t)===pe.REDIRECT?(this.validity.reachable=!0,we("errors.urlRedirect")):pn.getErrorType(t)===pe.CONNECTION?(this.validity.reachable=!1,pn.getErrorMsgFromType(pe.CONNECTION,we("texts.httpStatus",{httpStatus:t}))??!1):pn.getErrorType(t)===pe.BAD_REQUEST?(this.validity.reachable=!0,pn.getErrorMsgFromType(pe.BAD_REQUEST,we("texts.httpStatus",{httpStatus:t}))??!1):pn.getErrorType(t)===pe.BAD_GATEWAY?(this.validity.reachable=!1,pn.getErrorMsgFromType(pe.BAD_GATEWAY,we("texts.httpStatus",{httpStatus:t}))??!1):(this.validity.reachable=!0,pn.getErrorMsgFromType(pn.getErrorType(t),we("texts.httpStatus",{httpStatus:t}))??!0)}isEmptyString(t){return!t||t.trim().length===0}isUrlValidated(t){return this._validatedUrl===t}async isAuthRequired(){return ut.logger.debug(`ConnectionValidator.isAuthRequired() - validity: ${JSON.stringify(this.validity)}`),!this._validatedUrl||this.validity.authenticated?!1:this.validity.authRequired}async validateAuth(t,r,n,{ignoreCertError:i=!1,sapClient:s,odataVersion:o,isSystem:a=!1,connectType:u}={}){if(!t)return{valResult:!1};try{let c=new URL(t);s&&c.searchParams.append(JY,s),this.systemAuthType="basic";let l=await this.checkUrl(c,r,n,{ignoreCertError:i,isSystem:a,odataVersion:o,connectType:u});ut.logger.debug(`ConnectionValidator.validateAuth() - status: ${l}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t;let f=this.getValidationResultFromStatusCode(l);if(f===!0){if(this.validity.authenticated===!0)return this._connectedUserName=r,{valResult:!0};if(this.validity.authenticated===!1)return{valResult:this.getAuthFailureReasonText(l,o),errorType:pe.AUTH}}return{valResult:f}}catch(c){return{valResult:Gr.getValidationErrorHelp(c,!1,this.destination)??Gr.getErrorMsg(c)??we("errors.unknownError"),errorType:Gr.getCurrentErrorType()??void 0}}}resetValidity(){delete this.validity.urlFormat,delete this.validity.reachable,delete this.validity.authRequired,delete this.validity.authenticated,delete this.validity.canSkipCertError,this._validatedUrl=void 0,this._destinationUrl=void 0,this._destination=void 0}getAuthFailureReasonText(t,r){let n;[403,"403"].includes(t)?n=we("texts.authorizationFailed"):[401,"401"].includes(t)&&(n=we("texts.authenticationFailed"));let i;return r?i=we("errors.authenticationFailedSpecificCatalog",{odataVersion:r,authFailType:n}):i=we("errors.authenticationFailedAllCatalogs",{authFailType:n}),i}};var WGt=be(nq(),1);var sv={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var ov=require("@sap-devx/yeoman-ui-types");var qJn=be(Oy(),1),jJn=be(Dy(),1);function NGt(e){return e.filter(t=>!!t.entityType.entityProperties.find(n=>n.name==="HasDraftEntity"))}var IGt=be(Oy(),1),LGt=be(Dy(),1);function VJn(e){return!!e.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}function $be(e){let t=!1;try{let r;typeof e=="string"?r=(0,IGt.convert)((0,LGt.parse)(e)):r=e;let n=NGt(r.entitySets)??[];n?.length>0&&(t=!VJn(n))}catch(r){ut.logger.error(we("errors.unparseableMetadata",{error:r.message}))}return t}var GJn=["/IWBEP/COMMON"],$Jn="SERVICE_INQUIRER_BAS_SUCCESS",HJn=e=>{let t=[],r=!1;return typeof ut.logger.getLogLevel=="function"&&(r=ut.logger.getLogLevel()==="trace"),e?.filter(n=>!GJn.some(i=>n.id.includes(i))).forEach(n=>{let i=n.name,s=n.path;i=`${i} (${n.serviceVersion}) - OData V${n.odataVersion}`,r&&(i=`${i} Service Type: ${n.serviceType}`),t.push({name:i,value:{servicePath:s,serviceODataVersion:n.odataVersion,toString:()=>i,serviceType:n.serviceType,serviceId:n.id}})}),ut.logger.debug(`Number of unique service choices: ${t.length}`),t.sort((n,i)=>n.name?n.name.localeCompare(i.name??""):0)};function WJn(e,t){let r=Object.entries(e);r.forEach(([n,i])=>{Gr.logErrorMsgs(i,we("warnings.missingServices",{odataVersion:n}))}),t===r.length&&Gr.logErrorMsgs(we("errors.allCatalogServiceRequestsFailed",{version:Object.keys(e).join(", ")}))}async function MGt(e,t){let r={},n={},i=[];for(let o of e){let a=o instanceof qm?Er.v2:Er.v4;try{let u=Date.now(),c=await o.listServices(),l=Date.now(),f=l-u===0?"<1 ms":`${l-u}ms`;n[`v${a}`]={serviceCount:c.length,duration:f},ut.logger.debug(`Number of service${a===Er.v4?" groups":"s"}: ${c.length} returned in: ${f}}`),i.push(c)}catch(u){ut.logger.error(we("errors.serviceCatalogRequest",{catalogRequestUri:o.getUri(),entitySet:o.entitySet,error:u})),Object.assign(r,{[a]:u}),i.push([])}}ut.logger.debug(`Service catalog request times: ${JSON.stringify(n,void 0," ")}`);let s=i?.flat()??[];return ut.logger.debug(`Number of services available: ${s.length}`),(s.length===0||Object.keys(r).length>0)&&WJn(r,e.length),t&&(s=s.filter(o=>t.includes(o.id)||t.includes(o.path))),HJn(s)}function Hbe(e){let t=SS.createTelemetryData({destODataType:l6(e)})??{};LS($Jn,t)}async function YJn(e,t,r,n,i){let s=[];try{let o=await t.metadata(),{validationMsg:a,version:u,convertedMetadata:c}=o7(o,i);if(a)return{validationMsg:a};if(!r&&u===Kn.v2&&n)try{ut.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=AE(n).catalog(Er.v2),ut.attachAxiosLogger(r.interceptors)}catch(l){ut.logger.warn(we("error.v2CatalogServiceNoAnnotations",l))}if(r)try{s=await r.getAnnotations({path:e})}catch{ut.logger.info(we("prompts.validationMessages.noAnnotations"))}return{annotations:s,metadata:o,version:u,convertedMetadata:c}}catch(o){let a=Gr.getErrorMsg(o);return ut.logger.error(we("errors.serviceMetadataErrorLog",{servicePath:e,errorText:a})),{validationMsg:we("errors.serviceMetadataErrorUI",{servicePath:e,errorText:a})}}}async function zJn(e,t,r){let n;if(t===RP.NotDetermined)try{n=await r.getServiceType(e)??RP.NotDetermined}catch(i){ut.logger.error(we("errors.serviceTypeRequestError",{error:i.message}))}return n??t}async function Wbe(e,t,r){let n=t.catalogs?.[e.serviceODataVersion];if(!t.serviceProvider)return ut.logger.error("ConnectionValidator connection is not initialized"),{validationResult:!1};let i=t.odataService;i||(i=t.serviceProvider.service(e.servicePath));let{validationMsg:s,version:o,convertedMetadata:a,annotations:u,metadata:c}=await YJn(e.servicePath,i,n,t.axiosConfig,r);if(s)return{validationResult:s};let l=t.destinationUrl??t.validatedUrl,f;return l&&(f=new URL(l).origin),yt.odataService.annotations=u,yt.odataService.metadata=c,yt.odataService.odataVersion=o??(e.serviceODataVersion===Er.v2?Kn.v2:Kn.v4),yt.odataService.servicePath=e.servicePath,yt.odataService.serviceId=e.serviceId,yt.odataService.origin=f,yt.odataService.sapClient=t.validatedClient,yt.odataService.ignoreCertError=t.ignoreCertError,{validationResult:!0,hasAnnotations:!!yt.odataService.annotations&&yt.odataService.annotations.length>0,convertedMetadata:a}}function FGt(e){let t=we("prompts.systemService.message");return e&&(t=t.concat(` ${we("texts.forUserName",{username:e})}`)),t}async function UGt(e,t,r,{requiredOdataVersion:n,hasAnnotations:i=!0,showCollabDraftWarnOptions:s,serviceFilter:o}){if(e?.length===0)return o&&o.length>0?{message:we("warnings.specifiedServicesNotAvailable",{odataVersion:n?`V${n} `:void 0,service:o[0],count:o.length}),severity:ov.Severity.warning}:n?{message:we("warnings.noServicesAvailableForOdataVersion",{odataVersion:n}),severity:ov.Severity.warning}:{message:we("warnings.noServicesAvailable"),severity:ov.Severity.warning};if(t){let a=t.serviceType;if(t.serviceODataVersion===Er.v2){if(!i)return{message:we("warnings.noAnnotations"),severity:ov.Severity.warning};a=await zJn(t.servicePath,t.serviceType,r.catalogs[Er.v2])}else if(s?.showCollabDraftWarning&&t.serviceODataVersion===Er.v4&&$be(s.edmx))return{message:we("warnings.collaborativeDraftMessage"),severity:ov.Severity.warning};if(a&&a!==RP.UI)return{message:we("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:ov.Severity.warning}}else if(Gr.getErrorMsg())return{message:`${Gr.getErrorMsg()} ${we("texts.seeLogForDetails")}`,severity:ov.Severity.information}}var KJn="VALUE_HELP_DOWNLOAD_PROMPTED",XJn="VALUE_HELP_DOWNLOAD_SUCCESS",JJn="VALUE_HELP_DOWNLOAD_FAILED";async function Ybe(e,t,r){let n=SS.createTelemetryData(t)??{};if(r&&Object.keys(r).length>0){let i=$Ut();i&&await i.reportEvent({eventName:e,properties:n,measurements:r},Pi.NoSampling)}else LS(e,n)}async function kGt(e,t,r){if(delete yt.odataService.valueListMetadata,await Ybe(KJn,{userChoseToDownload:e}),e&&t.serviceProvider instanceof Va){let n=Date.now();try{let i=await t.serviceProvider.fetchExternalServices(r),s=Date.now()-n;i.length>0?yt.odataService.valueListMetadata=i:ut.logger.info(we("warnings.noExternalServiceMetdataFetched")),await Ybe(XJn,{userChoseToDownload:!0,valueHelpCount:i.length},{downloadTimeMs:s})}catch(i){let s=Date.now()-n;ut.logger.error(`Failed to fetch external service metadata: ${i}`),await Ybe(JJn,{userChoseToDownload:!0,error:i instanceof Error?i.message:"Unknown error"},{downloadTimeMs:s})}}}function BGt(e,t,r){let n=`${t?t+":":""}`,i=`${n}${Cn.valueHelpDownload}`,s=`${n}${Cn.serviceSelection}`,o=`${n}cliValueHelpDownload`,a,c=[{when:l=>{let p=l?.[s]?.servicePath;return p&&r?.convertedMetadata?(a=fM(p,r?.convertedMetadata),a.length>0):!1},name:i,type:"confirm",message:we("prompts.valueHelpDownload.message"),validate:async l=>(qo()!==cn.cli&&await kGt(l,e,a),!0)}];return qo()===cn.cli&&c.push({when:async l=>{let f=l?.[i];return f!==void 0&&a&&await kGt(f,e,a),!1},name:o,type:"input"}),c}var QJn="cliServiceSelection";function av(e,t,r,n=!0){let i=[],s,o,a,u,c,l={convertedMetadata:void 0},f=r?.requiredOdataVersion,p=`${t}:${Cn.serviceSelection}`,d={when:()=>e.validity.authenticated||e.validity.authRequired===!1,name:p,type:r?.useAutoComplete?"autocomplete":"list",message:()=>FGt(e.connectedUserName),guiOptions:{breadcrumb:we("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:(g,_)=>Cw(_,i),choices:async g=>{if(i.length===0||s!==e.validatedUrl||o!==e.validatedClient||!DGt(u,r?.serviceFilter))if(e.catalogs[Kn.v2]||e.catalogs[Kn.v4])i=await ZJn(e.catalogs,f,r?.serviceFilter),s=e.validatedUrl,o=e.validatedClient,u=r?.serviceFilter?[...r.serviceFilter]:void 0,g?.[`${Cn.systemSelection}`]?.type==="destination"&&Hbe(g?.[`${Cn.systemSelection}`]?.system);else if(e.odataService&&e.validatedUrl&&!await e.isAuthRequired()){let _=new URL(e.destinationUrl??e.validatedUrl);i=[{name:_.toString(),value:{servicePath:_.pathname}}],g?.[`${Cn.systemSelection}`]?.type==="destination"&&Hbe(g?.[`${Cn.systemSelection}`]?.system)}else ut.logger.error(we("errors.noCatalogOrServiceAvailable"));return i},additionalMessages:g=>UGt(i,g,e,{requiredOdataVersion:f,hasAnnotations:c,showCollabDraftWarnOptions:l.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:l.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),default:()=>s7(i),validate:async g=>{let _=g;if(r?.useAutoComplete&&g.value&&(_=g.value),!e.validatedUrl)return!1;if(i.length===0&&Gr.hasError())return pn.getHelpForError(pe.SERVICES_UNAVAILABLE)??!1;if(_&&(a?.servicePath!==_.servicePath||a?.servicePath!==yt.odataService.servicePath)){c=void 0,l.convertedMetadata=void 0,a=_;let S=await Wbe(_,e,f);return c=S.hasAnnotations,l.convertedMetadata=S.convertedMetadata,S.validationResult}return!0}};if(r?.additionalMessages){let g={[p]:{additionalMessages:r.additionalMessages}};d=C_e([d],g,yt.odataService)[0]}let h=[d];return qo()===cn.cli&&!r?.useAutoComplete&&h.push({when:async g=>{let _=g?.[`${t}:${Cn.serviceSelection}`];if(_&&e.validatedUrl){let{validationResult:S,hasAnnotations:T,convertedMetadata:A}=await Wbe(_,e);if(typeof S=="string")throw ut.logger.error(S),new Error(S);c=T,l.convertedMetadata=A}if(i.length===0&&Gr.hasError()){let S=pn.getHelpForError(pe.SERVICES_UNAVAILABLE).toString();throw new Error(S)}return!1},name:`${t}:${QJn}`}),n||h.push(...Ds(BGt(e,t,l),g=>e.serviceProvider instanceof Va&&!!l.convertedMetadata&&g?.[p]?.serviceODataVersion===Er.v4)),h}async function ZJn(e,t,r){let n=[];return t&&e[t]?n.push(e[t]):n=Object.values(e).filter(i=>i!==void 0),await MGt(n,r)}async function zbe(){return await yS({entityName:"system"})}async function a7(e=!1){let t=[];try{t=await(await zbe()).getAll({includeSensitiveData:e,backendSystemFilter:{connectionType:["abap_catalog","odata_service"]}})}catch(r){ut.logger.error(we("errors.backendSystemRetrieval",{error:r.message}))}return t}async function eQn(e){return!!(await a7(!1)).find(r=>r.name===e)}async function XM(e){return e?await eQn(e)?we("prompts.systemName.systemNameExistsWarning"):!0:we("prompts.systemName.emptySystemNameWarning")}function qGt(e,t){try{return new URL(t,e),!0}catch{return we("errors.invalidUrl",{input:`${e}${t}`})}}async function jGt(e,t){let r=e+(t?we("texts.suggestedSystemNameClient",{client:t}):"");return await XM(r)===!0?r:tQn(r)}async function tQn(e){let t=1,r=`${e} (${t})`;for(;await XM(r)!==!0;)r=`${e} (${t})`,t++;return r}var VGt=require("@sap-devx/yeoman-ui-types");var Kbe=require("@sap-devx/yeoman-ui-types");var lc;(function(e){e.systemUsername="systemUsername",e.systemPassword="systemPassword",e.storeSystemCredentials="storeSystemCredentials"})(lc||(lc={}));function u7(e,t,r,n){let i=`${t?t+":":""}${lc.systemUsername}`,s=`${t?t+":":""}${lc.systemPassword}`,o=`${t?t+":":""}${lc.storeSystemCredentials}`,a,u=[{when:async()=>(a=await e.isAuthRequired(),e.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"input",name:i,message:we("prompts.systemUsername.message"),guiOptions:{mandatory:!0},default:"",validate:l=>l?.length>0},{when:()=>!!(e.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"password",guiOptions:{mandatory:!0,applyDefaultWhenDirty:!0},guiType:"login",showOutputTabLink:"validationMessageOverflow",name:s,message:we("prompts.systemPassword.message"),mask:"*",default:"",validate:async(l,f)=>{if(!(e.validatedUrl&&f?.[i]&&l&&(!r||r.isValid)))return!1;let p=f?.[Cn.systemSelection],d,h=!0;if(p?.type==="backendSystem")d=p.system?.client;else if(p?.type==="destination"){let _=p.system;(tg(_)||Kl(_))&&(h=!1)}let{valResult:g}=await e.validateAuth(e.validatedUrl,f?.[i],l,{sapClient:r?.sapClient||d,isSystem:h,odataVersion:Zh(n)});return g===!0&&e.serviceProvider?(rQn(e.serviceProvider,p,{username:f?.[i],password:l}),!0):g},additionalMessages:(l,f)=>{if(e.ignoreCertError&&f?.newSystemType!=="abapOnPrem")return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:Kbe.Severity.warning}}}],c={when:l=>!!(e.systemAuthType==="basic"&&a&&e.validity.authenticated&&l[s]),type:"confirm",name:o,message:we("prompts.storeSystemCredentials.message"),default:!1,guiOptions:{breadcrumb:we("prompts.storeSystemCredentials.breadcrumb")},validate:async l=>{if(yt.odataService.connectedSystem?.backendSystem){let f=yt.odataService.connectedSystem.backendSystem;yt.odataService.connectedSystem.backendSystem=Object.assign(f,{newOrUpdated:l})}return!0},additionalMessages:l=>{if(l===!0)return{message:we("texts.passwordStoreWarning"),severity:Kbe.Severity.warning}}};return Vr()||u.push(c),u}function rQn(e,t,{username:r,password:n}){if(yt.odataService.connectedSystem={serviceProvider:em(e)},t?.type==="backendSystem"){let i=t.system;(i.username!==r||i.password!==n)&&(yt.odataService.connectedSystem.backendSystem=Object.assign(i,{username:r,password:n,userDisplayName:r}))}else t?.type==="destination"&&(yt.odataService.connectedSystem.destination=t.system)}function nQn(e){switch(e){case"serviceKey":return mL.ReentranceTicket;case"reentranceTicket":return mL.ReentranceTicket;case"basic":return mL.Basic;default:return}}function c7(e,t,r,n,i=!0){return{type:"input",name:`${t?t+":":""}${sv.newSystemUrl}`,message:we("prompts.systemUrl.message"),guiOptions:{hint:we("prompts.systemUrl.description"),mandatory:!0,breadcrumb:!0},validate:async a=>{if(yt.resetConnectedSystem(),n&&n.backendSystem?.url===a&&n.backendSystem?.authenticationType==="reentranceTicket")e.setConnectedSystem(n);else if(i){let c=wC(yt.backendSystemsCache,a);if(c)return we("prompts.validationMessages.backendSystemExistsWarning",{backendName:c.name})}let u=await e.validateUrl(a,{isSystem:!0,odataVersion:Zh(r)});return u===!0&&(e.validity.authenticated&&e.serviceProvider?yt.odataService.connectedSystem={serviceProvider:em(e.serviceProvider)}:e.systemAuthType="basic"),u},additionalMessages:()=>{if(e.ignoreCertError)return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:VGt.Severity.warning}}}}function l7(e,t){let r,n=!1,i=`${t?t+":":""}`,s=`${i}${Cn.userSystemName}`;return{type:"input",guiOptions:{hint:we("prompts.systemName.hint"),applyDefaultWhenDirty:!0,breadcrumb:!0,mandatory:!0},name:s,message:we("prompts.systemName.message"),default:async()=>{let a=e.connectedSystemName;return a&&!n&&(r=await jGt(a,e.validatedClient)),r},validate:async(a,u)=>{if(!a)return!1;let c=!1;a===r?c=!0:(n=!0,r=a,c=await XM(a));let l=!!u?.[`${i}${lc.storeSystemCredentials}`];if(c===!0&&e.validatedUrl&&yt.odataService.connectedSystem){let f=new ui({authenticationType:nQn(e.systemAuthType),name:a,url:e.validatedUrl,client:e.validatedClient,username:l?e.axiosConfig?.auth?.username:void 0,password:l?e.axiosConfig?.auth?.password:void 0,serviceKeys:e.serviceInfo,userDisplayName:e.connectedUserName,systemType:gL({serviceKeys:e.serviceInfo,authenticationType:e.systemAuthType}),connectionType:"abap_catalog"});yt.odataService.connectedSystem.backendSystem=f,yt.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return c}}}var Xbe="!@\xA3*&937newSystem*X~qy^",f7="cfAbapEnvService";async function GGt(e,t,r,n,i){yt.resetConnectedSystem();let s=!1,a=await(await zbe()).read(e);if(a){n&&n.backendSystem?.url===a.url&&t.setConnectedSystem(n);let u=new URL(a.url),c=u.origin;if(i&&(c=new URL(i,u.origin).toString()),a.authenticationType==="reentranceTicket")u.pathname!=="/"&&ut.logger.warn(we("warnings.storedSystemUrlPathNotSupported",{systemUrl:a.url})),s=await t.validateUrl(c,{isSystem:!0,odataVersion:Zh(r),systemAuthType:"reentranceTicket",connectType:i?"odata_path":void 0});else if(a.serviceKeys)s=await t.validateServiceInfo(a.serviceKeys,Zh(r));else if(a.authenticationType==="basic"||!a.authenticationType){let l;if({valResult:s,errorType:l}=await t.validateAuth(c,a.username,a.password,{isSystem:!0,odataVersion:Zh(r),sapClient:a.client,connectType:i?"odata_path":void 0}),l===pe.AUTH)return ut.logger.error(we("errors.storedSystemConnectionError",{systemName:a.name,error:s})),!0}s===!0&&t.serviceProvider&&(yt.odataService.connectedSystem={serviceProvider:em(t.serviceProvider),backendSystem:a})}return s}async function JM(e,t,r,n){yt.resetConnectedSystem();let{valResult:i,errorType:s}=await t.validateDestination(e,Zh(r),n);return s===pe.AUTH&&t.systemAuthType==="basic"?(ut.logger.error(we("errors.destination.authError",{systemName:e.Name,error:i})),!0):(i===!0&&t.serviceProvider&&(yt.odataService.connectedSystem={serviceProvider:em(t.serviceProvider),destination:e}),i)}function iQn(e,t){return!t||t.odata_abap&&cq(e)||t.odata_generic&&uq(e)||t.full_service_url&&tg(e)||t.partial_service_url&&Kl(e)?!0:(ut.logger.debug(`Destination: ${e.Name} does not match any filters and will be excluded as a prompt choice. Destination configuration: ${JSON.stringify(e)}`),!1)}async function $Gt(e,t=!1,r=!1){let n=[],i;if(Vr()){let s={};try{s=await gre({stripS4HCApiHosts:!0})}catch(o){ut.logger.error(we("errors.destination.listDestinations",{error:o.message}))}n=Object.values(s).filter(o=>iQn(o,e)).map(o=>({name:yHe(o),value:{type:"destination",system:o}})),t&&(i={name:we("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:f7,system:f7}})}else{let s=await a7(!1);yt.backendSystemsCache=s,n=s.map(o=>({name:f5e(o),value:{system:o,type:"backendSystem"}})),r||(i={name:we("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:Xbe}})}return n.sort(({name:s},{name:o})=>s.localeCompare(o,void 0,{numeric:!0,caseFirst:"lower"})),i&&n.unshift(i),n}function Jbe(e,t){let r=typeof t=="string"?t:t?.value;return r?e.findIndex(i=>{let{type:s,system:o}=i.value;if(s==="destination")return o.Name===r;if(s==="backendSystem")return o.name===r;if(s==="newSystemChoice")return r===Xbe;if(s==="cfAbapEnvService")return r===f7}):-1}var p7="abapOnBtp",ens=`${p7}:${sv.newSystemUrl}`,sQn="cliCfAbapService",Qbe={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function YGt(e,t){yt.reset();let r=new bl,n=[];return n.push({type:"list",name:Qbe.abapOnBtpAuthType,choices:[{name:we("prompts.abapOnBTPType.choiceCloudFoundry"),value:"cloudFoundry"},{name:we("prompts.abapOnBTPType.choiceReentranceTicket"),value:"reentranceTicket"}],message:we("prompts.abapOnBTPType.message"),validate:()=>(r.resetConnectionState(!0),yt.resetConnectedSystem(),!0)}),n.push(Ds([c7(r,p7,e?.serviceSelection?.requiredOdataVersion,t)],i=>i?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=i.abapOnBtpAuthType,!0):!1)[0],...Ds([...Zbe(r,void 0,void 0,t)],i=>i?.abapOnBtpAuthType==="cloudFoundry")),e?.userSystemName?.hide!==!0&&n.push(Ds([l7(r,p7)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),n.push(...av(r,p7,e?.serviceSelection,e?.valueHelpDownload?.hide)),n}async function HGt(e,t,r,n=!1,i){yt.resetConnectedSystem();let s=e.label,o=await(0,WGt.apiGetInstanceCredentials)(s);if(!o?.credentials?.uaa)return we("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:s});let a=!0,u;if(qo()===cn.bas)try{u=await SHe(s,{uaaCredentials:o.credentials.uaa,hostUrl:o.credentials.url},ut.logger),a=await JM(u,t,r)}catch(c){a=c.message}else i&&i.backendSystem?.url===o.credentials.url&&JSON.stringify(i.backendSystem.serviceKeys?.uaa)===JSON.stringify(o.credentials.uaa)&&t.setConnectedSystem(i),a=await t.validateServiceInfo(o.credentials);if(!n&&a!==!0)return a;if(n&&typeof a=="string")throw ut.logger.error(a),new Error(a);if(n&&a===!1)throw ut.logger.error(Gr.getErrorMsg()??we("errors.abapServiceAuthenticationFailed")),new Error(we("errors.abapServiceAuthenticationFailed"));return t.serviceProvider&&qo()!==cn.bas&&(t.connectedSystemName=await yre(s),yt.odataService.connectedSystem={serviceProvider:em(t.serviceProvider)}),!0}function Zbe(e,t,r,n){let i=[],o=[{type:"list",name:`${t?t+":":""}${Qbe.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:async()=>{if(i=await WUt(Gr),i.length===0&&qo()===cn.cli)throw new Error(we("errors.abapEnvsUnavailable"));return i},default:()=>s7(i),message:we("prompts.cloudFoundryAbapSystem.message"),validate:async a=>{if(a){let c=await HGt(a,e,r,qo()===cn.cli,n);if(!Vr()&&c===!0&&e.validatedUrl){let l=wC(yt.backendSystemsCache,e.validatedUrl,e.validatedClient);if(l)return e.resetConnectionState(!0),we("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return c}if(Gr.getCurrentErrorType()===pe.NO_ABAP_ENVS){let c=Gr.getErrorMsg(!0),l=we("texts.seeLogForDetails");return`${c} ${l}`}return!1}}];return qo()===cn.cli&&o.push({when:async a=>{let u=a?.[Qbe.cloudFoundryAbapSystem];return u&&await HGt(u,e,r,!0),!1},name:sQn}),o}function zGt(e){let t="cfAbapBas",r=new bl;return[...Zbe(r,t,e?.serviceSelection?.requiredOdataVersion),...av(r,t,e?.serviceSelection,e?.valueHelpDownload?.hide)]}var KS="abapOnPrem",eTe=`${KS}:${sv.newSystemUrl}`,mns=`${KS}:${lc.systemUsername}`,gns=`${KS}:${lc.systemPassword}`,oQn={sapClient:"sapClient"};function KGt(e){yt.reset();let t=new bl,r=e?.serviceSelection?.requiredOdataVersion,n=aQn(e?.userSystemName,t,r);return n.push(...av(t,KS,e?.serviceSelection,e?.valueHelpDownload?.hide)),n}function aQn(e,t,r){let n=t??new bl,i={sapClient:void 0,isValid:!0},s=[c7(n,KS,r,void 0,!1),{type:"input",name:oQn.sapClient,message:we("prompts.sapClient.message"),guiOptions:{breadcrumb:we("prompts.sapClient.breadcrumb")},validate:(o,a)=>{let u=aGt(o);if(u===!0){if(i.sapClient=o,i.isValid=!0,a?.[eTe]){let c=wC(yt.backendSystemsCache,a[eTe],o);if(c)return i.isValid=!1,we("prompts.validationMessages.backendSystemExistsWarning",{backendName:c.name})}return!0}return i.sapClient=void 0,i.isValid=!1,u}},...u7(n,KS,i,r)];return e?.hide!==!0&&s.push(Ds([l7(n,KS)],o=>!!o?.[eTe]&&n.validity.reachable===!0&&(n.validity.authenticated||n.validity.authRequired===!1))[0]),s}function XGt(e,t){let r=[{type:"list",name:sv.newSystemType,choices:[{name:we("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:we("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:we("prompts.newSystemType.message")}];return r.push(...Ds(KGt(e),n=>n.newSystemType==="abapOnPrem")),r.push(...Ds(YGt(e,t),n=>n.newSystemType==="abapOnBtp")),r}var d7="systemSelection",Bns=`${d7}:${lc.systemUsername}`,qns=`${d7}:${lc.systemPassword}`,JGt={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function QGt(e,t,r,n,i){if(yt.reset(),e.type==="newSystemChoice"||e.type==="cfAbapEnvService")return t.resetConnectionState(!0),!0;let s=!1;if(e.type==="backendSystem"){e.system.connectionType==="odata_service"&&(i=e.system.url);let o=fa.from(e.system);s=await GGt(o,t,r,n,i)}else if(e.type==="destination"){if(Kl(e.system))return!0;s=await JM(e.system,t,r,i)}return s}async function rTe(e,t){yt.reset();let r=new bl,n=await uQn(r,e,t);return e?.serviceSelection?.hide||n.push(...Ds(av(r,d7,e?.serviceSelection,e?.valueHelpDownload?.hide),i=>i.systemSelection?.type!=="newSystemChoice")),Vr()?n.push(...Ds(zGt(e),i=>i.systemSelection?.type==="cfAbapEnvService")):n.push(...Ds(XGt(e,t),i=>i.systemSelection?.type==="newSystemChoice")),n}async function uQn(e,t,r){let n=t?.serviceSelection?.requiredOdataVersion,i=t?.systemSelection?.destinationFilters,s=await $Gt(i,t?.systemSelection?.includeCloudFoundryAbapEnvChoice,t?.systemSelection?.hideNewSystem),o=Jbe(s,t?.systemSelection?.defaultChoice),a=t?.systemSelection?.connectPath,u=t?.systemSelection?.onlyShowDefaultChoice&&t?.systemSelection?.defaultChoice,c=[{type:t?.systemSelection?.useAutoComplete?"autocomplete":"list",name:Cn.systemSelection,message:we("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:we("prompts.systemSelection.hint")},source:(l,f)=>Cw(f,s),choices:u?[s[o]]:s,default:()=>u?0:(o=Jbe(s,t?.systemSelection?.defaultChoice),typeof t?.systemSelection?.connectPath=="object"&&(a=t?.systemSelection.connectPath),o),validate:async l=>{if(!l)return!1;let f=l;return t?.systemSelection?.useAutoComplete&&l.value&&(f=l.value),QGt(f,e,n,r,a?.value)??!1},additionalMessages:async l=>{if(l.type==="backendSystem"&&e.systemAuthType==="basic"&&await e.isAuthRequired())return{message:we("prompts.systemSelection.authenticationFailedUpdateCredentials"),severity:tTe.Severity.information};if(e.ignoreCertError)return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:tTe.Severity.warning}}}];if(Vr()){let l={when:f=>{let p=f?.[Cn.systemSelection];return p?.type==="destination"?Kl(p.system):!1},type:"input",name:JGt.destinationServicePath,message:we("prompts.destinationServicePath.message"),guiOptions:{hint:we("prompts.destinationServicePath.hint"),mandatory:!0,breadcrumb:!0,applyDefaultWhenDirty:!0},default:"",validate:async(f,p)=>{if(!f||f.trim().length<2||f.startsWith("//"))return e.resetConnectionState(!0),we("prompts.destinationServicePath.invalidServicePathWarning");let d=p?.[Cn.systemSelection]?.system,h=qGt(d.Host,f);return h!==!0?(e.resetConnectionState(!0),h):await JM(d,e,n,f)}};c.push(l)}return qo()===cn.cli&&!t?.systemSelection?.useAutoComplete&&c.push({when:async l=>{let f=l?.[Cn.systemSelection];if(!f)return!1;let p=await QGt(f,e,n,void 0,a?.value);if(p!==!0)throw ut.logger.error(p.toString),new Error(p.toString());return!1},name:`${JGt.systemSelectionCli}`}),c.push(...u7(e,d7,void 0,n)),c}var cQn=require("@sap-devx/yeoman-ui-types");var nTe;(function(e){e.ignoreCertError="ignoreCertError",e.username="username",e.cliIgnoreCertValidate="cliIgnoreCertValidate"})(nTe||(nTe={}));var fQn=require("@sap-devx/yeoman-ui-types");async function ZGt(e,t,r){return t!==void 0&&(yt.isYUI=t),r&&(ut.logger=r),{prompts:await rTe(e),answers:yt.odataService}}var k8t=be(Oy()),RC=be(Dy()),dTe=require("node:fs"),B8t=require("node:fs/promises"),q8t=require("node:module"),C7=require("node:path");var ZM=be(L8t());var M8t=["DraftAdministrativeData","SiblingEntity"],F8t=["I_DraftAdministrativeData"];function DQn(e,t){for(let r of Object.keys(t))if(e[r]){let n=new Set(e[r].map(i=>JSON.stringify(i)));for(let i of t[r]){let s=JSON.stringify(i);n.has(s)||(n.add(s),e[r].push(i))}}else e[r]=t[r];return e}function hTe(e,t,r,n,i=""){let s={},o=Array.isArray(e)?e:[e],a={};return o.forEach(u=>{for(let l of Object.keys(u)){let f=i?`${i}/${l}`:l,p=t[f]??t[l];if(!p||!u[l])continue;let d=hTe(u[l],t,p,void 0,f);DQn(s,d),delete u[l]}a[r]||(a[r]=new Set((s[r]??[]).map(l=>JSON.stringify(l))));let c=JSON.stringify(u);a[r].has(c)||(a[r].add(c),s[r]?s[r].push(u):s[r]=[u])}),n?.length&&(IQn(s,n),LQn(s,n)),s}var RQn=/^[0-9A-F]{32}$/,U8t=/^0\d+$/;function NQn(e){let t=e.toLowerCase();return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function IQn(e,t){for(let r of t){let n=r.nodeProperty.split("/");for(let i of Object.values(e))for(let s of i){let o=s,a;if(n.length>1?a=o[n[0]]?.[n[1]]:a=o[n[0]],typeof a=="string"){if(r.parentPropertyType&&["Edm.Guid","Edm.UUID"].includes(r.parentPropertyType)&&RQn.test(a)){let u=NQn(a);n.length>1?o[n[0]][n[1]]=u:o[n[0]]=u}else if(r.parentProperty&&U8t.test(a)){let u=Number.parseInt(a,10).toString();n.length>1?o[n[0]][n[1]]=u:o[n[0]]=u;let c=o[r.parentProperty];typeof c=="string"&&U8t.test(c)&&(o[r.parentProperty]=Number.parseInt(c,10).toString())}}}}}function LQn(e,t){for(let r of t){let n=r.nodeProperty.split("/");for(let i of Object.values(e))for(let s of i){let o=s;if(!r.parentProperty||!(r.parentProperty in o))continue;(n.length>1?o[n[0]]?.DistanceFromRoot:o.DistanceFromRoot)===0&&(o[r.parentProperty]="")}}}async function j8t(e,t){let r=await yS({logger:lr.logger,entityName:"system"});return typeof t=="number"&&(t=String(t)),(await r.read(new fa({url:e,client:t})))?.name??"NewSystemChoice"}function MQn(e){let t=[],r=new Set(["DraftUUID","IsActiveEntity"]),n=e.keys.filter(i=>!r.has(i.name));if(e?.annotations.Common?.SemanticKey){e.annotations.Common.SemanticKey.forEach((o,a)=>{let u=o.value,l=n.some(f=>f.name===u)?void 0:n[a]?.name;l&&lr.logger.debug(`Semantic key '${u}' mapped to actual entity key '${l}'`),t.push({name:u,keyName:l,type:o.$target?.type??"Edm.String",value:void 0})});let s=new Set(t.map(o=>o.name));e.keys.filter(o=>r.has(o.name)&&!s.has(o.name)).forEach(o=>{t.push({name:o.name,type:o.type,value:o.name==="IsActiveEntity"?"true":void 0})})}return t.length===0&&e.keys.forEach(i=>{t.push({name:i.name,type:i.type,value:i.name==="IsActiveEntity"?"true":void 0})}),t}function FQn(e,t){return e.find(r=>r.entityTypeName===t)}function V8t(e,t,r,n=4){let i=[];return--n>0&&e.navigationProperties.forEach(s=>{if(!M8t.includes(s.name)){let o=[];s.targetType.navigationProperties.length>0&&n>0&&(o=V8t(s.targetType,t,r,n)),i.push({entityType:s.targetType,entityPath:s.name,entitySetName:t.entitySets.find(a=>a.entityTypeName===s.targetTypeName)?.name??"Unknown",navPropEntities:[...o]})}}),i}function UQn(e,t,r){let n=r?(0,C7.join)(r,`${e}.js`):void 0;if(!n||!(0,dTe.existsSync)(n))return;let s=(0,q8t.createRequire)(__importMetaUrl)(n).getReferentialConstraints?.({name:t,referentialConstraint:[]})??[];return lr.logger.debug(`getHierarchyEntities: '${e}' loaded constraints from existing file: ${JSON.stringify(s)}`),s[0]?.targetProperty}function kQn(e,t,r,n){if(r)return{parentProperty:t?.$target?.referentialConstraint?.[0]?.sourceProperty,missingReferentialConstraints:void 0};let i=t?.value;if(!i)return{parentProperty:void 0,missingReferentialConstraints:void 0};let s=UQn(e,i,n);return s?{parentProperty:s,missingReferentialConstraints:void 0}:(lr.logger.debug(`getHierarchyEntities: '${e}' nav prop '${i}' has no referentialConstraint in metadata \u2014 will prompt user`),{parentProperty:void 0,missingReferentialConstraints:{navPropName:i,constraints:[]}})}function BQn(e,t){let r=[];for(let n of e.entitySets){let i=n.entityType?.annotations?.Aggregation,s=Object.keys(i??{}).find(d=>d.startsWith("RecursiveHierarchy"));if(!s)continue;let o=i[s],a=o.NodeProperty?.value;if(!a)continue;lr.logger.debug(`Number of hierarchy annotations entity type: ${n.entityType.name} - ${Object.keys(i).filter(d=>d.startsWith("RecursiveHierarchy")).length}`);let u=s.split("#")[1]??"",c=o.ParentNavigationProperty,l=(c?.$target?.referentialConstraint?.length??0)>0,{parentProperty:f,missingReferentialConstraints:p}=kQn(n.name,c,l,t);r.push({entitySetName:n.name,entityTypeName:n.entityType.fullyQualifiedName,qualifier:u,nodeProperty:a,parentProperty:f,parentPropertyType:f?n.entityType.entityProperties.find(d=>d.name===f)?.type??"Edm.String":void 0,isDraft:!!(n.annotations?.Common?.DraftRoot??n.annotations?.Common?.DraftNode),entityTypeKeys:n.entityType.keys.map(d=>d.name),entityProperties:n.entityType.entityProperties.map(d=>d.name),missingReferentialConstraints:p})}return r.length&&lr.logger.debug(`Hierarchy entities found: ${r.map(n=>n.entitySetName).join(", ")}`),r}async function G8t(e,t,r){let n,i=e.app.services.mainService;try{if(i.local){let s=(i.annotations??[]).map(f=>f.local).filter(f=>!!f&&(0,dTe.existsSync)(f)),a=(await Promise.all(s.map(f=>(0,B8t.readFile)(f,"utf-8")))).map((f,p)=>(0,RC.parse)(f,s[p])),u=a.length>0?(0,RC.merge)((0,RC.parse)(r),...a):(0,RC.parse)(r),c=(0,k8t.convert)(u),l=await t.readApp({app:e});if(l.applicationModel&&l.applicationModel?.target?.fioriElements==ZM.FioriElementsVersion.v4){let p=l.applicationModel.pages,d,h=[];if(Object.values(p).forEach(A=>{if(A.pageType===ZM.PageTypeV4.ListReport&&A.entityType&&A.entitySet){if(d=c.entityTypes.find(w=>w.fullyQualifiedName===A.entityType),d){let w=MQn(d);n={listEntity:{entitySetName:A.entitySet,semanticKeys:w,entityPath:A.entitySet,entityType:d}},n.listEntity.navPropEntities=V8t(d,c)}}else if(A.pageType===ZM.PageTypeV4.ObjectPage&&A.entityType&&A.entitySet&&A.entitySet&&A.entityType&&A.entityType!==d?.fullyQualifiedName){let w=FQn(c.entitySets,A.entityType),x={entityPath:A.navigationProperty,entitySetName:A.entitySet,entityType:w?.entityType,page:A};h.push(x)}}),!n?.listEntity)return lr.logger.info(It("info.noListEntityDefined")),It("info.noListEntityDefined");n.pageObjectEntities=h;let g=e.getAppRoot(),S=(await xx(g))?.services?.find(A=>A.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===i.uri?.replaceAll(/(^\/)|(\/$)/g,"")),T=(0,C7.join)(g,S?.mockdataPath??(0,C7.join)(ai.Webapp,ai.LocalService,ai.Mockdata));n.hierarchyEntities=BQn(c,T)}}return n}catch(s){let o=It("errors.entityModelLoading",{error:s});return lr.logger.error(o),o}}function $8t(e,t){let r=JSON.stringify(t,null,4).replaceAll(`
|
|
724
724
|
`,`
|
|
725
725
|
`);return["module.exports = {"," // See: https://github.com/SAP/open-ux-odata/blob/main/docs/MockserverAPI.md#getreferentialconstraints"," getReferentialConstraints: function (navigationProperty) {",` if (navigationProperty.name === "${e}") {`,` return ${r};`," }"," return undefined;"," }","};",""].join(`
|
|
726
726
|
`)}function H8t(e,t,r){if(e.includes(`"${t}"`)||e.includes(`'${t}'`))return e;let n=JSON.stringify(r,null,4).replaceAll(`
|
|
@@ -730,7 +730,7 @@ specVersion: "2.5"`);return s.setMetadata({name:e}),s.setType("application"),s.a
|
|
|
730
730
|
${i}`);let s=[" getReferentialConstraints: function (navigationProperty) {",`${i}`," return undefined;"," }"].join(`
|
|
731
731
|
`),o=e.lastIndexOf(`
|
|
732
732
|
};`);return o!==-1?`${e.slice(0,o)},
|
|
733
|
-
${s}${e.slice(o)}`:e}var e2=be(W8t()),r4t=require("node:fs/promises"),n4t=require("node:path");var z8t=require("node:crypto"),K8t=be(k8());var Y8t={name:"@sap-ux/generator-odata-downloader",displayName:"Fiori Elements Data Downloader",description:"Yeoman generator that supports download of app data, typically for mock data server use.",version:"0.3.9",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/generator-odata-downloader"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aodata-download"},license:"Apache-2.0",main:"generators/app/index.js",keywords:["yeoman-generator"],scripts:{build:"npm-run-all clean bundle:prod",compile:"tsc --build",clean:"rimraf --glob generators prebuilds test/test-output coverage *.tsbuildinfo",watch:"tsc --watch",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",bundle:"node esbuild.mjs","bundle:dev":"pnpm clean && node esbuild.mjs --development && pnpm pack","bundle:prod":"node esbuild.mjs --production"},files:["LICENSE","generators","!generators/*.map","!generators/**/*.map","prebuilds","yeoman.png"],devDependencies:{"@jest/globals":"30.3.0"},dependencies:{"@sap-devx/yeoman-ui-types":"1.25.0","@sap-ux/annotation-converter":"0.10.21","@sap-ux/axios-extension":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/edmx-parser":"0.10.0","@sap-ux/fiori-generator-shared":"workspace:*","@sap-ux/inquirer-common":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/mockserver-config-writer":"workspace:*","@sap-ux/odata-service-inquirer":"workspace:*","@sap-ux/odata-service-writer":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/store":"workspace:*","@sap-ux/telemetry":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/vocabularies-types":"0.15.0","@sap/ux-specification":"1.144.0","@types/inquirer":"8.2.6","@types/yeoman-generator":"5.2.14","@vscode-logging/logger":"2.0.9",deepmerge:"4.3.1",i18next:"25.10.10",inquirer:"8.2.7","odata-query":"8.0.5","os-name":"4.0.1","prettify-xml":"1.2.0",rimraf:"6.1.3","yeoman-generator":"5.10.0"},engines:{node:">=22.x"}};var EZn="@sap-ux/odata-download-sub-generator",_Zn="0a65e45d-6bf4-421d-b845-61e888c50e9e",va=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(t){this._sessionId=(0,z8t.randomUUID)(),lr.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:EZn,version:Y8t.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:_Zn,...t};try{await AL(r)}catch(n){lr.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(t){if(!this._telemetryData){let r=It("telemetry.unknownOs");try{r=(0,K8t.default)()}catch{}this._telemetryData={Platform:Vr()?"SBAS":"VSCode",OperatingSystem:r,SessionId:this._sessionId}}return this._telemetryData=Object.assign(this._telemetryData,t),this._telemetryData}static prepareTelemetryEvent(t,r){return{eventName:t,properties:r,measurements:{}}}static async sendTelemetry(t,r){let n=this.createTelemetryData(r),i=this.prepareTelemetryEvent(t,n);await ic.getTelemetryClient().reportEvent(i,Pi.NoSampling)}};var SZn=["eq","ne","gt","ge","lt","le"],O7=["and","or","not"],bZn=["any","all"],TZn=["startswith","endswith","contains","matchespattern"],AZn=["expand","levels","select","skip","top","count","orderby","filter"],X8t=/\((.*)\)/,J8t=/(?!indexof)\((\w+)\)/;var sm="";function gTe({select:e,search:t,skiptoken:r,format:n,top:i,skip:s,filter:o,transform:a,orderBy:u,key:c,count:l,expand:f,action:p,func:d}={}){let h="",g=[],_={};if(c!=null&&(h+=`(${ad(c,g)})`),(o||typeof l=="object")&&(_.$filter=D7(typeof l=="object"?l:o,g)),a&&(_.$apply=Z8t(a)),f&&(_.$expand=P7(f)),u&&(_.$orderby=yTe(u)),l&&(typeof l=="boolean"?_.$count=!0:h+="/$count"),typeof i=="number"&&(_.$top=i),typeof s=="number"&&(_.$skip=s),p&&(h+=`/${p}`),d){if(typeof d=="string")h+=`/${d}`;else if(typeof d=="object"){let[S]=Object.keys(d),T=ad(d[S],g);h+=`/${S}`,T!==""&&(h+=`(${T})`)}}return g.length>0&&Object.assign(_,g.reduce((S,T)=>Object.assign(S,{[`@${T.name}`]:ad(T.value)}),{})),PZn(h,{$select:e,$search:t,$skiptoken:r,$format:n,..._})}function mTe(e,t,r=[]){return`${e} eq ${ad(t,r)}`}function D7(e={},t=[],r=""){return(Array.isArray(e)?e:[e]).reduce((s,o)=>{if(o){let a=n(o,t,r);a&&s.push(a)}return s},[]).join(" and ");function n(s={},o=[],a=""){let u="";return typeof s=="string"?u=s:s&&typeof s=="object"&&(u=Object.keys(s).reduce((c,l)=>{let f=s[l];if(f===void 0)return c;let p="";if(a?l===sm?p=a:J8t.test(l)?p=l.replace(J8t,(d,h)=>h.trim()===sm?`(${a})`:`(${a}/${h.trim()})`):X8t.test(l)?p=l.replace(X8t,(d,h)=>h.trim()===sm?`(${a})`:`(${a}/${h.trim()})`):p=`${a}/${l}`:p=l,l===sm&&Array.isArray(f))return c.concat(f.map(d=>mTe(p,d)));if(["number","string","boolean"].indexOf(typeof f)!==-1||f instanceof Date||f===null)c.push(mTe(p,f,o));else if(Array.isArray(f)){let d=l,h=f.map(g=>D7(g,o,a)).filter(g=>g).map(g=>O7.indexOf(d)!==-1?`(${g})`:g);h.length&&(O7.indexOf(d)!==-1?h.length&&(d==="not"?c.push(Q8t(h)):c.push(`(${h.join(` ${d} `)})`)):c.push(h.join(` ${d} `)))}else if(O7.indexOf(p)!==-1){let d=p,h=Object.keys(f).map(g=>n({[g]:f[g]}));h.length&&(d==="not"?c.push(Q8t(h)):c.push(`(${h.join(` ${d} `)})`))}else if(typeof f=="object")"type"in f?c.push(mTe(p,f,o)):Object.keys(f).forEach(d=>{if(f[d]!==void 0)if(SZn.indexOf(d)!==-1)c.push(`${p} ${d} ${ad(f[d],o)}`);else if(O7.indexOf(d)!==-1)Array.isArray(f[d])?c.push(f[d].map(h=>"("+n(h,o,p)+")").join(` ${d} `)):c.push("("+n(f[d],o,p)+")");else if(bZn.indexOf(d)!==-1){let h=i(l.toLowerCase(),f[d],d,p);h&&c.push(h)}else if(d==="has")c.push(`${p} ${d} ${ad(f[d],o)}`);else if(d==="in"){let h=Array.isArray(f[d])?f[d]:f[d].value.map(g=>({type:f[d].type,value:g}));c.push(p+" in ("+h.map(g=>ad(g,o)).join(",")+")")}else if(TZn.indexOf(d)!==-1)c.push(`${d}(${p},${ad(f[d],o)})`);else{let h=n({[d]:f[d]},o,p);h&&c.push(h)}});else throw new Error(`Unexpected value type: ${f}`);return c},[]).join(" and ")),u}function i(s,o,a,u){let c="";if(typeof o=="string"||o instanceof String)c=xZn(s,o,a,u);else if(o){let l=Array.isArray(o)?o.reduce((p,d)=>d.hasOwnProperty(sm)?(p.hasOwnProperty(sm)||(p[sm]=[]),p[sm].push(d[sm]),p):{...p,...d},{}):o,f=n(l,t,s);c=`${u}/${a}(${f?`${s}:${f}`:""})`}return c}}function xZn(e,t,r,n){let i=r=="all"?"ne":"eq";return`${n}/${r}(${e}: ${e} ${i} '${t}')`}function wZn(e){return e=e.replace(/%/g,"%25"),e=e.replace(/\+/g,"%2B"),e=e.replace(/\//g,"%2F"),e=e.replace(/\?/g,"%3F"),e=e.replace(/#/g,"%23"),e=e.replace(/&/g,"%26"),e=e.replace(/'/g,"''"),e}function ad(e,t){if(typeof e=="string")return`'${wZn(e)}'`;if(e instanceof Date)return e.toISOString();if(typeof e=="number")return e;if(Array.isArray(e))return`[${e.map(r=>ad(r)).join(",")}]`;if(e===null)return e;if(typeof e=="object")switch(e.type){case"raw":case"guid":return e.value;case"duration":return`duration'${e.value}'`;case"binary":return`binary'${e.value}'`;case"alias":return Array.isArray(t)&&t.push(e),`@${e.name}`;case"json":return escape(JSON.stringify(e.value));case"decimal":return`${e.value}M`;default:return Object.entries(e).filter(([,r])=>r!==void 0).map(([r,n])=>`${r}=${ad(n,t)}`).join(",")}return e}function P7(e){if(typeof e=="number")return e;if(typeof e=="string")return e.indexOf("/")===-1?e:e.split("/").reverse().reduce((t,r,n,i)=>n===0?`$expand=${r}`:n===i.length-1?`${r}(${t})`:`$expand=${r}(${t})`,"");if(Array.isArray(e))return`${e.map(t=>P7(t)).join(",")}`;if(typeof e=="object"){let t=Object.keys(e);return t.some(r=>AZn.indexOf(r.toLowerCase())!==-1)?t.map(r=>{let n;switch(r){case"filter":n=D7(e[r]);break;case"orderBy":n=yTe(e[r]);break;case"levels":case"count":case"skip":case"top":n=`${e[r]}`;break;default:n=P7(e[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):t.map(r=>{let n=P7(e[r]);return n?`${r}(${n})`:r}).join(",")}return""}function Z8t(e){return(Array.isArray(e)?e:[e]).reduce((t,r)=>{for(let n of Object.keys(r))switch(n){case"aggregate":{let i=r[n];i&&t.push(`aggregate(${CZn(i)})`);break}case"filter":{let i=r[n];if(i){let s=D7(i);s&&t.push(`filter(${s})`)}break}case"groupBy":{let i=r[n];i&&t.push(`groupby(${OZn(i)})`);break}default:throw new Error(`Unsupported transform: ${n}`)}return t},[]).join("/")||void 0}function CZn(e){return(Array.isArray(e)?e:[e]).map(t=>typeof t=="string"?t:Object.keys(t).map(r=>{let n=t[r];if(!n.with&&n.as)return`${r} as ${n.as}`;if(!n.with)throw new Error(`'with' property required for '${r}'`);if(!n.as)throw new Error(`'as' property required for '${r}'`);return`${r} with ${n.with} as ${n.as}`})).join(",")}function OZn(e){if(!e.properties)throw new Error("'properties' property required for groupBy");let t=`(${e.properties.join(",")})`;return e.transform&&(t+=`,${Z8t(e.transform)}`),t}function yTe(e,t=""){return Array.isArray(e)?e.map(r=>Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r).map(r=>`${t}${String(r)}`).join(","):typeof e=="object"?Object.entries(e).map(([r,n])=>yTe(n,`${r}/`)).map(r=>`${t}${r}`).join(","):`${t}${String(e)}`}function PZn(e,t){let r=Object.getOwnPropertyNames(t).filter(n=>t[n]!==void 0&&t[n]!=="").map(n=>`${n}=${t[n]}`);return r.length?`${e}?${r.join("&")}`:e}function Q8t(e){return`not (${e.join(" and ")})`}function DZn(e){let t=[];return{expands:e.reduce((n,{entityPath:i})=>{let s=i.split("/"),o=n;return s.forEach((a,u)=>{o.expand||(o.expand={}),o.expand[a]??=u===s.length-1?{}:{expand:{}},o=o.expand[a],t.includes(a)||t.push(a)}),n},{expand:{}}),entityPathParts:t}}function RZn(e,t,r=1,n){let i=t?.map(d=>({entityPath:d.fullPath,entitySetName:d.entity.entitySetName})),{expands:s,entityPathParts:o}=DZn(i),a=o.map(d=>t.find(g=>d===g.entity.entityPath?g.entity.entitySetName:void 0)?.entity.entitySetName).filter(d=>d!==void 0);lr.logger.info(It("info.entityFilesToBeGenerated",{entities:a.join(", ")}));let u=e;if(n){let d=[];u.semanticKeys.forEach(x=>{if(x.value!==void 0&&x.value!=="")if(x.type==="Edm.Boolean")d.push(`${x.name} eq ${x.value}`);else{let N=String(x.value).split(","),F=["Edm.UUID","Edm.Guid"].includes(x.type),D=V=>F?V.trim():`'${V.trim()}'`;if(N.length===1)d.push(`${x.name} eq ${D(N[0])}`);else{let V=N.map(z=>`${x.name} eq ${D(z)}`);d.push(`(${V.join(" or ")})`)}}});let h=d.length>0?`,filter(${d.join(" and ")})`:"",g=`$root/${u.entitySetName},${n.qualifier},${n.nodeProperty}`,_=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/${u.entitySetName},HierarchyQualifier='${n.qualifier}',NodeProperty='${n.nodeProperty}')`,S=n.isDraft?`$apply=ancestors(${g}${h},keep start)/${_}`:`$apply=${_}`,T=s?gTe(s):"",A=T?`&${T.substring(1)}`:"",w=`${u.entitySetName}?${S}${A}`;return lr.logger.debug(`Query for odata: ${w}`),{query:w}}let c=[];u.semanticKeys.forEach(d=>{if(d.value!==void 0&&d.value!=="")if(["Edm.UUID","Edm.Guid"].includes(d.type)){let g=String(d.value).split(",").map(_=>({[d.name]:{type:"guid",value:_.trim()}}));c.push(g.length===1?g[0]:{or:g})}else if(d.type==="Edm.Boolean")c.push({[d.name]:String(d.value)==="true"});else if(d.type==="Edm.String"){let h=String(d.value).split(","),g=[];h.forEach(_=>{let S=_.trim().split("-");S.length===1?g.push({[d.name]:_.trim()}):S.length===2&&g.push({[d.name]:{ge:S[0].trim(),le:S[1].trim()}})}),c.push(g.length==1?g[0]:{or:g})}else c.push({[d.name]:d.value})});let l={};s&&Object.assign(l,s),c.length>0?Object.assign(l,{filter:c.length===1?c[0]:c,count:!0}):r&&Object.assign(l,{top:r});let f=gTe(l),p=`${u.entitySetName}${f}`;return lr.logger.debug(`Query for odata: ${p}`),{query:p}}function NZn(e,t,r){let n=new Set(["DraftUUID","IsActiveEntity"]),i=[];for(let f of e.semanticKeys){if(f.value===void 0||f.value===""||n.has(f.name))continue;let p=f.keyName??f.name,d=String(f.value).split(",")[0].trim(),h=["Edm.UUID","Edm.Guid"].includes(f.type),g=f.type==="Edm.Boolean";i.push(`${p}=${h||g?d:`'${d}'`}`)}if(i.length===0){lr.logger.debug(`buildNavPropHierarchyQuery: no key values available for '${e.entitySetName}', skipping nav-prop hierarchy query for '${t}'`);return}let s={DraftUUID:"00000000-0000-0000-0000-000000000000",IsActiveEntity:"true"};e.entityType?.keys?.filter(f=>f.name in s).forEach(f=>i.push(`${f.name}=${s[f.name]}`)),lr.logger.debug(`buildNavPropHierarchyQuery: key segment for '${e.entitySetName}': (${i.join(",")})`);let a=`${`${e.entitySetName}(${i.join(",")})`}/${t}`,c=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=${`$root/${a}`},HierarchyQualifier='${r.qualifier}',NodeProperty='${r.nodeProperty}')`,l=`${a}?$apply=${c}`;return lr.logger.debug(`Nav-prop hierarchy query: ${l}`),l}async function t4t(e,t,r,n,i,s=[]){let o=RZn(e,r,n,i),a=await e4t(t,o.query);for(let u of s){let c=r.find(_=>_.entity.entitySetName===u.entitySetName);if(!c){lr.logger.debug(`fetchData: no selected entity matched hierarchy entity '${u.entitySetName}', skipping`);continue}let l=NZn(e,c.entity.entityPath,u);if(!l){lr.logger.debug(`fetchData: could not build nav-prop hierarchy query for '${u.entitySetName}', skipping`);continue}let f=await e4t(t,l);if(!f.entityData||!a.entityData){lr.logger.debug(`fetchData: no data returned for nav-prop hierarchy query '${u.entitySetName}', skipping merge`);continue}lr.logger.debug(`fetchData: merging ${f.entityData.length} hierarchy records into '${c.entity.entityPath}' expanded items`);let p=c.entity.entityPath,d=u.nodeProperty.split("/")[0],h=f.entityData,g=0;for(let _ of a.entityData){let S=_[p];if(Array.isArray(S))for(let T of S){let A=h.find(w=>u.entityTypeKeys.every(x=>w[x]===T[x]));A&&(T[d]=A[d],g++)}}lr.logger.debug(`fetchData: patched '${d}' onto ${g} expanded '${p}' records`)}return{odataResult:a}}async function e4t(e,t){try{lr.logger.info(`OData query request: ${encodeURI(e.defaults.baseURL+t).replaceAll("'","%27")}`),lr.logger.debug(`OData query request headers: ${JSON.stringify(e.defaults.headers)}`);let r=await e.get(t),n=r?.data?.match(/"@odata\.count":(\d+)/)?.[1];return lr.logger.info(`OData query records count: ${n}`),{entityData:r?.odata()}}catch(r){let n=It("errors.odataQueryError",{error:r});return lr.logger.error(n),{error:n}}}var wu=class e{static externalServiceRequestCache={};static entityTypeRefFacetCache={};static resetExternalServiceCache(t){if(t){delete e.externalServiceRequestCache[t];return}e.externalServiceRequestCache={}}static resetRefFacetCache(){e.entityTypeRefFacetCache={}}static resetServiceCaches(){e.resetExternalServiceCache(),e.resetRefFacetCache()}};async function i4t(e,t,r){if(e.metadata&&t.appAccess&&e.connectedSystem&&e.servicePath&&t.appAccess&&t.referencedEntities){e.connectedSystem.serviceProvider.log=lr.logger;let n=e.connectedSystem?.serviceProvider.service(e.servicePath);if(n){let i=Date.now();va.sendTelemetry("ODATA_DOWNLOAD_SEND_QUERY",{time:Date()});let s=t.referencedEntities.hierarchyEntities?.find(u=>u.entitySetName===t.referencedEntities.listEntity.entitySetName),o=t.referencedEntities.hierarchyEntities?.filter(u=>u.entitySetName!==t.referencedEntities.listEntity.entitySetName&&r.some(c=>c.entity.entitySetName===u.entitySetName))??[],{odataResult:a}=await t4t(t.referencedEntities.listEntity,n,r,s?void 0:1,s,o);if(a.entityData)return va.sendTelemetry("ODATA_DOWNLOAD_RECEIVED_QUERY_RESULT",{duration:`${Date.now()-i} ms`,resultSize:`${a.entityData.length} rows`}),lr.logger.debug(`Got result rows: ${a.entityData.length}`),{odataQueryResult:a.entityData};if(a.error)return va.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return It("errors.dataNotFetched")}function s4t(e){let t=[];return e.Facets.forEach(r=>{if(r.$Type===e2.UIAnnotationTypes.ReferenceFacet&&r.Target.type==="AnnotationPath"){let n=r.Target.value;n.lastIndexOf("/")>-1&&t.push(n.substring(0,n.lastIndexOf("/")))}else r.$Type===e2.UIAnnotationTypes.CollectionFacet&&t.push(...s4t(r))}),t}function IZn(e){if(wu.entityTypeRefFacetCache[e.name])return wu.entityTypeRefFacetCache[e.name];let t=[];return e.annotations?.UI?.Facets?.forEach(r=>{if(r.$Type===e2.UIAnnotationTypes.ReferenceFacet&&r.Target?.type==="AnnotationPath"){let n=r.Target.value;n?.lastIndexOf("/")>-1&&t.push(n.substring(0,n.lastIndexOf("/")))}r.$Type===e2.UIAnnotationTypes.CollectionFacet&&t.push(...s4t(r))}),wu.entityTypeRefFacetCache[e.name]=t,t??[]}function o4t(e,t="",r=[],n,i){let s={},o=e.navPropEntities;if(o&&o.length>0){let a=e.entityType?IZn(e.entityType):[];for(let u of o){let c=u.entityPath,l=i??e;if(u.entityType?.name===l?.entityType?.name||t.includes(c))continue;let f=t.concat(`${t?"/":""}${c}`);u.navPropEntities&&u.navPropEntities.length>0&&Object.assign(s,o4t(u,f,r,n,i??e).entitySetsFlat);let p={fullPath:f,entity:{entityPath:u.entityPath,entitySetName:u.entitySetName,defaultSelected:a.includes(u.entityPath)||!!n?.includes(f)}},d=`${f}`;r||(r=[]),r.push({name:d,value:p,checked:p.entity.defaultSelected}),s[f]=u.entitySetName}}return{entitySetsFlat:s,choices:r}}function a4t(e,t){let r=t?.map(n=>{let i=n.page?.contextPath??n.page?.routePattern?.replace(":?query:","").replaceAll(/\(\{[^}]*\}\)/g,"");return i?.startsWith(`/${e.entityPath}/`)?i.replace(`/${e.entityPath}/`,""):i}).filter(n=>n!==void 0);if(e.navPropEntities){let n=o4t(e,void 0,void 0,r);return n.choices.sort((i,s)=>(i.name??"").localeCompare(s.name??"")),n}}async function u4t(e,t){let n=(await Po.newInstance(await(0,r4t.readFile)((0,n4t.join)(e,St.Ui5Yaml),"utf-8"))).getBackendConfigsFromFioriToolsProxyMiddleware()[0],i;if(n){let s=n.url;if(n.connectPath){let o=n.connectPath.startsWith("/")?n.connectPath:`/${n.connectPath}`;s=new URL(o,n.url).href}i=Vr()?n?.destination:await j8t(s,n?.client)}return{servicePath:t.uri,systemName:i}}async function c4t(e){let t=await pL(e.app.appRoot),r=t.getApiVersion(),n=typeof r?.version=="string"?Number.parseInt(r.version,10):0;return n<24?(lr.logger.debug(`@sap/ux-specification from module cache API version is: ${n}. API version '24' at least is required.`),It("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):t}var l4t,LZn=(...e)=>new Promise(t=>{clearTimeout(l4t),l4t=setTimeout(async()=>t(await i4t(...e)),1e3)}),Ol={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},MZn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,f4t=["."];async function p4t(e,t,r){let n=!1;if(!r.referencedEntities?.listEntity.semanticKeys.every((a,u)=>(a.name!=="IsActiveEntity"&&!n&&(n=!!a.value),a.value!==void 0&&a.value!==""||!e[`entityKeyIdx:${u}`]))||!n)return It("prompts.skipDataDownload.validation.keyRequired");let s=[];r.relatedEntityChoices?.choices?.length&&(s=e[Ol.relatedEntitySelection]);let o=await LZn(t,r,s);return o}function FZn(e){return wu.resetServiceCaches(),e.appAccess=void 0,e.referencedEntities=void 0,e.servicePath=void 0,e.systemName&&(e.systemName.value=void 0),e.relatedEntityChoices.choices=[],e.relatedEntityChoices.entitySetsFlat={},e}async function d4t(e){let t=[],r={appAccess:void 0,referencedEntities:void 0,servicePath:void 0,systemName:{value:void 0},connectPath:{value:void 0},relatedEntityChoices:{choices:[],entitySetsFlat:{}}},n=[],i=UZn(r,n,e?.appPath),s=await ZGt({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:Kn.v4}},kc()!==cn.cli,lr.logger);s.prompts=Ds(s.prompts,()=>!!r.appAccess);let o={odata:[]},a=BZn(r,r.relatedEntityChoices),u=qZn(5,r,s.answers,o),c=kZn(r.relatedEntityChoices,s.answers,r,o);return t.push(i,...s.prompts,VZn(s.answers,r),jZn(s.answers,r),...u,a,c),{questions:t,answers:{application:r,odataQueryResult:o,odataServiceAnswers:s.answers}}}function UZn(e,t,r){return{type:"input",guiType:"folder-browser",name:Ol.appSelection,message:It("prompts.appSelection.message"),default:n=>r??n.appSelection??e.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:It("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===e.appAccess?.app.appRoot)return!0;t.length=0,FZn(e);let i;try{i=await Q5(n)}catch(c){let l=c;return c instanceof Error&&(l=c.message),lr.logger.error(It("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${It("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${It("texts.seeLogForDetails")}`}let s=i.app.services[i.app.mainService??"mainService"];if(!s?.odataVersion?.startsWith("4."))return It("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:s.odataVersion});let o=await c4t(i);if(typeof o=="string")return o;e.appAccess=i,e.specification=o;let{servicePath:a,systemName:u}=await u4t(i.app.appRoot,s);return a&&(e.servicePath=a,t.push(a)),e.systemName&&(e.systemName.value=u),e.connectPath&&(e.connectPath.value=a),!0}}}function kZn(e,t,r,n){let i;return{when:async s=>e.choices.length>0,name:Ol.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:It("prompts.relatedEntitySelection.message"),choices:()=>e.choices,validate:async(s,o)=>{if(e.choices.forEach(a=>{a.disabled||(a.checked=s.some(u=>u.fullPath===a.value.fullPath))}),o&&!o[Ol.skipDataDownload]?.[0]){if(i=await p4t(o,t,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:It("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:vTe.Severity.information}}}}function BZn(e,t){let r,n,i;return{when:()=>{if((n!==e.systemName?.value||e.servicePath!==r)&&e.referencedEntities?.listEntity){let o=a4t(e.referencedEntities.listEntity,e.referencedEntities.pageObjectEntities);o&&(t.choices=o.choices,Object.assign(t.entitySetsFlat,o.entitySetsFlat)),r=e.servicePath,n=e.systemName?.value}return t.choices.length>0},name:Ol.toggleSelection,type:"confirm",message:It("prompts.toggleSelection.message"),labelTrue:It("prompts.toggleSelection.labelTrue"),labelFalse:It("prompts.toggleSelection.labelFalse"),default:!1,validate:o=>(o!==i&&(t.choices.forEach(a=>{if(a.disabled)return;let u=a.value;a.checked=o===!1?u.entity.defaultSelected:!1}),i=o),!0)}}function qZn(e,t,r,n){let i=[],s,o=0,a=u=>({when:async()=>{let c=t.referencedEntities?.listEntity.semanticKeys[u],l=!!c?.name&&c.name!=="IsActiveEntity";return l&&u>o&&(o=u),l},name:`entityKeyIdx:${u}`,message:()=>It("prompts.entityKey.message",{keyName:`${t.referencedEntities?.listEntity.semanticKeys[u]?.name} (${t.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:It("prompts.entityKey.hint")},validate:async(c,l)=>{let f=t.referencedEntities?.listEntity.semanticKeys[u];if(f&&delete f.value,f4t.includes(c))return It("prompts.entityKey.validation.invalidKeyValueChars",{chars:f4t.join()});if(c&&f)if(f.type==="Edm.Boolean")try{f.value=JSON.parse(c)}catch{return It("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(f.type)){let d=c.split(",");for(let h of d)if(!MZn.test(h.trim()))return It("prompts.entityKey.validation.invalidGuidValue");f.value=c.trim()}else f.value=c.trim();let p=c.split(",");if(f?.type&&!["Edm.UUID","Edm.Guid"].includes(f.type)){for(let d of p)if(d.split("-").length>2)return f&&delete f.value,It("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!t.relatedEntityChoices?.choices?.length&&u===o&&!l[Ol.skipDataDownload]?.[0]&&t.referencedEntities?.listEntity.semanticKeys[u]?.name){if(s=await p4t(l,r,t),typeof s=="string")return s;n.odata=s.odataQueryResult}return!0}});for(let u=0;u<e;u++)i.push(a(u));return i}function jZn(e,t){return{when:()=>!!e.metadata&&!!t.servicePath,name:Ol.skipDataDownload,type:"checkbox",message:It("prompts.skipDataDownload.message"),guiOptions:{hint:It("prompts.skipDataDownload.hint")},default:!1,choices:[{name:It("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function VZn(e,t){let r;return{when:async()=>t.appAccess&&t.specification&&e?.metadata?(r=await G8t(t.appAccess,t.specification,e.metadata),typeof r=="object"&&(t.referencedEntities=r),!0):!1,name:Ol.updateMainServiceMetadata,type:"confirm",message:It("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:vTe.Severity.error}}}}function h4t(e){let t=[],r=n=>[{name:`${n.entitySetName}/${n.nodeProperty}/source`,type:"list",message:`Source: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))},{name:`${n.entitySetName}/${n.nodeProperty}/target`,type:"list",message:`Target: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))}];return e.forEach(n=>{!n.parentProperty&&n.missingReferentialConstraints?.navPropName&&t.push(...r(n))}),t}var E4t=be(Oy()),_4t=be(Dy());var S4t=be(v4t()),b4t=require("node:path");function T4t(e,t,r){wu.resetExternalServiceCache();let n=iei(e,t),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:It("prompts.valueHelpSelection.message"),choices:()=>n,validate:async o=>{if(!o||o.length===0)return wu.resetExternalServiceCache(),!0;let a=await nei(o,r),u=(0,S4t.default)(i,a);return i.length=0,i.push(...u),await rei(i,r),!0}}],valueHelpData:i}}async function rei(e,t){let r=[],n={transformResponse:s=>typeof s=="string"?JSON.parse(s):s},i=e.map(async s=>{let o=s,[a]=o.path.split(";");wu.externalServiceRequestCache[a]??=[];let l=(0,E4t.convert)((0,_4t.parse)(s.metadata)).entitySets.map(async f=>{let p=f.name;if(wu.externalServiceRequestCache[a].includes(p))return;wu.externalServiceRequestCache[a].push(p);let d=await t.get((0,b4t.join)(o.path,p),n);o.entityData=o.entityData??[],o.entityData?.push({entitySetName:p,items:d.data.value})});await Promise.allSettled(l),o.entityData&&r.push(o)});return await Promise.allSettled(i),r}async function nei(e,t){let r=e.flat();return await t.fetchExternalServices(r)}function iei(e,t){let r=fM(e,t,[]),n={};for(let s of r)if(s.type==="value-list"){if(F8t.includes(s.target))continue;let[o]=s.value.split(";"),a=s.target.split("/").pop();a&&(n[o]??={},n[o][a]??=[],n[o][a].push(s))}else s.type==="code-list"&&(n[s.value]??={},n[s.value]["Code list"]??=[],n[s.value]["Code list"].push(s));let i=[];for(let s of Object.values(n))for(let[o,a]of Object.entries(s)){let u=a.map(c=>{if(c.type==="value-list")return c.target.replace(/\/[^/]*$/,"");if(c.type==="code-list"&&c.collectionPath)return c.collectionPath}).filter(c=>c!==void 0);i.push({name:`${o} (${u.join()})`,value:a})}return i.sort((s,o)=>s.name.localeCompare(o.name))}var lr=class e extends x4t.default{vscode;appWizard;static _logger=d4;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(t,r){super(t,{...r,skipInstall:!0},{unique:"namespace"}),hEe(this.env,!0),this.options.force=!0,this.prompts=new R7.Prompts([{description:It("steps.odataDownloader.description"),name:It("steps.odataDownloader.name")},{description:It("steps.valueHelpSelection.description"),name:It("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(It("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return e._logger}async initializing(){await S_e(),e._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await va.initTelemetrySettings(),va.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:t,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await d4t(this.options?.data),s=await this.prompt(i);if(this.state.entityOData=r.odata,this.state.entityPropertyToEntitySet=t.relatedEntityChoices.entitySetsFlat,this.state.appRootPath=t.appAccess?.getAppRoot(),this.state.mainServicePath=n.servicePath,this.state.mainServiceName=t.appAccess?.app.mainService,this.state.appEntities=t.referencedEntities,this.state.appRootPath){this.state.mockServerConfig=await xx(this.state.appRootPath);let o;this.state.mockServerConfig?.services&&(e.logger.debug(`Mock config: ${JSON.stringify(this.state.mockServerConfig)}`),o=this.state.mockServerConfig.services.find(a=>a.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===this.state.mainServicePath?.replaceAll(/(^\/)|(\/$)/g,""))),this.state.mockDataRootPath=o?.mockdataPath??(0,e0.join)(ai.Webapp,ai.LocalService,ai.Mockdata)}if(this.state.updateMainServiceMetadata=s[Ol.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,s[Ol.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(t,s),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof Va){let{questions:o,valueHelpData:a}=T4t(n.servicePath,n.metadata,n.connectedSystem?.serviceProvider);await this.prompt(o),this.state.valueHelpData=a}}catch(t){e.logger.error(t),this._exitOnError(t)}}async writing(){if(this.state.appRootPath){if(this.state.entityOData&&this.state.entityPropertyToEntitySet&&this.state.appEntities)try{let t=Date.now();va.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,e0.join)(this.state.appRootPath));let r=hTe(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);e.logger.info(It("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,s])=>{this.writeDestinationJSON((0,e0.join)(this.state.mockDataRootPath,`${i}.json`),s)}),this.state.appEntities.hierarchyEntities?.filter(i=>i.missingReferentialConstraints&&n.some(([s])=>s===i.entitySetName))?.forEach(i=>{let s=(0,e0.join)(this.state.mockDataRootPath,`${i.entitySetName}.js`),o=this.destinationPath(s),{navPropName:a,constraints:u}=i.missingReferentialConstraints;if(this.fs.exists(o)){let c=this.fs.read(o),l=H8t(c,a,u);l!==c?(this.writeDestination(s,l),e.logger.info(`Updated referential constraint file: ${i.entitySetName}.js`)):e.logger.debug(`Referential constraint for '${a}' already present in ${i.entitySetName}.js \u2014 skipping`)}else{let c=$8t(a,u);this.writeDestination(s,c),e.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),va.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-t} ms`,numberOfFiles:`${n.length}`})}catch(t){e.logger.error(t),va.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else e.logger.info(It("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let t=Date.now();va.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,e0.join)(this.state.appRootPath,ai.Webapp);if(await M4(this.fs,r,this.state.valueHelpData,this.state.mainServiceName,this.state.mainServicePath),this.state.mockServerConfig){let n={webappPath:r,packageJsonConfig:{skip:!0},ui5MockYamlConfig:{overwrite:!0}};n.ui5MockYamlConfig&&this.state.mainServiceName&&(n.ui5MockYamlConfig.resolveExternalServiceReferences={[this.state.mainServiceName]:!0},await m4(this.state.appRootPath,n,this.fs))}va.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_DATA_FILES_END",{writeFileDuration:`${Date.now()-t} ms`,numberOfExternalServices:`${this.state.valueHelpData.length}`})}catch(t){e.logger.error(t),va.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else e.logger.info(It("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let t=(0,e0.join)(this.state.appRootPath,ai.Webapp,ai.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(t,(0,A4t.default)(this.state.mainServiceMetadata,{indent:4}))}}}async _promptMissingReferentialConstraints(t,r){let n=t.referencedEntities?.listEntity.entitySetName,i=new Set([...n?[n]:[],...(r[Ol.relatedEntitySelection]??[]).map(o=>o.entity.entitySetName)]),s=t.referencedEntities?.hierarchyEntities?.filter(o=>!o.parentProperty&&o.missingReferentialConstraints&&i.has(o.entitySetName))??[];if(s.length>0){this.prompts.splice(1,0,[{name:It("steps.addConstraints.name"),description:It("steps.addConstraints.description")}]);let o=h4t(s),a=await this.prompt(o),u=[t.referencedEntities?.listEntity,...t.referencedEntities?.pageObjectEntities??[]];s.forEach(c=>{let l=a[`${c.entitySetName}/${c.nodeProperty}/source`],f=a[`${c.entitySetName}/${c.nodeProperty}/target`];if(l&&f){c.missingReferentialConstraints.constraints=[{sourceProperty:l,targetProperty:f}],c.parentProperty=l;let p=u.find(d=>d?.entitySetName===c.entitySetName)?.entityType;c.parentPropertyType=p?.entityProperties.find(d=>d.name===l)?.type??"Edm.String"}})}}_exitOnError(t){throw kc()!==cn.cli&&this.appWizard?.showError(t,R7.MessageType.notification),new Error(t)}_configureLogging(t,r,n){let i=new p4(this.rootGeneratorName(),this.log,t,r,n);return i.info(It("info.loggingInitialised",{logLevel:i.getLogLevel()})),i}};
|
|
733
|
+
${s}${e.slice(o)}`:e}var e2=be(W8t()),r4t=require("node:fs/promises"),n4t=require("node:path");var z8t=require("node:crypto"),K8t=be(k8());var Y8t={name:"@sap-ux/generator-odata-downloader",displayName:"Fiori Elements Data Downloader",description:"Yeoman generator that supports download of app data, typically for mock data server use.",version:"0.3.11",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/generator-odata-downloader"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aodata-download"},license:"Apache-2.0",main:"generators/app/index.js",keywords:["yeoman-generator"],scripts:{build:"npm-run-all clean bundle:prod",compile:"tsc --build",clean:"rimraf --glob generators prebuilds test/test-output coverage *.tsbuildinfo",watch:"tsc --watch",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",bundle:"node esbuild.mjs","bundle:dev":"pnpm clean && node esbuild.mjs --development && pnpm pack","bundle:prod":"node esbuild.mjs --production"},files:["LICENSE","generators","!generators/*.map","!generators/**/*.map","prebuilds","yeoman.png"],devDependencies:{"@jest/globals":"30.3.0"},dependencies:{"@sap-devx/yeoman-ui-types":"1.25.0","@sap-ux/annotation-converter":"0.10.21","@sap-ux/axios-extension":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/edmx-parser":"0.10.0","@sap-ux/fiori-generator-shared":"workspace:*","@sap-ux/inquirer-common":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/mockserver-config-writer":"workspace:*","@sap-ux/odata-service-inquirer":"workspace:*","@sap-ux/odata-service-writer":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/store":"workspace:*","@sap-ux/telemetry":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/vocabularies-types":"0.15.0","@sap/ux-specification":"1.144.0","@types/inquirer":"8.2.6","@types/yeoman-generator":"5.2.14","@vscode-logging/logger":"2.0.9",deepmerge:"4.3.1",i18next:"25.10.10",inquirer:"8.2.7","odata-query":"8.0.5","os-name":"4.0.1","prettify-xml":"1.2.0",rimraf:"6.1.3","yeoman-generator":"5.10.0"},engines:{node:">=22.x"}};var EZn="@sap-ux/odata-download-sub-generator",_Zn="0a65e45d-6bf4-421d-b845-61e888c50e9e",va=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(t){this._sessionId=(0,z8t.randomUUID)(),lr.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:EZn,version:Y8t.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:_Zn,...t};try{await AL(r)}catch(n){lr.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(t){if(!this._telemetryData){let r=It("telemetry.unknownOs");try{r=(0,K8t.default)()}catch{}this._telemetryData={Platform:Vr()?"SBAS":"VSCode",OperatingSystem:r,SessionId:this._sessionId}}return this._telemetryData=Object.assign(this._telemetryData,t),this._telemetryData}static prepareTelemetryEvent(t,r){return{eventName:t,properties:r,measurements:{}}}static async sendTelemetry(t,r){let n=this.createTelemetryData(r),i=this.prepareTelemetryEvent(t,n);await ic.getTelemetryClient().reportEvent(i,Pi.NoSampling)}};var SZn=["eq","ne","gt","ge","lt","le"],O7=["and","or","not"],bZn=["any","all"],TZn=["startswith","endswith","contains","matchespattern"],AZn=["expand","levels","select","skip","top","count","orderby","filter"],X8t=/\((.*)\)/,J8t=/(?!indexof)\((\w+)\)/;var sm="";function gTe({select:e,search:t,skiptoken:r,format:n,top:i,skip:s,filter:o,transform:a,orderBy:u,key:c,count:l,expand:f,action:p,func:d}={}){let h="",g=[],_={};if(c!=null&&(h+=`(${ad(c,g)})`),(o||typeof l=="object")&&(_.$filter=D7(typeof l=="object"?l:o,g)),a&&(_.$apply=Z8t(a)),f&&(_.$expand=P7(f)),u&&(_.$orderby=yTe(u)),l&&(typeof l=="boolean"?_.$count=!0:h+="/$count"),typeof i=="number"&&(_.$top=i),typeof s=="number"&&(_.$skip=s),p&&(h+=`/${p}`),d){if(typeof d=="string")h+=`/${d}`;else if(typeof d=="object"){let[S]=Object.keys(d),T=ad(d[S],g);h+=`/${S}`,T!==""&&(h+=`(${T})`)}}return g.length>0&&Object.assign(_,g.reduce((S,T)=>Object.assign(S,{[`@${T.name}`]:ad(T.value)}),{})),PZn(h,{$select:e,$search:t,$skiptoken:r,$format:n,..._})}function mTe(e,t,r=[]){return`${e} eq ${ad(t,r)}`}function D7(e={},t=[],r=""){return(Array.isArray(e)?e:[e]).reduce((s,o)=>{if(o){let a=n(o,t,r);a&&s.push(a)}return s},[]).join(" and ");function n(s={},o=[],a=""){let u="";return typeof s=="string"?u=s:s&&typeof s=="object"&&(u=Object.keys(s).reduce((c,l)=>{let f=s[l];if(f===void 0)return c;let p="";if(a?l===sm?p=a:J8t.test(l)?p=l.replace(J8t,(d,h)=>h.trim()===sm?`(${a})`:`(${a}/${h.trim()})`):X8t.test(l)?p=l.replace(X8t,(d,h)=>h.trim()===sm?`(${a})`:`(${a}/${h.trim()})`):p=`${a}/${l}`:p=l,l===sm&&Array.isArray(f))return c.concat(f.map(d=>mTe(p,d)));if(["number","string","boolean"].indexOf(typeof f)!==-1||f instanceof Date||f===null)c.push(mTe(p,f,o));else if(Array.isArray(f)){let d=l,h=f.map(g=>D7(g,o,a)).filter(g=>g).map(g=>O7.indexOf(d)!==-1?`(${g})`:g);h.length&&(O7.indexOf(d)!==-1?h.length&&(d==="not"?c.push(Q8t(h)):c.push(`(${h.join(` ${d} `)})`)):c.push(h.join(` ${d} `)))}else if(O7.indexOf(p)!==-1){let d=p,h=Object.keys(f).map(g=>n({[g]:f[g]}));h.length&&(d==="not"?c.push(Q8t(h)):c.push(`(${h.join(` ${d} `)})`))}else if(typeof f=="object")"type"in f?c.push(mTe(p,f,o)):Object.keys(f).forEach(d=>{if(f[d]!==void 0)if(SZn.indexOf(d)!==-1)c.push(`${p} ${d} ${ad(f[d],o)}`);else if(O7.indexOf(d)!==-1)Array.isArray(f[d])?c.push(f[d].map(h=>"("+n(h,o,p)+")").join(` ${d} `)):c.push("("+n(f[d],o,p)+")");else if(bZn.indexOf(d)!==-1){let h=i(l.toLowerCase(),f[d],d,p);h&&c.push(h)}else if(d==="has")c.push(`${p} ${d} ${ad(f[d],o)}`);else if(d==="in"){let h=Array.isArray(f[d])?f[d]:f[d].value.map(g=>({type:f[d].type,value:g}));c.push(p+" in ("+h.map(g=>ad(g,o)).join(",")+")")}else if(TZn.indexOf(d)!==-1)c.push(`${d}(${p},${ad(f[d],o)})`);else{let h=n({[d]:f[d]},o,p);h&&c.push(h)}});else throw new Error(`Unexpected value type: ${f}`);return c},[]).join(" and ")),u}function i(s,o,a,u){let c="";if(typeof o=="string"||o instanceof String)c=xZn(s,o,a,u);else if(o){let l=Array.isArray(o)?o.reduce((p,d)=>d.hasOwnProperty(sm)?(p.hasOwnProperty(sm)||(p[sm]=[]),p[sm].push(d[sm]),p):{...p,...d},{}):o,f=n(l,t,s);c=`${u}/${a}(${f?`${s}:${f}`:""})`}return c}}function xZn(e,t,r,n){let i=r=="all"?"ne":"eq";return`${n}/${r}(${e}: ${e} ${i} '${t}')`}function wZn(e){return e=e.replace(/%/g,"%25"),e=e.replace(/\+/g,"%2B"),e=e.replace(/\//g,"%2F"),e=e.replace(/\?/g,"%3F"),e=e.replace(/#/g,"%23"),e=e.replace(/&/g,"%26"),e=e.replace(/'/g,"''"),e}function ad(e,t){if(typeof e=="string")return`'${wZn(e)}'`;if(e instanceof Date)return e.toISOString();if(typeof e=="number")return e;if(Array.isArray(e))return`[${e.map(r=>ad(r)).join(",")}]`;if(e===null)return e;if(typeof e=="object")switch(e.type){case"raw":case"guid":return e.value;case"duration":return`duration'${e.value}'`;case"binary":return`binary'${e.value}'`;case"alias":return Array.isArray(t)&&t.push(e),`@${e.name}`;case"json":return escape(JSON.stringify(e.value));case"decimal":return`${e.value}M`;default:return Object.entries(e).filter(([,r])=>r!==void 0).map(([r,n])=>`${r}=${ad(n,t)}`).join(",")}return e}function P7(e){if(typeof e=="number")return e;if(typeof e=="string")return e.indexOf("/")===-1?e:e.split("/").reverse().reduce((t,r,n,i)=>n===0?`$expand=${r}`:n===i.length-1?`${r}(${t})`:`$expand=${r}(${t})`,"");if(Array.isArray(e))return`${e.map(t=>P7(t)).join(",")}`;if(typeof e=="object"){let t=Object.keys(e);return t.some(r=>AZn.indexOf(r.toLowerCase())!==-1)?t.map(r=>{let n;switch(r){case"filter":n=D7(e[r]);break;case"orderBy":n=yTe(e[r]);break;case"levels":case"count":case"skip":case"top":n=`${e[r]}`;break;default:n=P7(e[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):t.map(r=>{let n=P7(e[r]);return n?`${r}(${n})`:r}).join(",")}return""}function Z8t(e){return(Array.isArray(e)?e:[e]).reduce((t,r)=>{for(let n of Object.keys(r))switch(n){case"aggregate":{let i=r[n];i&&t.push(`aggregate(${CZn(i)})`);break}case"filter":{let i=r[n];if(i){let s=D7(i);s&&t.push(`filter(${s})`)}break}case"groupBy":{let i=r[n];i&&t.push(`groupby(${OZn(i)})`);break}default:throw new Error(`Unsupported transform: ${n}`)}return t},[]).join("/")||void 0}function CZn(e){return(Array.isArray(e)?e:[e]).map(t=>typeof t=="string"?t:Object.keys(t).map(r=>{let n=t[r];if(!n.with&&n.as)return`${r} as ${n.as}`;if(!n.with)throw new Error(`'with' property required for '${r}'`);if(!n.as)throw new Error(`'as' property required for '${r}'`);return`${r} with ${n.with} as ${n.as}`})).join(",")}function OZn(e){if(!e.properties)throw new Error("'properties' property required for groupBy");let t=`(${e.properties.join(",")})`;return e.transform&&(t+=`,${Z8t(e.transform)}`),t}function yTe(e,t=""){return Array.isArray(e)?e.map(r=>Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r).map(r=>`${t}${String(r)}`).join(","):typeof e=="object"?Object.entries(e).map(([r,n])=>yTe(n,`${r}/`)).map(r=>`${t}${r}`).join(","):`${t}${String(e)}`}function PZn(e,t){let r=Object.getOwnPropertyNames(t).filter(n=>t[n]!==void 0&&t[n]!=="").map(n=>`${n}=${t[n]}`);return r.length?`${e}?${r.join("&")}`:e}function Q8t(e){return`not (${e.join(" and ")})`}function DZn(e){let t=[];return{expands:e.reduce((n,{entityPath:i})=>{let s=i.split("/"),o=n;return s.forEach((a,u)=>{o.expand||(o.expand={}),o.expand[a]??=u===s.length-1?{}:{expand:{}},o=o.expand[a],t.includes(a)||t.push(a)}),n},{expand:{}}),entityPathParts:t}}function RZn(e,t,r=1,n){let i=t?.map(d=>({entityPath:d.fullPath,entitySetName:d.entity.entitySetName})),{expands:s,entityPathParts:o}=DZn(i),a=o.map(d=>t.find(g=>d===g.entity.entityPath?g.entity.entitySetName:void 0)?.entity.entitySetName).filter(d=>d!==void 0);lr.logger.info(It("info.entityFilesToBeGenerated",{entities:a.join(", ")}));let u=e;if(n){let d=[];u.semanticKeys.forEach(x=>{if(x.value!==void 0&&x.value!=="")if(x.type==="Edm.Boolean")d.push(`${x.name} eq ${x.value}`);else{let N=String(x.value).split(","),F=["Edm.UUID","Edm.Guid"].includes(x.type),D=V=>F?V.trim():`'${V.trim()}'`;if(N.length===1)d.push(`${x.name} eq ${D(N[0])}`);else{let V=N.map(z=>`${x.name} eq ${D(z)}`);d.push(`(${V.join(" or ")})`)}}});let h=d.length>0?`,filter(${d.join(" and ")})`:"",g=`$root/${u.entitySetName},${n.qualifier},${n.nodeProperty}`,_=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/${u.entitySetName},HierarchyQualifier='${n.qualifier}',NodeProperty='${n.nodeProperty}')`,S=n.isDraft?`$apply=ancestors(${g}${h},keep start)/${_}`:`$apply=${_}`,T=s?gTe(s):"",A=T?`&${T.substring(1)}`:"",w=`${u.entitySetName}?${S}${A}`;return lr.logger.debug(`Query for odata: ${w}`),{query:w}}let c=[];u.semanticKeys.forEach(d=>{if(d.value!==void 0&&d.value!=="")if(["Edm.UUID","Edm.Guid"].includes(d.type)){let g=String(d.value).split(",").map(_=>({[d.name]:{type:"guid",value:_.trim()}}));c.push(g.length===1?g[0]:{or:g})}else if(d.type==="Edm.Boolean")c.push({[d.name]:String(d.value)==="true"});else if(d.type==="Edm.String"){let h=String(d.value).split(","),g=[];h.forEach(_=>{let S=_.trim().split("-");S.length===1?g.push({[d.name]:_.trim()}):S.length===2&&g.push({[d.name]:{ge:S[0].trim(),le:S[1].trim()}})}),c.push(g.length==1?g[0]:{or:g})}else c.push({[d.name]:d.value})});let l={};s&&Object.assign(l,s),c.length>0?Object.assign(l,{filter:c.length===1?c[0]:c,count:!0}):r&&Object.assign(l,{top:r});let f=gTe(l),p=`${u.entitySetName}${f}`;return lr.logger.debug(`Query for odata: ${p}`),{query:p}}function NZn(e,t,r){let n=new Set(["DraftUUID","IsActiveEntity"]),i=[];for(let f of e.semanticKeys){if(f.value===void 0||f.value===""||n.has(f.name))continue;let p=f.keyName??f.name,d=String(f.value).split(",")[0].trim(),h=["Edm.UUID","Edm.Guid"].includes(f.type),g=f.type==="Edm.Boolean";i.push(`${p}=${h||g?d:`'${d}'`}`)}if(i.length===0){lr.logger.debug(`buildNavPropHierarchyQuery: no key values available for '${e.entitySetName}', skipping nav-prop hierarchy query for '${t}'`);return}let s={DraftUUID:"00000000-0000-0000-0000-000000000000",IsActiveEntity:"true"};e.entityType?.keys?.filter(f=>f.name in s).forEach(f=>i.push(`${f.name}=${s[f.name]}`)),lr.logger.debug(`buildNavPropHierarchyQuery: key segment for '${e.entitySetName}': (${i.join(",")})`);let a=`${`${e.entitySetName}(${i.join(",")})`}/${t}`,c=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=${`$root/${a}`},HierarchyQualifier='${r.qualifier}',NodeProperty='${r.nodeProperty}')`,l=`${a}?$apply=${c}`;return lr.logger.debug(`Nav-prop hierarchy query: ${l}`),l}async function t4t(e,t,r,n,i,s=[]){let o=RZn(e,r,n,i),a=await e4t(t,o.query);for(let u of s){let c=r.find(_=>_.entity.entitySetName===u.entitySetName);if(!c){lr.logger.debug(`fetchData: no selected entity matched hierarchy entity '${u.entitySetName}', skipping`);continue}let l=NZn(e,c.entity.entityPath,u);if(!l){lr.logger.debug(`fetchData: could not build nav-prop hierarchy query for '${u.entitySetName}', skipping`);continue}let f=await e4t(t,l);if(!f.entityData||!a.entityData){lr.logger.debug(`fetchData: no data returned for nav-prop hierarchy query '${u.entitySetName}', skipping merge`);continue}lr.logger.debug(`fetchData: merging ${f.entityData.length} hierarchy records into '${c.entity.entityPath}' expanded items`);let p=c.entity.entityPath,d=u.nodeProperty.split("/")[0],h=f.entityData,g=0;for(let _ of a.entityData){let S=_[p];if(Array.isArray(S))for(let T of S){let A=h.find(w=>u.entityTypeKeys.every(x=>w[x]===T[x]));A&&(T[d]=A[d],g++)}}lr.logger.debug(`fetchData: patched '${d}' onto ${g} expanded '${p}' records`)}return{odataResult:a}}async function e4t(e,t){try{lr.logger.info(`OData query request: ${encodeURI(e.defaults.baseURL+t).replaceAll("'","%27")}`),lr.logger.debug(`OData query request headers: ${JSON.stringify(e.defaults.headers)}`);let r=await e.get(t),n=r?.data?.match(/"@odata\.count":(\d+)/)?.[1];return lr.logger.info(`OData query records count: ${n}`),{entityData:r?.odata()}}catch(r){let n=It("errors.odataQueryError",{error:r});return lr.logger.error(n),{error:n}}}var wu=class e{static externalServiceRequestCache={};static entityTypeRefFacetCache={};static resetExternalServiceCache(t){if(t){delete e.externalServiceRequestCache[t];return}e.externalServiceRequestCache={}}static resetRefFacetCache(){e.entityTypeRefFacetCache={}}static resetServiceCaches(){e.resetExternalServiceCache(),e.resetRefFacetCache()}};async function i4t(e,t,r){if(e.metadata&&t.appAccess&&e.connectedSystem&&e.servicePath&&t.appAccess&&t.referencedEntities){e.connectedSystem.serviceProvider.log=lr.logger;let n=e.connectedSystem?.serviceProvider.service(e.servicePath);if(n){let i=Date.now();va.sendTelemetry("ODATA_DOWNLOAD_SEND_QUERY",{time:Date()});let s=t.referencedEntities.hierarchyEntities?.find(u=>u.entitySetName===t.referencedEntities.listEntity.entitySetName),o=t.referencedEntities.hierarchyEntities?.filter(u=>u.entitySetName!==t.referencedEntities.listEntity.entitySetName&&r.some(c=>c.entity.entitySetName===u.entitySetName))??[],{odataResult:a}=await t4t(t.referencedEntities.listEntity,n,r,s?void 0:1,s,o);if(a.entityData)return va.sendTelemetry("ODATA_DOWNLOAD_RECEIVED_QUERY_RESULT",{duration:`${Date.now()-i} ms`,resultSize:`${a.entityData.length} rows`}),lr.logger.debug(`Got result rows: ${a.entityData.length}`),{odataQueryResult:a.entityData};if(a.error)return va.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return It("errors.dataNotFetched")}function s4t(e){let t=[];return e.Facets.forEach(r=>{if(r.$Type===e2.UIAnnotationTypes.ReferenceFacet&&r.Target.type==="AnnotationPath"){let n=r.Target.value;n.lastIndexOf("/")>-1&&t.push(n.substring(0,n.lastIndexOf("/")))}else r.$Type===e2.UIAnnotationTypes.CollectionFacet&&t.push(...s4t(r))}),t}function IZn(e){if(wu.entityTypeRefFacetCache[e.name])return wu.entityTypeRefFacetCache[e.name];let t=[];return e.annotations?.UI?.Facets?.forEach(r=>{if(r.$Type===e2.UIAnnotationTypes.ReferenceFacet&&r.Target?.type==="AnnotationPath"){let n=r.Target.value;n?.lastIndexOf("/")>-1&&t.push(n.substring(0,n.lastIndexOf("/")))}r.$Type===e2.UIAnnotationTypes.CollectionFacet&&t.push(...s4t(r))}),wu.entityTypeRefFacetCache[e.name]=t,t??[]}function o4t(e,t="",r=[],n,i){let s={},o=e.navPropEntities;if(o&&o.length>0){let a=e.entityType?IZn(e.entityType):[];for(let u of o){let c=u.entityPath,l=i??e;if(u.entityType?.name===l?.entityType?.name||t.includes(c))continue;let f=t.concat(`${t?"/":""}${c}`);u.navPropEntities&&u.navPropEntities.length>0&&Object.assign(s,o4t(u,f,r,n,i??e).entitySetsFlat);let p={fullPath:f,entity:{entityPath:u.entityPath,entitySetName:u.entitySetName,defaultSelected:a.includes(u.entityPath)||!!n?.includes(f)}},d=`${f}`;r||(r=[]),r.push({name:d,value:p,checked:p.entity.defaultSelected}),s[f]=u.entitySetName}}return{entitySetsFlat:s,choices:r}}function a4t(e,t){let r=t?.map(n=>{let i=n.page?.contextPath??n.page?.routePattern?.replace(":?query:","").replaceAll(/\(\{[^}]*\}\)/g,"");return i?.startsWith(`/${e.entityPath}/`)?i.replace(`/${e.entityPath}/`,""):i}).filter(n=>n!==void 0);if(e.navPropEntities){let n=o4t(e,void 0,void 0,r);return n.choices.sort((i,s)=>(i.name??"").localeCompare(s.name??"")),n}}async function u4t(e,t){let n=(await Po.newInstance(await(0,r4t.readFile)((0,n4t.join)(e,St.Ui5Yaml),"utf-8"))).getBackendConfigsFromFioriToolsProxyMiddleware()[0],i;if(n){let s=n.url;if(n.connectPath){let o=n.connectPath.startsWith("/")?n.connectPath:`/${n.connectPath}`;s=new URL(o,n.url).href}i=Vr()?n?.destination:await j8t(s,n?.client)}return{servicePath:t.uri,systemName:i}}async function c4t(e){let t=await pL(e.app.appRoot),r=t.getApiVersion(),n=typeof r?.version=="string"?Number.parseInt(r.version,10):0;return n<24?(lr.logger.debug(`@sap/ux-specification from module cache API version is: ${n}. API version '24' at least is required.`),It("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):t}var l4t,LZn=(...e)=>new Promise(t=>{clearTimeout(l4t),l4t=setTimeout(async()=>t(await i4t(...e)),1e3)}),Ol={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},MZn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,f4t=["."];async function p4t(e,t,r){let n=!1;if(!r.referencedEntities?.listEntity.semanticKeys.every((a,u)=>(a.name!=="IsActiveEntity"&&!n&&(n=!!a.value),a.value!==void 0&&a.value!==""||!e[`entityKeyIdx:${u}`]))||!n)return It("prompts.skipDataDownload.validation.keyRequired");let s=[];r.relatedEntityChoices?.choices?.length&&(s=e[Ol.relatedEntitySelection]);let o=await LZn(t,r,s);return o}function FZn(e){return wu.resetServiceCaches(),e.appAccess=void 0,e.referencedEntities=void 0,e.servicePath=void 0,e.systemName&&(e.systemName.value=void 0),e.relatedEntityChoices.choices=[],e.relatedEntityChoices.entitySetsFlat={},e}async function d4t(e){let t=[],r={appAccess:void 0,referencedEntities:void 0,servicePath:void 0,systemName:{value:void 0},connectPath:{value:void 0},relatedEntityChoices:{choices:[],entitySetsFlat:{}}},n=[],i=UZn(r,n,e?.appPath),s=await ZGt({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:Kn.v4}},kc()!==cn.cli,lr.logger);s.prompts=Ds(s.prompts,()=>!!r.appAccess);let o={odata:[]},a=BZn(r,r.relatedEntityChoices),u=qZn(5,r,s.answers,o),c=kZn(r.relatedEntityChoices,s.answers,r,o);return t.push(i,...s.prompts,VZn(s.answers,r),jZn(s.answers,r),...u,a,c),{questions:t,answers:{application:r,odataQueryResult:o,odataServiceAnswers:s.answers}}}function UZn(e,t,r){return{type:"input",guiType:"folder-browser",name:Ol.appSelection,message:It("prompts.appSelection.message"),default:n=>r??n.appSelection??e.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:It("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===e.appAccess?.app.appRoot)return!0;t.length=0,FZn(e);let i;try{i=await Q5(n)}catch(c){let l=c;return c instanceof Error&&(l=c.message),lr.logger.error(It("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${It("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${It("texts.seeLogForDetails")}`}let s=i.app.services[i.app.mainService??"mainService"];if(!s?.odataVersion?.startsWith("4."))return It("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:s.odataVersion});let o=await c4t(i);if(typeof o=="string")return o;e.appAccess=i,e.specification=o;let{servicePath:a,systemName:u}=await u4t(i.app.appRoot,s);return a&&(e.servicePath=a,t.push(a)),e.systemName&&(e.systemName.value=u),e.connectPath&&(e.connectPath.value=a),!0}}}function kZn(e,t,r,n){let i;return{when:async s=>e.choices.length>0,name:Ol.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:It("prompts.relatedEntitySelection.message"),choices:()=>e.choices,validate:async(s,o)=>{if(e.choices.forEach(a=>{a.disabled||(a.checked=s.some(u=>u.fullPath===a.value.fullPath))}),o&&!o[Ol.skipDataDownload]?.[0]){if(i=await p4t(o,t,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:It("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:vTe.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:It("prompts.relatedEntitySelection.openLogs")})}}function BZn(e,t){let r,n,i;return{when:()=>{if((n!==e.systemName?.value||e.servicePath!==r)&&e.referencedEntities?.listEntity){let o=a4t(e.referencedEntities.listEntity,e.referencedEntities.pageObjectEntities);o&&(t.choices=o.choices,Object.assign(t.entitySetsFlat,o.entitySetsFlat)),r=e.servicePath,n=e.systemName?.value}return t.choices.length>0},name:Ol.toggleSelection,type:"confirm",message:It("prompts.toggleSelection.message"),labelTrue:It("prompts.toggleSelection.labelTrue"),labelFalse:It("prompts.toggleSelection.labelFalse"),default:!1,validate:o=>(o!==i&&(t.choices.forEach(a=>{if(a.disabled)return;let u=a.value;a.checked=o===!1?u.entity.defaultSelected:!1}),i=o),!0)}}function qZn(e,t,r,n){let i=[],s,o=0,a=u=>({when:async()=>{let c=t.referencedEntities?.listEntity.semanticKeys[u],l=!!c?.name&&c.name!=="IsActiveEntity";return l&&u>o&&(o=u),l},name:`entityKeyIdx:${u}`,message:()=>It("prompts.entityKey.message",{keyName:`${t.referencedEntities?.listEntity.semanticKeys[u]?.name} (${t.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:It("prompts.entityKey.hint")},validate:async(c,l)=>{let f=t.referencedEntities?.listEntity.semanticKeys[u];if(f&&delete f.value,f4t.includes(c))return It("prompts.entityKey.validation.invalidKeyValueChars",{chars:f4t.join()});if(c&&f)if(f.type==="Edm.Boolean")try{f.value=JSON.parse(c)}catch{return It("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(f.type)){let d=c.split(",");for(let h of d)if(!MZn.test(h.trim()))return It("prompts.entityKey.validation.invalidGuidValue");f.value=c.trim()}else f.value=c.trim();let p=c.split(",");if(f?.type&&!["Edm.UUID","Edm.Guid"].includes(f.type)){for(let d of p)if(d.split("-").length>2)return f&&delete f.value,It("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!t.relatedEntityChoices?.choices?.length&&u===o&&!l[Ol.skipDataDownload]?.[0]&&t.referencedEntities?.listEntity.semanticKeys[u]?.name){if(s=await p4t(l,r,t),typeof s=="string")return s;n.odata=s.odataQueryResult}return!0}});for(let u=0;u<e;u++)i.push(a(u));return i}function jZn(e,t){return{when:()=>!!e.metadata&&!!t.servicePath,name:Ol.skipDataDownload,type:"checkbox",message:It("prompts.skipDataDownload.message"),guiOptions:{hint:It("prompts.skipDataDownload.hint")},default:!1,choices:[{name:It("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function VZn(e,t){let r;return{when:async()=>t.appAccess&&t.specification&&e?.metadata?(r=await G8t(t.appAccess,t.specification,e.metadata),typeof r=="object"&&(t.referencedEntities=r),!0):!1,name:Ol.updateMainServiceMetadata,type:"confirm",message:It("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:vTe.Severity.error}}}}function h4t(e){let t=[],r=n=>[{name:`${n.entitySetName}/${n.nodeProperty}/source`,type:"list",message:`Source: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))},{name:`${n.entitySetName}/${n.nodeProperty}/target`,type:"list",message:`Target: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))}];return e.forEach(n=>{!n.parentProperty&&n.missingReferentialConstraints?.navPropName&&t.push(...r(n))}),t}var E4t=be(Oy()),_4t=be(Dy());var S4t=be(v4t()),b4t=require("node:path");function T4t(e,t,r){wu.resetExternalServiceCache();let n=iei(e,t),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:It("prompts.valueHelpSelection.message"),choices:()=>n,validate:async o=>{if(!o||o.length===0)return wu.resetExternalServiceCache(),!0;let a=await nei(o,r),u=(0,S4t.default)(i,a);return i.length=0,i.push(...u),await rei(i,r),!0}}],valueHelpData:i}}async function rei(e,t){let r=[],n={transformResponse:s=>typeof s=="string"?JSON.parse(s):s},i=e.map(async s=>{let o=s,[a]=o.path.split(";");wu.externalServiceRequestCache[a]??=[];let l=(0,E4t.convert)((0,_4t.parse)(s.metadata)).entitySets.map(async f=>{let p=f.name;if(wu.externalServiceRequestCache[a].includes(p))return;wu.externalServiceRequestCache[a].push(p);let d=await t.get((0,b4t.join)(o.path,p),n);o.entityData=o.entityData??[],o.entityData?.push({entitySetName:p,items:d.data.value})});await Promise.allSettled(l),o.entityData&&r.push(o)});return await Promise.allSettled(i),r}async function nei(e,t){let r=e.flat();return await t.fetchExternalServices(r)}function iei(e,t){let r=fM(e,t,[]),n={};for(let s of r)if(s.type==="value-list"){if(F8t.includes(s.target))continue;let[o]=s.value.split(";"),a=s.target.split("/").pop();a&&(n[o]??={},n[o][a]??=[],n[o][a].push(s))}else s.type==="code-list"&&(n[s.value]??={},n[s.value]["Code list"]??=[],n[s.value]["Code list"].push(s));let i=[];for(let s of Object.values(n))for(let[o,a]of Object.entries(s)){let u=a.map(c=>{if(c.type==="value-list")return c.target.replace(/\/[^/]*$/,"");if(c.type==="code-list"&&c.collectionPath)return c.collectionPath}).filter(c=>c!==void 0);i.push({name:`${o} (${u.join()})`,value:a})}return i.sort((s,o)=>s.name.localeCompare(o.name))}var lr=class e extends x4t.default{vscode;appWizard;static _logger=d4;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(t,r){super(t,{...r,skipInstall:!0},{unique:"namespace"}),hEe(this.env,!0),this.options.force=!0,this.prompts=new R7.Prompts([{description:It("steps.odataDownloader.description"),name:It("steps.odataDownloader.name")},{description:It("steps.valueHelpSelection.description"),name:It("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(It("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return e._logger}async initializing(){await S_e(),e._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await va.initTelemetrySettings(),va.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:t,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await d4t(this.options?.data),s=await this.prompt(i);if(this.state.entityOData=r.odata,this.state.entityPropertyToEntitySet=t.relatedEntityChoices.entitySetsFlat,this.state.appRootPath=t.appAccess?.getAppRoot(),this.state.mainServicePath=n.servicePath,this.state.mainServiceName=t.appAccess?.app.mainService,this.state.appEntities=t.referencedEntities,this.state.appRootPath){this.state.mockServerConfig=await xx(this.state.appRootPath);let o;this.state.mockServerConfig?.services&&(e.logger.debug(`Mock config: ${JSON.stringify(this.state.mockServerConfig)}`),o=this.state.mockServerConfig.services.find(a=>a.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===this.state.mainServicePath?.replaceAll(/(^\/)|(\/$)/g,""))),this.state.mockDataRootPath=o?.mockdataPath??(0,e0.join)(ai.Webapp,ai.LocalService,ai.Mockdata)}if(this.state.updateMainServiceMetadata=s[Ol.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,s[Ol.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(t,s),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof Va){let{questions:o,valueHelpData:a}=T4t(n.servicePath,n.metadata,n.connectedSystem?.serviceProvider);await this.prompt(o),this.state.valueHelpData=a}}catch(t){e.logger.error(t),this._exitOnError(t)}}async writing(){if(this.state.appRootPath){if(this.state.entityOData&&this.state.entityPropertyToEntitySet&&this.state.appEntities)try{let t=Date.now();va.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,e0.join)(this.state.appRootPath));let r=hTe(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);e.logger.info(It("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,s])=>{this.writeDestinationJSON((0,e0.join)(this.state.mockDataRootPath,`${i}.json`),s)}),this.state.appEntities.hierarchyEntities?.filter(i=>i.missingReferentialConstraints&&n.some(([s])=>s===i.entitySetName))?.forEach(i=>{let s=(0,e0.join)(this.state.mockDataRootPath,`${i.entitySetName}.js`),o=this.destinationPath(s),{navPropName:a,constraints:u}=i.missingReferentialConstraints;if(this.fs.exists(o)){let c=this.fs.read(o),l=H8t(c,a,u);l!==c?(this.writeDestination(s,l),e.logger.info(`Updated referential constraint file: ${i.entitySetName}.js`)):e.logger.debug(`Referential constraint for '${a}' already present in ${i.entitySetName}.js \u2014 skipping`)}else{let c=$8t(a,u);this.writeDestination(s,c),e.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),va.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-t} ms`,numberOfFiles:`${n.length}`})}catch(t){e.logger.error(t),va.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else e.logger.info(It("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let t=Date.now();va.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,e0.join)(this.state.appRootPath,ai.Webapp);if(await M4(this.fs,r,this.state.valueHelpData,this.state.mainServiceName,this.state.mainServicePath),this.state.mockServerConfig){let n={webappPath:r,packageJsonConfig:{skip:!0},ui5MockYamlConfig:{overwrite:!0}};n.ui5MockYamlConfig&&this.state.mainServiceName&&(n.ui5MockYamlConfig.resolveExternalServiceReferences={[this.state.mainServiceName]:!0},await m4(this.state.appRootPath,n,this.fs))}va.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_DATA_FILES_END",{writeFileDuration:`${Date.now()-t} ms`,numberOfExternalServices:`${this.state.valueHelpData.length}`})}catch(t){e.logger.error(t),va.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else e.logger.info(It("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let t=(0,e0.join)(this.state.appRootPath,ai.Webapp,ai.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(t,(0,A4t.default)(this.state.mainServiceMetadata,{indent:4}))}}}async _promptMissingReferentialConstraints(t,r){let n=t.referencedEntities?.listEntity.entitySetName,i=new Set([...n?[n]:[],...(r[Ol.relatedEntitySelection]??[]).map(o=>o.entity.entitySetName)]),s=t.referencedEntities?.hierarchyEntities?.filter(o=>!o.parentProperty&&o.missingReferentialConstraints&&i.has(o.entitySetName))??[];if(s.length>0){this.prompts.splice(1,0,[{name:It("steps.addConstraints.name"),description:It("steps.addConstraints.description")}]);let o=h4t(s),a=await this.prompt(o),u=[t.referencedEntities?.listEntity,...t.referencedEntities?.pageObjectEntities??[]];s.forEach(c=>{let l=a[`${c.entitySetName}/${c.nodeProperty}/source`],f=a[`${c.entitySetName}/${c.nodeProperty}/target`];if(l&&f){c.missingReferentialConstraints.constraints=[{sourceProperty:l,targetProperty:f}],c.parentProperty=l;let p=u.find(d=>d?.entitySetName===c.entitySetName)?.entityType;c.parentPropertyType=p?.entityProperties.find(d=>d.name===l)?.type??"Edm.String"}})}}_exitOnError(t){throw kc()!==cn.cli&&this.appWizard?.showError(t,R7.MessageType.notification),new Error(t)}_configureLogging(t,r,n){let i=new p4(this.rootGeneratorName(),this.log,t,r,n);return i.info(It("info.loggingInitialised",{logLevel:i.getLogLevel()})),i}};
|
|
734
734
|
/*! Bundled license information:
|
|
735
735
|
|
|
736
736
|
mime-db/index.js:
|