@sap-ux/generator-odata-downloader 0.3.23 → 0.3.24

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.
@@ -2270,7 +2270,7 @@ PGHZoN9jcvvvWDLUGtJkEotMgdFpEA2XWR83H4fVFVc=
2270
2270
  ABAP Package: ${s?s.Package:r.package}`);let a=this.createConfig(r.transport,n,i),c=this.getAbapFrontendUrl();try{let u=await this.updateRepoRequest(!!s,r.name,o,a);if(u?.headers?.["sap-message"]&&ZSe({msg:u.headers["sap-message"],log:this.log,host:c,isDest:this.isDest}),n)e0e({error:t0e(u?.data),log:this.log,host:c,isDest:this.isDest},!1);else{let l="/sap/bc/ui5_ui5"+(r.name.startsWith("/")?"":"/sap/")+r.name.toLowerCase(),p=this.defaults.params?.["sap-client"]?"?sap-client="+this.defaults.params["sap-client"]:"";this.log.info(`App available at ${c}${l}${p}`)}return s&&s.Package!==r.package&&this.log.warn(`Cannot change package assignment from ${s.Package} to ${r.package}.`),u}catch(u){throw Cq({error:u,host:c,log:this.log,isDest:this.isDest}),u}}async undeploy({bsp:e,testMode:r=!1}){let n=this.createConfig(e.transport,r),i=this.getAbapFrontendUrl(),s=await this.getInfo(e.name);try{if(s){let o=await this.deleteRepoRequest(e.name,n);return o?.headers?.["sap-message"]&&ZSe({msg:o.headers["sap-message"],log:this.log,host:i,isDest:this.isDest}),o}else{this.log.warn(`Application ${e.name} not found, nothing to undeploy.`);return}}catch(o){throw Cq({error:o,host:i,log:this.log}),o}}getAbapFrontendUrl(){let e=new URL(this.publicUrl);return gPn.forEach((r,n)=>{e.hostname=e.hostname.replace(n,r)}),`${e.protocol}//${e.host}`}createConfig(e,r,n){let i={"Content-Type":"application/atom+xml",type:"entry",charset:"UTF8"},s={CodePage:"'UTF8'",CondenseMessagesInHttpResponseHeader:"X",format:"json"};return e&&(s.TransportRequest=e),r&&(s.TestMode=!0),n!==void 0&&(s.SafeMode=n),{headers:i,params:s,maxBodyLength:1/0,maxContentLength:1/0}}createPayload(e,r,n,i){let s=e.toString("base64"),o=new Date().toISOString(),a=Mgt(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>${Mgt(n)}</d:Description> <d:ZipArchive>${s}</d:ZipArchive> <d:Info/> </m:properties> </content></entry>`}async updateRepoRequest(e,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=e;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(e,r,n,i,s+1)}else{if(i?.params?.TestMode)return o.response;throw o}}}async deleteRepoRequest(e,r,n=1){try{return n===2&&this.log.warn("Warning: retry undeploy to handle a backend rejection..."),await this.delete(`/Repositories('${encodeURIComponent(e)}')`,r)}catch(i){if(i?.response?.status===400){if(n>=2)throw i;return this.deleteRepoRequest(e,r,n+1)}else throw i}}};var Fgt=require("node:fs"),EW=require("node:url");var qgt=Pe(A0e(),1),C0e;(function(t){t.ON_PREMISE="onPremise",t.CLOUD_READY="cloudReady"})(C0e||(C0e={}));function P0e(t){return typeof t!="string"?`apps/${t.reference}/appVariants/${t.id}/`:t}function vPn(t){return t.BYTES_PER_ELEMENT!==void 0}var kgt=t=>decodeURIComponent(t.toString());function O0e(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}var vW="/dta_folder/",SR=class extends Il{static PATH="/sap/bc/lrep";log;async getCsrfToken(){try{return await this.get("/actions/getcsrftoken/")}catch(e){throw od(e)&&this.tryLogResponse(e.response),e}}async mergeAppDescriptorVariant(e,r){let n="/appdescr_variant_preview/",i=new EW.URLSearchParams(this.defaults?.params);r&&i.append("workspacePath",r);try{let s=await this.put(n,e,{paramsSerializer:kgt,params:i,headers:{"Content-Type":"application/zip"}});return JSON.parse(s.data)}catch(s){throw od(s)&&this.tryLogResponse(s.response),s}}async isExistingVariant(e,r="CUSTOMER_BASE"){try{let n=await this.get(vW,{params:{name:P0e(e),layer:r,timestamp:Date.now()}});return this.tryLogResponse(n),n}catch(n){if(od(n)&&(this.tryLogResponse(n.response),n.response?.status===404))return n.response;throw n}}async deploy(e,r){let n=vPn(e)?e:(0,Fgt.readFileSync)(e),i=await this.isExistingVariant(r.namespace),s={name:P0e(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:vW,data:n,params:s,headers:{"Content-Type":"application/octet-stream"}});return this.tryLogResponse(o,"Deployment successful."),o}catch(o){throw Cq({error:o,log:this.log}),o}}async undeploy(e){if((await this.isExistingVariant(e.namespace)).status!==200)throw new Error("Undeploy failed because the given project does not exist.");let n={name:P0e(e.namespace),layer:e.layer??"CUSTOMER_BASE"};e.transport&&(n.changelist=e.transport);try{let i=await this.delete(vW,{params:n});return this.tryLogResponse(i,"Undeployment successful."),i}catch(i){throw this.log.error("Undeployment failed"),this.log.debug(i),od(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(e,r){try{let n=await this.get(`/flex/apps/${encodeURIComponent(e)}/adaptations/?version=${encodeURIComponent(r)}`,{transformResponse:O0e});return this.tryLogResponse(n,`Successfully fetched adaptations for app ${e}`),n.data}catch(n){throw od(n)&&this.tryLogResponse(n.response),n}}async getKeyUserData(e,r){let n=new EW.URLSearchParams(this.defaults?.params);n.append("adaptationId",encodeURIComponent(r));try{let i=await this.get(`/flex/keyuserdata/${e}`,{params:n,paramsSerializer:kgt,transformResponse:O0e});return this.tryLogResponse(i,`Successfully fetched key user data for component ${e} and ${r} adaptation.`),i.data}catch(i){throw od(i)&&this.tryLogResponse(i.response),i}}async getFlexVersions(e,r=2,n="EN"){try{let i=new EW.URLSearchParams(this.defaults?.params);i.append("sap-language",n),i.append("limit",r.toString());let s=await this.get(`/flex/versions/${encodeURIComponent(e)}`,{params:i,transformResponse:O0e});return this.tryLogResponse(s,`Successfully fetched flex versions for component ${e}`),s.data}catch(i){throw od(i)&&this.tryLogResponse(i.response),i}}async getSystemInfo(e="EN",r,n){try{let i={"sap-language":e};r&&(i.package=r),n&&(i["sap-app-id"]=n);let s=await this.get(`${vW}system_info`,{params:i,paramsSerializer:o=>qgt.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(e,r){try{let n=e.data?JSON.parse(e.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(e){let r=e.severity==="Error"?Mc.Error:Mc.Info;this.log.log({level:r,message:e.text}),(e.details??[]).forEach(n=>{this.log.log({level:r,message:n})})}};var l_t=require("node:path/posix");var bW=class{adtSchema;getAdtCollection(e){if(!this.adtSchema)return null;let r=this.serializeAdtCategory(e);return this.adtSchema[r]}updateSchemaData(e){if(e){this.adtSchema={};let r=e.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(e){return`${e.scheme},${e.term}`}};var Ugt=":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",EPn=Ugt+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",bPn="["+Ugt+"]["+EPn+"]*",SPn=new RegExp("^"+bPn+"$");function SW(t,e){let r=[],n=e.exec(t);for(;n;){let i=[];i.startIndex=e.lastIndex-n[0].length;let s=n.length;for(let o=0;o<s;o++)i.push(n[o]);r.push(i),n=e.exec(t)}return r}var R0e=function(t){let e=SPn.exec(t);return!(e===null||typeof e>"u")};function jgt(t){return typeof t<"u"}var Vq=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],TW=["__proto__","constructor","prototype"];var TPn={allowBooleanAttributes:!1,unpairedTags:[]};function AW(t,e){e=Object.assign({},TPn,e);let r=[],n=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=$gt(t,s),s.err)return s}else if(t[s]==="<"){let o=s;if(s++,t[s]==="!"){s=Vgt(t,s);continue}else{let a=!1;t[s]==="/"&&(a=!0,s++);let c="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
2271
2271
  `&&t[s]!=="\r";s++)c+=t[s];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),s--),!NPn(c)){let p;return c.trim().length===0?p="Invalid space after '<'.":p="Tag '"+c+"' is an invalid name.",io("InvalidTag",p,Mu(t,s))}let u=xPn(t,s);if(u===!1)return io("InvalidAttr","Attributes for '"+c+"' have open quote.",Mu(t,s));let l=u.value;if(s=u.index,l[l.length-1]==="/"){let p=s-l.length;l=l.substring(0,l.length-1);let f=Ggt(l,e);if(f===!0)n=!0;else return io(f.err.code,f.err.msg,Mu(t,p+f.err.line))}else if(a)if(u.tagClosed){if(l.trim().length>0)return io("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Mu(t,o));if(r.length===0)return io("InvalidTag","Closing tag '"+c+"' has not been opened.",Mu(t,o));{let p=r.pop();if(c!==p.tagName){let f=Mu(t,p.tagStartPos);return io("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+c+"'.",Mu(t,o))}r.length==0&&(i=!0)}}else return io("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Mu(t,s));else{let p=Ggt(l,e);if(p!==!0)return io(p.err.code,p.err.msg,Mu(t,s-l.length+p.err.line));if(i===!0)return io("InvalidXml","Multiple possible root nodes found.",Mu(t,s));e.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:o}),n=!0}for(s++;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="!"){s++,s=Vgt(t,s);continue}else if(t[s+1]==="?"){if(s=$gt(t,++s),s.err)return s}else break;else if(t[s]==="&"){let p=CPn(t,s);if(p==-1)return io("InvalidChar","char '&' is not expected.",Mu(t,s));s=p}else if(i===!0&&!Bgt(t[s]))return io("InvalidXml","Extra text at the end",Mu(t,s));t[s]==="<"&&s--}}else{if(Bgt(t[s]))continue;return io("InvalidChar","char '"+t[s]+"' is not expected.",Mu(t,s))}if(n){if(r.length==1)return io("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Mu(t,r[0].tagStartPos));if(r.length>0)return io("InvalidXml","Invalid '"+JSON.stringify(r.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return io("InvalidXml","Start tag expected.",1);return!0}function Bgt(t){return t===" "||t===" "||t===`
2272
2272
  `||t==="\r"}function $gt(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return io("InvalidXml","XML declaration allowed only at the start of the document.",Mu(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Vgt(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var APn='"',wPn="'";function xPn(t,e){let r="",n="",i=!1;for(;e<t.length;e++){if(t[e]===APn||t[e]===wPn)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){i=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:i}}var PPn=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Ggt(t,e){let r=SW(t,PPn),n={};for(let i=0;i<r.length;i++){if(r[i][1].length===0)return io("InvalidAttr","Attribute '"+r[i][2]+"' has no space in starting.",Gq(r[i]));if(r[i][3]!==void 0&&r[i][4]===void 0)return io("InvalidAttr","Attribute '"+r[i][2]+"' is without value.",Gq(r[i]));if(r[i][3]===void 0&&!e.allowBooleanAttributes)return io("InvalidAttr","boolean attribute '"+r[i][2]+"' is not allowed.",Gq(r[i]));let s=r[i][2];if(!RPn(s))return io("InvalidAttr","Attribute '"+s+"' is an invalid name.",Gq(r[i]));if(!Object.prototype.hasOwnProperty.call(n,s))n[s]=1;else return io("InvalidAttr","Attribute '"+s+"' is repeated.",Gq(r[i]))}return!0}function OPn(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function CPn(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,OPn(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function io(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function RPn(t){return R0e(t)}function NPn(t){return R0e(t)}function Mu(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function Gq(t){return t.startIndex+t[1].length}var Hgt={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"},zgt={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"},Wgt={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"},Kgt={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"},Ygt={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"},Xgt={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:"<"},Jgt={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"},Qgt={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"},Zgt={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"},eyt={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"},wW={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"},tyt={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"},ryt={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"},DPn={...Hgt,...zgt,...Wgt,...Kgt,...Ygt,...Xgt,...Jgt,...Qgt,...Zgt,...eyt,...wW,...tyt,...ryt},Hq={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},N0e={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 IPn=new Set("!?\\\\/[]$%{}^&*()<>|+");function nyt(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(let e of t)if(IPn.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function D0e(...t){let e=Object.create(null);for(let r of t)if(r)for(let n of Object.keys(r)){let i=r[n];if(typeof i=="string")e[n]=i;else if(i&&typeof i=="object"&&i.val!==void 0){let s=i.val;typeof s=="string"&&(e[n]=s)}}return e}var sw="external",xW="base",I0e="all";function LPn(t){return!t||t===sw?new Set([sw]):t===I0e?new Set([I0e]):t===xW?new Set([xW]):Array.isArray(t)?new Set(t):new Set([sw])}var Ul=Object.freeze({allow:0,leave:1,remove:2,throw:3}),MPn=new Set([9,10,13]);function kPn(t){if(!t)return{xmlVersion:1,onLevel:Ul.allow,nullLevel:Ul.remove};let e=t.xmlVersion===1.1?1.1:1,r=Ul[t.onNCR]??Ul.allow,n=Ul[t.nullNCR]??Ul.remove,i=Math.max(n,Ul.remove);return{xmlVersion:e,onLevel:r,nullLevel:i}}var TR=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck=="function"?e.postCheck:n=>n,this._limitTiers=LPn(this._limit.applyLimitsTo??sw),this._numericAllowed=e.numericAllowed??!0,this._baseMap=D0e(Hq,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let r=kPn(e.ncr);this._ncrXmlVersion=r.xmlVersion,this._ncrOnLevel=r.onLevel,this._ncrNullLevel=r.nullLevel}setExternalEntities(e){if(e)for(let r of Object.keys(e))nyt(r);this._externalMap=D0e(e)}addExternalEntity(e,r){nyt(e),typeof r=="string"&&r.indexOf("&")===-1&&(this._externalMap[e]=r)}addInputEntities(e){this._totalExpansions=0,this._expandedLength=0,this._inputMap=D0e(e)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!="string"||e.length===0)return e;let r=e,n=[],i=e.length,s=0,o=0,a=this._maxTotalExpansions>0,c=this._maxExpandedLength>0,u=a||c;for(;o<i;){if(e.charCodeAt(o)!==38){o++;continue}let p=o+1;for(;p<i&&e.charCodeAt(p)!==59&&p-o<=32;)p++;if(p>=i||e.charCodeAt(p)!==59){o++;continue}let f=e.slice(o+1,p);if(f.length===0){o++;continue}let h,d;if(this._removeSet.has(f))h="",d===void 0&&(d=sw);else if(this._leaveSet.has(f)){o++;continue}else if(f.charCodeAt(0)===35){let m=this._resolveNCR(f);if(m===void 0){o++;continue}h=m,d=xW}else{let m=this._resolveName(f);h=m?.value,d=m?.tier}if(h===void 0){o++;continue}if(o>s&&n.push(e.slice(s,o)),n.push(h),s=p+1,o=s,u&&this._tierCounts(d)){if(a&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(c){let m=h.length-(f.length+2);if(m>0&&(this._expandedLength+=m,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}s<i&&n.push(e.slice(s));let l=n.length===0?e:n.join("");return this._postCheck(l,r)}_tierCounts(e){return this._limitTiers.has(I0e)?!0:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return{value:this._inputMap[e],tier:sw};if(e in this._externalMap)return{value:this._externalMap[e],tier:sw};if(e in this._baseMap)return{value:this._baseMap[e],tier:xW}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!MPn.has(e)?Ul.remove:-1}_applyNCRAction(e,r,n){switch(e){case Ul.allow:return String.fromCodePoint(n);case Ul.remove:return"";case Ul.leave:return;case Ul.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${r}; (U+${n.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(n)}}_resolveNCR(e){let r=e.charCodeAt(1),n;if(r===120||r===88?n=parseInt(e.slice(2),16):n=parseInt(e.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let i=this._classifyNCR(n);if(!this._numericAllowed&&i<Ul.remove)return;let s=i===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,i);return this._applyNCRAction(s,e,n)}};var iyt=t=>Vq.includes(t)?"__"+t:t,FPn={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(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:iyt};function qPn(t,e){if(typeof t!="string")return;let r=t.toLowerCase();if(Vq.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(TW.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function syt(t,e){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null,appliesTo:t.appliesTo??"all"}:syt(!0)}var oyt=function(t){let e=Object.assign({},FPn,t),r=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:n,name:i}of r)n&&qPn(n,i);return e.onDangerousProperty===null&&(e.onDangerousProperty=iyt),e.processEntities=syt(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(n=>typeof n=="string"&&n.startsWith("*.")?".."+n.substring(2):n)),e};var PW;typeof Symbol!="function"?PW="@@xmlMetadata":PW=Symbol("XML Node Metadata");var jl=class{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e,r){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),r!==void 0&&(this.child[this.child.length-1][PW]={startIndex:r})}static getMetaDataSymbol(){return PW}};var ayt=":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",UPn=ayt+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",cyt=":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}",jPn=cyt+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",uyt=(t,e,r="")=>{let n=t.replace(":",""),i=e.replace(":",""),s=`[${n}][${i}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,r),ncName:new RegExp(`^${s}$`,r),qName:new RegExp(`^${s}(?::${s})?$`,r),nmToken:new RegExp(`^[${e}]+$`,r),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,r)}},BPn=uyt(ayt,UPn),$Pn=uyt(cyt,jPn,"u"),VPn=(t="1.0")=>t==="1.1"?$Pn:BPn;var L0e=(t,{xmlVersion:e="1.0"}={})=>VPn(e).qName.test(t);var Wq=class{constructor(e,r){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=r||1}setXmlVersion(e=1){this.xmlVersion=e}readDocType(e,r){let n=Object.create(null),i=0;if(e[r+3]==="O"&&e[r+4]==="C"&&e[r+5]==="T"&&e[r+6]==="Y"&&e[r+7]==="P"&&e[r+8]==="E"){r=r+9;let s=1,o=!1,a=!1,c="";for(;r<e.length;r++)if(e[r]==="<"&&!a){if(o&&ow(e,"!ENTITY",r)){r+=7;let u,l;if([u,l,r]=this.readEntityExp(e,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[u]=l,i++}}else if(o&&ow(e,"!ELEMENT",r)){r+=8;let{index:u}=this.readElementExp(e,r+1);r=u}else if(o&&ow(e,"!ATTLIST",r))r+=8;else if(o&&ow(e,"!NOTATION",r)){r+=9;let{index:u}=this.readNotationExp(e,r+1,this.suppressValidationErr);r=u}else if(ow(e,"!--",r))a=!0;else throw new Error("Invalid DOCTYPE");s++,c=""}else if(e[r]===">"){if(a?e[r-1]==="-"&&e[r-2]==="-"&&(a=!1,s--):s--,s===0)break}else e[r]==="["?o=!0:c+=e[r];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(e,r){r=Bl(e,r);let n=r;for(;r<e.length&&!/\s/.test(e[r])&&e[r]!=='"'&&e[r]!=="'";)r++;let i=e.substring(n,r);if(zq(i,{xmlVersion:this.xmlVersion}),r=Bl(e,r),!this.suppressValidationErr){if(e.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[r]==="%")throw new Error("Parameter entities are not supported")}let s="";if([r,s]=this.readIdentifierVal(e,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(e,r){r=Bl(e,r);let n=r;for(;r<e.length&&!/\s/.test(e[r]);)r++;let i=e.substring(n,r);!this.suppressValidationErr&&zq(i,{xmlVersion:this.xmlVersion}),r=Bl(e,r);let s=e.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=Bl(e,r);let o=null,a=null;if(s==="PUBLIC")[r,o]=this.readIdentifierVal(e,r,"publicIdentifier"),r=Bl(e,r),(e[r]==='"'||e[r]==="'")&&([r,a]=this.readIdentifierVal(e,r,"systemIdentifier"));else if(s==="SYSTEM"&&([r,a]=this.readIdentifierVal(e,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(e,r,n){let i="",s=e[r];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);r++;let o=r;for(;r<e.length&&e[r]!==s;)r++;if(i=e.substring(o,r),e[r]!==s)throw new Error(`Unterminated ${n} value`);return r++,[r,i]}readElementExp(e,r){r=Bl(e,r);let n=r;for(;r<e.length&&!/\s/.test(e[r]);)r++;let i=e.substring(n,r);if(!this.suppressValidationErr&&!L0e(i,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${i}"`);r=Bl(e,r);let s="";if(e[r]==="E"&&ow(e,"MPTY",r))r+=4;else if(e[r]==="A"&&ow(e,"NY",r))r+=2;else if(e[r]==="("){r++;let o=r;for(;r<e.length&&e[r]!==")";)r++;if(s=e.substring(o,r),e[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[r]}"`);return{elementName:i,contentModel:s.trim(),index:r}}readAttlistExp(e,r){r=Bl(e,r);let n=r;for(;r<e.length&&!/\s/.test(e[r]);)r++;let i=e.substring(n,r);for(zq(i,{xmlVersion:this.xmlVersion}),r=Bl(e,r),n=r;r<e.length&&!/\s/.test(e[r]);)r++;let s=e.substring(n,r);if(!zq(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${s}"`);r=Bl(e,r);let o="";if(e.substring(r,r+8).toUpperCase()==="NOTATION"){if(o="NOTATION",r+=8,r=Bl(e,r),e[r]!=="(")throw new Error(`Expected '(', found "${e[r]}"`);r++;let c=[];for(;r<e.length&&e[r]!==")";){let u=r;for(;r<e.length&&e[r]!=="|"&&e[r]!==")";)r++;let l=e.substring(u,r);if(l=l.trim(),!zq(l,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${l}"`);c.push(l),e[r]==="|"&&(r++,r=Bl(e,r))}if(e[r]!==")")throw new Error("Unterminated list of notations");r++,o+=" ("+c.join("|")+")"}else{let c=r;for(;r<e.length&&!/\s/.test(e[r]);)r++;o+=e.substring(c,r);let u=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!u.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}r=Bl(e,r);let a="";return e.substring(r,r+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",r+=8):e.substring(r,r+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",r+=7):[r,a]=this.readIdentifierVal(e,r,"ATTLIST"),{elementName:i,attributeName:s,attributeType:o,defaultValue:a,index:r}}},Bl=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function ow(t,e,r){for(let n=0;n<e.length;n++)if(e[n]!==t[r+n+1])return!1;return!0}function zq(t,e){if(L0e(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}var GPn=/^[-+]?0x[a-fA-F0-9]+$/,HPn=/^0b[01]+$/,zPn=/^0o[0-7]+$/,WPn=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,KPn={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function k0e(t,e={}){if(e=Object.assign({},KPn,e),!t||typeof t!="string")return t;let r=t.trim();if(r.length===0)return t;if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(r==="0")return 0;if(e.hex&&GPn.test(r))return M0e(r,16);if(e.binary&&HPn.test(r))return M0e(r,2);if(e.octal&&zPn.test(r))return M0e(r,8);if(isFinite(r)){if(r.includes("e")||r.includes("E"))return XPn(t,r,e);{let n=WPn.exec(r);if(n){let i=n[1]||"",s=n[2],o=JPn(n[3]),a=i?t[s.length+1]===".":t[s.length]===".";if(!e.leadingZeros&&(s.length>1||s.length===1&&!a))return t;{let c=Number(r),u=String(c);if(c===0)return c;if(u.search(/[eE]/)!==-1)return e.eNotation?c:t;if(r.indexOf(".")!==-1)return u==="0"||u===o||u===`${i}${o}`?c:t;let l=s?o:r;return s?l===u||i+l===u?c:t:l===u||l===i+u?c:t}}else return t}}else return QPn(t,Number(r),e)}var YPn=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function XPn(t,e,r){if(!r.eNotation)return t;let n=e.match(YPn);if(n){let i=n[1]||"",s=n[3].indexOf("e")===-1?"E":"e",o=n[2],a=i?t[o.length+1]===s:t[o.length]===s;return o.length>1&&a?t:o.length===1&&(n[3].startsWith(`.${s}`)||n[3][0]===s)?Number(e):o.length>0?r.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):t:Number(e)}else return t}function JPn(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function M0e(t,e){let r=t.trim();if((e===2||e===8)&&(t=r.substring(2)),parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function QPn(t,e,r){let n=e===1/0;switch(r.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return n?"Infinity":"-Infinity";default:return t}}function F0e(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(let r of t)if(typeof r=="string"&&e===r||r instanceof RegExp&&r.test(e))return!0}:()=>!1}var aw=class{constructor(e,r={},n){this.pattern=e,this.separator=r.separator||".",this.segments=this._parse(e),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(e){let r=[],n=0,i="";for(;n<e.length;)e[n]===this.separator?n+1<e.length&&e[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+=e[n],n++);return i.trim()&&r.push(this._parseSegment(i.trim())),r}_parseSegment(e){let r={type:"tag"},n=null,i=e,s=e.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: ${e}`)}let c,u=null;if(a.includes(":")){let l=a.lastIndexOf(":"),p=a.substring(0,l).trim(),f=a.substring(l+1).trim();["first","last","odd","even"].includes(f)||/^nth\(\d+\)$/.test(f)?(c=p,u=f):c=a}else c=a;if(!c)throw new Error(`Invalid segment pattern: ${e}`);if(r.tag=c,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(u){let l=u.match(/^nth\((\d+)\)$/);l?(r.position="nth",r.positionValue=parseInt(l[1],10)):r.position=u}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 AR=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard())return this._deepWildcards.push(e),this;let r=e.length,i=e.segments[e.segments.length-1]?.tag;if(!i||i==="*")this._wildcardByDepth.has(r)||this._wildcardByDepth.set(r,[]),this._wildcardByDepth.get(r).push(e);else{let s=`${r}:${i}`;this._byDepthAndTag.has(s)||this._byDepthAndTag.set(s,[]),this._byDepthAndTag.get(s).push(e)}return this}addAll(e){for(let r of e)this.add(r);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let r=e.getDepth(),n=e.getCurrentTag(),i=`${r}:${n}`,s=this._byDepthAndTag.get(i);if(s){for(let a=0;a<s.length;a++)if(e.matches(s[a]))return s[a]}let o=this._wildcardByDepth.get(r);if(o){for(let a=0;a<o.length;a++)if(e.matches(o[a]))return o[a]}for(let a=0;a<this._deepWildcards.length;a++)if(e.matches(this._deepWildcards[a]))return this._deepWildcards[a];return null}};var q0e=class{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let r=this._matcher.path;if(r.length!==0)return r[r.length-1].values?.[e]}hasAttr(e){let r=this._matcher.path;if(r.length===0)return!1;let n=r[r.length-1];return n.values!==void 0&&e in n.values}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,r=!0){return this._matcher.toString(e,r)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},wR=class{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new q0e(this)}push(e,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}:${e}`:e,a=s.get(o)||0,c=0;for(let l of s.values())c+=l;s.set(o,a+1);let u={tag:e,position:c,counter:a};n!=null&&(u.namespace=n),r!=null&&(u.values=r),this.path.push(u)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){let r=this.path[this.path.length-1];e!=null&&(r.values=e)}}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(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;let r=this.path[this.path.length-1];return r.values!==void 0&&e 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(e,r=!0){let n=e||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(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){let r=e.segments;return r.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(r):this._matchSimple(r)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let r=0;r<e.length;r++)if(!this._matchSegment(e[r],this.path[r],r===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let r=this.path.length-1,n=e.length-1;for(;n>=0&&r>=0;){let i=e[n];if(i.type==="deep-wildcard"){if(n--,n<0)return!0;let s=e[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(e,r,n){if(e.tag!=="*"&&e.tag!==r.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==r.namespace||e.attrName!==void 0&&(!n||!r.values||!(e.attrName in r.values)||e.attrValue!==void 0&&String(r.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!n)return!1;let i=r.counter??0;if(e.position==="first"&&i!==0)return!1;if(e.position==="odd"&&i%2!==1)return!1;if(e.position==="even"&&i%2!==0)return!1;if(e.position==="nth"&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(r=>({...r})),this.siblingStacks=e.siblingStacks.map(r=>new Map(r))}readOnly(){return this._view}};function ZPn(t,e){if(!t)return{};let r=e.attributesGroupName?t[e.attributesGroupName]:t;if(!r)return{};let n={};for(let i in r)if(i.startsWith(e.attributeNamePrefix)){let s=i.substring(e.attributeNamePrefix.length);n[s]=r[i]}else n[i]=r[i];return n}function eOn(t){if(!t||typeof t!="string")return;let e=t.indexOf(":");if(e!==-1&&e>0){let r=t.substring(0,e);if(r!=="xmlns")return r}}var Kq=class{constructor(e,r){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=sOn,this.parseTextData=tOn,this.resolveNameSpace=rOn,this.buildAttributesMap=iOn,this.isItStopNode=uOn,this.replaceEntitiesValue=aOn,this.readStopNodeData=fOn,this.saveTextToParentTag=cOn,this.addChild=oOn,this.ignoreAttributesFn=F0e(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let n={...Hq};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?n=this.options.htmlEntities:this.options.htmlEntities===!0&&(n={...N0e,...wW}),this.entityDecoder=new TR({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 wR,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new AR;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 aw(o)):o instanceof aw&&this.stopNodeExpressionsSet.add(o)}this.stopNodeExpressionsSet.seal()}}};function tOn(t,e,r,n,i,s,o){let a=this.options;if(t!==void 0&&(a.trimValues&&!n&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,r));let c=a.jPath?r.toString():r,u=a.tagValueProcessor(e,t,c,i,s);return u==null?t:typeof u!=typeof t||u!==t?u:a.trimValues||t.trim()===t?B0e(t,a.parseTagValue,a.numberParseOptions):t}}function rOn(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var nOn=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function iOn(t,e,r,n=!1){let i=this.options;if(n===!0||i.ignoreAttributes!==!0&&typeof t=="string"){let s=SW(t,nOn),o=s.length,a={},c=new Array(o),u=!1,l={};for(let h=0;h<o;h++){let d=this.resolveNameSpace(s[h][1]),m=s[h][4];if(d.length&&m!==void 0){let _=m;i.trimValues&&(_=_.trim()),_=this.replaceEntitiesValue(_,r,this.readonlyMatcher),c[h]=_,l[d]=_,u=!0}}u&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(l);let p=i.jPath?e.toString():this.readonlyMatcher,f=!1;for(let h=0;h<o;h++){let d=this.resolveNameSpace(s[h][1]);if(this.ignoreAttributesFn(d,p))continue;let m=i.attributeNamePrefix+d;if(d.length)if(i.transformAttributeName&&(m=i.transformAttributeName(m)),m=lyt(m,i),s[h][4]!==void 0){let _=c[h],b=i.attributeValueProcessor(d,_,p);b==null?a[m]=_:typeof b!=typeof _||b!==_?a[m]=b:a[m]=B0e(_,i.parseAttributeValue,i.numberParseOptions),f=!0}else i.allowBooleanAttributes&&(a[m]=!0,f=!0)}if(!f)return;if(i.attributesGroupName&&!i.preserveOrder){let h={};return h[i.attributesGroupName]=a,h}return a}}var sOn=function(t){t=t.replace(/\r\n?/g,`
2273
- `);let e=new jl("!xml"),r=e,n="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let i=this.options,s=new Wq(i.processEntities),o=t.length;for(let a=0;a<o;a++)if(t[a]==="<"){let u=t.charCodeAt(a+1);if(u===47){let l=xR(t,">",a,"Closing Tag is not closed."),p=t.substring(a+2,l).trim();if(i.removeNSPrefix){let h=p.indexOf(":");h!==-1&&(p=p.substr(h+1))}p=U0e(i.transformTagName,p,"",i).tagName,r&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher));let f=this.matcher.getCurrentTag();if(p&&i.unpairedTagsSet.has(p))throw new Error(`Unpaired tag can not be used as closing tag: </${p}>`);f&&i.unpairedTagsSet.has(f)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=this.tagsNodeStack.pop(),n="",a=l}else if(u===63){let l=j0e(t,a,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let p=this.buildAttributesMap(l.tagExp,this.matcher,l.tagName,!0);if(p){let f=p[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(f)||1),s.setXmlVersion(Number(f)||1)}if(!(i.ignoreDeclaration&&l.tagName==="?xml"||i.ignorePiTags)){let f=new jl(l.tagName);f.add(i.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&i.ignoreAttributes!==!0&&(f[":@"]=p),this.addChild(r,f,this.readonlyMatcher,a)}a=l.closeIndex+1}else if(u===33&&t.charCodeAt(a+2)===45&&t.charCodeAt(a+3)===45){let l=xR(t,"-->",a+4,"Comment is not closed.");if(i.commentPropName){let p=t.substring(a+4,l-2);n=this.saveTextToParentTag(n,r,this.readonlyMatcher),r.add(i.commentPropName,[{[i.textNodeName]:p}])}a=l}else if(u===33&&t.charCodeAt(a+2)===68){let l=s.readDocType(t,a);this.entityDecoder.addInputEntities(l.entities),a=l.i}else if(u===33&&t.charCodeAt(a+2)===91){let l=xR(t,"]]>",a,"CDATA is not closed.")-2,p=t.substring(a+9,l);n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let f=this.parseTextData(p,r.tagname,this.readonlyMatcher,!0,!1,!0,!0);f==null&&(f=""),i.cdataPropName?r.add(i.cdataPropName,[{[i.textNodeName]:p}]):r.add(i.textNodeName,f),a=l+2}else{let l=j0e(t,a,i.removeNSPrefix);if(!l){let R=t.substring(Math.max(0,a-50),Math.min(o,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${R}"`)}let p=l.tagName,f=l.rawTagName,h=l.tagExp,d=l.attrExpPresent,m=l.closeIndex;if({tagName:p,tagExp:h}=U0e(i.transformTagName,p,h,i),i.strictReservedNames&&(p===i.commentPropName||p===i.cdataPropName||p===i.textNodeName||p===i.attributesGroupName))throw new Error(`Invalid tag name: ${p}`);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 b=!1;h.length>0&&h.lastIndexOf("/")===h.length-1&&(b=!0,p[p.length-1]==="/"?(p=p.substr(0,p.length-1),h=p):h=h.substr(0,h.length-1),d=p!==h);let T=null,S={},A;A=eOn(f),p!==e.tagname&&this.matcher.push(p,{},A),p!==h&&d&&(T=this.buildAttributesMap(h,this.matcher,p),T&&(S=ZPn(T,i))),p!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let x=a;if(this.isCurrentNodeStopNode){let R="";if(b)a=l.closeIndex;else if(i.unpairedTagsSet.has(p))a=l.closeIndex;else{let O=this.readStopNodeData(t,f,m+1);if(!O)throw new Error(`Unexpected end of ${f}`);a=O.i,R=O.tagContent}let M=new jl(p);T&&(M[":@"]=T),M.add(i.textNodeName,R),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(r,M,this.readonlyMatcher,x)}else{if(b){({tagName:p,tagExp:h}=U0e(i.transformTagName,p,h,i));let R=new jl(p);T&&(R[":@"]=T),this.addChild(r,R,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(i.unpairedTagsSet.has(p)){let R=new jl(p);T&&(R[":@"]=T),this.addChild(r,R,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=!1,a=l.closeIndex;continue}else{let R=new jl(p);if(this.tagsNodeStack.length>i.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),T&&(R[":@"]=T),this.addChild(r,R,this.readonlyMatcher,x),r=R}n="",a=m}}}else n+=t[a];return e.child};function oOn(t,e,r,n){this.options.captureMetaData||(n=void 0);let i=this.options.jPath?r.toString():r,s=this.options.updateTag(e.tagname,i,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),t.addChild(e,n))}function aOn(t,e,r){let n=this.options.processEntities;if(!n||!n.enabled)return t;if(n.allowedTags){let i=this.options.jPath?r.toString():r;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,i)))return t}if(n.tagFilter){let i=this.options.jPath?r.toString():r;if(!n.tagFilter(e,i))return t}return this.entityDecoder.decode(t)}function cOn(t,e,r,n){return t&&(n===void 0&&(n=e.child.length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function uOn(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function lOn(t,e,r=">"){let n=0,i=t.length,s=r.charCodeAt(0),o=r.length>1?r.charCodeAt(1):-1,a="",c=e;for(let u=e;u<i;u++){let l=t.charCodeAt(u);if(n)l===n&&(n=0);else if(l===34||l===39)n=l;else if(l===s)if(o!==-1){if(t.charCodeAt(u+1)===o)return a+=t.substring(c,u),{data:a,index:u}}else return a+=t.substring(c,u),{data:a,index:u};else l===9&&!n&&(a+=t.substring(c,u)+" ",c=u+1)}}function xR(t,e,r,n){let i=t.indexOf(e,r);if(i===-1)throw new Error(n);return i+e.length-1}function pOn(t,e,r,n){let i=t.indexOf(e,r);if(i===-1)throw new Error(n);return i}function j0e(t,e,r,n=">"){let i=lOn(t,e+1,n);if(!i)return;let s=i.data,o=i.index,a=s.search(/\s/),c=s,u=!0;a!==-1&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());let l=c;if(r){let p=c.indexOf(":");p!==-1&&(c=c.substr(p+1),u=c!==i.data.substr(p+1))}return{tagName:c,tagExp:s,closeIndex:o,attrExpPresent:u,rawTagName:l}}function fOn(t,e,r){let n=r,i=1,s=t.length;for(;r<s;r++)if(t[r]==="<"){let o=t.charCodeAt(r+1);if(o===47){let a=pOn(t,">",r,`${e} is not closed`);if(t.substring(r+2,a).trim()===e&&(i--,i===0))return{tagContent:t.substring(n,r),i:a};r=a}else if(o===63)r=xR(t,"?>",r+1,"StopNode is not closed.");else if(o===33&&t.charCodeAt(r+2)===45&&t.charCodeAt(r+3)===45)r=xR(t,"-->",r+3,"StopNode is not closed.");else if(o===33&&t.charCodeAt(r+2)===91)r=xR(t,"]]>",r,"StopNode is not closed.")-2;else{let a=j0e(t,r,!1);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&i++,r=a.closeIndex)}}}function B0e(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:k0e(t,r)}else return jgt(t)?t:""}function U0e(t,e,r,n){if(t){let i=t(e);r===e&&(r=i),e=i}return e=lyt(e,n),{tagName:e,tagExp:r}}function lyt(t,e){if(TW.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return Vq.includes(t)?e.onDangerousProperty(t):t}var $0e=jl.getMetaDataSymbol();function dOn(t,e){if(!t||typeof t!="object")return{};if(!e)return t;let r={};for(let n in t)if(n.startsWith(e)){let i=n.substring(e.length);r[i]=t[n]}else r[n]=t[n];return r}function V0e(t,e,r,n){return pyt(t,e,r,n)}function pyt(t,e,r,n){let i,s={};for(let o=0;o<t.length;o++){let a=t[o],c=hOn(a);if(c!==void 0&&c!==e.textNodeName){let u=dOn(a[":@"]||{},e.attributeNamePrefix);r.push(c,u)}if(c===e.textNodeName)i===void 0?i=a[c]:i+=""+a[c];else{if(c===void 0)continue;if(a[c]){let u=pyt(a[c],e,r,n),l=gOn(u,e);if(Object.keys(u).length===0&&e.alwaysCreateTextNode&&(u[e.textNodeName]=""),a[":@"]?mOn(u,a[":@"],n,e):Object.keys(u).length===1&&u[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?u=u[e.textNodeName]:Object.keys(u).length===0&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""),a[$0e]!==void 0&&typeof u=="object"&&u!==null&&(u[$0e]=a[$0e]),s[c]!==void 0&&Object.prototype.hasOwnProperty.call(s,c))Array.isArray(s[c])||(s[c]=[s[c]]),s[c].push(u);else{let p=e.jPath?n.toString():n;e.isArray(c,p,l)?s[c]=[u]:s[c]=u}c!==void 0&&c!==e.textNodeName&&r.pop()}}}return typeof i=="string"?i.length>0&&(s[e.textNodeName]=i):i!==void 0&&(s[e.textNodeName]=i),s}function hOn(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function mOn(t,e,r,n){if(e){let i=Object.keys(e),s=i.length;for(let o=0;o<s;o++){let a=i[o],c=a.startsWith(n.attributeNamePrefix)?a.substring(n.attributeNamePrefix.length):a,u=n.jPath?r.toString()+"."+c:r;n.isArray(a,u,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function gOn(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}var qg=class{constructor(e){this.externalEntities={},this.options=oyt(e)}parse(e,r){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let s=AW(e,r);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}let n=new Kq(this.options,this.externalEntities),i=n.parseXml(e);return this.options.preserveOrder||i===void 0?i:V0e(i,this.options,n.matcher,n.readonlyMatcher)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}static getMetaDataSymbol(){return jl.getMetaDataSymbol()}};var PR={validate:AW};var rS=class extends Il{static ADT_DISCOVERY_SERVICE_PATH="/sap/bc/adt/discovery";schemaStore=new bW;log;async getServiceDefinition(e){await this.checkOrLoadAdtDiscoverySchema();let r=this.schemaStore.getAdtCollection(e);return this.validateServiceSchema(e,r)?r:(this.log.warn("Invalid Discovery Schema"),null)}validateServiceSchema(e,r){return r?r.href?!0:(this.log.warn(`Empty href in schema: ${e.term} - ${e.scheme}`),!1):(this.log.warn(`Schema Not Found: ${e.term} - ${e.scheme}`),!1)}async checkOrLoadAdtDiscoverySchema(){if(!this.schemaStore.isAdtSchemaEmpty())return;let e=await this.get("",{headers:{Accept:"application/*"}}),r=this.parseAdtSchemaData(e.data);this.schemaStore.updateSchemaData(r)}parseAdtSchemaData(e){if(PR.validate(e)!==!0)return null;let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0},i=new qg(r).parse(e,!0);return i.service?i:null}};var sv=class extends Il{static PATH="/sap/bc/ui2/app_index";log;async search(e={},r){let n={...e};r&&(n.fields=r.join(","));let i=await this.get("/",{params:n});return JSON.parse(i.data).results}async getIsManiFirstSupported(e){try{let r={id:e},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: ${e}.`),this.log.debug(r),r}}async getAppInfo(e){try{let r=await this.get("/ui5_app_info_json",{params:{id:e}});return JSON.parse(r.data)}catch(r){throw b6(r)?this.log.error(`Failed fetching ui5_app_info_json for app with id ${e}.`):this.log.error(`Parsing error: ui5_app_info_json is not in expected format for app with id ${e}.`),this.log.debug(r),r}}};var Yq={UI:"UI",NotClassified:"Not Classified",WebApi:"WEB_API",NotDetermined:"Not Determined"},OR=class extends Ub{entitySet;services;isS4Cloud;async listServices(e=!1){return this.services||(this.services=await this.fetchServices(e)),this.services}};var fyt="ServiceCollection",dyt="RecommendedServiceCollection",yOn="((IsSapService%20eq%20true)and(ReleaseStatus%20eq%20%27RELEASED%27))or((IsSapService%20eq%20false))",nS=class extends OR{static PATH="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2";async determineEntitySet(){let e=await this.document();this.entitySet=e.EntitySets.includes(dyt)?dyt:fyt}getServicePath(e,r){let n;try{n=new URL(e)}catch{n=new URL(e,r)}return n.pathname}mapServices(e){return e.map(r=>{let n=this.getServicePath(r.ServiceUrl,this.defaults.baseURL);return{id:r.ID,name:r.TechnicalServiceName,path:n,serviceVersion:r.TechnicalServiceVersion+"",odataVersion:zr.v2,serviceType:r.ServiceType}})}async fetchServices(){let e={$format:"json"};this.entitySet||await this.determineEntitySet(),this.entitySet===fyt&&await this.isS4Cloud&&(e.$filter=yOn);let n=(await this.get(`/${this.entitySet}`,{params:e})).odata();if(Tg.containsError(n))throw new Tg(n);return this.mapServices(n)}async findService({title:e,path:r}){let n=1;if(!e){let c=r.replace(/\/$/,"").split("/").pop().split(";");if(e=c[0].toUpperCase(),!e)throw new Error(`Cannot determine service title from path: ${r}`);c.slice(1).forEach(l=>{let[p,f]=l.split("=");p==="v"&&(n=Number.parseInt(f,10))})}let i={$format:"json",$filter:`Title eq '${e}' and TechnicalServiceVersion eq ${n}`},s=this.entitySet?`/${this.entitySet}`:"/ServiceCollection",a=(await this.get(s,{params:i})).odata();if(a.length>1){let c=a.filter(u=>u.ServiceUrl?.toUpperCase().includes((r||e).toUpperCase()));if(c.length>1)this.log.warn("Service filter was not sufficient to identify one service.");else if(c.length>0)return this.log.info(`Service filter chose service: ${c[0].TechnicalServiceName}`),c[0]}return a.length>0?a[0]:void 0}async getServiceAnnotations({id:e,title:r,path:n}){if(!e){let i=await this.findService({title:r,path:n});i&&(e=i.ID)}return e?(await this.get(`/ServiceCollection('${encodeURIComponent(e)}')/Annotations`,{params:{$format:"json"}})).odata():[]}async getAnnotations({id:e,title:r,path:n}){if(!e&&!r&&!n)throw new Error("No filter parameters passed in");let i=await this.getServiceAnnotations({id:e,title:r,path:n}),s=[];for(let o of i){let a=`/Annotations(TechnicalName='${encodeURIComponent(o.TechnicalName)}',Version='${o.Version}')/$value/`,c=await this.get(a,{headers:{Accept:"application/xml"}});c.data?s.push({TechnicalName:o.TechnicalName,Version:o.Version,Definitions:c.data,Uri:this.defaults.baseURL+a}):this.log.warn(`No annotations found for TechnicalName=${o.TechnicalName}, Version=${o.Version}`)}return s}async getServiceType(e){let r,{ID:n}=await this.findService({path:e});if(n){let i=await this.get(`/ServiceTypeForHUBServices('${encodeURIComponent(n)}')`);i&&(r=i.odata().ServiceType)}return r}};var hyt="RecommendedServices",myt="Services",CR=class extends OR{logger=new va;static PATH="/sap/opu/odata4/iwfnd/config/default/iwfnd/catalog/0002";mapServices(e,r,n=!1){let i=[],s=new Set;return e.filter(o=>o?.DefaultSystem?.[r]?.length>0).forEach(o=>{i.push(...o.DefaultSystem[r].flatMap(a=>{let c=a.ServiceUrl.split("?").shift();if(n){let u=`${a.ServiceId}|${c}`;if(s.has(u))return[];s.add(u)}return{id:a.ServiceId,group:o.GroupId,path:c,name:`${o.GroupId} > ${a.ServiceAlias||a.ServiceId}`,serviceVersion:a.ServiceVersion,odataVersion:zr.v4,serviceType:a.ServiceType}}))}),i}async fetchServicesNextLink(){if(this.entitySet===void 0){let o=await this.metadata();this.entitySet=o.includes('Name="RecommendedServices"')?hyt:myt}let e=new URLSearchParams([["$count","true"],["$expand",`DefaultSystem($expand=${this.entitySet})`]]),n=(await this.get("/ServiceGroups",{params:e},!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.`),Tg.containsError(i))throw new Tg(i);return this.mapServices(i,this.entitySet)}async fetchServices(e=!1){return e?this.fetchServicesNextLink():this.fetchServicesParallel()}async fetchServicesParallel(){if(this.entitySet===void 0){let u=await this.metadata();this.entitySet=u.includes('Name="RecommendedServices"')?hyt:myt}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),c=1;if(!Number.isNaN(a)){let u=Math.ceil(o/a),l=Array.from({length:u-1},(f,h)=>{let d=new URLSearchParams([["$count","true"],["$skip",String((h+1)*a)],["$top",a.toString()],["$expand",`DefaultSystem($expand=${this.entitySet})`]]);return c++,this.get("/ServiceGroups",{params:d},!0)});(await Promise.all(l)).forEach(f=>{let h=f.odata();s.push(...h.value)})}if(this.logger.log(`Fetched ${s.length} service groups in ${c} requests.`),Tg.containsError(s))throw new Tg(s);return this.mapServices(s,this.entitySet,!0)}getAnnotations(){return Promise.resolve([])}getServiceType(){return Promise.resolve(void 0)}};var Xq;(function(t){t.SAP="SAP",t.Customer="CUSTOMER"})(Xq||(Xq={}));var Ls=class extends Il{log;serviceSchema;static getAdtCatagory(){throw new Error("NEEDS TO BE IMPLEMENTED BY AdtService SUBCLASSES")}attachAdtSchema(e){this.serviceSchema=e}parseResponse(e){if(PR.validate(e)!==!0)return this.log.warn(`Invalid XML: ${e}`),{};let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0};return new qg(r).parse(e,!0)}};var Jq=class t extends Ls{static adtCategory={scheme:"http://www.sap.com/adt/categories/ato",term:"settings"};static getAdtCatagory(){return t.adtCategory}async getAtoInfo(){let e={headers:{Accept:"application/*"}},r=await this.get("",e);return this.parseAtoResponse(r.data)}parseAtoResponse(e){if(PR.validate(e)!==!0)return this.log.warn(`Invalid XML: ${e}`),{};let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0},i=new qg(r).parse(e,!0);return i.settings?i.settings:{}}};var u_t=Pe(gyt(),1),KOn=Pe(c_t(),1);var lU=class t extends Ls{static adtCategory={scheme:"http://www.sap.com/adt/categories/respository",term:"generators"};static getAdtCatagory(){return t.adtCategory}async getUIServiceGeneratorConfig(e){let r=await this.get("",{headers:{Accept:"application/atom+xml;type=feed"},params:{referencedObject:e,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 pU=class t extends Ls{static adtCategory={scheme:"http://www.sap.com/adt/categories/respository",term:"generators"};static getAdtCatagory(){return t.adtCategory}id;async getRAPGeneratorConfig(){let e=await this.get("",{headers:{Accept:"application/atom+xml;type=feed"},params:{type:"webapi",fetchAllGenerators:!0}}),r=this.parseResponse(e.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 fU=class extends Ls{packageName;contentType;configure(e,r){this.packageName=r}setContentType(e){this.contentType=e}async validate(e){let r=await this.post("/validation",e,{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(e){let r=await this.post("/preview",e,{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(e){return(await this.post("",e,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.repository.generator.v1+json"},params:{package:this.packageName}})).status}parseValidateResponse(e){let n=this.parseResponse(e).validationMessages;return Array.isArray(n)||(n=[n]),n.map(i=>i.validationMessage||{})||[]}parsePreviewResponse(e){let n=(this.parseResponse(e).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 UR=class extends Ls{referencedObject;contentType;configure(e,r,n){this.referencedObject=r,this.contentType=n}async getSchema(){let e=await this.get("/schema",{headers:{Accept:"application/vnd.sap.adt.repository.generator.schema.v1+json"},params:{referencedObject:this.referencedObject.uri}});return JSON.parse(e.data)}async getContent(e){let n=(await this.get("/content",{headers:{Accept:this.contentType},params:{referencedObject:this.referencedObject.uri,package:e}})).data,i=JSON.parse(n);return i.metadata||(i.metadata={package:e}),JSON.stringify(i)}async validatePackage(e){let r=await this.get("/validation",{headers:{Accept:"application/vnd.sap.adt.validationMessages.v1+xml"},params:{referencedObject:this.referencedObject.uri,package:e,checks:"package"}});return this.parseResponse(r.data)}async validateContent(e){let r=await this.post("/validation",e,{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(e,r){let n=await this.post("",e,{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 jW=class extends Ls{async getSystemInfo(){let e={headers:{Accept:"application/vnd.sap.adt.core.http.systeminformation.v1+json"}},r=await this.get("/sap/bc/adt/core/http/systeminformation",e);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 dU=class extends Il{static PATH="/sap/public/bc/ui5_ui5";log;async getUI5Version(){try{let e=await this.get("/bootstrap_info.json",{transformResponse:n=>JSON.parse(n)}),{Version:r}=e.data;if(!r)throw new Error("UI5 version not provided.");return r}catch(e){throw this.log.error("Could not get UI5 Version."),this.log.debug(e),e}}};var Hl=class extends tS{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 e=this.createService("",jW);this._systemInfo=await e.getSystemInfo()}catch(e){this.log.error(`An error occurred retrieving system info: ${e}`)}return this._systemInfo}setAtoInfo(e){this.atoSettings=e}async getAtoInfo(){if(this.atoSettings)return this.atoSettings;let e;try{e=await this.getAdtService(Jq),e?this.atoSettings=await e.getAtoInfo():this.atoSettings={}}catch{this.atoSettings={}}return this.atoSettings}set publicUrl(e){this._publicUrl=e}get publicUrl(){return this._publicUrl||this.defaults.baseURL}async isAbapCloud(){return this.atoSettings===void 0&&await this.getAtoInfo(),this.atoSettings.tenantType===Xq.Customer&&this.atoSettings.operationsType==="C"}getAdtCatalogService(){if(!this.services[rS.ADT_DISCOVERY_SERVICE_PATH]){let e=this.createService(rS.ADT_DISCOVERY_SERVICE_PATH,rS);this.services[rS.ADT_DISCOVERY_SERVICE_PATH]=e}return this.services[rS.ADT_DISCOVERY_SERVICE_PATH]}catalog(e){let r;if(e===zr.v2)r=this.services[nS.PATH]??this.createService(nS.PATH,nS);else if(e===zr.v4)r=this.services[CR.PATH]??this.createService(CR.PATH,CR);else throw new Error("not implemented yet");return Object.defineProperty(r,"isAbapCloud",{get:this.isAbapCloud.bind(this)}),r}getUi5AbapRepository(e){let r=e??bR.PATH;return this.services[r]||(this.services[r]=this.createService(r,bR)),this.services[r]}getAppIndex(){return this.services[sv.PATH]||(this.services[sv.PATH]=this.createService(sv.PATH,sv)),this.services[sv.PATH]}getLayeredRepository(e){let r=e??SR.PATH;return this.services[r]||(this.services[r]=this.createService(r,SR)),this.services[r]}async getAdtService(e){let r=e.name;if(!this.services[r]){let i=await this.getAdtCatalogService().getServiceDefinition(e.getAdtCatagory());if(!i)return null;this.services[r]=this.createService(i.href,e),this.services[r].attachAdtSchema(i)}return this.services[r]}getUI5VersionService(){let e=dU.PATH;return this.services[e]||(this.services[e]=this.createService(e,dU)),this.services[e]}async getUiServiceGenerator(e){let r=await this.getAdtService(lU);if(!r)throw new Error("Generators are not supported on this system");let n=await r.getUIServiceGeneratorConfig(e.uri),i=this.createService(this.getServiceUrlFromConfig(n),UR);return i.configure(n,e,this.getContentType(n)),i}async getODataServiceGenerator(e){let r=await this.getAdtService(pU);if(!r)throw new Error("RAP Generator are not support on this system");let n=await r.getRAPGeneratorConfig(),i=this.createService(this.getServiceUrlFromConfig(n),fU);return i.setContentType(this.getContentType(n)),i.configure(n,e||"$TMP"),i}async fetchExternalServices(e){let r=[],n=e.map(async i=>{let{serviceRootPath:s,value:o}=i,a=(0,l_t.join)(s,o).replace("/$metadata",""),c=this.service(a);try{let u=await c.metadata();i.type==="value-list"?r.push({type:"value-list",path:a,target:i.target,metadata:u}):i.type==="code-list"&&r.push({type:"code-list",path:a,metadata:u})}catch(u){this.log.warn(`Could not fetch value list reference metadata from ${a}, ${u.message}`)}});return await Promise.allSettled(n),r}getServiceUrlFromConfig(e){if(Array.isArray(e.link)&&!e.link[0]?.href)throw new Error("No service URL found in the generator config");let r=e.link[0].href.indexOf(e.id)+e.id.length;return e.link[0].href.substring(0,r)}getContentType(e){return(e.link?.find(n=>typeof n.href=="string"&&n.href.includes("/content"))).type}async createLockServiceBindingGenerator(e){return this.createService(e,UR)}};var gAt=Pe(F0t(),1),Jg=Pe(o7(),1);var yS;(function(t){t.H2O_URL="H2O_URL",t.HTTP_PROXY="HTTP_PROXY",t.HTTPS_PROXY="HTTPS_PROXY"})(yS||(yS={}));var a7;(function(t){t.HTTP="HTTP",t.LDAP="LDAP",t.MAIL="MAIL",t.RFC="RFC"})(a7||(a7={}));var c7;(function(t){t.DEDICATED="Dedicated",t.COMMON="Common"})(c7||(c7={}));var Xg;(function(t){t.BASIC_AUTHENTICATION="BasicAuthentication",t.CLIENT_CERT_AUTHENTICATION="ClientCertificateAuthentication",t.NO_AUTHENTICATION="NoAuthentication",t.OAUTH2_CLIENT_CREDENTIALS="OAuth2ClientCredentials",t.OAUTH2_JWT_BEARER="OAuth2JWTBearer",t.OAUTH2_PASSWORD="OAuth2Password",t.OAUTH2_REFRESH_TOKEN="OAuth2RefreshToken",t.OAUTH2_SAML_BEARER_ASSERTION="OAuth2SAMLBearerAssertion",t.OAUTH2_USER_TOKEN_EXCHANGE="OAuth2UserTokenExchange",t.SAML_ASSERTION="SAMLAssertion"})(Xg||(Xg={}));var u7;(function(t){t.S4HC="S4HC",t.BTP="BTP"})(u7||(u7={}));var Awe;(function(t){t.ON_PREMISE="OnPremise",t.INTERNET="Internet",t.PRIVATE_LINK="PrivateLink"})(Awe||(Awe={}));var Pw;(function(t){t.ODATA_GENERIC="odata_gen",t.ODATA_ABAP="odata_abap",t.DEV_ABAP="dev_abap",t.ABAP_CLOUD="abap_cloud"})(Pw||(Pw={}));var l7;(function(t){t.FULL_URL="full_url",t.API_MGMT="api_mgmt"})(l7||(l7={}));var XU;(function(t){t.ON_PREMISE="OnPremise",t.INTERNET="Internet",t.PRIVATE_LINK="PrivateLink"})(XU||(XU={}));function fAt(t){return!!(t.WebIDEUsage?.includes("abap")||t["sap-client"]||t["sap-platform"]?.toLocaleLowerCase()==="abap"||t.ProxyType==="OnPremise")}function Eqn(t){return!!(t.WebIDEUsage?.includes(Pw.ABAP_CLOUD)||t["sap-platform"]?.toLocaleLowerCase()==="abap")}function p7(t){return!!(t.WebIDEUsage?.includes(Pw.ODATA_GENERIC)&&!t.WebIDEUsage.includes(Pw.ODATA_ABAP))}function cm(t){return!!(!t.WebIDEAdditionalData?.includes(l7.FULL_URL)&&p7(t))}function _S(t){return!!(t.WebIDEAdditionalData?.includes(l7.FULL_URL)&&p7(t))}function dAt(t){return!!t.ProxyType.includes(XU.ON_PREMISE)}function hAt(t){return!!t["HTML5.DynamicDestination"]}function bqn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pAt(t,e){let r=` (${e})`;return RegExp(`${bqn(r)}$`).exec(t.trim())?t:`${t} (${e})`}function mAt(t,e){let r=e?` [${e}]`:"",n;return Eqn(t)?n=pAt(t.Name,u7.BTP):wwe(t)?n=pAt(t.Name,u7.S4HC):n=t.Name,`${n}${r}`}function wwe(t){return!!(t.WebIDEUsage?.includes(Pw.ODATA_ABAP)&&t.Authentication===Xg.SAML_ASSERTION&&t.ProxyType===Awe.INTERNET)}function f7(t){return!!t.WebIDEUsage?.includes(Pw.ODATA_ABAP)}var bv={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 xwe="abap-cloud-destination-instance",yAt="bas-destination-instance-cred";function kn(){return!!process.env[yS.H2O_URL]}async function _At(t){try{let e=await(0,Jg.cfGetInstanceKeyParameters)(t);if(!e)throw new Error(`No destination instance ${t} found`);let r=e.credentials;if(!r)throw new Error(`No credentials for destination instance ${t} found`);let n=r.uaa?.clientid||r.clientid,i=r.uaa?.clientsecret||r.clientsecret;return Buffer.from(`${encodeURIComponent(n)}:${encodeURIComponent(i)}`).toString("base64")}catch(e){throw new Error(`An error occurred while retrieving service key for the destination instance ${t}: ${e}`)}}function g1(t,e){let r=`https://${t}.dest`;return e&&e.length>1?new URL(e,r).toString():r}function Sqn(t){let[e,...r]=t.split(".");return[e.replace(/-api$/,""),...r].join(".")}async function Pwe(t){let e={};await Dl.get("/reload",{baseURL:process.env[yS.HTTP_PROXY]}),Tqn();let r=await Dl.get("/api/listDestinations",{baseURL:process.env[yS.H2O_URL]});return(Array.isArray(r.data)?r.data:[]).forEach(i=>{t?.stripS4HCApiHosts&&wwe(i)&&(i.Host=Sqn(i.Host)),i.WebIDEEnabled&&(e[i.Name]=i)}),e}function Tqn(){!kn()||!globalThis.GLOBAL_AGENT||(globalThis.GLOBAL_AGENT.HTTP_PROXY||(globalThis.GLOBAL_AGENT.HTTP_PROXY=process.env[yS.HTTP_PROXY]??null),globalThis.GLOBAL_AGENT.HTTPS_PROXY||(globalThis.GLOBAL_AGENT.HTTPS_PROXY=process.env[yS.HTTPS_PROXY]??null))}function Aqn(t,e,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:c7.DEDICATED};return{name:t,description:e,url:new URL(n),type:a7.HTTP,proxyType:XU.INTERNET,basProperties:i,credentials:{authentication:Xg.OAUTH2_USER_TOKEN_EXCHANGE,oauth2UserTokenExchange:s}}}async function Owe(t){let e=await(0,Jg.cfGetTarget)(!0);if(!e.space)throw new Error("No Dev Space has been created for the subaccount.");return`abap-cloud-${`${t}-${e.org}-${e.space}`.replace(/\W/gi,"-").toLowerCase()}`.substring(0,199)}async function wqn(t,e,r,n){let i=await Owe(t);return(await(0,Jg.apiGetServicesInstancesFilteredByType)(["destination"])).find(a=>a.label===xwe)||(await(0,Jg.apiCreateServiceInstance)("destination","lite",xwe,null),n?.info(`New ABAP destination instance ${xwe} created.`)),Aqn(i,`Destination generated by App Studio for Cloud Foundry Abap service instance: '${t}', Do not remove.`,e,r)}async function vAt(t,e,r){if(!kn())throw new Error("Creating a SAP BTP destinations is only supported on SAP Business Application Studio.");let n=e;try{if(!n){let a=await(0,Jg.apiGetInstanceCredentials)(t);if(!a?.credentials)throw new Error(`Could not retrieve SAP BTP credentials for ${t}.`);n={uaaCredentials:a.credentials.uaa,hostUrl:a.credentials.url}}let i=await wqn(t,n.uaaCredentials,n.hostUrl,r);await gAt.destinations.createDestination(i),r?.debug(`SAP BTP destination ${JSON.stringify(i,null,2)} created.`);let o=(await Pwe())?.[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 ${t}: ${i}`)}}var kAt=Pe(h7(),1),FAt=require("node:https"),qAt=Pe(_7(),1),UAt=Pe(F6(),1),jAt=Pe(MAt(),1),BAt=require("node:util");var Nwe=class extends qAt.HttpsProxyAgent{extraOptions;constructor(e,r){super(e,r),this.extraOptions=r}async connect(e,r){return super.connect(e,{...this.extraOptions,...r})}};function Ow(t,e){let r=(0,UAt.default)(e),n={rejectUnauthorized:!r.ignoreCertErrors};r.httpsAgent||(r.httpsAgent=new FAt.Agent(n)),delete r.ignoreCertErrors,r.withCredentials=r?.auth&&Object.keys(r.auth).length>0,r.validateStatus=s=>s<400;let i=new t(r);return i.interceptors.request.use(s=>{let o=i.getUri(s),a=(0,jAt.getProxyForUrl)(o);return a&&!kn()&&(s.httpsAgent=new Nwe(a,n),s.httpAgent=new kAt.HttpProxyAgent(a),s.proxy=!1),s}),i.defaults.headers=i.defaults.headers??{common:{},delete:{},put:{},get:{},post:{},head:{},patch:{}},Nmt(i),r.auth?.password&&Dgt(i),e.cookies&&e.cookies.split(";").forEach(s=>{i.cookies.addCookie(s.trim())}),$q.isPatchRequired(e.baseURL)&&$q.apply(),i}function $At(t){return typeof t=="string"?Ow(tS,{baseURL:t}):Ow(tS,t)}function Rw(t){return Ow(Hl,t)}var Cw;(function(t){t.Standalone="Standalone",t.EmbeddedSteampunk="EmbeddedSteampunk"})(Cw||(Cw={}));function Dwe(t){let e;switch(t.environment){case Cw.Standalone:{let{service:r,refreshToken:n,refreshTokenChangedCb:i,cookies:s,...o}=t;e=Ow(Hl,{baseURL:r.url,cookies:s,...o}),s||(t.service?.uaa?.username&&t.service.uaa.password?Igt(e,r,n,i):w0e({provider:e}));break}case Cw.EmbeddedSteampunk:{let{url:r,cookies:n,...i}=t;e=Ow(Hl,{baseURL:r,cookies:n,...i}),n||w0e({provider:e});break}default:{let r=t;throw new Error(`Unknown environment type supplied: ${(0,BAt.inspect)(r)}`)}}return e}function VAt(t,e,r){let{cookies:n,...i}=t,s={...i,baseURL:g1(e.Name,e.Host?new URL(e.Host).pathname:void 0),cookies:n};s.params=s.params??{},s.params.saml2="disabled";let o;if(fAt(e)?(o=Ow(Hl,s),o.publicUrl=e.Host):o=Ow(tS,s),r){let a=o.interceptors.request.use(async c=>{let u=await _At(r);return o.defaults.headers.common[yAt]=u,o.interceptors.request.eject(a),c})}return o}var GAt;(function(t){t.FF_SIMPLE="basic"})(GAt||(GAt={}));var HAt;(function(t){t.FE_FPM="fpm",t.FE_LROP="lrop",t.FE_OVP="ovp",t.FE_ALP="alp",t.FE_FEOP="feop",t.FE_WORKLIST="worklist"})(HAt||(HAt={}));var gi={vscode:{name:"Visual Studio Code",technical:"VSCode"},bas:{name:"SAP Business Application Studio",technical:"SBAS"},cli:{name:"CLI",technical:"CLI"}};var zAt;(function(t){t.CF="CF",t.ABAP="ABAP"})(zAt||(zAt={}));function aUn(){return!!(process.argv[1]?.includes("yo")||process.stdin.isTTY)}function Ad(){return aUn()?gi.cli:kn()?gi.bas:gi.vscode}var sr=t=>typeof t=="string",QU=()=>{let t,e,r=new Promise((n,i)=>{t=n,e=i});return r.resolve=t,r.reject=e,r},WAt=t=>t==null?"":""+t,cUn=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},uUn=/###/g,KAt=t=>t&&t.indexOf("###")>-1?t.replace(uUn,"."):t,YAt=t=>!t||sr(t),ZU=(t,e,r)=>{let n=sr(e)?e.split("."):e,i=0;for(;i<n.length-1;){if(YAt(t))return{};let s=KAt(n[i]);!t[s]&&r&&(t[s]=new r),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++i}return YAt(t)?{}:{obj:t,k:KAt(n[i])}},XAt=(t,e,r)=>{let{obj:n,k:i}=ZU(t,e,Object);if(n!==void 0||e.length===1){n[i]=r;return}let s=e[e.length-1],o=e.slice(0,e.length-1),a=ZU(t,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=ZU(t,o,Object),a?.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=r},lUn=(t,e,r,n)=>{let{obj:i,k:s}=ZU(t,e,Object);i[s]=i[s]||[],i[s].push(r)},E7=(t,e)=>{let{obj:r,k:n}=ZU(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},pUn=(t,e,r)=>{let n=E7(t,r);return n!==void 0?n:E7(e,r)},nwt=(t,e,r)=>{for(let n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?sr(t[n])||t[n]instanceof String||sr(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):nwt(t[n],e[n],r):t[n]=e[n]);return t},Nw=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),fUn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},dUn=t=>sr(t)?t.replace(/[&<>"'\/]/g,e=>fUn[e]):t,kwe=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let r=this.regExpMap.get(e);if(r!==void 0)return r;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},hUn=[" ",",","?","!",";"],mUn=new kwe(20),gUn=(t,e,r)=>{e=e||"",r=r||"";let n=hUn.filter(o=>e.indexOf(o)<0&&r.indexOf(o)<0);if(n.length===0)return!0;let i=mUn.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),s=!i.test(t);if(!s){let o=t.indexOf(r);o>0&&!i.test(t.substring(0,o))&&(s=!0)}return s},Fwe=(t,e,r=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;let n=e.split(r),i=t;for(let s=0;s<n.length;){if(!i||typeof i!="object")return;let o,a="";for(let c=s;c<n.length;++c)if(c!==s&&(a+=r),a+=n[c],o=i[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<n.length-1)continue;s+=c-s+1;break}i=o}return i},ej=t=>t?.replace(/_/g,"-"),yUn={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}},qwe=class t{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||yUn,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,i){return i&&!this.debug?null:(sr(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new t(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new t(this.logger,e)}},Zg=new qwe,b1=class{constructor(){this.observers={}}on(e,r){return e.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(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].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,[e,...r])})}},b7=class extends b1{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,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;e.indexOf(".")>-1?a=e.split("."):(a=[e,r],n&&(Array.isArray(n)?a.push(...n):sr(n)&&s?a.push(...n.split(s)):a.push(n)));let c=E7(this.data,a);return!c&&!r&&!n&&e.indexOf(".")>-1&&(e=a[0],r=a[1],n=a.slice(2).join(".")),c||!o||!sr(n)?c:Fwe(this.data?.[e]?.[r],n,s)}addResource(e,r,n,i,s={silent:!1}){let o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=[e,r];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."),i=r,r=a[1]),this.addNamespaces(r),XAt(this.data,a,i),s.silent||this.emit("added",e,r,n,i)}addResources(e,r,n,i={silent:!1}){for(let s in n)(sr(n[s])||Array.isArray(n[s]))&&this.addResource(e,r,s,n[s],{silent:!0});i.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,i,s,o={silent:!1,skipCopy:!1}){let a=[e,r];e.indexOf(".")>-1&&(a=e.split("."),i=n,n=r,r=a[1]),this.addNamespaces(r);let c=E7(this.data,a)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?nwt(c,n,s):c={...c,...n},XAt(this.data,a,c),o.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},iwt={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,i){return t.forEach(s=>{e=this.processors[s]?.process(e,r,n,i)??e}),e}},swt=Symbol("i18next/PATH_KEY");function _Un(){let t=[],e=Object.create(null),r;return e.get=(n,i)=>(r?.revoke?.(),i===swt?t:(t.push(i),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function E1(t,e){let{[swt]:r}=t(_Un()),n=e?.keySeparator??".",i=e?.nsSeparator??":";if(r.length>1&&i){let s=e?.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 JAt={},Iwe=t=>!sr(t)&&typeof t!="boolean"&&typeof t!="number",S7=class t extends b1{constructor(e,r={}){super(),cUn(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Zg.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){let n={...r};if(e==null)return!1;let i=this.resolve(e,n);if(i?.res===void 0)return!1;let s=Iwe(i.res);return!(n.returnObjects===!1&&s)}extractFromKey(e,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&&e.indexOf(n)>-1,a=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!gUn(e,n,i);if(o&&!a){let c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:sr(s)?[s]:s};let u=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),e=u.join(i)}return{key:e,namespaces:sr(s)?[s]:s}}translate(e,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={}),e==null)return"";typeof e=="function"&&(e=E1(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]),e=e.map(Z=>typeof Z=="function"?E1(Z,{...this.options,...i}):String(Z));let s=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(e[e.length-1],i),u=c[c.length-1],l=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");let p=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p?.toLowerCase()==="cimode")return f?s?{res:`${u}${l}${a}`,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${l}${a}`:s?{res:a,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:a;let h=this.resolve(e,i),d=h?.res,m=h?.usedKey||a,_=h?.exactUsedKey||a,b=["[object Number]","[object Function]","[object RegExp]"],T=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,A=i.count!==void 0&&!sr(i.count),x=t.hasDefaultValue(i),R=A?this.pluralResolver.getSuffix(p,i.count,i):"",M=i.ordinal&&A?this.pluralResolver.getSuffix(p,i.count,{ordinal:!1}):"",O=A&&!i.ordinal&&i.count===0,F=O&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${R}`]||i[`defaultValue${M}`]||i.defaultValue,V=d;S&&!d&&x&&(V=F);let I=Iwe(V),te=Object.prototype.toString.apply(V);if(S&&V&&I&&b.indexOf(te)<0&&!(sr(T)&&Array.isArray(V))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let Z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,V,{...i,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(h.res=Z,h.usedParams=this.getUsedParamsDetails(i),h):Z}if(o){let Z=Array.isArray(V),k=Z?[]:{},$=Z?_:m;for(let K in V)if(Object.prototype.hasOwnProperty.call(V,K)){let be=`${$}${o}${K}`;x&&!d?k[K]=this.translate(be,{...i,defaultValue:Iwe(F)?F[K]:void 0,joinArrays:!1,ns:c}):k[K]=this.translate(be,{...i,joinArrays:!1,ns:c}),k[K]===be&&(k[K]=V[K])}d=k}}else if(S&&sr(T)&&Array.isArray(d))d=d.join(T),d&&(d=this.extendTranslation(d,e,i,n));else{let Z=!1,k=!1;!this.isValidLookup(d)&&x&&(Z=!0,d=F),this.isValidLookup(d)||(k=!0,d=a);let K=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&k?void 0:d,be=x&&F!==d&&this.options.updateMissing;if(k||Z||be){if(this.logger.log(be?"updateKey":"missingKey",p,u,a,be?F:d),o){let Ke=this.resolve(a,{...i,keySeparator:!1});Ke&&Ke.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 ye=[],Re=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Re&&Re[0])for(let Ke=0;Ke<Re.length;Ke++)ye.push(Re[Ke]);else this.options.saveMissingTo==="all"?ye=this.languageUtils.toResolveHierarchy(i.lng||this.language):ye.push(i.lng||this.language);let qe=(Ke,Ie,Ue)=>{let lt=x&&Ue!==d?Ue:K;this.options.missingKeyHandler?this.options.missingKeyHandler(Ke,u,Ie,lt,be,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(Ke,u,Ie,lt,be,i),this.emit("missingKey",Ke,u,Ie,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&A?ye.forEach(Ke=>{let Ie=this.pluralResolver.getSuffixes(Ke,i);O&&i[`defaultValue${this.options.pluralSeparator}zero`]&&Ie.indexOf(`${this.options.pluralSeparator}zero`)<0&&Ie.push(`${this.options.pluralSeparator}zero`),Ie.forEach(Ue=>{qe([Ke],a+Ue,i[`defaultValue${Ue}`]||F)})}):qe(ye,a,F))}d=this.extendTranslation(d,e,i,h,n),k&&d===a&&this.options.appendNamespaceToMissingKey&&(d=`${u}${l}${a}`),(k||Z)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${l}${a}`:a,Z?d:void 0,i))}return s?(h.res=d,h.usedParams=this.getUsedParamsDetails(i),h):d}extendTranslation(e,r,n,i,s){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...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 c=sr(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(c){let p=e.match(this.interpolator.nestingRegexp);u=p&&p.length}let l=n.replace&&!sr(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||i.usedLng,n),c){let p=e.match(this.interpolator.nestingRegexp),f=p&&p.length;u<f&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...p)=>s?.[0]===p[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${r[0]}`),null):this.translate(...p,r),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,a=sr(o)?[o]:o;return e!=null&&a?.length&&n.applyPostProcessor!==!1&&(e=iwt.handle(a,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,i,s,o,a;return sr(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(c=>typeof c=="function"?E1(c,{...this.options,...r}):c)),e.forEach(c=>{if(this.isValidLookup(n))return;let u=this.extractFromKey(c,r),l=u.key;i=l;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));let f=r.count!==void 0&&!sr(r.count),h=f&&!r.ordinal&&r.count===0,d=r.context!==void 0&&(sr(r.context)||typeof r.context=="number")&&r.context!=="",m=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);p.forEach(_=>{this.isValidLookup(n)||(a=_,!JAt[`${m[0]}-${_}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(JAt[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.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!!!")),m.forEach(b=>{if(this.isValidLookup(n))return;o=b;let T=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(T,l,b,_,r);else{let A;f&&(A=this.pluralResolver.getSuffix(b,r.count,r));let x=`${this.options.pluralSeparator}zero`,R=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&A.indexOf(R)===0&&T.push(l+A.replace(R,this.options.pluralSeparator)),T.push(l+A),h&&T.push(l+x)),d){let M=`${l}${this.options.contextSeparator||"_"}${r.context}`;T.push(M),f&&(r.ordinal&&A.indexOf(R)===0&&T.push(M+A.replace(R,this.options.pluralSeparator)),T.push(M+A),h&&T.push(M+x))}}let S;for(;S=T.pop();)this.isValidLookup(n)||(s=S,n=this.getResource(b,_,S,r))}))})}),{res:n,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,i):this.resourceStore.getResource(e,r,n,i)}getUsedParamsDetails(e={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!sr(e.replace),i=n?e.replace:e;if(n&&typeof e.count<"u"&&(i.count=e.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(e){let r="defaultValue";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}},T7=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Zg.create("languageUtils")}getScriptPartFromCode(e){if(e=ej(e),!e||e.indexOf("-")<0)return null;let r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=ej(e),!e||e.indexOf("-")<0)return e;let r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(sr(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&e.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(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),sr(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return sr(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):sr(e)&&s(this.formatLanguageCode(e)),n.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}},QAt={zero:0,one:1,two:2,few:3,many:4,other:5},ZAt={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},Uwe=class{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=Zg.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){let n=ej(e==="dev"?"en":e),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!"),ZAt;if(!e.match(/-|_/))return ZAt;let c=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(c,r)}return this.pluralRulesCache[s]=o,o}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(i=>`${r}${i}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,s)=>QAt[i]-QAt[s]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,r,n={}){let i=this.getRule(e,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",r,n))}},ewt=(t,e,r,n=".",i=!0)=>{let s=pUn(t,e,r);return!s&&i&&sr(r)&&(s=Fwe(t,r,n),s===void 0&&(s=Fwe(e,r,n))),s},Lwe=t=>t.replace(/\$/g,"$$$$"),A7=class{constructor(e={}){this.logger=Zg.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:r,escapeValue:n,useRawValueToEscape:i,prefix:s,prefixEscaped:o,suffix:a,suffixEscaped:c,formatSeparator:u,unescapeSuffix:l,unescapePrefix:p,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:d,nestingSuffixEscaped:m,nestingOptionsSeparator:_,maxReplaces:b,alwaysFormat:T}=e.interpolation;this.escape=r!==void 0?r:dUn,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?Nw(s):o||"{{",this.suffix=a?Nw(a):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=l?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=f?Nw(f):h||Nw("$t("),this.nestingSuffix=d?Nw(d):m||Nw(")"),this.nestingOptionsSeparator=_||",",this.maxReplaces=b||1e3,this.alwaysFormat=T!==void 0?T:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,r,n,i){let s,o,a,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){let b=ewt(r,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,n,{...i,...r,interpolationkey:h}):b}let d=h.split(this.formatSeparator),m=d.shift().trim(),_=d.join(this.formatSeparator).trim();return this.format(ewt(r,c,m,this.options.keySeparator,this.options.ignoreJSONStructure),_,n,{...i,...r,interpolationkey:m})};this.resetRegExp();let l=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Lwe(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Lwe(this.escape(h)):Lwe(h)}].forEach(h=>{for(a=0;s=h.regex.exec(e);){let d=s[1].trim();if(o=u(d),o===void 0)if(typeof l=="function"){let _=l(e,s,i);o=sr(_)?_:""}else if(i&&Object.prototype.hasOwnProperty.call(i,d))o="";else if(p){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${d} for interpolating ${e}`),o="";else!sr(o)&&!this.useRawValueToEscape&&(o=WAt(o));let m=h.safeValue(o);if(e=e.replace(s[0],m),p?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,r,n={}){let i,s,o,a=(c,u)=>{let l=this.nestingOptionsSeparator;if(c.indexOf(l)<0)return c;let p=c.split(new RegExp(`${Nw(l)}[ ]*{`)),f=`{${p[1]}`;c=p[0],f=this.interpolate(f,o);let h=f.match(/'/g),d=f.match(/"/g);((h?.length??0)%2===0&&!d||(d?.length??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${l}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(e);){let c=[];o={...n},o=o.replace&&!sr(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(c=i[1].slice(u).split(this.formatSeparator).map(l=>l.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),s=r(a.call(this,i[1].trim(),o),o),s&&i[0]===e&&!sr(s))return s;sr(s)||(s=WAt(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),c.length&&(s=c.reduce((l,p)=>this.format(l,p,n.lng,{...n,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}},vUn=t=>{let e=t.toLowerCase().trim(),r={};if(t.indexOf("(")>-1){let n=t.split("(");e=n[0].toLowerCase().trim();let i=n[1].substring(0,n[1].length-1);e==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(o=>{if(o){let[a,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),l=a.trim();r[l]||(r[l]=u),u==="false"&&(r[l]=!1),u==="true"&&(r[l]=!0),isNaN(u)||(r[l]=parseInt(u,10))}})}return{formatName:e,formatOptions:r}},twt=t=>{let e={};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=e[o];return a||(a=t(ej(n),i),e[o]=a),a(r)}},EUn=t=>(e,r,n)=>t(ej(r),n)(e),jwe=class{constructor(e={}){this.logger=Zg.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?twt:EUn;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(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=twt(r)}format(e,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(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,c)=>{let{formatName:u,formatOptions:l}=vUn(c);if(this.formats[u]){let p=a;try{let f=i?.formatParams?.[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||n;p=this.formats[u](a,h,{...l,...i,...f})}catch(f){this.logger.warn(f)}return p}else this.logger.warn(`there was no format function for ${u}`);return a},e)}},bUn=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)},Bwe=class extends b1{constructor(e,r,n,i={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=Zg.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(e,r,n,i){let s={},o={},a={},c={};return e.forEach(u=>{let l=!0;r.forEach(p=>{let f=`${u}|${p}`;!n.reload&&this.store.hasResourceBundle(u,p)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,l=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),c[p]===void 0&&(c[p]=!0)))}),l||(a[u]=!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(c)}}loaded(e,r,n){let i=e.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[e]=r?-1:2,r&&n&&(this.state[e]=0);let a={};this.queue.forEach(c=>{lUn(c.loaded,[s],o),bUn(c,e),r&&c.errors.push(r),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{a[u]||(a[u]={});let l=c.loaded[u];l.length&&l.forEach(p=>{a[u][p]===void 0&&(a[u][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(e,r,n,i=0,s=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:i,wait:s,callback:o});return}this.readingCalls++;let a=(u,l)=>{if(this.readingCalls--,this.waitingReads.length>0){let p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&l&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,i+1,s*2,o)},s);return}o(u,l)},c=this.backend[n].bind(this.backend);if(c.length===2){try{let u=c(e,r);u&&typeof u.then=="function"?u.then(l=>a(null,l)).catch(a):a(null,u)}catch(u){a(u)}return}return c(e,r,a)}prepareLoading(e,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();sr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),sr(r)&&(r=[r]);let s=this.queueLoad(e,r,n,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){let n=e.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(e,o,a)})}saveMissing(e,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 c={...o,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let l;u.length===5?l=u(e,r,n,i,c):l=u(e,r,n,i),l&&typeof l.then=="function"?l.then(p=>a(null,p)).catch(a):a(null,l)}catch(l){a(l)}else u(e,r,n,i,a,c)}!e||!e[0]||this.store.addResource(e[0],r,n,i)}}},Mwe=()=>({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:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),sr(t[1])&&(e.defaultValue=t[1]),sr(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){let r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),rwt=t=>(sr(t.ns)&&(t.ns=[t.ns]),sr(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),sr(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),v7=()=>{},SUn=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})},owt="__i18next_supportNoticeShown",TUn=()=>!!(typeof globalThis<"u"&&globalThis[owt]||typeof process<"u"&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&process.env&&process.env.NODE_ENV==="production"),AUn=()=>{typeof globalThis<"u"&&(globalThis[owt]=!0)},wUn=t=>!!(t?.modules?.backend?.name?.indexOf("Locize")>0||t?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||t?.options?.backend?.backends&&t.options.backend.backends.some(e=>e?.name?.indexOf("Locize")>0||e?.constructor?.name?.indexOf("Locize")>0)||t?.options?.backend?.projectId||t?.options?.backend?.backendOptions&&t.options.backend.backendOptions.some(e=>e?.projectId)),$we=class t extends b1{constructor(e={},r){if(super(),this.options=rwt(e),this.services={},this.logger=Zg,this.modules={external:[]},SUn(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(sr(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));let n=Mwe();this.options={...n,...this.options,...rwt(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!wUn(this)&&!TUn()&&(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}"),AUn());let i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Zg.init(i(this.modules.logger),this.options):Zg.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=jwe;let l=new T7(this.options);this.store=new b7(this.options.resources,this.options);let p=this.services;p.logger=Zg,p.resourceStore=this.store,p.languageUtils=l,p.pluralResolver=new Uwe(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"),u&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(p.formatter=i(u),p.formatter.init&&p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new A7(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new Bwe(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(h,...d)=>{this.emit(h,...d)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new S7(this.services,this.options),this.translator.on("*",(h,...d)=>{this.emit(h,...d)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=v7),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...l)=>this.store[u](...l)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...l)=>(this.store[u](...l),this)});let a=QU(),c=()=>{let u=(l,p)=>{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(p),r(l,p)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),a}loadResources(e,r=v7){let n=r,i=sr(e)?e:this.language;if(typeof e=="function"&&(n=e),!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(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),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(e,r,n){let i=QU();return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=void 0),e||(e=this.languages),r||(r=this.options.ns),n||(n=v7),this.services.backendConnector.reload(e,r,s=>{i.resolve(),n(s)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&iwt.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-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(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let n=QU();this.emit("languageChanging",e);let i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},s=(a,c)=>{c?this.isLanguageChangingTo===e&&(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),r&&r(a,(...u)=>this.t(...u))},o=a=>{!e&&!a&&this.services.languageDetector&&(a=[]);let c=sr(a)?a:a&&a[0],u=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(sr(a)?[a]:a);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,l=>{s(l,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&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(e),n}getFixedT(e,r,n){let i=(s,o,...a)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([s,o].concat(a)):c={...o},c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||n||i.keyPrefix);let u={...this.options,...c};typeof c.keyPrefix=="function"&&(c.keyPrefix=E1(c.keyPrefix,u));let l=this.options.keySeparator||".",p;return c.keyPrefix&&Array.isArray(s)?p=s.map(f=>(typeof f=="function"&&(f=E1(f,u)),`${c.keyPrefix}${l}${f}`)):(typeof s=="function"&&(s=E1(s,u)),p=c.keyPrefix?`${c.keyPrefix}${l}${s}`:s),this.t(p,c)};return sr(e)?i.lng=e:i.lngs=e,i.ns=r,i.keyPrefix=n,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,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,c)=>{let u=this.services.backendConnector.state[`${a}|${c}`];return u===-1||u===0||u===2};if(r.precheck){let a=r.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,e)&&(!i||o(s,e)))}loadNamespaces(e,r){let n=QU();return this.options.ns?(sr(e)&&(e=[e]),e.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(e,r){let n=QU();sr(e)&&(e=[e]);let i=this.options.preload||[],s=e.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(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let i=new Intl.Locale(e);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 T7(Mwe());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){let n=new t(e,r);return n.createInstance=t.createInstance,n}cloneInstance(e={},r=v7){let n=e.forkResourceStore;n&&delete e.forkResourceStore;let i={...this.options,...e,isClone:!0},s=new t(i);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["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((c,u)=>(c[u]={...this.store.data[u]},c[u]=Object.keys(c[u]).reduce((l,p)=>(l[p]={...c[u][p]},l),c[u]),c),{});s.store=new b7(a,i),s.services.resourceStore=s.store}if(e.interpolation){let c={...Mwe().interpolation,...this.options.interpolation,...e.interpolation},u={...i,interpolation:c};s.services.interpolator=new A7(u)}return s.translator=new S7(s.services,i),s.translator.on("*",(a,...c)=>{s.emit(a,...c)}),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}}},On=$we.createInstance(),Yvo=On.createInstance,Xvo=On.dir,Jvo=On.init,Qvo=On.loadResources,Zvo=On.reloadResources,eEo=On.use,tEo=On.changeLanguage,rEo=On.getFixedT,nEo=On.t,iEo=On.exists,sEo=On.setDefaultNamespace,oEo=On.hasLoadedNamespace,aEo=On.loadNamespaces,cEo=On.loadLanguages;var awt={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 Vwe="fiori-freestyle-writer",cwt=On.createInstance();async function PUn(){await cwt.init({resources:{en:{[Vwe]:awt}},lng:"en",fallbackLng:"en",defaultNS:Vwe,ns:[Vwe],showSupportNotice:!1})}function vS(t,e){return cwt.t(t,e)}PUn().catch(()=>{});function uwt(t){return OUn(t.name,t.userDisplayName,t.systemType)}function OUn(t,e,r){let n=e?` [${e}]`:"";return`${t}${CUn(r)}${n}`}function CUn(t){let e="",r=` (${vS("texts.systemTypeLabel.abapCloud")})`;return(t==="AbapCloud"||t==="S4HC"||t==="BTP")&&(e=r),e}var tj=class{applicationKey="";extensionName="";extensionVersion="";getApplicationKey(){return this.applicationKey}getExtensionVersion(){return this.extensionVersion}getExtensionName(){return this.extensionName}};var Evr=Pe(QVe(),1);var PG=class{extensionName;eventName;constructor(e,r){this.extensionName=e,this.eventName=r}getExtensionName(){return this.extensionName}getEventName(){return this.eventName}toString(){return`${this.extensionName}/${this.eventName}`}};var ho;(function(t){t[t.OnePercent=0]="OnePercent",t[t.TenPercent=1]="TenPercent",t[t.NoSampling=2]="NoSampling"})(ho||(ho={}));function nae(t){if(t.setUseDiskRetryCaching)try{t.setUseDiskRetryCaching(!0)}catch{}t.addTelemetryProcessor(e=>(e.tags??={},e.tags["ai.location.ip"]="0.0.0.0",e.tags["ai.cloud.roleInstance"]="masked",e.tags["ai.cloud.role"]="masked",e.tags["ai.device.type"]="masked",!0))}var ZVe={name:"@sap-ux/telemetry",version:"1.0.15",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:"3.15.0",axios:"1.18.0","performance-now":"2.1.0",yaml:"2.9.0"},devDependencies:{"@jest/globals":"30.4.1","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 su={azureInstrumentationKey:"",telemetryEnabled:!0,telemetryLibName:ZVe.name,telemetryLibVersion:ZVe.version,consumerModuleName:"",consumerModuleVersion:""};process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL??="true";var OG=class extends tj{clients;constructor(e,r,n){super(),this.clients=new Map,this.applicationKey=e,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(ho.OnePercent),s=this.createTelemetryClient(ho.TenPercent),o=this.createTelemetryClient(ho.NoSampling);this.clients.set(ho.OnePercent,i),this.clients.set(ho.TenPercent,s),this.clients.set(ho.NoSampling,o)}reportBlocking(e,r,n,i,s=!1){if(!s||su.telemetryEnabled){let{client:o,event:a}=this.prepareClientAndEvent(e,r,n,i);return this.trackEventBlocking(o,a)}return Promise.resolve()}async report(e,r,n,i,s,o){if(o!==void 0&&!o||!su.telemetryEnabled)return;let{client:a,event:c}=this.prepareClientAndEvent(e,r,n,i);this.trackEvent(a,c)}prepareClientAndEvent(e,r,n,i=ho.NoSampling){let s=this.clients.get(i),a={name:new PG(this.extensionName,e).toString(),properties:r,measurements:n};return{client:s,event:a}}async trackEventBlocking(e,r){process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&(e.trackEvent(r),await e.flush())}trackEvent(e,r){return process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"?(e.trackEvent(r),!0):!1}createTelemetryClient(e){let r;switch(e){case ho.OnePercent:r=1;break;case ho.TenPercent:r=10;break;case ho.NoSampling:default:r=100;break}let n=new Evr.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,nae(n),n}};var eGe=()=>{let t=new Date().getTime();return new Date(t).toISOString()};var CG=class extends OG{constructor(e,r,n){super(e,r,n)}async report(e,r,n,i,s,o){let a=await iae(s),c={v:this.extensionVersion,datetime:eGe()},u={...r,...a,...c};await super.report(e,u,n,i,s,o)}async reportEvent(e,r,n,i){let{finalProperties:s,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(e,n);return super.report(e.eventName,s,o,r,n,i)}async reportEventBlocking(e,r,n,i){let{finalProperties:s,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(e,n);return super.reportBlocking(e.eventName,s,o,r,i)}async collectToolsSuiteTelemetry(e,r){let n=await iae(r),i={v:this.extensionVersion,datetime:eGe()},s={...e.properties,...n,...i},o={...e.measurements};return{finalProperties:s,finalMeasurements:o}}};var bvr=require("node:child_process"),RG=class{run(e,r=[],n={},i){return i&&i.debug(`Running command: ${e} ${r.join(" ")}`),new Promise((s,o)=>{let a=[],c=process.platform==="win32"?{...n,shell:!0}:n,u=(0,bvr.spawn)(e,r,c);u.stdout.setEncoding("utf8");let l;u.stdout.on("data",p=>{i?.info(p.toString().replace(/[\r\n]$/,"")),l=p.toString()}),u.stderr.on("data",p=>{i?.info(p.toString().replace(/[\r\n]$/,"")),a.push(p.toString())}),u.on("error",p=>{let f=`Command failed with error: ${p.message}`;i?.error(f),o(p)}),u.on("close",p=>{if(p!==0){let f=`Command failed, \`${e} ${r.join(" ")}\`, ${a.join(", ")}`;i?.debug(f),o(f)}s(l)})})}};var Vss=Pe(Iae(),1);var Gss=Pe(I5e(),1),M5e=Pe(Ep(),1);var ATr={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 L5e="nodejs-utils",Bss=On.createInstance();async function $ss(){await Bss.init({lng:"en",fallbackLng:"en",defaultNS:L5e,ns:[L5e],resources:{en:{[L5e]:ATr}},interpolation:{escapeValue:!1},showSupportNotice:!1})}$ss().catch(()=>{});var WG=Pe(require("node:https"),1);function aM(t){WG.default.globalAgent.options&&(WG.default.globalAgent.options.rejectUnauthorized=t),WG.default.globalAgent.fallbackAgent?.options&&(WG.default.globalAgent.fallbackAgent.options.rejectUnauthorized=t)}var mh=Pe(g8e(),1),Zxr=Pe(Qxr(),1);var Qs=class extends Error{code;constructor(e,r){super(e),this.code=r,this.name=this.constructor.name}};var ua=Object.freeze({yamlParsing:"yamlParsing",nodeNotFound:"nodeNotFound",nodeNotFoundMatching:"nodeNotFoundMatching",nodeNotAMap:"nodeNotAMap",propertyNotFound:"propertyNotFound",pathCannotBeEmpty:"pathCannotBeEmpty",pathDoesNotExist:"pathDoesNotExist",seqDoesNotExist:"seqDoesNotExist",tryingToAppendToNonSequence:"tryingToAppendToNonSequence",startNodeMustBeCollection:"startNodeMustBeCollection",scalarValuesDoNotHaveProperties:"scalarValuesDoNotHaveProperties"}),lu=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 hh(t,e){try{return e?t?.replace(/{{-?([^{}]*)}}/g,(r,n)=>{let i=n?.trim();return e[i]?.toString()||r}):t}catch{return""}}var AH=class t{documents;static async newInstance(e){return new t(e)}constructor(e){this.documents=mh.default.parseAllDocuments(e),this.documents.length===0&&this.documents.push(mh.default.parseDocument(e));let r=this.documents.filter(n=>n.errors.length>0);if(r.length>0)throw new Qs(lu.yamlParsing+`
2273
+ `);let e=new jl("!xml"),r=e,n="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let i=this.options,s=new Wq(i.processEntities),o=t.length;for(let a=0;a<o;a++)if(t[a]==="<"){let u=t.charCodeAt(a+1);if(u===47){let l=xR(t,">",a,"Closing Tag is not closed."),p=t.substring(a+2,l).trim();if(i.removeNSPrefix){let h=p.indexOf(":");h!==-1&&(p=p.substr(h+1))}p=U0e(i.transformTagName,p,"",i).tagName,r&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher));let f=this.matcher.getCurrentTag();if(p&&i.unpairedTagsSet.has(p))throw new Error(`Unpaired tag can not be used as closing tag: </${p}>`);f&&i.unpairedTagsSet.has(f)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=this.tagsNodeStack.pop(),n="",a=l}else if(u===63){let l=j0e(t,a,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let p=this.buildAttributesMap(l.tagExp,this.matcher,l.tagName,!0);if(p){let f=p[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(f)||1),s.setXmlVersion(Number(f)||1)}if(!(i.ignoreDeclaration&&l.tagName==="?xml"||i.ignorePiTags)){let f=new jl(l.tagName);f.add(i.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&i.ignoreAttributes!==!0&&(f[":@"]=p),this.addChild(r,f,this.readonlyMatcher,a)}a=l.closeIndex+1}else if(u===33&&t.charCodeAt(a+2)===45&&t.charCodeAt(a+3)===45){let l=xR(t,"-->",a+4,"Comment is not closed.");if(i.commentPropName){let p=t.substring(a+4,l-2);n=this.saveTextToParentTag(n,r,this.readonlyMatcher),r.add(i.commentPropName,[{[i.textNodeName]:p}])}a=l}else if(u===33&&t.charCodeAt(a+2)===68){let l=s.readDocType(t,a);this.entityDecoder.addInputEntities(l.entities),a=l.i}else if(u===33&&t.charCodeAt(a+2)===91){let l=xR(t,"]]>",a,"CDATA is not closed.")-2,p=t.substring(a+9,l);n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let f=this.parseTextData(p,r.tagname,this.readonlyMatcher,!0,!1,!0,!0);f==null&&(f=""),i.cdataPropName?r.add(i.cdataPropName,[{[i.textNodeName]:p}]):r.add(i.textNodeName,f),a=l+2}else{let l=j0e(t,a,i.removeNSPrefix);if(!l){let R=t.substring(Math.max(0,a-50),Math.min(o,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${R}"`)}let p=l.tagName,f=l.rawTagName,h=l.tagExp,d=l.attrExpPresent,m=l.closeIndex;if({tagName:p,tagExp:h}=U0e(i.transformTagName,p,h,i),i.strictReservedNames&&(p===i.commentPropName||p===i.cdataPropName||p===i.textNodeName||p===i.attributesGroupName))throw new Error(`Invalid tag name: ${p}`);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 b=!1;h.length>0&&h.lastIndexOf("/")===h.length-1&&(b=!0,p[p.length-1]==="/"?(p=p.substr(0,p.length-1),h=p):h=h.substr(0,h.length-1),d=p!==h);let T=null,S={},A;A=eOn(f),p!==e.tagname&&this.matcher.push(p,{},A),p!==h&&d&&(T=this.buildAttributesMap(h,this.matcher,p),T&&(S=ZPn(T,i))),p!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let x=a;if(this.isCurrentNodeStopNode){let R="";if(b)a=l.closeIndex;else if(i.unpairedTagsSet.has(p))a=l.closeIndex;else{let O=this.readStopNodeData(t,f,m+1);if(!O)throw new Error(`Unexpected end of ${f}`);a=O.i,R=O.tagContent}let M=new jl(p);T&&(M[":@"]=T),M.add(i.textNodeName,R),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(r,M,this.readonlyMatcher,x)}else{if(b){({tagName:p,tagExp:h}=U0e(i.transformTagName,p,h,i));let R=new jl(p);T&&(R[":@"]=T),this.addChild(r,R,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(i.unpairedTagsSet.has(p)){let R=new jl(p);T&&(R[":@"]=T),this.addChild(r,R,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=!1,a=l.closeIndex;continue}else{let R=new jl(p);if(this.tagsNodeStack.length>i.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),T&&(R[":@"]=T),this.addChild(r,R,this.readonlyMatcher,x),r=R}n="",a=m}}}else n+=t[a];return e.child};function oOn(t,e,r,n){this.options.captureMetaData||(n=void 0);let i=this.options.jPath?r.toString():r,s=this.options.updateTag(e.tagname,i,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),t.addChild(e,n))}function aOn(t,e,r){let n=this.options.processEntities;if(!n||!n.enabled)return t;if(n.allowedTags){let i=this.options.jPath?r.toString():r;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,i)))return t}if(n.tagFilter){let i=this.options.jPath?r.toString():r;if(!n.tagFilter(e,i))return t}return this.entityDecoder.decode(t)}function cOn(t,e,r,n){return t&&(n===void 0&&(n=e.child.length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function uOn(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function lOn(t,e,r=">"){let n=0,i=t.length,s=r.charCodeAt(0),o=r.length>1?r.charCodeAt(1):-1,a="",c=e;for(let u=e;u<i;u++){let l=t.charCodeAt(u);if(n)l===n&&(n=0);else if(l===34||l===39)n=l;else if(l===s)if(o!==-1){if(t.charCodeAt(u+1)===o)return a+=t.substring(c,u),{data:a,index:u}}else return a+=t.substring(c,u),{data:a,index:u};else l===9&&!n&&(a+=t.substring(c,u)+" ",c=u+1)}}function xR(t,e,r,n){let i=t.indexOf(e,r);if(i===-1)throw new Error(n);return i+e.length-1}function pOn(t,e,r,n){let i=t.indexOf(e,r);if(i===-1)throw new Error(n);return i}function j0e(t,e,r,n=">"){let i=lOn(t,e+1,n);if(!i)return;let s=i.data,o=i.index,a=s.search(/\s/),c=s,u=!0;a!==-1&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());let l=c;if(r){let p=c.indexOf(":");p!==-1&&(c=c.substr(p+1),u=c!==i.data.substr(p+1))}return{tagName:c,tagExp:s,closeIndex:o,attrExpPresent:u,rawTagName:l}}function fOn(t,e,r){let n=r,i=1,s=t.length;for(;r<s;r++)if(t[r]==="<"){let o=t.charCodeAt(r+1);if(o===47){let a=pOn(t,">",r,`${e} is not closed`);if(t.substring(r+2,a).trim()===e&&(i--,i===0))return{tagContent:t.substring(n,r),i:a};r=a}else if(o===63)r=xR(t,"?>",r+1,"StopNode is not closed.");else if(o===33&&t.charCodeAt(r+2)===45&&t.charCodeAt(r+3)===45)r=xR(t,"-->",r+3,"StopNode is not closed.");else if(o===33&&t.charCodeAt(r+2)===91)r=xR(t,"]]>",r,"StopNode is not closed.")-2;else{let a=j0e(t,r,!1);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&i++,r=a.closeIndex)}}}function B0e(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:k0e(t,r)}else return jgt(t)?t:""}function U0e(t,e,r,n){if(t){let i=t(e);r===e&&(r=i),e=i}return e=lyt(e,n),{tagName:e,tagExp:r}}function lyt(t,e){if(TW.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return Vq.includes(t)?e.onDangerousProperty(t):t}var $0e=jl.getMetaDataSymbol();function dOn(t,e){if(!t||typeof t!="object")return{};if(!e)return t;let r={};for(let n in t)if(n.startsWith(e)){let i=n.substring(e.length);r[i]=t[n]}else r[n]=t[n];return r}function V0e(t,e,r,n){return pyt(t,e,r,n)}function pyt(t,e,r,n){let i,s={};for(let o=0;o<t.length;o++){let a=t[o],c=hOn(a);if(c!==void 0&&c!==e.textNodeName){let u=dOn(a[":@"]||{},e.attributeNamePrefix);r.push(c,u)}if(c===e.textNodeName)i===void 0?i=a[c]:i+=""+a[c];else{if(c===void 0)continue;if(a[c]){let u=pyt(a[c],e,r,n),l=gOn(u,e);if(Object.keys(u).length===0&&e.alwaysCreateTextNode&&(u[e.textNodeName]=""),a[":@"]?mOn(u,a[":@"],n,e):Object.keys(u).length===1&&u[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?u=u[e.textNodeName]:Object.keys(u).length===0&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""),a[$0e]!==void 0&&typeof u=="object"&&u!==null&&(u[$0e]=a[$0e]),s[c]!==void 0&&Object.prototype.hasOwnProperty.call(s,c))Array.isArray(s[c])||(s[c]=[s[c]]),s[c].push(u);else{let p=e.jPath?n.toString():n;e.isArray(c,p,l)?s[c]=[u]:s[c]=u}c!==void 0&&c!==e.textNodeName&&r.pop()}}}return typeof i=="string"?i.length>0&&(s[e.textNodeName]=i):i!==void 0&&(s[e.textNodeName]=i),s}function hOn(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function mOn(t,e,r,n){if(e){let i=Object.keys(e),s=i.length;for(let o=0;o<s;o++){let a=i[o],c=a.startsWith(n.attributeNamePrefix)?a.substring(n.attributeNamePrefix.length):a,u=n.jPath?r.toString()+"."+c:r;n.isArray(a,u,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function gOn(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}var qg=class{constructor(e){this.externalEntities={},this.options=oyt(e)}parse(e,r){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let s=AW(e,r);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}let n=new Kq(this.options,this.externalEntities),i=n.parseXml(e);return this.options.preserveOrder||i===void 0?i:V0e(i,this.options,n.matcher,n.readonlyMatcher)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}static getMetaDataSymbol(){return jl.getMetaDataSymbol()}};var PR={validate:AW};var rS=class extends Il{static ADT_DISCOVERY_SERVICE_PATH="/sap/bc/adt/discovery";schemaStore=new bW;log;async getServiceDefinition(e){await this.checkOrLoadAdtDiscoverySchema();let r=this.schemaStore.getAdtCollection(e);return this.validateServiceSchema(e,r)?r:(this.log.warn("Invalid Discovery Schema"),null)}validateServiceSchema(e,r){return r?r.href?!0:(this.log.warn(`Empty href in schema: ${e.term} - ${e.scheme}`),!1):(this.log.warn(`Schema Not Found: ${e.term} - ${e.scheme}`),!1)}async checkOrLoadAdtDiscoverySchema(){if(!this.schemaStore.isAdtSchemaEmpty())return;let e=await this.get("",{headers:{Accept:"application/*"}}),r=this.parseAdtSchemaData(e.data);this.schemaStore.updateSchemaData(r)}parseAdtSchemaData(e){if(PR.validate(e)!==!0)return null;let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0},i=new qg(r).parse(e,!0);return i.service?i:null}};var sv=class extends Il{static PATH="/sap/bc/ui2/app_index";log;async search(e={},r){let n={...e};r&&(n.fields=r.join(","));let i=await this.get("/",{params:n});return JSON.parse(i.data).results}async getIsManiFirstSupported(e){try{let r={id:e},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: ${e}.`),this.log.debug(r),r}}async getAppInfo(e){try{let r=await this.get("/ui5_app_info_json",{params:{id:e}});return JSON.parse(r.data)}catch(r){throw b6(r)?this.log.error(`Failed fetching ui5_app_info_json for app with id ${e}.`):this.log.error(`Parsing error: ui5_app_info_json is not in expected format for app with id ${e}.`),this.log.debug(r),r}}};var Yq={UI:"UI",NotClassified:"Not Classified",WebApi:"WEB_API",NotDetermined:"Not Determined"},OR=class extends Ub{entitySet;services;isS4Cloud;async listServices(e=!1){return this.services||(this.services=await this.fetchServices(e)),this.services}};var fyt="ServiceCollection",dyt="RecommendedServiceCollection",yOn="((IsSapService%20eq%20true)and(ReleaseStatus%20eq%20%27RELEASED%27))or((IsSapService%20eq%20false))",nS=class extends OR{static PATH="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2";async determineEntitySet(){let e=await this.document();this.entitySet=e.EntitySets.includes(dyt)?dyt:fyt}getServicePath(e,r){let n;try{n=new URL(e)}catch{n=new URL(e,r)}return n.pathname}mapServices(e){return e.map(r=>{let n=this.getServicePath(r.ServiceUrl,this.defaults.baseURL);return{id:r.ID,name:r.TechnicalServiceName,path:n,serviceVersion:r.TechnicalServiceVersion+"",odataVersion:zr.v2,serviceType:r.ServiceType}})}async fetchServices(){let e={$format:"json"};this.entitySet||await this.determineEntitySet(),this.entitySet===fyt&&await this.isS4Cloud&&(e.$filter=yOn);let n=(await this.get(`/${this.entitySet}`,{params:e})).odata();if(Tg.containsError(n))throw new Tg(n);return this.mapServices(n)}async findService({title:e,path:r}){let n=1;if(!e){let c=r.replace(/\/$/,"").split("/").pop().split(";");if(e=c[0].toUpperCase(),!e)throw new Error(`Cannot determine service title from path: ${r}`);c.slice(1).forEach(l=>{let[p,f]=l.split("=");p==="v"&&(n=Number.parseInt(f,10))})}let i={$format:"json",$filter:`Title eq '${e}' and TechnicalServiceVersion eq ${n}`},s=this.entitySet?`/${this.entitySet}`:"/ServiceCollection",a=(await this.get(s,{params:i})).odata();if(a.length>1){let c=a.filter(u=>u.ServiceUrl?.toUpperCase().includes((r||e).toUpperCase()));if(c.length>1)this.log.warn("Service filter was not sufficient to identify one service.");else if(c.length>0)return this.log.info(`Service filter chose service: ${c[0].TechnicalServiceName}`),c[0]}return a.length>0?a[0]:void 0}async getServiceAnnotations({id:e,title:r,path:n}){if(!e){let i=await this.findService({title:r,path:n});i&&(e=i.ID)}return e?(await this.get(`/ServiceCollection('${encodeURIComponent(e)}')/Annotations`,{params:{$format:"json"}})).odata():[]}async getAnnotations({id:e,title:r,path:n}){if(!e&&!r&&!n)throw new Error("No filter parameters passed in");let i=await this.getServiceAnnotations({id:e,title:r,path:n}),s=[];for(let o of i){let a=`/Annotations(TechnicalName='${encodeURIComponent(o.TechnicalName)}',Version='${o.Version}')/$value/`,c=await this.get(a,{headers:{Accept:"application/xml"}});c.data?s.push({TechnicalName:o.TechnicalName,Version:o.Version,Definitions:c.data,Uri:this.defaults.baseURL+a}):this.log.warn(`No annotations found for TechnicalName=${o.TechnicalName}, Version=${o.Version}`)}return s}async getServiceType(e){let r,{ID:n}=await this.findService({path:e});if(n){let i=await this.get(`/ServiceTypeForHUBServices('${encodeURIComponent(n)}')`);i&&(r=i.odata().ServiceType)}return r}};var hyt="RecommendedServices",myt="Services",CR=class extends OR{logger=new va;static PATH="/sap/opu/odata4/iwfnd/config/default/iwfnd/catalog/0002";mapServices(e,r,n=!1){let i=[],s=new Set;return e.filter(o=>o?.DefaultSystem?.[r]?.length>0).forEach(o=>{i.push(...o.DefaultSystem[r].flatMap(a=>{let c=a.ServiceUrl.split("?").shift();if(n){let u=`${a.ServiceId}|${c}`;if(s.has(u))return[];s.add(u)}return{id:a.ServiceId,group:o.GroupId,path:c,name:`${o.GroupId} > ${a.ServiceAlias||a.ServiceId}`,serviceVersion:a.ServiceVersion,odataVersion:zr.v4,serviceType:a.ServiceType}}))}),i}async fetchServicesNextLink(){if(this.entitySet===void 0){let o=await this.metadata();this.entitySet=o.includes('Name="RecommendedServices"')?hyt:myt}let e=new URLSearchParams([["$count","true"],["$expand",`DefaultSystem($expand=${this.entitySet})`]]),n=(await this.get("/ServiceGroups",{params:e},!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.`),Tg.containsError(i))throw new Tg(i);return this.mapServices(i,this.entitySet)}async fetchServices(e=!1){return e?this.fetchServicesNextLink():this.fetchServicesParallel()}async fetchServicesParallel(){if(this.entitySet===void 0){let u=await this.metadata();this.entitySet=u.includes('Name="RecommendedServices"')?hyt:myt}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),c=1;if(!Number.isNaN(a)){let u=Math.ceil(o/a),l=Array.from({length:u-1},(f,h)=>{let d=new URLSearchParams([["$count","true"],["$skip",String((h+1)*a)],["$top",a.toString()],["$expand",`DefaultSystem($expand=${this.entitySet})`]]);return c++,this.get("/ServiceGroups",{params:d},!0)});(await Promise.all(l)).forEach(f=>{let h=f.odata();s.push(...h.value)})}if(this.logger.log(`Fetched ${s.length} service groups in ${c} requests.`),Tg.containsError(s))throw new Tg(s);return this.mapServices(s,this.entitySet,!0)}getAnnotations(){return Promise.resolve([])}getServiceType(){return Promise.resolve(void 0)}};var Xq;(function(t){t.SAP="SAP",t.Customer="CUSTOMER"})(Xq||(Xq={}));var Ls=class extends Il{log;serviceSchema;static getAdtCatagory(){throw new Error("NEEDS TO BE IMPLEMENTED BY AdtService SUBCLASSES")}attachAdtSchema(e){this.serviceSchema=e}parseResponse(e){if(PR.validate(e)!==!0)return this.log.warn(`Invalid XML: ${e}`),{};let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0};return new qg(r).parse(e,!0)}};var Jq=class t extends Ls{static adtCategory={scheme:"http://www.sap.com/adt/categories/ato",term:"settings"};static getAdtCatagory(){return t.adtCategory}async getAtoInfo(){let e={headers:{Accept:"application/*"}},r=await this.get("",e);return this.parseAtoResponse(r.data)}parseAtoResponse(e){if(PR.validate(e)!==!0)return this.log.warn(`Invalid XML: ${e}`),{};let r={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0},i=new qg(r).parse(e,!0);return i.settings?i.settings:{}}};var u_t=Pe(gyt(),1),KOn=Pe(c_t(),1);var lU=class t extends Ls{static adtCategory={scheme:"http://www.sap.com/adt/categories/respository",term:"generators"};static getAdtCatagory(){return t.adtCategory}async getUIServiceGeneratorConfig(e){let r=await this.get("",{headers:{Accept:"application/atom+xml;type=feed"},params:{referencedObject:e,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 pU=class t extends Ls{static adtCategory={scheme:"http://www.sap.com/adt/categories/respository",term:"generators"};static getAdtCatagory(){return t.adtCategory}id;async getRAPGeneratorConfig(){let e=await this.get("",{headers:{Accept:"application/atom+xml;type=feed"},params:{type:"webapi",fetchAllGenerators:!0}}),r=this.parseResponse(e.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 fU=class extends Ls{packageName;contentType;configure(e,r){this.packageName=r}setContentType(e){this.contentType=e}async validate(e){let r=await this.post("/validation",e,{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(e){let r=await this.post("/preview",e,{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(e){return(await this.post("",e,{headers:{"Content-Type":this.contentType,Accept:"application/vnd.sap.adt.repository.generator.v1+json"},params:{package:this.packageName}})).status}parseValidateResponse(e){let n=this.parseResponse(e).validationMessages;return Array.isArray(n)||(n=[n]),n.map(i=>i.validationMessage||{})||[]}parsePreviewResponse(e){let n=(this.parseResponse(e).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 UR=class extends Ls{referencedObject;contentType;configure(e,r,n){this.referencedObject=r,this.contentType=n}async getSchema(){let e=await this.get("/schema",{headers:{Accept:"application/vnd.sap.adt.repository.generator.schema.v1+json"},params:{referencedObject:this.referencedObject.uri}});return JSON.parse(e.data)}async getContent(e){let n=(await this.get("/content",{headers:{Accept:this.contentType},params:{referencedObject:this.referencedObject.uri,package:e}})).data,i=JSON.parse(n);return i.metadata||(i.metadata={package:e}),JSON.stringify(i)}async validatePackage(e){let r=await this.get("/validation",{headers:{Accept:"application/vnd.sap.adt.validationMessages.v1+xml"},params:{referencedObject:this.referencedObject.uri,package:e,checks:"package"}});return this.parseResponse(r.data)}async validateContent(e){let r=await this.post("/validation",e,{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(e,r){let n=await this.post("",e,{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 jW=class extends Ls{async getSystemInfo(){let e={headers:{Accept:"application/vnd.sap.adt.core.http.systeminformation.v1+json"}},r=await this.get("/sap/bc/adt/core/http/systeminformation",e);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 dU=class extends Il{static PATH="/sap/public/bc/ui5_ui5";log;async getUI5Version(){try{let e=await this.get("/bootstrap_info.json",{transformResponse:n=>JSON.parse(n)}),{Version:r}=e.data;if(!r)throw new Error("UI5 version not provided.");return r}catch(e){throw this.log.error("Could not get UI5 Version."),this.log.debug(e),e}}};var Hl=class extends tS{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 e=this.createService("",jW);this._systemInfo=await e.getSystemInfo()}catch(e){this.log.error(`An error occurred retrieving system info: ${e}`)}return this._systemInfo}setAtoInfo(e){this.atoSettings=e}async getAtoInfo(){if(this.atoSettings)return this.atoSettings;let e;try{e=await this.getAdtService(Jq),e?this.atoSettings=await e.getAtoInfo():this.atoSettings={}}catch{this.atoSettings={}}return this.atoSettings}set publicUrl(e){this._publicUrl=e}get publicUrl(){return this._publicUrl||this.defaults.baseURL}async isAbapCloud(){return this.atoSettings===void 0&&await this.getAtoInfo(),this.atoSettings.tenantType===Xq.Customer&&this.atoSettings.operationsType==="C"}getAdtCatalogService(){if(!this.services[rS.ADT_DISCOVERY_SERVICE_PATH]){let e=this.createService(rS.ADT_DISCOVERY_SERVICE_PATH,rS);this.services[rS.ADT_DISCOVERY_SERVICE_PATH]=e}return this.services[rS.ADT_DISCOVERY_SERVICE_PATH]}catalog(e){let r;if(e===zr.v2)r=this.services[nS.PATH]??this.createService(nS.PATH,nS);else if(e===zr.v4)r=this.services[CR.PATH]??this.createService(CR.PATH,CR);else throw new Error("not implemented yet");return Object.defineProperty(r,"isAbapCloud",{get:this.isAbapCloud.bind(this)}),r}getUi5AbapRepository(e){let r=e??bR.PATH;return this.services[r]||(this.services[r]=this.createService(r,bR)),this.services[r]}getAppIndex(){return this.services[sv.PATH]||(this.services[sv.PATH]=this.createService(sv.PATH,sv)),this.services[sv.PATH]}getLayeredRepository(e){let r=e??SR.PATH;return this.services[r]||(this.services[r]=this.createService(r,SR)),this.services[r]}async getAdtService(e){let r=e.name;if(!this.services[r]){let i=await this.getAdtCatalogService().getServiceDefinition(e.getAdtCatagory());if(!i)return null;this.services[r]=this.createService(i.href,e),this.services[r].attachAdtSchema(i)}return this.services[r]}getUI5VersionService(){let e=dU.PATH;return this.services[e]||(this.services[e]=this.createService(e,dU)),this.services[e]}async getUiServiceGenerator(e){let r=await this.getAdtService(lU);if(!r)throw new Error("Generators are not supported on this system");let n=await r.getUIServiceGeneratorConfig(e.uri),i=this.createService(this.getServiceUrlFromConfig(n),UR);return i.configure(n,e,this.getContentType(n)),i}async getODataServiceGenerator(e){let r=await this.getAdtService(pU);if(!r)throw new Error("RAP Generator are not support on this system");let n=await r.getRAPGeneratorConfig(),i=this.createService(this.getServiceUrlFromConfig(n),fU);return i.setContentType(this.getContentType(n)),i.configure(n,e||"$TMP"),i}async fetchExternalServices(e){let r=[],n=e.map(async i=>{let{serviceRootPath:s,value:o}=i,a=(0,l_t.join)(s,o).replace("/$metadata",""),c=this.service(a);try{let u=await c.metadata();i.type==="value-list"?r.push({type:"value-list",path:a,target:i.target,metadata:u}):i.type==="code-list"&&r.push({type:"code-list",path:a,metadata:u})}catch(u){this.log.warn(`Could not fetch value list reference metadata from ${a}, ${u.message}`)}});return await Promise.allSettled(n),r}getServiceUrlFromConfig(e){if(Array.isArray(e.link)&&!e.link[0]?.href)throw new Error("No service URL found in the generator config");let r=e.link[0].href.indexOf(e.id)+e.id.length;return e.link[0].href.substring(0,r)}getContentType(e){return(e.link?.find(n=>typeof n.href=="string"&&n.href.includes("/content"))).type}async createLockServiceBindingGenerator(e){return this.createService(e,UR)}};var gAt=Pe(F0t(),1),Jg=Pe(o7(),1);var yS;(function(t){t.H2O_URL="H2O_URL",t.HTTP_PROXY="HTTP_PROXY",t.HTTPS_PROXY="HTTPS_PROXY"})(yS||(yS={}));var a7;(function(t){t.HTTP="HTTP",t.LDAP="LDAP",t.MAIL="MAIL",t.RFC="RFC"})(a7||(a7={}));var c7;(function(t){t.DEDICATED="Dedicated",t.COMMON="Common"})(c7||(c7={}));var Xg;(function(t){t.BASIC_AUTHENTICATION="BasicAuthentication",t.CLIENT_CERT_AUTHENTICATION="ClientCertificateAuthentication",t.NO_AUTHENTICATION="NoAuthentication",t.OAUTH2_CLIENT_CREDENTIALS="OAuth2ClientCredentials",t.OAUTH2_JWT_BEARER="OAuth2JWTBearer",t.OAUTH2_PASSWORD="OAuth2Password",t.OAUTH2_REFRESH_TOKEN="OAuth2RefreshToken",t.OAUTH2_SAML_BEARER_ASSERTION="OAuth2SAMLBearerAssertion",t.OAUTH2_USER_TOKEN_EXCHANGE="OAuth2UserTokenExchange",t.SAML_ASSERTION="SAMLAssertion"})(Xg||(Xg={}));var u7;(function(t){t.S4HC="S4HC",t.BTP="BTP"})(u7||(u7={}));var Awe;(function(t){t.ON_PREMISE="OnPremise",t.INTERNET="Internet",t.PRIVATE_LINK="PrivateLink"})(Awe||(Awe={}));var Pw;(function(t){t.ODATA_GENERIC="odata_gen",t.ODATA_ABAP="odata_abap",t.DEV_ABAP="dev_abap",t.ABAP_CLOUD="abap_cloud"})(Pw||(Pw={}));var l7;(function(t){t.FULL_URL="full_url",t.API_MGMT="api_mgmt"})(l7||(l7={}));var XU;(function(t){t.ON_PREMISE="OnPremise",t.INTERNET="Internet",t.PRIVATE_LINK="PrivateLink"})(XU||(XU={}));function fAt(t){return!!(t.WebIDEUsage?.includes("abap")||t["sap-client"]||t["sap-platform"]?.toLocaleLowerCase()==="abap"||t.ProxyType==="OnPremise")}function Eqn(t){return!!(t.WebIDEUsage?.includes(Pw.ABAP_CLOUD)||t["sap-platform"]?.toLocaleLowerCase()==="abap")}function p7(t){return!!(t.WebIDEUsage?.includes(Pw.ODATA_GENERIC)&&!t.WebIDEUsage.includes(Pw.ODATA_ABAP))}function cm(t){return!!(!t.WebIDEAdditionalData?.includes(l7.FULL_URL)&&p7(t))}function _S(t){return!!(t.WebIDEAdditionalData?.includes(l7.FULL_URL)&&p7(t))}function dAt(t){return!!t.ProxyType.includes(XU.ON_PREMISE)}function hAt(t){return!!t["HTML5.DynamicDestination"]}function bqn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pAt(t,e){let r=` (${e})`;return RegExp(`${bqn(r)}$`).exec(t.trim())?t:`${t} (${e})`}function mAt(t,e){let r=e?` [${e}]`:"",n;return Eqn(t)?n=pAt(t.Name,u7.BTP):wwe(t)?n=pAt(t.Name,u7.S4HC):n=t.Name,`${n}${r}`}function wwe(t){return!!(t.WebIDEUsage?.includes(Pw.ODATA_ABAP)&&t.Authentication===Xg.SAML_ASSERTION&&t.ProxyType===Awe.INTERNET)}function f7(t){return!!t.WebIDEUsage?.includes(Pw.ODATA_ABAP)}var bv={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 xwe="abap-cloud-destination-instance",yAt="bas-destination-instance-cred";function kn(){return!!process.env[yS.H2O_URL]}async function _At(t){try{let e=await(0,Jg.cfGetInstanceKeyParameters)(t);if(!e)throw new Error(`No destination instance ${t} found`);let r=e.credentials;if(!r)throw new Error(`No credentials for destination instance ${t} found`);let n=r.uaa?.clientid||r.clientid,i=r.uaa?.clientsecret||r.clientsecret;return Buffer.from(`${encodeURIComponent(n)}:${encodeURIComponent(i)}`).toString("base64")}catch(e){throw new Error(`An error occurred while retrieving service key for the destination instance ${t}: ${e}`)}}function g1(t,e){let r=`https://${t}.dest`;return e&&e.length>1?new URL(e,r).toString():r}function Sqn(t){let[e,...r]=t.split(".");return[e.replace(/-api$/,""),...r].join(".")}async function Pwe(t){let e={};await Dl.get("/reload",{baseURL:process.env[yS.HTTP_PROXY]}),Tqn();let r=await Dl.get("/api/listDestinations",{baseURL:process.env[yS.H2O_URL]});return(Array.isArray(r.data)?r.data:[]).forEach(i=>{t?.stripS4HCApiHosts&&wwe(i)&&(i.Host=Sqn(i.Host)),i.WebIDEEnabled&&(e[i.Name]=i)}),e}function Tqn(){!kn()||!globalThis.GLOBAL_AGENT||(globalThis.GLOBAL_AGENT.HTTP_PROXY||(globalThis.GLOBAL_AGENT.HTTP_PROXY=process.env[yS.HTTP_PROXY]??null),globalThis.GLOBAL_AGENT.HTTPS_PROXY||(globalThis.GLOBAL_AGENT.HTTPS_PROXY=process.env[yS.HTTPS_PROXY]??null))}function Aqn(t,e,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:c7.DEDICATED};return{name:t,description:e,url:new URL(n),type:a7.HTTP,proxyType:XU.INTERNET,basProperties:i,credentials:{authentication:Xg.OAUTH2_USER_TOKEN_EXCHANGE,oauth2UserTokenExchange:s}}}async function Owe(t){let e=await(0,Jg.cfGetTarget)(!0);if(!e.space)throw new Error("No Dev Space has been created for the subaccount.");return`abap-cloud-${`${t}-${e.org}-${e.space}`.replace(/\W/gi,"-").toLowerCase()}`.substring(0,199)}async function wqn(t,e,r,n){let i=await Owe(t);return(await(0,Jg.apiGetServicesInstancesFilteredByType)(["destination"])).find(a=>a.label===xwe)||(await(0,Jg.apiCreateServiceInstance)("destination","lite",xwe,null),n?.info(`New ABAP destination instance ${xwe} created.`)),Aqn(i,`Destination generated by App Studio for Cloud Foundry Abap service instance: '${t}', Do not remove.`,e,r)}async function vAt(t,e,r){if(!kn())throw new Error("Creating a SAP BTP destinations is only supported on SAP Business Application Studio.");let n=e;try{if(!n){let a=await(0,Jg.apiGetInstanceCredentials)(t);if(!a?.credentials)throw new Error(`Could not retrieve SAP BTP credentials for ${t}.`);n={uaaCredentials:a.credentials.uaa,hostUrl:a.credentials.url}}let i=await wqn(t,n.uaaCredentials,n.hostUrl,r);await gAt.destinations.createDestination(i),r?.debug(`SAP BTP destination ${JSON.stringify(i,null,2)} created.`);let o=(await Pwe())?.[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 ${t}: ${i}`)}}var kAt=Pe(h7(),1),FAt=require("node:https"),qAt=Pe(_7(),1),UAt=Pe(F6(),1),jAt=Pe(MAt(),1),BAt=require("node:util");var Nwe=class extends qAt.HttpsProxyAgent{extraOptions;constructor(e,r){super(e,r),this.extraOptions=r}async connect(e,r){return super.connect(e,{...this.extraOptions,...r})}};function Ow(t,e){let r=(0,UAt.default)(e),n={rejectUnauthorized:!r.ignoreCertErrors};r.httpsAgent||(r.httpsAgent=new FAt.Agent(n)),delete r.ignoreCertErrors,r.withCredentials=r?.auth&&Object.keys(r.auth).length>0,r.validateStatus=s=>s<400;let i=new t(r);return i.interceptors.request.use(s=>{let o=i.getUri(s),a=(0,jAt.getProxyForUrl)(o);return a&&!kn()&&(s.httpsAgent=new Nwe(a,n),s.httpAgent=new kAt.HttpProxyAgent(a),s.proxy=!1),s}),i.defaults.headers=i.defaults.headers??{common:{},delete:{},put:{},get:{},post:{},head:{},patch:{}},Nmt(i),r.auth?.password&&Dgt(i),e.cookies&&e.cookies.split(";").forEach(s=>{i.cookies.addCookie(s.trim())}),$q.isPatchRequired(e.baseURL)&&$q.apply(),i}function $At(t){return typeof t=="string"?Ow(tS,{baseURL:t}):Ow(tS,t)}function Rw(t){return Ow(Hl,t)}var Cw;(function(t){t.Standalone="Standalone",t.EmbeddedSteampunk="EmbeddedSteampunk"})(Cw||(Cw={}));function Dwe(t){let e;switch(t.environment){case Cw.Standalone:{let{service:r,refreshToken:n,refreshTokenChangedCb:i,cookies:s,...o}=t;e=Ow(Hl,{baseURL:r.url,cookies:s,...o}),s||(t.service?.uaa?.username&&t.service.uaa.password?Igt(e,r,n,i):w0e({provider:e}));break}case Cw.EmbeddedSteampunk:{let{url:r,cookies:n,...i}=t;e=Ow(Hl,{baseURL:r,cookies:n,...i}),n||w0e({provider:e});break}default:{let r=t;throw new Error(`Unknown environment type supplied: ${(0,BAt.inspect)(r)}`)}}return e}function VAt(t,e,r){let{cookies:n,...i}=t,s={...i,baseURL:g1(e.Name,e.Host?new URL(e.Host).pathname:void 0),cookies:n};s.params=s.params??{},s.params.saml2="disabled";let o;if(fAt(e)?(o=Ow(Hl,s),o.publicUrl=e.Host):o=Ow(tS,s),r){let a=o.interceptors.request.use(async c=>{let u=await _At(r);return o.defaults.headers.common[yAt]=u,o.interceptors.request.eject(a),c})}return o}var GAt;(function(t){t.FF_SIMPLE="basic"})(GAt||(GAt={}));var HAt;(function(t){t.FE_FPM="fpm",t.FE_LROP="lrop",t.FE_OVP="ovp",t.FE_ALP="alp",t.FE_FEOP="feop",t.FE_WORKLIST="worklist"})(HAt||(HAt={}));var gi={vscode:{name:"Visual Studio Code",technical:"VSCode"},bas:{name:"SAP Business Application Studio",technical:"SBAS"},cli:{name:"CLI",technical:"CLI"}};var zAt;(function(t){t.CF="CF",t.ABAP="ABAP"})(zAt||(zAt={}));function aUn(){return!!(process.argv[1]?.includes("yo")||process.stdin.isTTY)}function Ad(){return aUn()?gi.cli:kn()?gi.bas:gi.vscode}var sr=t=>typeof t=="string",QU=()=>{let t,e,r=new Promise((n,i)=>{t=n,e=i});return r.resolve=t,r.reject=e,r},WAt=t=>t==null?"":""+t,cUn=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},uUn=/###/g,KAt=t=>t&&t.indexOf("###")>-1?t.replace(uUn,"."):t,YAt=t=>!t||sr(t),ZU=(t,e,r)=>{let n=sr(e)?e.split("."):e,i=0;for(;i<n.length-1;){if(YAt(t))return{};let s=KAt(n[i]);!t[s]&&r&&(t[s]=new r),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++i}return YAt(t)?{}:{obj:t,k:KAt(n[i])}},XAt=(t,e,r)=>{let{obj:n,k:i}=ZU(t,e,Object);if(n!==void 0||e.length===1){n[i]=r;return}let s=e[e.length-1],o=e.slice(0,e.length-1),a=ZU(t,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=ZU(t,o,Object),a?.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=r},lUn=(t,e,r,n)=>{let{obj:i,k:s}=ZU(t,e,Object);i[s]=i[s]||[],i[s].push(r)},E7=(t,e)=>{let{obj:r,k:n}=ZU(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},pUn=(t,e,r)=>{let n=E7(t,r);return n!==void 0?n:E7(e,r)},nwt=(t,e,r)=>{for(let n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?sr(t[n])||t[n]instanceof String||sr(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):nwt(t[n],e[n],r):t[n]=e[n]);return t},Nw=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),fUn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},dUn=t=>sr(t)?t.replace(/[&<>"'\/]/g,e=>fUn[e]):t,kwe=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let r=this.regExpMap.get(e);if(r!==void 0)return r;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},hUn=[" ",",","?","!",";"],mUn=new kwe(20),gUn=(t,e,r)=>{e=e||"",r=r||"";let n=hUn.filter(o=>e.indexOf(o)<0&&r.indexOf(o)<0);if(n.length===0)return!0;let i=mUn.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),s=!i.test(t);if(!s){let o=t.indexOf(r);o>0&&!i.test(t.substring(0,o))&&(s=!0)}return s},Fwe=(t,e,r=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;let n=e.split(r),i=t;for(let s=0;s<n.length;){if(!i||typeof i!="object")return;let o,a="";for(let c=s;c<n.length;++c)if(c!==s&&(a+=r),a+=n[c],o=i[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<n.length-1)continue;s+=c-s+1;break}i=o}return i},ej=t=>t?.replace(/_/g,"-"),yUn={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}},qwe=class t{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||yUn,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,i){return i&&!this.debug?null:(sr(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new t(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new t(this.logger,e)}},Zg=new qwe,b1=class{constructor(){this.observers={}}on(e,r){return e.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(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].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,[e,...r])})}},b7=class extends b1{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,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;e.indexOf(".")>-1?a=e.split("."):(a=[e,r],n&&(Array.isArray(n)?a.push(...n):sr(n)&&s?a.push(...n.split(s)):a.push(n)));let c=E7(this.data,a);return!c&&!r&&!n&&e.indexOf(".")>-1&&(e=a[0],r=a[1],n=a.slice(2).join(".")),c||!o||!sr(n)?c:Fwe(this.data?.[e]?.[r],n,s)}addResource(e,r,n,i,s={silent:!1}){let o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=[e,r];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."),i=r,r=a[1]),this.addNamespaces(r),XAt(this.data,a,i),s.silent||this.emit("added",e,r,n,i)}addResources(e,r,n,i={silent:!1}){for(let s in n)(sr(n[s])||Array.isArray(n[s]))&&this.addResource(e,r,s,n[s],{silent:!0});i.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,i,s,o={silent:!1,skipCopy:!1}){let a=[e,r];e.indexOf(".")>-1&&(a=e.split("."),i=n,n=r,r=a[1]),this.addNamespaces(r);let c=E7(this.data,a)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?nwt(c,n,s):c={...c,...n},XAt(this.data,a,c),o.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},iwt={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,i){return t.forEach(s=>{e=this.processors[s]?.process(e,r,n,i)??e}),e}},swt=Symbol("i18next/PATH_KEY");function _Un(){let t=[],e=Object.create(null),r;return e.get=(n,i)=>(r?.revoke?.(),i===swt?t:(t.push(i),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function E1(t,e){let{[swt]:r}=t(_Un()),n=e?.keySeparator??".",i=e?.nsSeparator??":";if(r.length>1&&i){let s=e?.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 JAt={},Iwe=t=>!sr(t)&&typeof t!="boolean"&&typeof t!="number",S7=class t extends b1{constructor(e,r={}){super(),cUn(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Zg.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){let n={...r};if(e==null)return!1;let i=this.resolve(e,n);if(i?.res===void 0)return!1;let s=Iwe(i.res);return!(n.returnObjects===!1&&s)}extractFromKey(e,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&&e.indexOf(n)>-1,a=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!gUn(e,n,i);if(o&&!a){let c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:sr(s)?[s]:s};let u=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),e=u.join(i)}return{key:e,namespaces:sr(s)?[s]:s}}translate(e,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={}),e==null)return"";typeof e=="function"&&(e=E1(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]),e=e.map(Z=>typeof Z=="function"?E1(Z,{...this.options,...i}):String(Z));let s=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(e[e.length-1],i),u=c[c.length-1],l=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");let p=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p?.toLowerCase()==="cimode")return f?s?{res:`${u}${l}${a}`,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${l}${a}`:s?{res:a,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:a;let h=this.resolve(e,i),d=h?.res,m=h?.usedKey||a,_=h?.exactUsedKey||a,b=["[object Number]","[object Function]","[object RegExp]"],T=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,A=i.count!==void 0&&!sr(i.count),x=t.hasDefaultValue(i),R=A?this.pluralResolver.getSuffix(p,i.count,i):"",M=i.ordinal&&A?this.pluralResolver.getSuffix(p,i.count,{ordinal:!1}):"",O=A&&!i.ordinal&&i.count===0,F=O&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${R}`]||i[`defaultValue${M}`]||i.defaultValue,V=d;S&&!d&&x&&(V=F);let I=Iwe(V),te=Object.prototype.toString.apply(V);if(S&&V&&I&&b.indexOf(te)<0&&!(sr(T)&&Array.isArray(V))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let Z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,V,{...i,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(h.res=Z,h.usedParams=this.getUsedParamsDetails(i),h):Z}if(o){let Z=Array.isArray(V),k=Z?[]:{},$=Z?_:m;for(let K in V)if(Object.prototype.hasOwnProperty.call(V,K)){let be=`${$}${o}${K}`;x&&!d?k[K]=this.translate(be,{...i,defaultValue:Iwe(F)?F[K]:void 0,joinArrays:!1,ns:c}):k[K]=this.translate(be,{...i,joinArrays:!1,ns:c}),k[K]===be&&(k[K]=V[K])}d=k}}else if(S&&sr(T)&&Array.isArray(d))d=d.join(T),d&&(d=this.extendTranslation(d,e,i,n));else{let Z=!1,k=!1;!this.isValidLookup(d)&&x&&(Z=!0,d=F),this.isValidLookup(d)||(k=!0,d=a);let K=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&k?void 0:d,be=x&&F!==d&&this.options.updateMissing;if(k||Z||be){if(this.logger.log(be?"updateKey":"missingKey",p,u,a,be?F:d),o){let Ke=this.resolve(a,{...i,keySeparator:!1});Ke&&Ke.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 ye=[],Re=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Re&&Re[0])for(let Ke=0;Ke<Re.length;Ke++)ye.push(Re[Ke]);else this.options.saveMissingTo==="all"?ye=this.languageUtils.toResolveHierarchy(i.lng||this.language):ye.push(i.lng||this.language);let qe=(Ke,Ie,Ue)=>{let lt=x&&Ue!==d?Ue:K;this.options.missingKeyHandler?this.options.missingKeyHandler(Ke,u,Ie,lt,be,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(Ke,u,Ie,lt,be,i),this.emit("missingKey",Ke,u,Ie,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&A?ye.forEach(Ke=>{let Ie=this.pluralResolver.getSuffixes(Ke,i);O&&i[`defaultValue${this.options.pluralSeparator}zero`]&&Ie.indexOf(`${this.options.pluralSeparator}zero`)<0&&Ie.push(`${this.options.pluralSeparator}zero`),Ie.forEach(Ue=>{qe([Ke],a+Ue,i[`defaultValue${Ue}`]||F)})}):qe(ye,a,F))}d=this.extendTranslation(d,e,i,h,n),k&&d===a&&this.options.appendNamespaceToMissingKey&&(d=`${u}${l}${a}`),(k||Z)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${l}${a}`:a,Z?d:void 0,i))}return s?(h.res=d,h.usedParams=this.getUsedParamsDetails(i),h):d}extendTranslation(e,r,n,i,s){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...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 c=sr(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(c){let p=e.match(this.interpolator.nestingRegexp);u=p&&p.length}let l=n.replace&&!sr(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||i.usedLng,n),c){let p=e.match(this.interpolator.nestingRegexp),f=p&&p.length;u<f&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...p)=>s?.[0]===p[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${r[0]}`),null):this.translate(...p,r),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,a=sr(o)?[o]:o;return e!=null&&a?.length&&n.applyPostProcessor!==!1&&(e=iwt.handle(a,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,i,s,o,a;return sr(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(c=>typeof c=="function"?E1(c,{...this.options,...r}):c)),e.forEach(c=>{if(this.isValidLookup(n))return;let u=this.extractFromKey(c,r),l=u.key;i=l;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));let f=r.count!==void 0&&!sr(r.count),h=f&&!r.ordinal&&r.count===0,d=r.context!==void 0&&(sr(r.context)||typeof r.context=="number")&&r.context!=="",m=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);p.forEach(_=>{this.isValidLookup(n)||(a=_,!JAt[`${m[0]}-${_}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(JAt[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.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!!!")),m.forEach(b=>{if(this.isValidLookup(n))return;o=b;let T=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(T,l,b,_,r);else{let A;f&&(A=this.pluralResolver.getSuffix(b,r.count,r));let x=`${this.options.pluralSeparator}zero`,R=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&A.indexOf(R)===0&&T.push(l+A.replace(R,this.options.pluralSeparator)),T.push(l+A),h&&T.push(l+x)),d){let M=`${l}${this.options.contextSeparator||"_"}${r.context}`;T.push(M),f&&(r.ordinal&&A.indexOf(R)===0&&T.push(M+A.replace(R,this.options.pluralSeparator)),T.push(M+A),h&&T.push(M+x))}}let S;for(;S=T.pop();)this.isValidLookup(n)||(s=S,n=this.getResource(b,_,S,r))}))})}),{res:n,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,i):this.resourceStore.getResource(e,r,n,i)}getUsedParamsDetails(e={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!sr(e.replace),i=n?e.replace:e;if(n&&typeof e.count<"u"&&(i.count=e.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(e){let r="defaultValue";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}},T7=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Zg.create("languageUtils")}getScriptPartFromCode(e){if(e=ej(e),!e||e.indexOf("-")<0)return null;let r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=ej(e),!e||e.indexOf("-")<0)return e;let r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(sr(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&e.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(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),sr(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return sr(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):sr(e)&&s(this.formatLanguageCode(e)),n.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}},QAt={zero:0,one:1,two:2,few:3,many:4,other:5},ZAt={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},Uwe=class{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=Zg.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){let n=ej(e==="dev"?"en":e),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!"),ZAt;if(!e.match(/-|_/))return ZAt;let c=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(c,r)}return this.pluralRulesCache[s]=o,o}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(i=>`${r}${i}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,s)=>QAt[i]-QAt[s]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,r,n={}){let i=this.getRule(e,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",r,n))}},ewt=(t,e,r,n=".",i=!0)=>{let s=pUn(t,e,r);return!s&&i&&sr(r)&&(s=Fwe(t,r,n),s===void 0&&(s=Fwe(e,r,n))),s},Lwe=t=>t.replace(/\$/g,"$$$$"),A7=class{constructor(e={}){this.logger=Zg.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:r,escapeValue:n,useRawValueToEscape:i,prefix:s,prefixEscaped:o,suffix:a,suffixEscaped:c,formatSeparator:u,unescapeSuffix:l,unescapePrefix:p,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:d,nestingSuffixEscaped:m,nestingOptionsSeparator:_,maxReplaces:b,alwaysFormat:T}=e.interpolation;this.escape=r!==void 0?r:dUn,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?Nw(s):o||"{{",this.suffix=a?Nw(a):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=l?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=f?Nw(f):h||Nw("$t("),this.nestingSuffix=d?Nw(d):m||Nw(")"),this.nestingOptionsSeparator=_||",",this.maxReplaces=b||1e3,this.alwaysFormat=T!==void 0?T:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,r,n,i){let s,o,a,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){let b=ewt(r,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,n,{...i,...r,interpolationkey:h}):b}let d=h.split(this.formatSeparator),m=d.shift().trim(),_=d.join(this.formatSeparator).trim();return this.format(ewt(r,c,m,this.options.keySeparator,this.options.ignoreJSONStructure),_,n,{...i,...r,interpolationkey:m})};this.resetRegExp();let l=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Lwe(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Lwe(this.escape(h)):Lwe(h)}].forEach(h=>{for(a=0;s=h.regex.exec(e);){let d=s[1].trim();if(o=u(d),o===void 0)if(typeof l=="function"){let _=l(e,s,i);o=sr(_)?_:""}else if(i&&Object.prototype.hasOwnProperty.call(i,d))o="";else if(p){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${d} for interpolating ${e}`),o="";else!sr(o)&&!this.useRawValueToEscape&&(o=WAt(o));let m=h.safeValue(o);if(e=e.replace(s[0],m),p?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,r,n={}){let i,s,o,a=(c,u)=>{let l=this.nestingOptionsSeparator;if(c.indexOf(l)<0)return c;let p=c.split(new RegExp(`${Nw(l)}[ ]*{`)),f=`{${p[1]}`;c=p[0],f=this.interpolate(f,o);let h=f.match(/'/g),d=f.match(/"/g);((h?.length??0)%2===0&&!d||(d?.length??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${l}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(e);){let c=[];o={...n},o=o.replace&&!sr(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(c=i[1].slice(u).split(this.formatSeparator).map(l=>l.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),s=r(a.call(this,i[1].trim(),o),o),s&&i[0]===e&&!sr(s))return s;sr(s)||(s=WAt(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),c.length&&(s=c.reduce((l,p)=>this.format(l,p,n.lng,{...n,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}},vUn=t=>{let e=t.toLowerCase().trim(),r={};if(t.indexOf("(")>-1){let n=t.split("(");e=n[0].toLowerCase().trim();let i=n[1].substring(0,n[1].length-1);e==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(o=>{if(o){let[a,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),l=a.trim();r[l]||(r[l]=u),u==="false"&&(r[l]=!1),u==="true"&&(r[l]=!0),isNaN(u)||(r[l]=parseInt(u,10))}})}return{formatName:e,formatOptions:r}},twt=t=>{let e={};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=e[o];return a||(a=t(ej(n),i),e[o]=a),a(r)}},EUn=t=>(e,r,n)=>t(ej(r),n)(e),jwe=class{constructor(e={}){this.logger=Zg.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?twt:EUn;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(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=twt(r)}format(e,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(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,c)=>{let{formatName:u,formatOptions:l}=vUn(c);if(this.formats[u]){let p=a;try{let f=i?.formatParams?.[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||n;p=this.formats[u](a,h,{...l,...i,...f})}catch(f){this.logger.warn(f)}return p}else this.logger.warn(`there was no format function for ${u}`);return a},e)}},bUn=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)},Bwe=class extends b1{constructor(e,r,n,i={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=Zg.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(e,r,n,i){let s={},o={},a={},c={};return e.forEach(u=>{let l=!0;r.forEach(p=>{let f=`${u}|${p}`;!n.reload&&this.store.hasResourceBundle(u,p)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,l=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),c[p]===void 0&&(c[p]=!0)))}),l||(a[u]=!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(c)}}loaded(e,r,n){let i=e.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[e]=r?-1:2,r&&n&&(this.state[e]=0);let a={};this.queue.forEach(c=>{lUn(c.loaded,[s],o),bUn(c,e),r&&c.errors.push(r),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{a[u]||(a[u]={});let l=c.loaded[u];l.length&&l.forEach(p=>{a[u][p]===void 0&&(a[u][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(e,r,n,i=0,s=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:i,wait:s,callback:o});return}this.readingCalls++;let a=(u,l)=>{if(this.readingCalls--,this.waitingReads.length>0){let p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&l&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,i+1,s*2,o)},s);return}o(u,l)},c=this.backend[n].bind(this.backend);if(c.length===2){try{let u=c(e,r);u&&typeof u.then=="function"?u.then(l=>a(null,l)).catch(a):a(null,u)}catch(u){a(u)}return}return c(e,r,a)}prepareLoading(e,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();sr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),sr(r)&&(r=[r]);let s=this.queueLoad(e,r,n,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){let n=e.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(e,o,a)})}saveMissing(e,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 c={...o,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let l;u.length===5?l=u(e,r,n,i,c):l=u(e,r,n,i),l&&typeof l.then=="function"?l.then(p=>a(null,p)).catch(a):a(null,l)}catch(l){a(l)}else u(e,r,n,i,a,c)}!e||!e[0]||this.store.addResource(e[0],r,n,i)}}},Mwe=()=>({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:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),sr(t[1])&&(e.defaultValue=t[1]),sr(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){let r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),rwt=t=>(sr(t.ns)&&(t.ns=[t.ns]),sr(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),sr(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),v7=()=>{},SUn=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})},owt="__i18next_supportNoticeShown",TUn=()=>!!(typeof globalThis<"u"&&globalThis[owt]||typeof process<"u"&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&process.env&&process.env.NODE_ENV==="production"),AUn=()=>{typeof globalThis<"u"&&(globalThis[owt]=!0)},wUn=t=>!!(t?.modules?.backend?.name?.indexOf("Locize")>0||t?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||t?.options?.backend?.backends&&t.options.backend.backends.some(e=>e?.name?.indexOf("Locize")>0||e?.constructor?.name?.indexOf("Locize")>0)||t?.options?.backend?.projectId||t?.options?.backend?.backendOptions&&t.options.backend.backendOptions.some(e=>e?.projectId)),$we=class t extends b1{constructor(e={},r){if(super(),this.options=rwt(e),this.services={},this.logger=Zg,this.modules={external:[]},SUn(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(sr(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));let n=Mwe();this.options={...n,...this.options,...rwt(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!wUn(this)&&!TUn()&&(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}"),AUn());let i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Zg.init(i(this.modules.logger),this.options):Zg.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=jwe;let l=new T7(this.options);this.store=new b7(this.options.resources,this.options);let p=this.services;p.logger=Zg,p.resourceStore=this.store,p.languageUtils=l,p.pluralResolver=new Uwe(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"),u&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(p.formatter=i(u),p.formatter.init&&p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new A7(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new Bwe(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(h,...d)=>{this.emit(h,...d)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new S7(this.services,this.options),this.translator.on("*",(h,...d)=>{this.emit(h,...d)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=v7),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...l)=>this.store[u](...l)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...l)=>(this.store[u](...l),this)});let a=QU(),c=()=>{let u=(l,p)=>{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(p),r(l,p)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),a}loadResources(e,r=v7){let n=r,i=sr(e)?e:this.language;if(typeof e=="function"&&(n=e),!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(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),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(e,r,n){let i=QU();return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=void 0),e||(e=this.languages),r||(r=this.options.ns),n||(n=v7),this.services.backendConnector.reload(e,r,s=>{i.resolve(),n(s)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&iwt.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-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(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let n=QU();this.emit("languageChanging",e);let i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},s=(a,c)=>{c?this.isLanguageChangingTo===e&&(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),r&&r(a,(...u)=>this.t(...u))},o=a=>{!e&&!a&&this.services.languageDetector&&(a=[]);let c=sr(a)?a:a&&a[0],u=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(sr(a)?[a]:a);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,l=>{s(l,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&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(e),n}getFixedT(e,r,n){let i=(s,o,...a)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([s,o].concat(a)):c={...o},c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||n||i.keyPrefix);let u={...this.options,...c};typeof c.keyPrefix=="function"&&(c.keyPrefix=E1(c.keyPrefix,u));let l=this.options.keySeparator||".",p;return c.keyPrefix&&Array.isArray(s)?p=s.map(f=>(typeof f=="function"&&(f=E1(f,u)),`${c.keyPrefix}${l}${f}`)):(typeof s=="function"&&(s=E1(s,u)),p=c.keyPrefix?`${c.keyPrefix}${l}${s}`:s),this.t(p,c)};return sr(e)?i.lng=e:i.lngs=e,i.ns=r,i.keyPrefix=n,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,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,c)=>{let u=this.services.backendConnector.state[`${a}|${c}`];return u===-1||u===0||u===2};if(r.precheck){let a=r.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,e)&&(!i||o(s,e)))}loadNamespaces(e,r){let n=QU();return this.options.ns?(sr(e)&&(e=[e]),e.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(e,r){let n=QU();sr(e)&&(e=[e]);let i=this.options.preload||[],s=e.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(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let i=new Intl.Locale(e);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 T7(Mwe());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){let n=new t(e,r);return n.createInstance=t.createInstance,n}cloneInstance(e={},r=v7){let n=e.forkResourceStore;n&&delete e.forkResourceStore;let i={...this.options,...e,isClone:!0},s=new t(i);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["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((c,u)=>(c[u]={...this.store.data[u]},c[u]=Object.keys(c[u]).reduce((l,p)=>(l[p]={...c[u][p]},l),c[u]),c),{});s.store=new b7(a,i),s.services.resourceStore=s.store}if(e.interpolation){let c={...Mwe().interpolation,...this.options.interpolation,...e.interpolation},u={...i,interpolation:c};s.services.interpolator=new A7(u)}return s.translator=new S7(s.services,i),s.translator.on("*",(a,...c)=>{s.emit(a,...c)}),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}}},On=$we.createInstance(),Yvo=On.createInstance,Xvo=On.dir,Jvo=On.init,Qvo=On.loadResources,Zvo=On.reloadResources,eEo=On.use,tEo=On.changeLanguage,rEo=On.getFixedT,nEo=On.t,iEo=On.exists,sEo=On.setDefaultNamespace,oEo=On.hasLoadedNamespace,aEo=On.loadNamespaces,cEo=On.loadLanguages;var awt={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 Vwe="fiori-freestyle-writer",cwt=On.createInstance();async function PUn(){await cwt.init({resources:{en:{[Vwe]:awt}},lng:"en",fallbackLng:"en",defaultNS:Vwe,ns:[Vwe],showSupportNotice:!1})}function vS(t,e){return cwt.t(t,e)}PUn().catch(()=>{});function uwt(t){return OUn(t.name,t.userDisplayName,t.systemType)}function OUn(t,e,r){let n=e?` [${e}]`:"";return`${t}${CUn(r)}${n}`}function CUn(t){let e="",r=` (${vS("texts.systemTypeLabel.abapCloud")})`;return(t==="AbapCloud"||t==="S4HC"||t==="BTP")&&(e=r),e}var tj=class{applicationKey="";extensionName="";extensionVersion="";getApplicationKey(){return this.applicationKey}getExtensionVersion(){return this.extensionVersion}getExtensionName(){return this.extensionName}};var Evr=Pe(QVe(),1);var PG=class{extensionName;eventName;constructor(e,r){this.extensionName=e,this.eventName=r}getExtensionName(){return this.extensionName}getEventName(){return this.eventName}toString(){return`${this.extensionName}/${this.eventName}`}};var ho;(function(t){t[t.OnePercent=0]="OnePercent",t[t.TenPercent=1]="TenPercent",t[t.NoSampling=2]="NoSampling"})(ho||(ho={}));function nae(t){if(t.setUseDiskRetryCaching)try{t.setUseDiskRetryCaching(!0)}catch{}t.addTelemetryProcessor(e=>(e.tags??={},e.tags["ai.location.ip"]="0.0.0.0",e.tags["ai.cloud.roleInstance"]="masked",e.tags["ai.cloud.role"]="masked",e.tags["ai.device.type"]="masked",!0))}var ZVe={name:"@sap-ux/telemetry",version:"1.0.16",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:"3.15.0",axios:"1.18.1","performance-now":"2.1.0",yaml:"2.9.0"},devDependencies:{"@jest/globals":"30.4.1","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 su={azureInstrumentationKey:"",telemetryEnabled:!0,telemetryLibName:ZVe.name,telemetryLibVersion:ZVe.version,consumerModuleName:"",consumerModuleVersion:""};process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL??="true";var OG=class extends tj{clients;constructor(e,r,n){super(),this.clients=new Map,this.applicationKey=e,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(ho.OnePercent),s=this.createTelemetryClient(ho.TenPercent),o=this.createTelemetryClient(ho.NoSampling);this.clients.set(ho.OnePercent,i),this.clients.set(ho.TenPercent,s),this.clients.set(ho.NoSampling,o)}reportBlocking(e,r,n,i,s=!1){if(!s||su.telemetryEnabled){let{client:o,event:a}=this.prepareClientAndEvent(e,r,n,i);return this.trackEventBlocking(o,a)}return Promise.resolve()}async report(e,r,n,i,s,o){if(o!==void 0&&!o||!su.telemetryEnabled)return;let{client:a,event:c}=this.prepareClientAndEvent(e,r,n,i);this.trackEvent(a,c)}prepareClientAndEvent(e,r,n,i=ho.NoSampling){let s=this.clients.get(i),a={name:new PG(this.extensionName,e).toString(),properties:r,measurements:n};return{client:s,event:a}}async trackEventBlocking(e,r){process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&(e.trackEvent(r),await e.flush())}trackEvent(e,r){return process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"?(e.trackEvent(r),!0):!1}createTelemetryClient(e){let r;switch(e){case ho.OnePercent:r=1;break;case ho.TenPercent:r=10;break;case ho.NoSampling:default:r=100;break}let n=new Evr.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,nae(n),n}};var eGe=()=>{let t=new Date().getTime();return new Date(t).toISOString()};var CG=class extends OG{constructor(e,r,n){super(e,r,n)}async report(e,r,n,i,s,o){let a=await iae(s),c={v:this.extensionVersion,datetime:eGe()},u={...r,...a,...c};await super.report(e,u,n,i,s,o)}async reportEvent(e,r,n,i){let{finalProperties:s,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(e,n);return super.report(e.eventName,s,o,r,n,i)}async reportEventBlocking(e,r,n,i){let{finalProperties:s,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(e,n);return super.reportBlocking(e.eventName,s,o,r,i)}async collectToolsSuiteTelemetry(e,r){let n=await iae(r),i={v:this.extensionVersion,datetime:eGe()},s={...e.properties,...n,...i},o={...e.measurements};return{finalProperties:s,finalMeasurements:o}}};var bvr=require("node:child_process"),RG=class{run(e,r=[],n={},i){return i&&i.debug(`Running command: ${e} ${r.join(" ")}`),new Promise((s,o)=>{let a=[],c=process.platform==="win32"?{...n,shell:!0}:n,u=(0,bvr.spawn)(e,r,c);u.stdout.setEncoding("utf8");let l;u.stdout.on("data",p=>{i?.info(p.toString().replace(/[\r\n]$/,"")),l=p.toString()}),u.stderr.on("data",p=>{i?.info(p.toString().replace(/[\r\n]$/,"")),a.push(p.toString())}),u.on("error",p=>{let f=`Command failed with error: ${p.message}`;i?.error(f),o(p)}),u.on("close",p=>{if(p!==0){let f=`Command failed, \`${e} ${r.join(" ")}\`, ${a.join(", ")}`;i?.debug(f),o(f)}s(l)})})}};var Vss=Pe(Iae(),1);var Gss=Pe(I5e(),1),M5e=Pe(Ep(),1);var ATr={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 L5e="nodejs-utils",Bss=On.createInstance();async function $ss(){await Bss.init({lng:"en",fallbackLng:"en",defaultNS:L5e,ns:[L5e],resources:{en:{[L5e]:ATr}},interpolation:{escapeValue:!1},showSupportNotice:!1})}$ss().catch(()=>{});var WG=Pe(require("node:https"),1);function aM(t){WG.default.globalAgent.options&&(WG.default.globalAgent.options.rejectUnauthorized=t),WG.default.globalAgent.fallbackAgent?.options&&(WG.default.globalAgent.fallbackAgent.options.rejectUnauthorized=t)}var mh=Pe(g8e(),1),Zxr=Pe(Qxr(),1);var Qs=class extends Error{code;constructor(e,r){super(e),this.code=r,this.name=this.constructor.name}};var ua=Object.freeze({yamlParsing:"yamlParsing",nodeNotFound:"nodeNotFound",nodeNotFoundMatching:"nodeNotFoundMatching",nodeNotAMap:"nodeNotAMap",propertyNotFound:"propertyNotFound",pathCannotBeEmpty:"pathCannotBeEmpty",pathDoesNotExist:"pathDoesNotExist",seqDoesNotExist:"seqDoesNotExist",tryingToAppendToNonSequence:"tryingToAppendToNonSequence",startNodeMustBeCollection:"startNodeMustBeCollection",scalarValuesDoNotHaveProperties:"scalarValuesDoNotHaveProperties"}),lu=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 hh(t,e){try{return e?t?.replace(/{{-?([^{}]*)}}/g,(r,n)=>{let i=n?.trim();return e[i]?.toString()||r}):t}catch{return""}}var AH=class t{documents;static async newInstance(e){return new t(e)}constructor(e){this.documents=mh.default.parseAllDocuments(e),this.documents.length===0&&this.documents.push(mh.default.parseDocument(e));let r=this.documents.filter(n=>n.errors.length>0);if(r.length>0)throw new Qs(lu.yamlParsing+`
2274
2274
  `+r.map(n=>n.errors.map(i=>i.message).join("")),ua.yamlParsing)}toString(){return this.documents.map(e=>e.toString({singleQuote:!0})).join("")}addDocumentComment({comment:e,location:r="beginning"}){switch(r){case"beginning":this.documents[0].commentBefore=e;break;case"end":this.documents[0].comment=e;break;default:break}return this}createNode({value:e,comments:r}){let n=this.documents[0].createNode(e);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:e,value:r,createIntermediateKeys:n,comment:i}){let s=this.toPathArray(e);if(s.length>1){let a=s.slice(0,-1);if(!this.documents[0].getIn(a)&&!n)throw new Qs(hh(lu.pathDoesNotExist,{path:a}),ua.pathDoesNotExist)}let o=this.documents[0].createNode(r);return i&&(o.commentBefore=i),this.documents[0].setIn(s,o),this}appendTo({path:e,value:r,createIntermediateKeys:n=!0,nodeComment:i,comments:s}){let o=this.toPathArray(e),a=this.documents[0].clone(),c=a.getIn(o);if(c){if(!(0,mh.isSeq)(c))throw new Qs(hh(lu.tryingToAppendToNonSequence,{path:e}),ua.tryingToAppendToNonSequence)}else{if(!n)throw new Qs(hh(lu.seqDoesNotExist,{path:e}),ua.seqDoesNotExist);c=new mh.YAMLSeq,a.setIn(o,c)}let u=a.createNode(r);if(i&&(u.commentBefore=i),c.items.push(u),s&&s.length>0){if(typeof r!="object")throw new Qs(lu.scalarValuesDoNotHaveProperties,ua.scalarValuesDoNotHaveProperties);let l=c.items.length-1;for(let p of s){let f=this.toPathArray(p.path),h=a.getIn([...o,l,...f],!0);if(!h)throw new Qs(hh(lu.propertyNotFound,{path:p.path}),ua.propertyNotFound);h.comment=p.comment}}return this.documents[0]=a,this}updateAt({path:e,matcher:r,value:n,mode:i="merge"}){let s=this.toPathArray(e),o=this.documents[0].getIn(s);if(!o)throw new Qs(hh(lu.seqDoesNotExist,{path:e}),ua.seqDoesNotExist);let a=o.items.find(l=>l.toJSON()[r.key]===r.value);if(!a)throw new Qs(hh(lu.nodeNotFoundMatching,{path:e,key:r.key,value:r.value}),ua.nodeNotFoundMatching);let c=i==="merge"?(0,Zxr.default)(a.toJSON(),n):n,u=this.documents[0].createNode(c);return o.items.splice(o.items.indexOf(a),1,u),this}delete(e){return this.documents[0].delete(e)}deleteAt({path:e,matcher:r}){let n=this.toPathArray(e),i=this.documents[0].getIn(n);if(!i?.items)throw new Qs(hh(lu.seqDoesNotExist,{path:e}),ua.seqDoesNotExist);if(!i.items.find((o,a)=>o.toJSON()[r.key]===r.value?(i.items.splice(a,1),!0):!1))throw new Qs(hh(lu.propertyNotFound,{path:e}),ua.propertyNotFound);return this}getNode({start:e,path:r}){if(e&&!((0,mh.isSeq)(e)||(0,mh.isMap)(e)))throw new Qs(lu.startNodeMustBeCollection,ua.startNodeMustBeCollection);let n=this.toPathArray(r),s=(e||this.documents[0])?.getIn(n);if(s)return s;throw new Qs(hh(lu.nodeNotFound,{path:r}),ua.nodeNotFound)}getSequence({start:e,path:r}){let n=this.getNode({start:e,path:r});if((0,mh.isSeq)(n))return n;throw new Qs(hh(lu.seqDoesNotExist,{path:r}),ua.seqDoesNotExist)}getMap({start:e,path:r}){let n=this.getNode({start:e,path:r});if((0,mh.isMap)(n))return n;throw new Qs(hh(lu.nodeNotAMap,{path:r}),ua.nodeNotAMap)}findItem(e,r){let n=i=>i!==void 0&&typeof i.toJSON=="function"&&i.toJSON.call(i)||{};return e.items.find(i=>r(n(i)))}toPathArray(e){let r=e?.toString().split(".").filter(n=>n!=="").map(n=>Number.isNaN(Number(n))?n:Number(n));if(!r||r.length===0)throw new Qs(lu.pathCannotBeEmpty,ua.pathCannotBeEmpty);return r}};var LE=require("node:path");function ePr(){return{name:"fiori-tools-appreload",afterMiddleware:"compression",configuration:{port:35729,path:"webapp",delay:300}}}function tue(t,e){let r=[];return t.authenticationType==="reentranceTicket"&&r.push({path:`configuration.backend.${e}.authenticationType`,comment:" SAML support for vscode",key:"authenticationType"}),r}function tPr(t,e,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 t&&t.length>0&&(t.forEach((o,a)=>{o.path=o.path??"/";let c=tue(o,a);c&&(s=[...s,...c])}),i.configuration.backend=t),e!==void 0&&(i.configuration.ui5={path:e.path??["/resources","/test-resources"],url:e.url??"https://ui5.sap.com"},e.version!==void 0&&(i.configuration.ui5.version=e.version),e.directLoad&&(i.configuration.ui5.directLoad=!0)),{config:i,comments:s}}var rPr=(t,e,r,n)=>{let i=[];return r.forEach(s=>{let o=`.${LE.posix.sep}${(0,LE.relative)(t,(0,LE.join)(e,"localService",s.serviceName)).replaceAll(LE.sep,LE.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 vM="fiori-tools-servestatic",ME="fiori-tools-proxy";var tRr=Pe(LCr(),1),Eh=require("node:path"),rRr=require("node:url"),nRr=require("node:fs/promises");var vys=Object.create,MCr=Object.defineProperty,Eys=Object.getOwnPropertyDescriptor,bys=Object.getOwnPropertyNames,Sys=Object.getPrototypeOf,Tys=Object.prototype.hasOwnProperty,ls=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),Ays=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=bys(e),s=0,o=i.length,a;s<o;s++)a=i[s],!Tys.call(t,a)&&a!==r&&MCr(t,a,{get:(c=>e[c]).bind(null,a),enumerable:!(n=Eys(e,a))||n.enumerable});return t},wys=(t,e,r)=>(r=t!=null?vys(Sys(t)):{},Ays(e||!t||!t.__esModule?MCr(r,"default",{value:t,enumerable:!0}):r,t)),ZH=ls(((t,e)=>{function r(c){return typeof c>"u"||c===null}function n(c){return typeof c=="object"&&c!==null}function i(c){return Array.isArray(c)?c:r(c)?[]:[c]}function s(c,u){if(u){let l=Object.keys(u);for(let p=0,f=l.length;p<f;p+=1){let h=l[p];c[h]=u[h]}}return c}function o(c,u){let l="";for(let p=0;p<u;p+=1)l+=c;return l}function a(c){return c===0&&Number.NEGATIVE_INFINITY===1/c}e.exports.isNothing=r,e.exports.isObject=n,e.exports.toArray=i,e.exports.repeat=o,e.exports.isNegativeZero=a,e.exports.extend=s})),e5=ls(((t,e)=>{function r(i,s){let o="",a=i.reason||"(unknown reason)";return i.mark?(i.mark.name&&(o+='in "'+i.mark.name+'" '),o+="("+(i.mark.line+1)+":"+(i.mark.column+1)+")",!s&&i.mark.snippet&&(o+=`
2275
2275
 
2276
2276
  `+i.mark.snippet),a+" "+o):a}function n(i,s){Error.call(this),this.name="YAMLException",this.reason=i,this.mark=s,this.message=r(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n.prototype.toString=function(s){return this.name+": "+r(this,s)},e.exports=n})),xys=ls(((t,e)=>{var r=ZH();function n(o,a,c,u,l){let p="",f="",h=Math.floor(l/2)-1;return u-a>h&&(p=" ... ",a=u-h+p.length),c-u>h&&(f=" ...",c=u+h-f.length),{str:p+o.slice(a,c).replace(/\t/g,"\u2192")+f,pos:u-a+p.length}}function i(o,a){return r.repeat(" ",a-o.length)+o}function s(o,a){if(a=Object.create(a||null),!o.buffer)return null;a.maxLength||(a.maxLength=79),typeof a.indent!="number"&&(a.indent=1),typeof a.linesBefore!="number"&&(a.linesBefore=3),typeof a.linesAfter!="number"&&(a.linesAfter=2);let c=/\r?\n|\r|\0/g,u=[0],l=[],p,f=-1;for(;p=c.exec(o.buffer);)l.push(p.index),u.push(p.index+p[0].length),o.position<=p.index&&f<0&&(f=u.length-2);f<0&&(f=u.length-1);let h="",d=Math.min(o.line+a.linesAfter,l.length).toString().length,m=a.maxLength-(a.indent+d+3);for(let b=1;b<=a.linesBefore&&!(f-b<0);b++){let T=n(o.buffer,u[f-b],l[f-b],o.position-(u[f]-u[f-b]),m);h=r.repeat(" ",a.indent)+i((o.line-b+1).toString(),d)+" | "+T.str+`
@@ -2344,7 +2344,7 @@ specVersion: "2.5"`);return s.setMetadata({name:t}),s.setType("application"),s.a
2344
2344
  ${i}`);let s=[" getReferentialConstraints: function (navigationProperty) {",`${i}`," return undefined;"," }"].join(`
2345
2345
  `),o=t.lastIndexOf(`
2346
2346
  };`);return o!==-1?`${t.slice(0,o)},
2347
- ${s}${t.slice(o)}`:t}var uZr=require("node:fs/promises"),lZr=require("node:path");var tZr=require("node:crypto"),rZr=Pe(Lpe());var eZr={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.23",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.4.1"},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.5","@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",rimraf:"6.1.3","xml-formatter":"3.7.0","yeoman-generator":"5.10.0"},engines:{node:">=22.x"}};var Yto="@sap-ux/odata-download-sub-generator",Xto="0a65e45d-6bf4-421d-b845-61e888c50e9e",Sl=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(e){this._sessionId=(0,tZr.randomUUID)(),qr.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:Yto,version:eZr.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:Xto,...e};try{await g4(r)}catch(n){qr.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e){if(!this._telemetryData){let r=tr("telemetry.unknownOs");try{r=(0,rZr.default)()}catch{}this._telemetryData={Platform:kn()?"SBAS":"VSCode",OperatingSystem:r,SessionId:this._sessionId}}return this._telemetryData=Object.assign(this._telemetryData,e),this._telemetryData}static prepareTelemetryEvent(e,r){return{eventName:e,properties:r,measurements:{}}}static async sendTelemetry(e,r){let n=this.createTelemetryData(r),i=this.prepareTelemetryEvent(e,n);await Hf.getTelemetryClient().reportEvent(i,ho.NoSampling)}};var Jto=["eq","ne","gt","ge","lt","le"],qye=["and","or","not"],Qto=["any","all"],Zto=["startswith","endswith","contains","matchespattern"],ero=["expand","levels","select","skip","top","count","orderby","filter"],nZr=/\((.*)\)/,iZr=/(?!indexof)\((\w+)\)/;var Sb="";function set({select:t,search:e,skiptoken:r,format:n,top:i,skip:s,filter:o,transform:a,orderBy:c,key:u,count:l,expand:p,action:f,func:h}={}){let d="",m=[],_={};if(u!=null&&(d+=`(${U_(u,m)})`),(o||typeof l=="object")&&(_.$filter=jye(typeof l=="object"?l:o,m)),a&&(_.$apply=oZr(a)),p&&(_.$expand=Uye(p)),c&&(_.$orderby=oet(c)),l&&(typeof l=="boolean"?_.$count=!0:d+="/$count"),typeof i=="number"&&(_.$top=i),typeof s=="number"&&(_.$skip=s),f&&(d+=`/${f}`),h){if(typeof h=="string")d+=`/${h}`;else if(typeof h=="object"){let[b]=Object.keys(h),T=U_(h[b],m);d+=`/${b}`,T!==""&&(d+=`(${T})`)}}return m.length>0&&Object.assign(_,m.reduce((b,T)=>Object.assign(b,{[`@${T.name}`]:U_(T.value)}),{})),sro(d,{$select:t,$search:e,$skiptoken:r,$format:n,..._})}function iet(t,e,r=[]){return`${t} eq ${U_(e,r)}`}function jye(t={},e=[],r=""){return(Array.isArray(t)?t:[t]).reduce((s,o)=>{if(o){let a=n(o,e,r);a&&s.push(a)}return s},[]).join(" and ");function n(s={},o=[],a=""){let c="";return typeof s=="string"?c=s:s&&typeof s=="object"&&(c=Object.keys(s).reduce((u,l)=>{let p=s[l];if(p===void 0)return u;let f="";if(a?l===Sb?f=a:iZr.test(l)?f=l.replace(iZr,(h,d)=>d.trim()===Sb?`(${a})`:`(${a}/${d.trim()})`):nZr.test(l)?f=l.replace(nZr,(h,d)=>d.trim()===Sb?`(${a})`:`(${a}/${d.trim()})`):f=`${a}/${l}`:f=l,l===Sb&&Array.isArray(p))return u.concat(p.map(h=>iet(f,h)));if(["number","string","boolean"].indexOf(typeof p)!==-1||p instanceof Date||p===null)u.push(iet(f,p,o));else if(Array.isArray(p)){let h=l,d=p.map(m=>jye(m,o,a)).filter(m=>m).map(m=>qye.indexOf(h)!==-1?`(${m})`:m);d.length&&(qye.indexOf(h)!==-1?d.length&&(h==="not"?u.push(sZr(d)):u.push(`(${d.join(` ${h} `)})`)):u.push(d.join(` ${h} `)))}else if(qye.indexOf(f)!==-1){let h=f,d=Object.keys(p).map(m=>n({[m]:p[m]}));d.length&&(h==="not"?u.push(sZr(d)):u.push(`(${d.join(` ${h} `)})`))}else if(typeof p=="object")"type"in p?u.push(iet(f,p,o)):Object.keys(p).forEach(h=>{if(p[h]!==void 0)if(Jto.indexOf(h)!==-1)u.push(`${f} ${h} ${U_(p[h],o)}`);else if(qye.indexOf(h)!==-1)Array.isArray(p[h])?u.push(p[h].map(d=>"("+n(d,o,f)+")").join(` ${h} `)):u.push("("+n(p[h],o,f)+")");else if(Qto.indexOf(h)!==-1){let d=i(l.toLowerCase(),p[h],h,f);d&&u.push(d)}else if(h==="has")u.push(`${f} ${h} ${U_(p[h],o)}`);else if(h==="in"){let d=Array.isArray(p[h])?p[h]:p[h].value.map(m=>({type:p[h].type,value:m}));u.push(f+" in ("+d.map(m=>U_(m,o)).join(",")+")")}else if(Zto.indexOf(h)!==-1)u.push(`${h}(${f},${U_(p[h],o)})`);else{let d=n({[h]:p[h]},o,f);d&&u.push(d)}});else throw new Error(`Unexpected value type: ${p}`);return u},[]).join(" and ")),c}function i(s,o,a,c){let u="";if(typeof o=="string"||o instanceof String)u=tro(s,o,a,c);else if(o){let l=Array.isArray(o)?o.reduce((f,h)=>h.hasOwnProperty(Sb)?(f.hasOwnProperty(Sb)||(f[Sb]=[]),f[Sb].push(h[Sb]),f):{...f,...h},{}):o,p=n(l,e,s);u=`${c}/${a}(${p?`${s}:${p}`:""})`}return u}}function tro(t,e,r,n){let i=r=="all"?"ne":"eq";return`${n}/${r}(${t}: ${t} ${i} '${e}')`}function rro(t){return t=t.replace(/%/g,"%25"),t=t.replace(/\+/g,"%2B"),t=t.replace(/\//g,"%2F"),t=t.replace(/\?/g,"%3F"),t=t.replace(/#/g,"%23"),t=t.replace(/&/g,"%26"),t=t.replace(/'/g,"''"),t}function U_(t,e){if(typeof t=="string")return`'${rro(t)}'`;if(t instanceof Date)return t.toISOString();if(typeof t=="number")return t;if(Array.isArray(t))return`[${t.map(r=>U_(r)).join(",")}]`;if(t===null)return t;if(typeof t=="object")switch(t.type){case"raw":case"guid":return t.value;case"duration":return`duration'${t.value}'`;case"binary":return`binary'${t.value}'`;case"alias":return Array.isArray(e)&&e.push(t),`@${t.name}`;case"json":return escape(JSON.stringify(t.value));case"decimal":return`${t.value}M`;default:return Object.entries(t).filter(([,r])=>r!==void 0).map(([r,n])=>`${r}=${U_(n,e)}`).join(",")}return t}function Uye(t){if(typeof t=="number")return t;if(typeof t=="string")return t.indexOf("/")===-1?t:t.split("/").reverse().reduce((e,r,n,i)=>n===0?`$expand=${r}`:n===i.length-1?`${r}(${e})`:`$expand=${r}(${e})`,"");if(Array.isArray(t))return`${t.map(e=>Uye(e)).join(",")}`;if(typeof t=="object"){let e=Object.keys(t);return e.some(r=>ero.indexOf(r.toLowerCase())!==-1)?e.map(r=>{let n;switch(r){case"filter":n=jye(t[r]);break;case"orderBy":n=oet(t[r]);break;case"levels":case"count":case"skip":case"top":n=`${t[r]}`;break;default:n=Uye(t[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):e.map(r=>{let n=Uye(t[r]);return n?`${r}(${n})`:r}).join(",")}return""}function oZr(t){return(Array.isArray(t)?t:[t]).reduce((e,r)=>{for(let n of Object.keys(r))switch(n){case"aggregate":{let i=r[n];i&&e.push(`aggregate(${nro(i)})`);break}case"filter":{let i=r[n];if(i){let s=jye(i);s&&e.push(`filter(${s})`)}break}case"groupBy":{let i=r[n];i&&e.push(`groupby(${iro(i)})`);break}default:throw new Error(`Unsupported transform: ${n}`)}return e},[]).join("/")||void 0}function nro(t){return(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?e:Object.keys(e).map(r=>{let n=e[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 iro(t){if(!t.properties)throw new Error("'properties' property required for groupBy");let e=`(${t.properties.join(",")})`;return t.transform&&(e+=`,${oZr(t.transform)}`),e}function oet(t,e=""){return Array.isArray(t)?t.map(r=>Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r).map(r=>`${e}${String(r)}`).join(","):typeof t=="object"?Object.entries(t).map(([r,n])=>oet(n,`${r}/`)).map(r=>`${e}${r}`).join(","):`${e}${String(t)}`}function sro(t,e){let r=Object.getOwnPropertyNames(e).filter(n=>e[n]!==void 0&&e[n]!=="").map(n=>`${n}=${e[n]}`);return r.length?`${t}?${r.join("&")}`:t}function sZr(t){return`not (${t.join(" and ")})`}function oro(t){let e=[];return{expands:t.reduce((n,{entityPath:i})=>{let s=i.split("/"),o=n;return s.forEach((a,c)=>{o.expand||(o.expand={}),o.expand[a]??=c===s.length-1?{}:{expand:{}},o=o.expand[a],e.includes(a)||e.push(a)}),n},{expand:{}}),entityPathParts:e}}function aro(t,e,r=1,n){let i=e?.map(h=>({entityPath:h.fullPath,entitySetName:h.entity.entitySetName})),{expands:s,entityPathParts:o}=oro(i),a=o.map(h=>e.find(m=>h===m.entity.entityPath?m.entity.entitySetName:void 0)?.entity.entitySetName).filter(h=>h!==void 0);qr.logger.info(tr("info.entityFilesToBeGenerated",{entities:a.join(", ")}));let c=t;if(n){let h=[];c.semanticKeys.forEach(x=>{if(x.value!==void 0&&x.value!=="")if(x.type==="Edm.Boolean")h.push(`${x.name} eq ${x.value}`);else{let R=String(x.value).split(","),M=["Edm.UUID","Edm.Guid"].includes(x.type),O=F=>M?F.trim():`'${F.trim()}'`;if(R.length===1)h.push(`${x.name} eq ${O(R[0])}`);else{let F=R.map(V=>`${x.name} eq ${O(V)}`);h.push(`(${F.join(" or ")})`)}}});let d=h.length>0?`,filter(${h.join(" and ")})`:"",m=`$root/${c.entitySetName},${n.qualifier},${n.nodeProperty}`,_=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/${c.entitySetName},HierarchyQualifier='${n.qualifier}',NodeProperty='${n.nodeProperty}')`,b=n.isDraft?`$apply=ancestors(${m}${d},keep start)/${_}`:`$apply=${_}`,T=s?set(s):"",S=T?`&${T.substring(1)}`:"",A=`${c.entitySetName}?${b}${S}`;return qr.logger.debug(`Query for odata: ${A}`),{query:A}}let u=[];c.semanticKeys.forEach(h=>{if(h.value!==void 0&&h.value!=="")if(["Edm.UUID","Edm.Guid"].includes(h.type)){let m=String(h.value).split(",").map(_=>({[h.name]:{type:"guid",value:_.trim()}}));u.push(m.length===1?m[0]:{or:m})}else if(h.type==="Edm.Boolean")u.push({[h.name]:String(h.value)==="true"});else if(h.type==="Edm.String"){let d=String(h.value).split(","),m=[];d.forEach(_=>{let b=_.trim().split("-");b.length===1?m.push({[h.name]:_.trim()}):b.length===2&&m.push({[h.name]:{ge:b[0].trim(),le:b[1].trim()}})}),u.push(m.length==1?m[0]:{or:m})}else u.push({[h.name]:h.value})});let l={};s&&Object.assign(l,s),u.length>0?Object.assign(l,{filter:u.length===1?u[0]:u,count:!0}):r&&Object.assign(l,{top:r});let p=set(l),f=`${c.entitySetName}${p}`;return qr.logger.debug(`Query for odata: ${f}`),{query:f}}function cro(t,e,r){let n=new Set(["DraftUUID","IsActiveEntity"]),i=[];for(let p of t.semanticKeys){if(p.value===void 0||p.value===""||n.has(p.name))continue;let f=p.keyName??p.name,h=String(p.value).split(",")[0].trim(),d=["Edm.UUID","Edm.Guid"].includes(p.type),m=p.type==="Edm.Boolean";i.push(`${f}=${d||m?h:`'${h}'`}`)}if(i.length===0){qr.logger.debug(`buildNavPropHierarchyQuery: no key values available for '${t.entitySetName}', skipping nav-prop hierarchy query for '${e}'`);return}let s={DraftUUID:"00000000-0000-0000-0000-000000000000",IsActiveEntity:"true"};t.entityType?.keys?.filter(p=>p.name in s).forEach(p=>i.push(`${p.name}=${s[p.name]}`)),qr.logger.debug(`buildNavPropHierarchyQuery: key segment for '${t.entitySetName}': (${i.join(",")})`);let a=`${`${t.entitySetName}(${i.join(",")})`}/${e}`,u=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=${`$root/${a}`},HierarchyQualifier='${r.qualifier}',NodeProperty='${r.nodeProperty}')`,l=`${a}?$apply=${u}`;return qr.logger.debug(`Nav-prop hierarchy query: ${l}`),l}async function cZr(t,e,r,n,i,s=[]){let o=aro(t,r,n,i),a=await aZr(e,o.query);for(let c of s){let u=r.find(_=>_.entity.entitySetName===c.entitySetName);if(!u){qr.logger.debug(`fetchData: no selected entity matched hierarchy entity '${c.entitySetName}', skipping`);continue}let l=cro(t,u.entity.entityPath,c);if(!l){qr.logger.debug(`fetchData: could not build nav-prop hierarchy query for '${c.entitySetName}', skipping`);continue}let p=await aZr(e,l);if(!p.entityData||!a.entityData){qr.logger.debug(`fetchData: no data returned for nav-prop hierarchy query '${c.entitySetName}', skipping merge`);continue}qr.logger.debug(`fetchData: merging ${p.entityData.length} hierarchy records into '${u.entity.entityPath}' expanded items`);let f=u.entity.entityPath,h=c.nodeProperty.split("/")[0],d=p.entityData,m=0;for(let _ of a.entityData){let b=_[f];if(Array.isArray(b))for(let T of b){let S=d.find(A=>c.entityTypeKeys.every(x=>A[x]===T[x]));S&&(T[h]=S[h],m++)}}qr.logger.debug(`fetchData: patched '${h}' onto ${m} expanded '${f}' records`)}return{odataResult:a}}async function aZr(t,e){try{qr.logger.info(`OData query request: ${encodeURI(t.defaults.baseURL+e).replaceAll("'","%27")}`),qr.logger.debug(`OData query request headers: ${JSON.stringify(t.defaults.headers)}`);let r=await t.get(e),n=r?.data?.match(/"@odata\.count":(\d+)/)?.[1];return qr.logger.info(`OData query records count: ${n}`),{entityData:r?.odata()}}catch(r){let n=tr("errors.odataQueryError",{error:r});return qr.logger.error(n),{error:n}}}var Wp=class t{static externalServiceRequestCache={};static entityTypeRefFacetCache={};static resetExternalServiceCache(e){if(e){delete t.externalServiceRequestCache[e];return}t.externalServiceRequestCache={}}static resetRefFacetCache(){t.entityTypeRefFacetCache={}}static resetServiceCaches(){t.resetExternalServiceCache(),t.resetRefFacetCache()}};async function pZr(t,e,r){if(t.metadata&&e.appAccess&&t.connectedSystem&&t.servicePath&&e.appAccess&&e.referencedEntities){t.connectedSystem.serviceProvider.log=qr.logger;let n=t.connectedSystem?.serviceProvider.service(t.servicePath);if(n){let i=Date.now();Sl.sendTelemetry("ODATA_DOWNLOAD_SEND_QUERY",{time:Date()});let s=e.referencedEntities.hierarchyEntities?.find(c=>c.entitySetName===e.referencedEntities.listEntity.entitySetName),o=e.referencedEntities.hierarchyEntities?.filter(c=>c.entitySetName!==e.referencedEntities.listEntity.entitySetName&&r.some(u=>u.entity.entitySetName===c.entitySetName))??[],{odataResult:a}=await cZr(e.referencedEntities.listEntity,n,r,s?void 0:1,s,o);if(a.entityData)return Sl.sendTelemetry("ODATA_DOWNLOAD_RECEIVED_QUERY_RESULT",{duration:`${Date.now()-i} ms`,resultSize:`${a.entityData.length} rows`}),qr.logger.debug(`Got result rows: ${a.entityData.length}`),{odataQueryResult:a.entityData};if(a.error)return Sl.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return tr("errors.dataNotFetched")}function fZr(t){let e=[];return t.Facets.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target.type==="AnnotationPath"){let n=r.Target.value;n.lastIndexOf("/")>-1&&e.push(n.substring(0,n.lastIndexOf("/")))}else r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&e.push(...fZr(r))}),e}function uro(t){if(Wp.entityTypeRefFacetCache[t.name])return Wp.entityTypeRefFacetCache[t.name];let e=[];return t.annotations?.UI?.Facets?.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target?.type==="AnnotationPath"){let n=r.Target.value;n?.lastIndexOf("/")>-1&&e.push(n.substring(0,n.lastIndexOf("/")))}r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&e.push(...fZr(r))}),Wp.entityTypeRefFacetCache[t.name]=e,e??[]}function dZr(t,e="",r=[],n,i){let s={},o=t.navPropEntities;if(o&&o.length>0){let a=t.entityType?uro(t.entityType):[];for(let c of o){let u=c.entityPath,l=i??t;if(c.entityType?.name===l?.entityType?.name||e.includes(u))continue;let p=e.concat(`${e?"/":""}${u}`);c.navPropEntities&&c.navPropEntities.length>0&&Object.assign(s,dZr(c,p,r,n,i??t).entitySetsFlat);let f={fullPath:p,entity:{entityPath:c.entityPath,entitySetName:c.entitySetName,defaultSelected:a.includes(c.entityPath)||!!n?.includes(p)}},h=`${p}`;r||(r=[]),r.push({name:h,value:f,checked:f.entity.defaultSelected}),s[p]=c.entitySetName}}return{entitySetsFlat:s,choices:r}}function hZr(t,e){let r=e?.map(n=>{let i=n.page?.contextPath??n.page?.routePattern?.replace(":?query:","").replaceAll(/\(\{[^}]*\}\)/g,"");return i?.startsWith(`/${t.entityPath}/`)?i.replace(`/${t.entityPath}/`,""):i}).filter(n=>n!==void 0);if(t.navPropEntities){let n=dZr(t,void 0,void 0,r);return n.choices.sort((i,s)=>(i.name??"").localeCompare(s.name??"")),n}}async function mZr(t,e){let n=(await hu.newInstance(await(0,uZr.readFile)((0,lZr.join)(t,qt.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=kn()?n?.destination:await YQr(s,n?.client)}return{servicePath:e.uri,systemName:i}}async function gZr(t){let e=await i4(t.app.appRoot),r=e.getApiVersion(),n=typeof r?.version=="string"?Number.parseInt(r.version,10):0;return n<24?(qr.logger.debug(`@sap/ux-specification from module cache API version is: ${n}. API version '24' at least is required.`),tr("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):e}var yZr,lro=(...t)=>new Promise(e=>{clearTimeout(yZr),yZr=setTimeout(async()=>e(await pZr(...t)),1e3)}),Bh={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},pro=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,_Zr=["."];async function vZr(t,e,r){let n=!1;if(!r.referencedEntities?.listEntity.semanticKeys.every((a,c)=>(a.name!=="IsActiveEntity"&&!n&&(n=!!a.value),a.value!==void 0&&a.value!==""||!t[`entityKeyIdx:${c}`]))||!n)return tr("prompts.skipDataDownload.validation.keyRequired");let s=[];r.relatedEntityChoices?.choices?.length&&(s=t[Bh.relatedEntitySelection]);let o=await lro(e,r,s);return o}function fro(t){return Wp.resetServiceCaches(),t.appAccess=void 0,t.referencedEntities=void 0,t.servicePath=void 0,t.systemName&&(t.systemName.value=void 0),t.relatedEntityChoices.choices=[],t.relatedEntityChoices.entitySetsFlat={},t}async function EZr(t){let e=[],r={appAccess:void 0,referencedEntities:void 0,servicePath:void 0,systemName:{value:void 0},connectPath:{value:void 0},relatedEntityChoices:{choices:[],entitySetsFlat:{}}},n=[],i=dro(r,n,t?.appPath),s=await iYr({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:Ps.v4}},Ad()!==gi.cli,qr.logger);s.prompts=Ya(s.prompts,()=>!!r.appAccess);let o={odata:[]},a=mro(r,r.relatedEntityChoices),c=gro(5,r,s.answers,o),u=hro(r.relatedEntityChoices,s.answers,r,o);return e.push(i,...s.prompts,_ro(s.answers,r),yro(s.answers,r),...c,a,u),{questions:e,answers:{application:r,odataQueryResult:o,odataServiceAnswers:s.answers}}}function dro(t,e,r){return{type:"input",guiType:"folder-browser",name:Bh.appSelection,message:tr("prompts.appSelection.message"),default:n=>r??n.appSelection??t.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:tr("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===t.appAccess?.app.appRoot)return!0;e.length=0,fro(t);let i;try{i=await Kle(n)}catch(u){let l=u;return u instanceof Error&&(l=u.message),qr.logger.error(tr("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${tr("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${tr("texts.seeLogForDetails")}`}let s=i.app.services[i.app.mainService??"mainService"];if(!s?.odataVersion?.startsWith("4."))return tr("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:s.odataVersion});let o=await gZr(i);if(typeof o=="string")return o;t.appAccess=i,t.specification=o;let{servicePath:a,systemName:c}=await mZr(i.app.appRoot,s);return a&&(t.servicePath=a,e.push(a)),t.systemName&&(t.systemName.value=c),t.connectPath&&(t.connectPath.value=a),!0}}}function hro(t,e,r,n){let i;return{when:async s=>t.choices.length>0,name:Bh.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:tr("prompts.relatedEntitySelection.message"),choices:()=>t.choices,validate:async(s,o)=>{if(t.choices.forEach(a=>{a.disabled||(a.checked=s.some(c=>c.fullPath===a.value.fullPath))}),o&&!o[Bh.skipDataDownload]?.[0]){if(i=await vZr(o,e,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:tr("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:aet.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:tr("prompts.relatedEntitySelection.openLogs")})}}function mro(t,e){let r,n,i;return{when:()=>{if((n!==t.systemName?.value||t.servicePath!==r)&&t.referencedEntities?.listEntity){let o=hZr(t.referencedEntities.listEntity,t.referencedEntities.pageObjectEntities);o&&(e.choices=o.choices,Object.assign(e.entitySetsFlat,o.entitySetsFlat)),r=t.servicePath,n=t.systemName?.value}return e.choices.length>0},name:Bh.toggleSelection,type:"confirm",message:tr("prompts.toggleSelection.message"),labelTrue:tr("prompts.toggleSelection.labelTrue"),labelFalse:tr("prompts.toggleSelection.labelFalse"),default:!1,validate:o=>(o!==i&&(e.choices.forEach(a=>{if(a.disabled)return;let c=a.value;a.checked=o===!1?c.entity.defaultSelected:!1}),i=o),!0)}}function gro(t,e,r,n){let i=[],s,o=0,a=c=>({when:async()=>{let u=e.referencedEntities?.listEntity.semanticKeys[c],l=!!u?.name&&u.name!=="IsActiveEntity";return l&&c>o&&(o=c),l},name:`entityKeyIdx:${c}`,message:()=>tr("prompts.entityKey.message",{keyName:`${e.referencedEntities?.listEntity.semanticKeys[c]?.name} (${e.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:tr("prompts.entityKey.hint")},validate:async(u,l)=>{let p=e.referencedEntities?.listEntity.semanticKeys[c];if(p&&delete p.value,_Zr.includes(u))return tr("prompts.entityKey.validation.invalidKeyValueChars",{chars:_Zr.join()});if(u&&p)if(p.type==="Edm.Boolean")try{p.value=JSON.parse(u)}catch{return tr("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(p.type)){let h=u.split(",");for(let d of h)if(!pro.test(d.trim()))return tr("prompts.entityKey.validation.invalidGuidValue");p.value=u.trim()}else p.value=u.trim();let f=u.split(",");if(p?.type&&!["Edm.UUID","Edm.Guid"].includes(p.type)){for(let h of f)if(h.split("-").length>2)return p&&delete p.value,tr("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!e.relatedEntityChoices?.choices?.length&&c===o&&!l[Bh.skipDataDownload]?.[0]&&e.referencedEntities?.listEntity.semanticKeys[c]?.name){if(s=await vZr(l,r,e),typeof s=="string")return s;n.odata=s.odataQueryResult}return!0}});for(let c=0;c<t;c++)i.push(a(c));return i}function yro(t,e){return{when:()=>!!t.metadata&&!!e.servicePath,name:Bh.skipDataDownload,type:"checkbox",message:tr("prompts.skipDataDownload.message"),guiOptions:{hint:tr("prompts.skipDataDownload.hint")},default:!1,choices:[{name:tr("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function _ro(t,e){let r;return{when:async()=>e.appAccess&&e.specification&&t?.metadata?(r=await JQr(e.appAccess,e.specification,t.metadata),typeof r=="object"&&(e.referencedEntities=r),!0):!1,name:Bh.updateMainServiceMetadata,type:"confirm",message:tr("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:aet.Severity.error}}}}function bZr(t){let e=[],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 t.forEach(n=>{!n.parentProperty&&n.missingReferentialConstraints?.navPropName&&e.push(...r(n))}),e}var xZr=Pe(LT()),PZr=Pe(kT());var OZr=Pe(wZr()),CZr=require("node:path");function RZr(t,e,r){Wp.resetExternalServiceCache();let n=Lro(t,e),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:tr("prompts.valueHelpSelection.message"),choices:()=>n,validate:async o=>{if(!o||o.length===0)return Wp.resetExternalServiceCache(),!0;let a=await Iro(o,r),c=(0,OZr.default)(i,a);return i.length=0,i.push(...c),await Dro(i,r),!0}}],valueHelpData:i}}async function Dro(t,e){let r=[],n={transformResponse:s=>typeof s=="string"?JSON.parse(s):s},i=t.map(async s=>{let o=s,[a]=o.path.split(";");Wp.externalServiceRequestCache[a]??=[];let l=(0,xZr.convert)((0,PZr.parse)(s.metadata)).entitySets.map(async p=>{let f=p.name;if(Wp.externalServiceRequestCache[a].includes(f))return;Wp.externalServiceRequestCache[a].push(f);let h=await e.get((0,CZr.join)(o.path,f),n);o.entityData=o.entityData??[],o.entityData?.push({entitySetName:f,items:h.data.value})});await Promise.allSettled(l),o.entityData&&r.push(o)});return await Promise.allSettled(i),r}async function Iro(t,e){let r=t.flat();return await e.fetchExternalServices(r)}function Lro(t,e){let r=n8(t,e,[]),n={};for(let s of r)if(s.type==="value-list"){if(GQr.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 c=a.map(u=>{if(u.type==="value-list")return u.target.replace(/\/[^/]*$/,"");if(u.type==="code-list"&&u.collectionPath)return u.collectionPath}).filter(u=>u!==void 0);i.push({name:`${o} (${c.join()})`,value:a})}return i.sort((s,o)=>s.name.localeCompare(o.name))}var qr=class t extends DZr.default{vscode;appWizard;static _logger=ufe;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(e,r){super(e,{...r,skipInstall:!0},{unique:"namespace"}),I7e(this.env,!0),this.options.force=!0,this.prompts=new Bye.Prompts([{description:tr("steps.odataDownloader.description"),name:tr("steps.odataDownloader.name")},{description:tr("steps.valueHelpSelection.description"),name:tr("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(tr("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return t._logger}async initializing(){await lXe(),t._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await Sl.initTelemetrySettings(),Sl.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:e,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await EZr(this.options?.data),s=await this.prompt(i);if(this.state.entityOData=r.odata,this.state.entityPropertyToEntitySet=e.relatedEntityChoices.entitySetsFlat,this.state.appRootPath=e.appAccess?.getAppRoot(),this.state.mainServicePath=n.servicePath,this.state.mainServiceName=e.appAccess?.app.mainService,this.state.appEntities=e.referencedEntities,this.state.appRootPath){this.state.mockServerConfig=await jM(this.state.appRootPath);let o;this.state.mockServerConfig?.services&&(t.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,pC.join)($s.Webapp,$s.LocalService,$s.Mockdata)}if(this.state.updateMainServiceMetadata=s[Bh.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,s[Bh.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(e,s),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof Hl){let{questions:o,valueHelpData:a}=RZr(n.servicePath,n.metadata,n.connectedSystem?.serviceProvider);await this.prompt(o),this.state.valueHelpData=a}}catch(e){t.logger.error(e),this._exitOnError(e)}}async writing(){if(this.state.appRootPath){if(this.state.entityOData&&this.state.entityPropertyToEntitySet&&this.state.appEntities)try{let e=Date.now();Sl.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,pC.join)(this.state.appRootPath));let r=net(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);t.logger.info(tr("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,s])=>{this.writeDestinationJSON((0,pC.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,pC.join)(this.state.mockDataRootPath,`${i.entitySetName}.js`),o=this.destinationPath(s),{navPropName:a,constraints:c}=i.missingReferentialConstraints;if(this.fs.exists(o)){let u=this.fs.read(o),l=ZQr(u,a,c);l!==u?(this.writeDestination(s,l),t.logger.info(`Updated referential constraint file: ${i.entitySetName}.js`)):t.logger.debug(`Referential constraint for '${a}' already present in ${i.entitySetName}.js \u2014 skipping`)}else{let u=QQr(a,c);this.writeDestination(s,u),t.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),Sl.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfFiles:`${n.length}`})}catch(e){t.logger.error(e),Sl.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(tr("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let e=Date.now();Sl.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,pC.join)(this.state.appRootPath,$s.Webapp);if(await Dfe(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 pfe(this.state.appRootPath,n,this.fs))}Sl.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfExternalServices:`${this.state.valueHelpData.length}`})}catch(e){t.logger.error(e),Sl.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(tr("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let e=(0,pC.join)(this.state.appRootPath,$s.Webapp,$s.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(e,(0,NZr.default)(this.state.mainServiceMetadata,{indentation:" ",lineSeparator:`
2347
+ ${s}${t.slice(o)}`:t}var uZr=require("node:fs/promises"),lZr=require("node:path");var tZr=require("node:crypto"),rZr=Pe(Lpe());var eZr={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.24",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.4.1"},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.5","@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",rimraf:"6.1.3","xml-formatter":"3.7.0","yeoman-generator":"5.10.0"},engines:{node:">=22.x"}};var Yto="@sap-ux/odata-download-sub-generator",Xto="0a65e45d-6bf4-421d-b845-61e888c50e9e",Sl=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(e){this._sessionId=(0,tZr.randomUUID)(),qr.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:Yto,version:eZr.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:Xto,...e};try{await g4(r)}catch(n){qr.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e){if(!this._telemetryData){let r=tr("telemetry.unknownOs");try{r=(0,rZr.default)()}catch{}this._telemetryData={Platform:kn()?"SBAS":"VSCode",OperatingSystem:r,SessionId:this._sessionId}}return this._telemetryData=Object.assign(this._telemetryData,e),this._telemetryData}static prepareTelemetryEvent(e,r){return{eventName:e,properties:r,measurements:{}}}static async sendTelemetry(e,r){let n=this.createTelemetryData(r),i=this.prepareTelemetryEvent(e,n);await Hf.getTelemetryClient().reportEvent(i,ho.NoSampling)}};var Jto=["eq","ne","gt","ge","lt","le"],qye=["and","or","not"],Qto=["any","all"],Zto=["startswith","endswith","contains","matchespattern"],ero=["expand","levels","select","skip","top","count","orderby","filter"],nZr=/\((.*)\)/,iZr=/(?!indexof)\((\w+)\)/;var Sb="";function set({select:t,search:e,skiptoken:r,format:n,top:i,skip:s,filter:o,transform:a,orderBy:c,key:u,count:l,expand:p,action:f,func:h}={}){let d="",m=[],_={};if(u!=null&&(d+=`(${U_(u,m)})`),(o||typeof l=="object")&&(_.$filter=jye(typeof l=="object"?l:o,m)),a&&(_.$apply=oZr(a)),p&&(_.$expand=Uye(p)),c&&(_.$orderby=oet(c)),l&&(typeof l=="boolean"?_.$count=!0:d+="/$count"),typeof i=="number"&&(_.$top=i),typeof s=="number"&&(_.$skip=s),f&&(d+=`/${f}`),h){if(typeof h=="string")d+=`/${h}`;else if(typeof h=="object"){let[b]=Object.keys(h),T=U_(h[b],m);d+=`/${b}`,T!==""&&(d+=`(${T})`)}}return m.length>0&&Object.assign(_,m.reduce((b,T)=>Object.assign(b,{[`@${T.name}`]:U_(T.value)}),{})),sro(d,{$select:t,$search:e,$skiptoken:r,$format:n,..._})}function iet(t,e,r=[]){return`${t} eq ${U_(e,r)}`}function jye(t={},e=[],r=""){return(Array.isArray(t)?t:[t]).reduce((s,o)=>{if(o){let a=n(o,e,r);a&&s.push(a)}return s},[]).join(" and ");function n(s={},o=[],a=""){let c="";return typeof s=="string"?c=s:s&&typeof s=="object"&&(c=Object.keys(s).reduce((u,l)=>{let p=s[l];if(p===void 0)return u;let f="";if(a?l===Sb?f=a:iZr.test(l)?f=l.replace(iZr,(h,d)=>d.trim()===Sb?`(${a})`:`(${a}/${d.trim()})`):nZr.test(l)?f=l.replace(nZr,(h,d)=>d.trim()===Sb?`(${a})`:`(${a}/${d.trim()})`):f=`${a}/${l}`:f=l,l===Sb&&Array.isArray(p))return u.concat(p.map(h=>iet(f,h)));if(["number","string","boolean"].indexOf(typeof p)!==-1||p instanceof Date||p===null)u.push(iet(f,p,o));else if(Array.isArray(p)){let h=l,d=p.map(m=>jye(m,o,a)).filter(m=>m).map(m=>qye.indexOf(h)!==-1?`(${m})`:m);d.length&&(qye.indexOf(h)!==-1?d.length&&(h==="not"?u.push(sZr(d)):u.push(`(${d.join(` ${h} `)})`)):u.push(d.join(` ${h} `)))}else if(qye.indexOf(f)!==-1){let h=f,d=Object.keys(p).map(m=>n({[m]:p[m]}));d.length&&(h==="not"?u.push(sZr(d)):u.push(`(${d.join(` ${h} `)})`))}else if(typeof p=="object")"type"in p?u.push(iet(f,p,o)):Object.keys(p).forEach(h=>{if(p[h]!==void 0)if(Jto.indexOf(h)!==-1)u.push(`${f} ${h} ${U_(p[h],o)}`);else if(qye.indexOf(h)!==-1)Array.isArray(p[h])?u.push(p[h].map(d=>"("+n(d,o,f)+")").join(` ${h} `)):u.push("("+n(p[h],o,f)+")");else if(Qto.indexOf(h)!==-1){let d=i(l.toLowerCase(),p[h],h,f);d&&u.push(d)}else if(h==="has")u.push(`${f} ${h} ${U_(p[h],o)}`);else if(h==="in"){let d=Array.isArray(p[h])?p[h]:p[h].value.map(m=>({type:p[h].type,value:m}));u.push(f+" in ("+d.map(m=>U_(m,o)).join(",")+")")}else if(Zto.indexOf(h)!==-1)u.push(`${h}(${f},${U_(p[h],o)})`);else{let d=n({[h]:p[h]},o,f);d&&u.push(d)}});else throw new Error(`Unexpected value type: ${p}`);return u},[]).join(" and ")),c}function i(s,o,a,c){let u="";if(typeof o=="string"||o instanceof String)u=tro(s,o,a,c);else if(o){let l=Array.isArray(o)?o.reduce((f,h)=>h.hasOwnProperty(Sb)?(f.hasOwnProperty(Sb)||(f[Sb]=[]),f[Sb].push(h[Sb]),f):{...f,...h},{}):o,p=n(l,e,s);u=`${c}/${a}(${p?`${s}:${p}`:""})`}return u}}function tro(t,e,r,n){let i=r=="all"?"ne":"eq";return`${n}/${r}(${t}: ${t} ${i} '${e}')`}function rro(t){return t=t.replace(/%/g,"%25"),t=t.replace(/\+/g,"%2B"),t=t.replace(/\//g,"%2F"),t=t.replace(/\?/g,"%3F"),t=t.replace(/#/g,"%23"),t=t.replace(/&/g,"%26"),t=t.replace(/'/g,"''"),t}function U_(t,e){if(typeof t=="string")return`'${rro(t)}'`;if(t instanceof Date)return t.toISOString();if(typeof t=="number")return t;if(Array.isArray(t))return`[${t.map(r=>U_(r)).join(",")}]`;if(t===null)return t;if(typeof t=="object")switch(t.type){case"raw":case"guid":return t.value;case"duration":return`duration'${t.value}'`;case"binary":return`binary'${t.value}'`;case"alias":return Array.isArray(e)&&e.push(t),`@${t.name}`;case"json":return escape(JSON.stringify(t.value));case"decimal":return`${t.value}M`;default:return Object.entries(t).filter(([,r])=>r!==void 0).map(([r,n])=>`${r}=${U_(n,e)}`).join(",")}return t}function Uye(t){if(typeof t=="number")return t;if(typeof t=="string")return t.indexOf("/")===-1?t:t.split("/").reverse().reduce((e,r,n,i)=>n===0?`$expand=${r}`:n===i.length-1?`${r}(${e})`:`$expand=${r}(${e})`,"");if(Array.isArray(t))return`${t.map(e=>Uye(e)).join(",")}`;if(typeof t=="object"){let e=Object.keys(t);return e.some(r=>ero.indexOf(r.toLowerCase())!==-1)?e.map(r=>{let n;switch(r){case"filter":n=jye(t[r]);break;case"orderBy":n=oet(t[r]);break;case"levels":case"count":case"skip":case"top":n=`${t[r]}`;break;default:n=Uye(t[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):e.map(r=>{let n=Uye(t[r]);return n?`${r}(${n})`:r}).join(",")}return""}function oZr(t){return(Array.isArray(t)?t:[t]).reduce((e,r)=>{for(let n of Object.keys(r))switch(n){case"aggregate":{let i=r[n];i&&e.push(`aggregate(${nro(i)})`);break}case"filter":{let i=r[n];if(i){let s=jye(i);s&&e.push(`filter(${s})`)}break}case"groupBy":{let i=r[n];i&&e.push(`groupby(${iro(i)})`);break}default:throw new Error(`Unsupported transform: ${n}`)}return e},[]).join("/")||void 0}function nro(t){return(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?e:Object.keys(e).map(r=>{let n=e[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 iro(t){if(!t.properties)throw new Error("'properties' property required for groupBy");let e=`(${t.properties.join(",")})`;return t.transform&&(e+=`,${oZr(t.transform)}`),e}function oet(t,e=""){return Array.isArray(t)?t.map(r=>Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r).map(r=>`${e}${String(r)}`).join(","):typeof t=="object"?Object.entries(t).map(([r,n])=>oet(n,`${r}/`)).map(r=>`${e}${r}`).join(","):`${e}${String(t)}`}function sro(t,e){let r=Object.getOwnPropertyNames(e).filter(n=>e[n]!==void 0&&e[n]!=="").map(n=>`${n}=${e[n]}`);return r.length?`${t}?${r.join("&")}`:t}function sZr(t){return`not (${t.join(" and ")})`}function oro(t){let e=[];return{expands:t.reduce((n,{entityPath:i})=>{let s=i.split("/"),o=n;return s.forEach((a,c)=>{o.expand||(o.expand={}),o.expand[a]??=c===s.length-1?{}:{expand:{}},o=o.expand[a],e.includes(a)||e.push(a)}),n},{expand:{}}),entityPathParts:e}}function aro(t,e,r=1,n){let i=e?.map(h=>({entityPath:h.fullPath,entitySetName:h.entity.entitySetName})),{expands:s,entityPathParts:o}=oro(i),a=o.map(h=>e.find(m=>h===m.entity.entityPath?m.entity.entitySetName:void 0)?.entity.entitySetName).filter(h=>h!==void 0);qr.logger.info(tr("info.entityFilesToBeGenerated",{entities:a.join(", ")}));let c=t;if(n){let h=[];c.semanticKeys.forEach(x=>{if(x.value!==void 0&&x.value!=="")if(x.type==="Edm.Boolean")h.push(`${x.name} eq ${x.value}`);else{let R=String(x.value).split(","),M=["Edm.UUID","Edm.Guid"].includes(x.type),O=F=>M?F.trim():`'${F.trim()}'`;if(R.length===1)h.push(`${x.name} eq ${O(R[0])}`);else{let F=R.map(V=>`${x.name} eq ${O(V)}`);h.push(`(${F.join(" or ")})`)}}});let d=h.length>0?`,filter(${h.join(" and ")})`:"",m=`$root/${c.entitySetName},${n.qualifier},${n.nodeProperty}`,_=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/${c.entitySetName},HierarchyQualifier='${n.qualifier}',NodeProperty='${n.nodeProperty}')`,b=n.isDraft?`$apply=ancestors(${m}${d},keep start)/${_}`:`$apply=${_}`,T=s?set(s):"",S=T?`&${T.substring(1)}`:"",A=`${c.entitySetName}?${b}${S}`;return qr.logger.debug(`Query for odata: ${A}`),{query:A}}let u=[];c.semanticKeys.forEach(h=>{if(h.value!==void 0&&h.value!=="")if(["Edm.UUID","Edm.Guid"].includes(h.type)){let m=String(h.value).split(",").map(_=>({[h.name]:{type:"guid",value:_.trim()}}));u.push(m.length===1?m[0]:{or:m})}else if(h.type==="Edm.Boolean")u.push({[h.name]:String(h.value)==="true"});else if(h.type==="Edm.String"){let d=String(h.value).split(","),m=[];d.forEach(_=>{let b=_.trim().split("-");b.length===1?m.push({[h.name]:_.trim()}):b.length===2&&m.push({[h.name]:{ge:b[0].trim(),le:b[1].trim()}})}),u.push(m.length==1?m[0]:{or:m})}else u.push({[h.name]:h.value})});let l={};s&&Object.assign(l,s),u.length>0?Object.assign(l,{filter:u.length===1?u[0]:u,count:!0}):r&&Object.assign(l,{top:r});let p=set(l),f=`${c.entitySetName}${p}`;return qr.logger.debug(`Query for odata: ${f}`),{query:f}}function cro(t,e,r){let n=new Set(["DraftUUID","IsActiveEntity"]),i=[];for(let p of t.semanticKeys){if(p.value===void 0||p.value===""||n.has(p.name))continue;let f=p.keyName??p.name,h=String(p.value).split(",")[0].trim(),d=["Edm.UUID","Edm.Guid"].includes(p.type),m=p.type==="Edm.Boolean";i.push(`${f}=${d||m?h:`'${h}'`}`)}if(i.length===0){qr.logger.debug(`buildNavPropHierarchyQuery: no key values available for '${t.entitySetName}', skipping nav-prop hierarchy query for '${e}'`);return}let s={DraftUUID:"00000000-0000-0000-0000-000000000000",IsActiveEntity:"true"};t.entityType?.keys?.filter(p=>p.name in s).forEach(p=>i.push(`${p.name}=${s[p.name]}`)),qr.logger.debug(`buildNavPropHierarchyQuery: key segment for '${t.entitySetName}': (${i.join(",")})`);let a=`${`${t.entitySetName}(${i.join(",")})`}/${e}`,u=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=${`$root/${a}`},HierarchyQualifier='${r.qualifier}',NodeProperty='${r.nodeProperty}')`,l=`${a}?$apply=${u}`;return qr.logger.debug(`Nav-prop hierarchy query: ${l}`),l}async function cZr(t,e,r,n,i,s=[]){let o=aro(t,r,n,i),a=await aZr(e,o.query);for(let c of s){let u=r.find(_=>_.entity.entitySetName===c.entitySetName);if(!u){qr.logger.debug(`fetchData: no selected entity matched hierarchy entity '${c.entitySetName}', skipping`);continue}let l=cro(t,u.entity.entityPath,c);if(!l){qr.logger.debug(`fetchData: could not build nav-prop hierarchy query for '${c.entitySetName}', skipping`);continue}let p=await aZr(e,l);if(!p.entityData||!a.entityData){qr.logger.debug(`fetchData: no data returned for nav-prop hierarchy query '${c.entitySetName}', skipping merge`);continue}qr.logger.debug(`fetchData: merging ${p.entityData.length} hierarchy records into '${u.entity.entityPath}' expanded items`);let f=u.entity.entityPath,h=c.nodeProperty.split("/")[0],d=p.entityData,m=0;for(let _ of a.entityData){let b=_[f];if(Array.isArray(b))for(let T of b){let S=d.find(A=>c.entityTypeKeys.every(x=>A[x]===T[x]));S&&(T[h]=S[h],m++)}}qr.logger.debug(`fetchData: patched '${h}' onto ${m} expanded '${f}' records`)}return{odataResult:a}}async function aZr(t,e){try{qr.logger.info(`OData query request: ${encodeURI(t.defaults.baseURL+e).replaceAll("'","%27")}`),qr.logger.debug(`OData query request headers: ${JSON.stringify(t.defaults.headers)}`);let r=await t.get(e),n=r?.data?.match(/"@odata\.count":(\d+)/)?.[1];return qr.logger.info(`OData query records count: ${n}`),{entityData:r?.odata()}}catch(r){let n=tr("errors.odataQueryError",{error:r});return qr.logger.error(n),{error:n}}}var Wp=class t{static externalServiceRequestCache={};static entityTypeRefFacetCache={};static resetExternalServiceCache(e){if(e){delete t.externalServiceRequestCache[e];return}t.externalServiceRequestCache={}}static resetRefFacetCache(){t.entityTypeRefFacetCache={}}static resetServiceCaches(){t.resetExternalServiceCache(),t.resetRefFacetCache()}};async function pZr(t,e,r){if(t.metadata&&e.appAccess&&t.connectedSystem&&t.servicePath&&e.appAccess&&e.referencedEntities){t.connectedSystem.serviceProvider.log=qr.logger;let n=t.connectedSystem?.serviceProvider.service(t.servicePath);if(n){let i=Date.now();Sl.sendTelemetry("ODATA_DOWNLOAD_SEND_QUERY",{time:Date()});let s=e.referencedEntities.hierarchyEntities?.find(c=>c.entitySetName===e.referencedEntities.listEntity.entitySetName),o=e.referencedEntities.hierarchyEntities?.filter(c=>c.entitySetName!==e.referencedEntities.listEntity.entitySetName&&r.some(u=>u.entity.entitySetName===c.entitySetName))??[],{odataResult:a}=await cZr(e.referencedEntities.listEntity,n,r,s?void 0:1,s,o);if(a.entityData)return Sl.sendTelemetry("ODATA_DOWNLOAD_RECEIVED_QUERY_RESULT",{duration:`${Date.now()-i} ms`,resultSize:`${a.entityData.length} rows`}),qr.logger.debug(`Got result rows: ${a.entityData.length}`),{odataQueryResult:a.entityData};if(a.error)return Sl.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return tr("errors.dataNotFetched")}function fZr(t){let e=[];return t.Facets.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target.type==="AnnotationPath"){let n=r.Target.value;n.lastIndexOf("/")>-1&&e.push(n.substring(0,n.lastIndexOf("/")))}else r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&e.push(...fZr(r))}),e}function uro(t){if(Wp.entityTypeRefFacetCache[t.name])return Wp.entityTypeRefFacetCache[t.name];let e=[];return t.annotations?.UI?.Facets?.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target?.type==="AnnotationPath"){let n=r.Target.value;n?.lastIndexOf("/")>-1&&e.push(n.substring(0,n.lastIndexOf("/")))}r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&e.push(...fZr(r))}),Wp.entityTypeRefFacetCache[t.name]=e,e??[]}function dZr(t,e="",r=[],n,i){let s={},o=t.navPropEntities;if(o&&o.length>0){let a=t.entityType?uro(t.entityType):[];for(let c of o){let u=c.entityPath,l=i??t;if(c.entityType?.name===l?.entityType?.name||e.includes(u))continue;let p=e.concat(`${e?"/":""}${u}`);c.navPropEntities&&c.navPropEntities.length>0&&Object.assign(s,dZr(c,p,r,n,i??t).entitySetsFlat);let f={fullPath:p,entity:{entityPath:c.entityPath,entitySetName:c.entitySetName,defaultSelected:a.includes(c.entityPath)||!!n?.includes(p)}},h=`${p}`;r||(r=[]),r.push({name:h,value:f,checked:f.entity.defaultSelected}),s[p]=c.entitySetName}}return{entitySetsFlat:s,choices:r}}function hZr(t,e){let r=e?.map(n=>{let i=n.page?.contextPath??n.page?.routePattern?.replace(":?query:","").replaceAll(/\(\{[^}]*\}\)/g,"");return i?.startsWith(`/${t.entityPath}/`)?i.replace(`/${t.entityPath}/`,""):i}).filter(n=>n!==void 0);if(t.navPropEntities){let n=dZr(t,void 0,void 0,r);return n.choices.sort((i,s)=>(i.name??"").localeCompare(s.name??"")),n}}async function mZr(t,e){let n=(await hu.newInstance(await(0,uZr.readFile)((0,lZr.join)(t,qt.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=kn()?n?.destination:await YQr(s,n?.client)}return{servicePath:e.uri,systemName:i}}async function gZr(t){let e=await i4(t.app.appRoot),r=e.getApiVersion(),n=typeof r?.version=="string"?Number.parseInt(r.version,10):0;return n<24?(qr.logger.debug(`@sap/ux-specification from module cache API version is: ${n}. API version '24' at least is required.`),tr("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):e}var yZr,lro=(...t)=>new Promise(e=>{clearTimeout(yZr),yZr=setTimeout(async()=>e(await pZr(...t)),1e3)}),Bh={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},pro=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,_Zr=["."];async function vZr(t,e,r){let n=!1;if(!r.referencedEntities?.listEntity.semanticKeys.every((a,c)=>(a.name!=="IsActiveEntity"&&!n&&(n=!!a.value),a.value!==void 0&&a.value!==""||!t[`entityKeyIdx:${c}`]))||!n)return tr("prompts.skipDataDownload.validation.keyRequired");let s=[];r.relatedEntityChoices?.choices?.length&&(s=t[Bh.relatedEntitySelection]);let o=await lro(e,r,s);return o}function fro(t){return Wp.resetServiceCaches(),t.appAccess=void 0,t.referencedEntities=void 0,t.servicePath=void 0,t.systemName&&(t.systemName.value=void 0),t.relatedEntityChoices.choices=[],t.relatedEntityChoices.entitySetsFlat={},t}async function EZr(t){let e=[],r={appAccess:void 0,referencedEntities:void 0,servicePath:void 0,systemName:{value:void 0},connectPath:{value:void 0},relatedEntityChoices:{choices:[],entitySetsFlat:{}}},n=[],i=dro(r,n,t?.appPath),s=await iYr({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:Ps.v4}},Ad()!==gi.cli,qr.logger);s.prompts=Ya(s.prompts,()=>!!r.appAccess);let o={odata:[]},a=mro(r,r.relatedEntityChoices),c=gro(5,r,s.answers,o),u=hro(r.relatedEntityChoices,s.answers,r,o);return e.push(i,...s.prompts,_ro(s.answers,r),yro(s.answers,r),...c,a,u),{questions:e,answers:{application:r,odataQueryResult:o,odataServiceAnswers:s.answers}}}function dro(t,e,r){return{type:"input",guiType:"folder-browser",name:Bh.appSelection,message:tr("prompts.appSelection.message"),default:n=>r??n.appSelection??t.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:tr("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===t.appAccess?.app.appRoot)return!0;e.length=0,fro(t);let i;try{i=await Kle(n)}catch(u){let l=u;return u instanceof Error&&(l=u.message),qr.logger.error(tr("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${tr("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${tr("texts.seeLogForDetails")}`}let s=i.app.services[i.app.mainService??"mainService"];if(!s?.odataVersion?.startsWith("4."))return tr("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:s.odataVersion});let o=await gZr(i);if(typeof o=="string")return o;t.appAccess=i,t.specification=o;let{servicePath:a,systemName:c}=await mZr(i.app.appRoot,s);return a&&(t.servicePath=a,e.push(a)),t.systemName&&(t.systemName.value=c),t.connectPath&&(t.connectPath.value=a),!0}}}function hro(t,e,r,n){let i;return{when:async s=>t.choices.length>0,name:Bh.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:tr("prompts.relatedEntitySelection.message"),choices:()=>t.choices,validate:async(s,o)=>{if(t.choices.forEach(a=>{a.disabled||(a.checked=s.some(c=>c.fullPath===a.value.fullPath))}),o&&!o[Bh.skipDataDownload]?.[0]){if(i=await vZr(o,e,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:tr("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:aet.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:tr("prompts.relatedEntitySelection.openLogs")})}}function mro(t,e){let r,n,i;return{when:()=>{if((n!==t.systemName?.value||t.servicePath!==r)&&t.referencedEntities?.listEntity){let o=hZr(t.referencedEntities.listEntity,t.referencedEntities.pageObjectEntities);o&&(e.choices=o.choices,Object.assign(e.entitySetsFlat,o.entitySetsFlat)),r=t.servicePath,n=t.systemName?.value}return e.choices.length>0},name:Bh.toggleSelection,type:"confirm",message:tr("prompts.toggleSelection.message"),labelTrue:tr("prompts.toggleSelection.labelTrue"),labelFalse:tr("prompts.toggleSelection.labelFalse"),default:!1,validate:o=>(o!==i&&(e.choices.forEach(a=>{if(a.disabled)return;let c=a.value;a.checked=o===!1?c.entity.defaultSelected:!1}),i=o),!0)}}function gro(t,e,r,n){let i=[],s,o=0,a=c=>({when:async()=>{let u=e.referencedEntities?.listEntity.semanticKeys[c],l=!!u?.name&&u.name!=="IsActiveEntity";return l&&c>o&&(o=c),l},name:`entityKeyIdx:${c}`,message:()=>tr("prompts.entityKey.message",{keyName:`${e.referencedEntities?.listEntity.semanticKeys[c]?.name} (${e.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:tr("prompts.entityKey.hint")},validate:async(u,l)=>{let p=e.referencedEntities?.listEntity.semanticKeys[c];if(p&&delete p.value,_Zr.includes(u))return tr("prompts.entityKey.validation.invalidKeyValueChars",{chars:_Zr.join()});if(u&&p)if(p.type==="Edm.Boolean")try{p.value=JSON.parse(u)}catch{return tr("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(p.type)){let h=u.split(",");for(let d of h)if(!pro.test(d.trim()))return tr("prompts.entityKey.validation.invalidGuidValue");p.value=u.trim()}else p.value=u.trim();let f=u.split(",");if(p?.type&&!["Edm.UUID","Edm.Guid"].includes(p.type)){for(let h of f)if(h.split("-").length>2)return p&&delete p.value,tr("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!e.relatedEntityChoices?.choices?.length&&c===o&&!l[Bh.skipDataDownload]?.[0]&&e.referencedEntities?.listEntity.semanticKeys[c]?.name){if(s=await vZr(l,r,e),typeof s=="string")return s;n.odata=s.odataQueryResult}return!0}});for(let c=0;c<t;c++)i.push(a(c));return i}function yro(t,e){return{when:()=>!!t.metadata&&!!e.servicePath,name:Bh.skipDataDownload,type:"checkbox",message:tr("prompts.skipDataDownload.message"),guiOptions:{hint:tr("prompts.skipDataDownload.hint")},default:!1,choices:[{name:tr("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function _ro(t,e){let r;return{when:async()=>e.appAccess&&e.specification&&t?.metadata?(r=await JQr(e.appAccess,e.specification,t.metadata),typeof r=="object"&&(e.referencedEntities=r),!0):!1,name:Bh.updateMainServiceMetadata,type:"confirm",message:tr("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:aet.Severity.error}}}}function bZr(t){let e=[],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 t.forEach(n=>{!n.parentProperty&&n.missingReferentialConstraints?.navPropName&&e.push(...r(n))}),e}var xZr=Pe(LT()),PZr=Pe(kT());var OZr=Pe(wZr()),CZr=require("node:path");function RZr(t,e,r){Wp.resetExternalServiceCache();let n=Lro(t,e),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:tr("prompts.valueHelpSelection.message"),choices:()=>n,validate:async o=>{if(!o||o.length===0)return Wp.resetExternalServiceCache(),!0;let a=await Iro(o,r),c=(0,OZr.default)(i,a);return i.length=0,i.push(...c),await Dro(i,r),!0}}],valueHelpData:i}}async function Dro(t,e){let r=[],n={transformResponse:s=>typeof s=="string"?JSON.parse(s):s},i=t.map(async s=>{let o=s,[a]=o.path.split(";");Wp.externalServiceRequestCache[a]??=[];let l=(0,xZr.convert)((0,PZr.parse)(s.metadata)).entitySets.map(async p=>{let f=p.name;if(Wp.externalServiceRequestCache[a].includes(f))return;Wp.externalServiceRequestCache[a].push(f);let h=await e.get((0,CZr.join)(o.path,f),n);o.entityData=o.entityData??[],o.entityData?.push({entitySetName:f,items:h.data.value})});await Promise.allSettled(l),o.entityData&&r.push(o)});return await Promise.allSettled(i),r}async function Iro(t,e){let r=t.flat();return await e.fetchExternalServices(r)}function Lro(t,e){let r=n8(t,e,[]),n={};for(let s of r)if(s.type==="value-list"){if(GQr.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 c=a.map(u=>{if(u.type==="value-list")return u.target.replace(/\/[^/]*$/,"");if(u.type==="code-list"&&u.collectionPath)return u.collectionPath}).filter(u=>u!==void 0);i.push({name:`${o} (${c.join()})`,value:a})}return i.sort((s,o)=>s.name.localeCompare(o.name))}var qr=class t extends DZr.default{vscode;appWizard;static _logger=ufe;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(e,r){super(e,{...r,skipInstall:!0},{unique:"namespace"}),I7e(this.env,!0),this.options.force=!0,this.prompts=new Bye.Prompts([{description:tr("steps.odataDownloader.description"),name:tr("steps.odataDownloader.name")},{description:tr("steps.valueHelpSelection.description"),name:tr("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(tr("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return t._logger}async initializing(){await lXe(),t._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await Sl.initTelemetrySettings(),Sl.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:e,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await EZr(this.options?.data),s=await this.prompt(i);if(this.state.entityOData=r.odata,this.state.entityPropertyToEntitySet=e.relatedEntityChoices.entitySetsFlat,this.state.appRootPath=e.appAccess?.getAppRoot(),this.state.mainServicePath=n.servicePath,this.state.mainServiceName=e.appAccess?.app.mainService,this.state.appEntities=e.referencedEntities,this.state.appRootPath){this.state.mockServerConfig=await jM(this.state.appRootPath);let o;this.state.mockServerConfig?.services&&(t.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,pC.join)($s.Webapp,$s.LocalService,$s.Mockdata)}if(this.state.updateMainServiceMetadata=s[Bh.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,s[Bh.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(e,s),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof Hl){let{questions:o,valueHelpData:a}=RZr(n.servicePath,n.metadata,n.connectedSystem?.serviceProvider);await this.prompt(o),this.state.valueHelpData=a}}catch(e){t.logger.error(e),this._exitOnError(e)}}async writing(){if(this.state.appRootPath){if(this.state.entityOData&&this.state.entityPropertyToEntitySet&&this.state.appEntities)try{let e=Date.now();Sl.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,pC.join)(this.state.appRootPath));let r=net(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);t.logger.info(tr("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,s])=>{this.writeDestinationJSON((0,pC.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,pC.join)(this.state.mockDataRootPath,`${i.entitySetName}.js`),o=this.destinationPath(s),{navPropName:a,constraints:c}=i.missingReferentialConstraints;if(this.fs.exists(o)){let u=this.fs.read(o),l=ZQr(u,a,c);l!==u?(this.writeDestination(s,l),t.logger.info(`Updated referential constraint file: ${i.entitySetName}.js`)):t.logger.debug(`Referential constraint for '${a}' already present in ${i.entitySetName}.js \u2014 skipping`)}else{let u=QQr(a,c);this.writeDestination(s,u),t.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),Sl.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfFiles:`${n.length}`})}catch(e){t.logger.error(e),Sl.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(tr("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let e=Date.now();Sl.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,pC.join)(this.state.appRootPath,$s.Webapp);if(await Dfe(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 pfe(this.state.appRootPath,n,this.fs))}Sl.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfExternalServices:`${this.state.valueHelpData.length}`})}catch(e){t.logger.error(e),Sl.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(tr("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let e=(0,pC.join)(this.state.appRootPath,$s.Webapp,$s.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(e,(0,NZr.default)(this.state.mainServiceMetadata,{indentation:" ",lineSeparator:`
2348
2348
  `,collapseContent:!0,throwOnFailure:!1}))}}}async _promptMissingReferentialConstraints(e,r){let n=e.referencedEntities?.listEntity.entitySetName,i=new Set([...n?[n]:[],...(r[Bh.relatedEntitySelection]??[]).map(o=>o.entity.entitySetName)]),s=e.referencedEntities?.hierarchyEntities?.filter(o=>!o.parentProperty&&o.missingReferentialConstraints&&i.has(o.entitySetName))??[];if(s.length>0){this.prompts.splice(1,0,[{name:tr("steps.addConstraints.name"),description:tr("steps.addConstraints.description")}]);let o=bZr(s),a=await this.prompt(o),c=[e.referencedEntities?.listEntity,...e.referencedEntities?.pageObjectEntities??[]];s.forEach(u=>{let l=a[`${u.entitySetName}/${u.nodeProperty}/source`],p=a[`${u.entitySetName}/${u.nodeProperty}/target`];if(l&&p){u.missingReferentialConstraints.constraints=[{sourceProperty:l,targetProperty:p}],u.parentProperty=l;let f=c.find(h=>h?.entitySetName===u.entitySetName)?.entityType;u.parentPropertyType=f?.entityProperties.find(h=>h.name===l)?.type??"Edm.String"}})}}_exitOnError(e){throw Ad()!==gi.cli&&this.appWizard?.showError(e,Bye.MessageType.notification),new Error(e)}_configureLogging(e,r,n){let i=new cfe(this.rootGeneratorName(),this.log,e,r,n);return i.info(tr("info.loggingInitialised",{logLevel:i.getLogLevel()})),i}};
2349
2349
  /*! Bundled license information:
2350
2350
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sap-ux/generator-odata-downloader",
3
3
  "displayName": "Fiori Elements Data Downloader",
4
4
  "description": "Yeoman generator that supports download of app data, typically for mock data server use.",
5
- "version": "0.3.23",
5
+ "version": "0.3.24",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -44,18 +44,18 @@
44
44
  "rimraf": "6.1.3",
45
45
  "xml-formatter": "3.7.0",
46
46
  "yeoman-generator": "5.10.0",
47
- "@sap-ux/axios-extension": "2.0.5",
48
- "@sap-ux/btp-utils": "2.0.4",
49
- "@sap-ux/fiori-generator-shared": "1.0.17",
50
- "@sap-ux/inquirer-common": "1.0.18",
47
+ "@sap-ux/axios-extension": "2.0.6",
48
+ "@sap-ux/btp-utils": "2.0.5",
49
+ "@sap-ux/fiori-generator-shared": "1.0.18",
50
+ "@sap-ux/inquirer-common": "1.0.19",
51
51
  "@sap-ux/logger": "1.0.2",
52
- "@sap-ux/mockserver-config-writer": "1.0.9",
53
- "@sap-ux/odata-service-inquirer": "3.0.20",
54
- "@sap-ux/odata-service-writer": "1.0.11",
55
- "@sap-ux/project-access": "2.1.5",
52
+ "@sap-ux/mockserver-config-writer": "1.0.10",
53
+ "@sap-ux/odata-service-inquirer": "3.0.21",
54
+ "@sap-ux/odata-service-writer": "1.0.12",
55
+ "@sap-ux/project-access": "2.1.6",
56
56
  "@sap-ux/store": "2.0.3",
57
- "@sap-ux/telemetry": "1.0.15",
58
- "@sap-ux/ui5-config": "1.0.4"
57
+ "@sap-ux/telemetry": "1.0.16",
58
+ "@sap-ux/ui5-config": "1.0.5"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=22.x"