@sap-ux/fiori-mcp-server 1.12.13 → 1.13.0

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -2
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -3683,7 +3683,7 @@ ${i}`),await UY(t,a.concat(i),n),!0}function Fxa(t,e){let r=IE.create("","",0,t)
3683
3683
  `,e-1),[i,a]=mHa(r);return{line:n===-1?i:t.slice(0,n+1).match(/\n/g).length+i,column:e-n-1+a}}function lSr(t,e,r){if(typeof t!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(e))throw new TypeError("Index parameter should be an integer");if(e<0||e>t.length)throw new RangeError("Index out of bounds");return gHa(t,e,r)}var yHa=t=>`\\u{${t.codePointAt(0).toString(16)}}`,uSr=class t extends Error{name="JSONError";fileName;#n;#t;#r;#f;#O;constructor(e){if(typeof e=="string")super(),this.#r=e;else{let{jsonParseError:r,fileName:n,input:i}=e;super(void 0,{cause:r}),this.#n=i,this.#t=r,this.fileName=n}Error.captureStackTrace?.(this,t)}get message(){this.#r??=`${vHa(this.#t.message)}${this.#n===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
3684
3684
 
3685
3685
  ${e}
3686
- `:""}`}set message(e){this.#r=e}#C(e){if(!this.#t)return;let r=this.#n,n=_Ha(r,this.#t.message);if(n)return(0,kzn.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#f??=this.#C(!0),this.#f}get rawCodeFrame(){return this.#O??=this.#C(!1),this.#O}},_Ha=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:a}=r.groups;return i&&a?{line:Number(i),column:Number(a)}:lSr(t,Number(n),{oneBased:!0})},vHa=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${yHa(n)})`);function pSr(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new uSr({jsonParseError:n,fileName:r,input:t})}}var R4n=Nr(I4n(),1);import{fileURLToPath as yza}from"node:url";function D4n(t){return t instanceof URL?yza(t):t}var Eza=t=>vza.resolve(D4n(t)??".","package.json"),Tza=(t,e)=>{let r=typeof t=="string"?pSr(t):t;return e&&(0,R4n.default)(r),r};async function M4n({cwd:t,normalize:e=!0}={}){let r=await _za.readFile(Eza(t),"utf8");return Tza(r,e)}async function L4n(t){let e=await pzn("package.json",t);if(e)return{packageJson:await M4n({...t,cwd:bza.dirname(e)}),path:e}}var Aot=Nr(hX(),1);var ic=t=>typeof t=="string",Tot=()=>{let t,e,r=new Promise((n,i)=>{t=n,e=i});return r.resolve=t,r.reject=e,r},k4n=t=>t==null?"":String(t),Sza=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},Aza=/###/g,$4n=t=>t&&t.includes("###")?t.replace(Aza,"."):t,F4n=t=>!t||ic(t),bot=(t,e,r)=>{let n=ic(e)?e.split("."):e,i=0;for(;i<n.length-1;){if(F4n(t))return{};let a=$4n(n[i]);!t[a]&&r&&(t[a]=new r),Object.prototype.hasOwnProperty.call(t,a)?t=t[a]:t={},++i}return F4n(t)?{}:{obj:t,k:$4n(n[i])}},V4n=(t,e,r)=>{let{obj:n,k:i}=bot(t,e,Object);if(n!==void 0||e.length===1){n[i]=r;return}let a=e[e.length-1],s=e.slice(0,e.length-1),c=bot(t,s,Object);for(;c.obj===void 0&&s.length;)a=`${s[s.length-1]}.${a}`,s=s.slice(0,s.length-1),c=bot(t,s,Object),c?.obj&&typeof c.obj[`${c.k}.${a}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${a}`]=r},Oza=(t,e,r,n)=>{let{obj:i,k:a}=bot(t,e,Object);i[a]=i[a]||[],i[a].push(r)},ADt=(t,e)=>{let{obj:r,k:n}=bot(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Cza=(t,e,r)=>{let n=ADt(t,r);return n!==void 0?n:ADt(e,r)},H4n=(t,e,r)=>{for(let n in e)n!=="__proto__"&&n!=="constructor"&&(Object.prototype.hasOwnProperty.call(t,n)?ic(t[n])||t[n]instanceof String||ic(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):H4n(t[n],e[n],r):t[n]=e[n]);return t},Qie=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Pza={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},Nza=t=>ic(t)?t.replace(/[&<>"'\/]/g,e=>Pza[e]):t,NSr=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}},wza=[" ",",","?","!",";"],xza=new NSr(20),Iza=(t,e,r)=>{e=e||"",r=r||"";let n=wza.filter(s=>!e.includes(s)&&!r.includes(s));if(n.length===0)return!0;let i=xza.getRegExp(`(${n.map(s=>s==="?"?"\\?":s).join("|")})`),a=!i.test(t);if(!a){let s=t.indexOf(r);s>0&&!i.test(t.substring(0,s))&&(a=!0)}return a},wSr=(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 a=0;a<n.length;){if(!i||typeof i!="object")return;let s,c="";for(let l=a;l<n.length;++l)if(l!==a&&(c+=r),c+=n[l],s=i[c],s!==void 0){if(["string","number","boolean"].includes(typeof s)&&l<n.length-1)continue;a+=l-a+1;break}i=s}return i},Sot=t=>t?.replace(/_/g,"-"),Dza={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)}},xSr=class t{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||Dza,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:(e=e.map(a=>ic(a)?a.replace(/[\r\n\x00-\x1F\x7F]/g," "):a),ic(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)}},mZ=new xSr,Tje=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)}}once(e,r){let n=(...i)=>{r(...i),this.off(e,n)};return this.on(e,n),this}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,a])=>{for(let s=0;s<a;s++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,a])=>{for(let s=0;s<a;s++)i(e,...r)})}},ODt=class extends Tje{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.includes(e)||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 a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,c;e.includes(".")?c=e.split("."):(c=[e,r],n&&(Array.isArray(n)?c.push(...n):ic(n)&&a?c.push(...n.split(a)):c.push(n)));let l=ADt(this.data,c);return!l&&!r&&!n&&e.includes(".")&&(e=c[0],r=c[1],n=c.slice(2).join(".")),l||!s||!ic(n)?l:wSr(this.data?.[e]?.[r],n,a)}addResource(e,r,n,i,a={silent:!1}){let s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=[e,r];n&&(c=c.concat(s?n.split(s):n)),e.includes(".")&&(c=e.split("."),i=r,r=c[1]),this.addNamespaces(r),V4n(this.data,c,i),a.silent||this.emit("added",e,r,n,i)}addResources(e,r,n,i={silent:!1}){for(let a in n)(ic(n[a])||Array.isArray(n[a]))&&this.addResource(e,r,a,n[a],{silent:!0});i.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,i,a,s={silent:!1,skipCopy:!1}){let c=[e,r];e.includes(".")&&(c=e.split("."),i=n,n=r,r=c[1]),this.addNamespaces(r);let l=ADt(this.data,c)||{};s.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?H4n(l,n,a):l={...l,...n},V4n(this.data,c,l),s.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}},z4n={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,i){return t.forEach(a=>{e=this.processors[a]?.process(e,r,n,i)??e}),e}},K4n=Symbol("i18next/PATH_KEY");function Rza(){let t=[],e=Object.create(null),r;return e.get=(n,i)=>(r?.revoke?.(),i===K4n?t:(t.push(i),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function vje(t,e){let{[K4n]:r}=t(Rza()),n=e?.keySeparator??".",i=e?.nsSeparator??":",a=e?.enableSelector==="strict";if(r.length>1&&i){let s=e?.ns,c=a?Array.isArray(s)?s:s?[s]:null:Array.isArray(s)?s:null;if(c&&(a?c:c.length>1?c.slice(1):[]).includes(r[0]))return`${r[0]}${i}${r.slice(1).join(n)}`}return r.join(n)}var CSr=t=>!ic(t)&&typeof t!="boolean"&&typeof t!="number",CDt=class t extends Tje{constructor(e,r={}){super(),Sza(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=mZ.create("translator"),this.checkedLoadedFor={}}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 a=CSr(i.res);return!(n.returnObjects===!1&&a)}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,a=r.ns||this.options.defaultNS||[],s=n&&e.includes(n),c=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Iza(e,n,i);if(s&&!c){let l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:ic(a)?[a]:a};let u=e.split(n);(n!==i||n===i&&this.options.ns.includes(u[0]))&&(a=u.shift()),e=u.join(i)}return{key:e,namespaces:ic(a)?[a]:a}}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=vje(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]),e=e.map(W=>typeof W=="function"?vje(W,{...this.options,...i}):String(W));let a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:c,namespaces:l}=this.extractFromKey(e[e.length-1],i),u=l[l.length-1],p=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;p===void 0&&(p=":");let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return f?a?{res:`${u}${p}${c}`,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${p}${c}`:a?{res:c,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:c;let h=this.resolve(e,i),m=h?.res,g=h?.usedKey||c,y=h?.exactUsedKey||c,_=["[object Number]","[object Function]","[object RegExp]"],v=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,C=i.count!==void 0&&!ic(i.count),O=t.hasDefaultValue(i),P=C?this.pluralResolver.getSuffix(d,i.count,i):"",N=i.ordinal&&C?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):"",D=C&&!i.ordinal&&i.count===0,M=D&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${P}`]||i[`defaultValue${N}`]||i.defaultValue,k=m;b&&!m&&O&&(k=M);let F=CSr(k),K=Object.prototype.toString.apply(k);if(b&&k&&F&&!_.includes(K)&&!(ic(v)&&Array.isArray(k))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let W=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,k,{...i,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return a?(h.res=W,h.usedParams=this.getUsedParamsDetails(i),h):W}if(s){let W=Array.isArray(k),G=W?[]:{},J=W?y:g;for(let ve in k)if(Object.prototype.hasOwnProperty.call(k,ve)){let Se=`${J}${s}${ve}`;O&&!m?G[ve]=this.translate(Se,{...i,defaultValue:CSr(M)?M[ve]:void 0,joinArrays:!1,ns:l}):G[ve]=this.translate(Se,{...i,joinArrays:!1,ns:l}),G[ve]===Se&&(G[ve]=k[ve])}m=G}}else if(b&&ic(v)&&Array.isArray(m))m=m.join(v),m&&(m=this.extendTranslation(m,e,i,n));else{let W=!1,G=!1;!this.isValidLookup(m)&&O&&(W=!0,m=M),this.isValidLookup(m)||(G=!0,m=c);let ve=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&G?void 0:m,Se=O&&M!==m&&this.options.updateMissing;if(G||W||Se){if(this.logger.log(Se?"updateKey":"missingKey",d,u,C&&!Se?`${c}${this.pluralResolver.getSuffix(d,i.count,i)}`:c,Se?M:m),s){let pe=this.resolve(c,{...i,keySeparator:!1});pe&&pe.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 fe=[],ne=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ne&&ne[0])for(let pe=0;pe<ne.length;pe++)fe.push(ne[pe]);else this.options.saveMissingTo==="all"?fe=this.languageUtils.toResolveHierarchy(i.lng||this.language):fe.push(i.lng||this.language);let se=(pe,le,Le)=>{let st=O&&Le!==m?Le:ve;this.options.missingKeyHandler?this.options.missingKeyHandler(pe,u,le,st,Se,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(pe,u,le,st,Se,i),this.emit("missingKey",pe,u,le,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?fe.forEach(pe=>{let le=this.pluralResolver.getSuffixes(pe,i);D&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!le.includes(`${this.options.pluralSeparator}zero`)&&le.push(`${this.options.pluralSeparator}zero`),le.forEach(Le=>{se([pe],c+Le,i[`defaultValue${Le}`]||M)})}):se(fe,c,M))}m=this.extendTranslation(m,e,i,h,n),G&&m===c&&this.options.appendNamespaceToMissingKey&&(m=`${u}${p}${c}`),(G||W)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${p}${c}`:c,W?m:void 0,i))}return a?(h.res=m,h.usedParams=this.getUsedParamsDetails(i),h):m}extendTranslation(e,r,n,i,a){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 l=ic(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(l){let d=e.match(this.interpolator.nestingRegexp);u=d&&d.length}let p=n.replace&&!ic(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),e=this.interpolator.interpolate(e,p,n.lng||this.language||i.usedLng,n),l){let d=e.match(this.interpolator.nestingRegexp),f=d&&d.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,(...d)=>a?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}let s=n.postProcess||this.options.postProcess,c=ic(s)?[s]:s;return e!=null&&c?.length&&n.applyPostProcessor!==!1&&(e=z4n.handle(c,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,i,a,s,c;return ic(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(l=>typeof l=="function"?vje(l,{...this.options,...r}):l)),e.forEach(l=>{if(this.isValidLookup(n))return;let u=this.extractFromKey(l,r),p=u.key;i=p;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));let f=r.count!==void 0&&!ic(r.count),h=f&&!r.ordinal&&r.count===0,m=r.context!==void 0&&(ic(r.context)||typeof r.context=="number")&&r.context!=="",g=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(y=>{this.isValidLookup(n)||(c=y,!this.checkedLoadedFor[`${g[0]}-${y}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(this.checkedLoadedFor[`${g[0]}-${y}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(_=>{if(this.isValidLookup(n))return;s=_;let v=[p];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(v,p,_,y,r);else{let C;f&&(C=this.pluralResolver.getSuffix(_,r.count,r));let O=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&C.startsWith(P)&&v.push(p+C.replace(P,this.options.pluralSeparator)),v.push(p+C),h&&v.push(p+O)),m){let N=`${p}${this.options.contextSeparator||"_"}${r.context}`;v.push(N),f&&(r.ordinal&&C.startsWith(P)&&v.push(N+C.replace(P,this.options.pluralSeparator)),v.push(N+C),h&&v.push(N+O))}}let b;for(;b=v.pop();)this.isValidLookup(n)||(a=b,n=this.getResource(_,y,b,r))}))})}),{res:n,usedKey:i,exactUsedKey:a,usedLng:s,usedNS:c}}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&&!ic(e.replace),i=n?e.replace:e;if(n&&typeof e.count<"u"&&(i={...i,count:e.count}),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let a of r)delete i[a]}return i}static hasDefaultValue(e){let r="defaultValue";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&n.startsWith(r)&&e[n]!==void 0)return!0;return!1}},PDt=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mZ.create("languageUtils")}getScriptPartFromCode(e){if(e=Sot(e),!e||!e.includes("-"))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=Sot(e),!e||!e.includes("-"))return e;let r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(ic(e)&&e.includes("-")){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.includes(e)}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 a=this.getLanguagePartFromCode(n);if(this.isSupportedCode(a))return r=a;r=this.options.supportedLngs.find(s=>s===a?!0:!s.includes("-")&&!a.includes("-")?!1:!!(s.includes("-")&&!a.includes("-")&&s.slice(0,s.indexOf("-"))===a||s.startsWith(a)&&a.length>1))}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),ic(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=[],a=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return ic(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(e))):ic(e)&&a(this.formatLanguageCode(e)),n.forEach(s=>{i.includes(s)||a(this.formatLanguageCode(s))}),i}},U4n={zero:0,one:1,two:2,few:3,many:4,other:5},j4n={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},ISr=class{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=mZ.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){let n=Sot(e==="dev"?"en":e),i=r.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:n,type:i});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let s;try{s=new Intl.PluralRules(n,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),j4n;if(!e.match(/-|_/))return j4n;let l=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(l,r)}return this.pluralRulesCache[a]=s,s}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,a)=>U4n[i]-U4n[a]).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))}},B4n=(t,e,r,n=".",i=!0)=>{let a=Cza(t,e,r);return!a&&i&&ic(r)&&(a=wSr(t,r,n),a===void 0&&(a=wSr(e,r,n))),a},Mza=t=>t.replace(/\$/g,"$$$$"),NDt=class{constructor(e={}){this.logger=mZ.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:a,prefixEscaped:s,suffix:c,suffixEscaped:l,formatSeparator:u,unescapeSuffix:p,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:m,nestingSuffixEscaped:g,nestingOptionsSeparator:y,maxReplaces:_,alwaysFormat:v}=e.interpolation;this.escape=r!==void 0?r:Nza,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=a?Qie(a):s||"{{",this.suffix=c?Qie(c):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":d?Qie(d):"-",this.unescapeSuffix=this.unescapePrefix?"":p?Qie(p):"",this.nestingPrefix=f?Qie(f):h||Qie("$t("),this.nestingSuffix=m?Qie(m):g||Qie(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=_||1e3,this.alwaysFormat=v!==void 0?v:!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 a,s,c,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(!h.includes(this.formatSeparator)){let _=B4n(r,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(_,void 0,n,{...i,...r,interpolationkey:h}):_}let m=h.split(this.formatSeparator),g=m.shift().trim(),y=m.join(this.formatSeparator).trim();return this.format(B4n(r,l,g,this.options.keySeparator,this.options.ignoreJSONStructure),y,n,{...i,...r,interpolationkey:g})};this.resetRegExp(),!this.escapeValue&&typeof e=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false \u2014 if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");let p=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>h},{regex:this.regexp,safeValue:h=>this.escapeValue?this.escape(h):h}].forEach(h=>{for(c=0;a=h.regex.exec(e);){let m=a[1].trim();if(s=u(m),s===void 0)if(typeof p=="function"){let y=p(e,a,i);s=ic(y)?y:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))s="";else if(d){s=a[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),s="";else!ic(s)&&!this.useRawValueToEscape&&(s=k4n(s));let g=h.safeValue(s);if(e=e.replace(a[0],Mza(g)),d?(h.regex.lastIndex+=g.length,h.regex.lastIndex-=a[0].length):h.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,r,n={}){let i,a,s,c=(l,u)=>{let p=this.nestingOptionsSeparator;if(!l.includes(p))return l;let d=l.split(new RegExp(`${Qie(p)}[ ]*{`)),f=`{${d[1]}`;l=d[0],f=this.interpolate(f,s);let h=f.match(/'/g),m=f.match(/"/g);((h?.length??0)%2===0&&!m||(m?.length??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),u&&(s={...u,...s})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${p}${f}`}return s.defaultValue&&s.defaultValue.includes(this.prefix)&&delete s.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];s={...n},s=s.replace&&!ic(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=/{.*}/s.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(l=i[1].slice(u).split(this.formatSeparator).map(p=>p.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),a=r(c.call(this,i[1].trim(),s),s),a&&i[0]===e&&!ic(a))return a;ic(a)||(a=k4n(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),a=""),l.length&&(a=l.reduce((p,d)=>this.format(p,d,n.lng,{...n,interpolationkey:i[1].trim()}),a.trim())),e=e.replace(i[0],a),this.regexp.lastIndex=0}return e}},Lza=t=>{let e=t.toLowerCase().trim(),r={};if(t.includes("(")){let n=t.split("(");e=n[0].toLowerCase().trim();let i=n[1].slice(0,-1);e==="currency"&&!i.includes(":")?r.currency||(r.currency=i.trim()):e==="relativetime"&&!i.includes(":")?r.range||(r.range=i.trim()):i.split(";").forEach(s=>{if(s){let[c,...l]=s.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),p=c.trim();r[p]||(r[p]=u),u==="false"&&(r[p]=!1),u==="true"&&(r[p]=!0),isNaN(u)||(r[p]=parseInt(u,10))}})}return{formatName:e,formatOptions:r}},q4n=t=>{let e={};return(r,n,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let s=n+JSON.stringify(a),c=e[s];return c||(c=t(Sot(n),i),e[s]=c),c(r)}},kza=t=>(e,r,n)=>t(Sot(r),n)(e),DSr=class{constructor(e={}){this.logger=mZ.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?q4n:kza;this.formats={number:n((i,a)=>{let s=new Intl.NumberFormat(i,{...a});return c=>s.format(c)}),currency:n((i,a)=>{let s=new Intl.NumberFormat(i,{...a,style:"currency"});return c=>s.format(c)}),datetime:n((i,a)=>{let s=new Intl.DateTimeFormat(i,{...a});return c=>s.format(c)}),relativetime:n((i,a)=>{let s=new Intl.RelativeTimeFormat(i,{...a});return c=>s.format(c,a.range||"day")}),list:n((i,a)=>{let s=new Intl.ListFormat(i,{...a});return c=>s.format(c)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=q4n(r)}format(e,r,n,i={}){if(!r||e==null)return e;let a=r.split(this.formatSeparator),s=[];for(let l=0;l<a.length;l++){let u=a[l];for(;u.indexOf("(")>-1&&!u.includes(")")&&l+1<a.length;)u=`${u}${this.formatSeparator}${a[++l]}`;s.push(u)}return s.reduce((l,u)=>{let{formatName:p,formatOptions:d}=Lza(u);if(this.formats[p]){let f=l;try{let h=i?.formatParams?.[i.interpolationkey]||{},m=h.locale||h.lng||i.locale||i.lng||n;f=this.formats[p](l,m,{...d,...i,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${p}`);return l},e)}},$za=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)},RSr=class extends Tje{constructor(e,r,n,i={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=mZ.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 a={},s={},c={},l={};return e.forEach(u=>{let p=!0;r.forEach(d=>{let f=`${u}|${d}`;!n.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,p=!1,s[f]===void 0&&(s[f]=!0),a[f]===void 0&&(a[f]=!0),l[d]===void 0&&(l[d]=!0)))}),p||(c[u]=!0)}),(Object.keys(a).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(a),pending:Object.keys(s),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(e,r,n){let i=e.split("|"),a=i[0],s=i[1];r&&this.emit("failedLoading",a,s,r),!r&&n&&this.store.addResourceBundle(a,s,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);let c={};this.queue.forEach(l=>{Oza(l.loaded,[a],s),$za(l,e),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{c[u]||(c[u]={});let p=l.loaded[u];p.length&&p.forEach(d=>{c[u][d]===void 0&&(c[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(e,r,n,i=0,a=this.retryTimeout,s){if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:i,wait:a,callback:s});return}this.readingCalls++;let c=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){let d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&p&&i<this.maxRetries){setTimeout(()=>{this.read(e,r,n,i+1,a*2,s)},a);return}s(u,p)},l=this.backend[n].bind(this.backend);if(l.length===2){try{let u=l(e,r);u&&typeof u.then=="function"?u.then(p=>c(null,p)).catch(c):c(null,u)}catch(u){c(u)}return}return l(e,r,c)}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();ic(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ic(r)&&(r=[r]);let a=this.queueLoad(e,r,n,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(s=>{this.loadOne(s)})}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],a=n[1];this.read(i,a,"read",void 0,void 0,(s,c)=>{s&&this.logger.warn(`${r}loading namespace ${a} for language ${i} failed`,s),!s&&c&&this.logger.log(`${r}loaded namespace ${a} for language ${i}`,c),this.loaded(e,s,c)})}saveMissing(e,r,n,i,a,s={},c=()=>{}){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 l={...s,isUpdate:a},u=this.backend.create.bind(this.backend);if(u.length<6)try{let p;u.length===5?p=u(e,r,n,i,l):p=u(e,r,n,i),p&&typeof p.then=="function"?p.then(d=>c(null,d)).catch(c):c(null,p)}catch(p){c(p)}else u(e,r,n,i,c,l)}!e||!e[0]||this.store.addResource(e[0],r,n,i)}}},PSr=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,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]),ic(t[1])&&(e.defaultValue=t[1]),ic(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,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),G4n=t=>(ic(t.ns)&&(t.ns=[t.ns]),ic(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ic(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&!t.supportedLngs.includes("cimode")&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),SDt=()=>{},Fza=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})},MSr=class t extends Tje{constructor(e={},r){if(super(),this.options=G4n(e),this.services={},this.logger=mZ,this.modules={external:[]},Fza(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&&(ic(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));let n=PSr();this.options={...n,...this.options,...G4n(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);let i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?mZ.init(i(this.modules.logger),this.options):mZ.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=DSr;let p=new PDt(this.options);this.store=new ODt(this.options.resources,this.options);let d=this.services;d.logger=mZ,d.resourceStore=this.store,d.languageUtils=p,d.pluralResolver=new ISr(p,{prepend:this.options.pluralSeparator}),u&&(d.formatter=i(u),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new NDt(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new RSr(i(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.languageDetector&&(d.languageDetector=i(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=i(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new CDt(this.services,this.options),this.translator.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,r||(r=SDt),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]=(...p)=>this.store[u](...p)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...p)=>(this.store[u](...p),this)});let c=Tot(),l=()=>{let u=(p,d)=>{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),c.resolve(d),r(p,d)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),c}loadResources(e,r=SDt){let n=r,i=ic(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 a=[],s=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(u=>{u!=="cimode"&&(a.includes(u)||a.push(u))})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload?.forEach?.(c=>s(c)),this.services.backendConnector.load(a,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(c)})}else n(null)}reloadResources(e,r,n){let i=Tot();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=SDt),this.services.backendConnector.reload(e,r,a=>{i.resolve(),n(a)}),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"&&z4n.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"].includes(e)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!["cimode","dev"].includes(n)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let n=Tot();this.emit("languageChanging",e);let i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,l)=>{l?this.isLanguageChangingTo===e&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),r&&r(c,(...u)=>this.t(...u))},s=c=>{!e&&!c&&this.services.languageDetector&&(c=[]);let l=ic(c)?c:c&&c[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(ic(c)?[c]:c);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,p=>{a(p,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),n}getFixedT(e,r,n,i){let a=i?.scopeNs,s=(c,l,...u)=>{let p;typeof l!="object"?p=this.options.overloadTranslationOptionHandler([c,l].concat(u)):p={...l},p.lng=p.lng||s.lng,p.lngs=p.lngs||s.lngs;let d=p.ns!==void 0&&p.ns!==null;p.ns=p.ns||s.ns,p.keyPrefix!==""&&(p.keyPrefix=p.keyPrefix||n||s.keyPrefix);let f={...this.options,...p};Array.isArray(a)&&!d&&(f.ns=a),typeof p.keyPrefix=="function"&&(p.keyPrefix=vje(p.keyPrefix,f));let h=this.options.keySeparator||".",m;return p.keyPrefix&&Array.isArray(c)?m=c.map(g=>(typeof g=="function"&&(g=vje(g,f)),`${p.keyPrefix}${h}${g}`)):(typeof c=="function"&&(c=vje(c,f)),m=p.keyPrefix?`${p.keyPrefix}${h}${c}`:c),this.t(m,p)};return ic(e)?s.lng=e:s.lngs=e,s.ns=r,s.keyPrefix=n,s}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,a=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let s=(c,l)=>{let u=this.services.backendConnector.state[`${c}|${l}`];return u===-1||u===0||u===2};if(r.precheck){let c=r.precheck(this,s);if(c!==void 0)return c}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(n,e)&&(!i||s(a,e)))}loadNamespaces(e,r){let n=Tot();return this.options.ns?(ic(e)&&(e=[e]),e.forEach(i=>{this.options.ns.includes(i)||this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){let n=Tot();ic(e)&&(e=[e]);let i=this.options.preload||[],a=e.filter(s=>!i.includes(s)&&this.services.languageUtils.isSupportedCode(s));return a.length?(this.options.preload=i.concat(a),this.loadResources(s=>{n.resolve(),r&&r(s)}),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 a=i.getTextInfo();if(a&&a.direction)return a.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 PDt(PSr());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.includes(n.getLanguagePartFromCode(e))||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=SDt){let n=e.forkResourceStore;n&&delete e.forkResourceStore;let i={...this.options,...e,isClone:!0},a=new t(i);if((e.debug!==void 0||e.prefix!==void 0)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(c=>{a[c]=this[c]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n){let c=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((p,d)=>(p[d]={...l[u][d]},p),l[u]),l),{});a.store=new ODt(c,i),a.services.resourceStore=a.store}if(e.interpolation){let l={...PSr().interpolation,...this.options.interpolation,...e.interpolation},u={...i,interpolation:l};a.services.interpolator=new NDt(u)}return a.translator=new CDt(a.services,i),a.translator.on("*",(c,...l)=>{a.emit(c,...l)}),a.init(i,r),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},Dy=MSr.createInstance(),sUl=Dy.createInstance,cUl=Dy.dir,lUl=Dy.init,uUl=Dy.loadResources,pUl=Dy.reloadResources,dUl=Dy.use,fUl=Dy.changeLanguage,hUl=Dy.getFixedT,mUl=Dy.t,gUl=Dy.exists,yUl=Dy.setDefaultNamespace,_Ul=Dy.hasLoadedNamespace,vUl=Dy.loadNamespaces,EUl=Dy.loadLanguages;var Y4n={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 LSr="nodejs-utils",Uza=Dy.createInstance();async function jza(){await Uza.init({lng:"en",fallbackLng:"en",defaultNS:LSr,ns:[LSr],resources:{en:{[LSr]:Y4n}},interpolation:{escapeValue:!1}})}jza().catch(()=>{});var Bza=async(t,e)=>{let r=await L4n({cwd:t});if(r)return e&&(0,Aot.lt)((0,Aot.coerce)(r.packageJson.version),e)?void 0:{packageJsonPath:r.path,packageInfo:r.packageJson,path:kSr(t,r.packageJson.main??"/generators/app")}};async function X4n(t,e){let r=await qza(e?.vscWorkspaceConfig),n=[],i=[];for(let a of r){let s=await(0,W4n.default)(`**/*${t}*`,{cwd:a,deep:2,onlyDirectories:!0,absolute:!0});s.length>0&&i.push(...s)}for(let a of i){let s=await Bza(a,e?.minVersion);s&&(!e?.keyword||e.keyword&&s.packageInfo.keywords?.includes(e.keyword))&&n.push(s)}return n}async function qza(t){let e=[];if(t){let s=t?.get("ApplicationWizard.installationLocation");s&&e.push(kSr(s,"node_modules"))}let r=new eUe,n=process.platform==="win32"?"npm.cmd":"npm",i=await r.run(n,["-g","root"]).then(a=>a).catch(()=>{});return i&&e.push(kSr(i.trim())),YC()&&process.env.NODE_PATH&&e.push(...process.env.NODE_PATH.split(":").filter(a=>a.endsWith("node_modules"))),e}async function wDt(t="1.18.5"){let e="@sap/generator-fiori";if((await X4n(e,{minVersion:t}))?.length<1)throw new Error(`Fiori generator not found. Please install the Fiori generator >=${t} with 'npm install -g ${e}' and retry this call`)}var xDt=Gza(Hza);var J4n="1.136.7",N_e="add-page",Zie="delete-page",IDt="create-controller-extension",DDt=/^[A-Za-z][A-Za-z0-9_-]*$/,Q4n="mcp-server-initialized",Z4n="mcp-list-tools";var sNe={version:"0.2",telemetryData:{generationSourceName:Wpn,generationSourceVersion:m$e},project:{sapux:!0}},RDt=Rp([So("FE_LROP").describe("List Report Object Page (OData V2/V4)."),So("FE_ALP").describe("Analytical List Page (OData V2/V4)."),So("FE_OVP").describe("Overview Page (OData V2/V4)."),So("FE_WORKLIST").describe("Worklist (OData V2/V4)."),So("FE_FEOP").describe("Form Entry Object Page (OData V4 only)."),So("FE_FPM").describe("Flexible Programming Model / Custom Page (OData V4 only)."),So("FF_SIMPLE").describe('Basic (SAPUI5 Freestyle template) \u2014 data source is optional for this template, supports "None".')]),MDt=ii({name:Fr().describe("Must be lowercase with dashes, e.g., 'sales-order-management'.").regex(/^[a-z0-9-]+$/),title:bf(Fr()),description:Fr(),targetFolder:Fr().describe("Absolute path to the project folder (projectPath). \u{1F6A8} The subfolder <targetFolder>/<project.name> MUST NOT already exist \u2014 the generator will refuse to run if it does. Do NOT pre-create that subfolder; only the parent targetFolder may exist."),ui5Version:Fr().default(J4n)}),e3n=ii({servicePath:Fr().describe("\u{1F6A8} DO NOT CONSTRUCT - This is provided by download_odata_service_metadata tool! The odata endpoint path returned from the metadata download tool. NEVER construct this yourself - always get it from download_odata_service_metadata output. Required for all floorplans except FF_SIMPLE."),host:QAt().describe("The host of the OData service. Must be an HTTPS endpoint. If the parameter is not provided, the agent should ask the user for it."),client:bf(Fr().describe("The client to be used for the OData service.")),destination:bf(Fr().describe("The BTP destination name to be used for the OData service. This must be provided on SAP Business Application Studio.")),metadataFilePath:bf(Fr().describe("Path to a local metadata.xml file."))}),t3n=ii({servicePath:Fr().describe("The odata endpoint as provided by the cds mcp or as fallback in case that tool is not available from the service cds file.").meta({examples:["/odata/v4/<servicename>/","/odata/v4/MyRiskService/","/odata/v2/MyOdataV2Service/","/odata/v4/MyOdataV4Service/","/odata/v4/<relative '@path' annotation from service cds file>/","<absolute '@path' annotation from service cds file>/","/myAbsolutePathFromServiceCdsFile/"]}),capService:ii({projectPath:Fr(),serviceName:Fr(),serviceCdsPath:Fr().describe("The path to the service cds file").meta({examples:["srv/service.cds","srv/my-service.cds","path/to/srv/service.cds","path/to/srv/my-service.cds"]}),capType:bf(So(["Node.js","Java"]))})}),LDt=ii({mainEntity:ii({entityName:Fr().describe("The name of the main entity. EntitySet Name attribute in OData Metadata. Required for all floorplans except FF_SIMPLE.").meta({examples:["SalesOrder","PurchaseOrderHeader","MyEntity"]})}),generateFormAnnotations:Qy().describe("Whether to generate form annotations for the main entity if none exist.").default(!0),generateLROPAnnotations:Qy().describe("Whether to generate LROP annotations for the main entity if none exist.").default(!0)});var kDt=Uke.object({entityConfig:LDt.optional(),floorplan:RDt,project:MDt,service:e3n.optional()}).describe(`\u{1F6A8} READ THIS SCHEMA BEFORE CALLING \u{1F6A8}
3686
+ `:""}`}set message(e){this.#r=e}#C(e){if(!this.#t)return;let r=this.#n,n=_Ha(r,this.#t.message);if(n)return(0,kzn.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#f??=this.#C(!0),this.#f}get rawCodeFrame(){return this.#O??=this.#C(!1),this.#O}},_Ha=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:a}=r.groups;return i&&a?{line:Number(i),column:Number(a)}:lSr(t,Number(n),{oneBased:!0})},vHa=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${yHa(n)})`);function pSr(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new uSr({jsonParseError:n,fileName:r,input:t})}}var R4n=Nr(I4n(),1);import{fileURLToPath as yza}from"node:url";function D4n(t){return t instanceof URL?yza(t):t}var Eza=t=>vza.resolve(D4n(t)??".","package.json"),Tza=(t,e)=>{let r=typeof t=="string"?pSr(t):t;return e&&(0,R4n.default)(r),r};async function M4n({cwd:t,normalize:e=!0}={}){let r=await _za.readFile(Eza(t),"utf8");return Tza(r,e)}async function L4n(t){let e=await pzn("package.json",t);if(e)return{packageJson:await M4n({...t,cwd:bza.dirname(e)}),path:e}}var Aot=Nr(hX(),1);var ic=t=>typeof t=="string",Tot=()=>{let t,e,r=new Promise((n,i)=>{t=n,e=i});return r.resolve=t,r.reject=e,r},k4n=t=>t==null?"":String(t),Sza=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},Aza=/###/g,$4n=t=>t&&t.includes("###")?t.replace(Aza,"."):t,F4n=t=>!t||ic(t),bot=(t,e,r)=>{let n=ic(e)?e.split("."):e,i=0;for(;i<n.length-1;){if(F4n(t))return{};let a=$4n(n[i]);!t[a]&&r&&(t[a]=new r),Object.prototype.hasOwnProperty.call(t,a)?t=t[a]:t={},++i}return F4n(t)?{}:{obj:t,k:$4n(n[i])}},V4n=(t,e,r)=>{let{obj:n,k:i}=bot(t,e,Object);if(n!==void 0||e.length===1){n[i]=r;return}let a=e[e.length-1],s=e.slice(0,e.length-1),c=bot(t,s,Object);for(;c.obj===void 0&&s.length;)a=`${s[s.length-1]}.${a}`,s=s.slice(0,s.length-1),c=bot(t,s,Object),c?.obj&&typeof c.obj[`${c.k}.${a}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${a}`]=r},Oza=(t,e,r,n)=>{let{obj:i,k:a}=bot(t,e,Object);i[a]=i[a]||[],i[a].push(r)},ADt=(t,e)=>{let{obj:r,k:n}=bot(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Cza=(t,e,r)=>{let n=ADt(t,r);return n!==void 0?n:ADt(e,r)},H4n=(t,e,r)=>{for(let n in e)n!=="__proto__"&&n!=="constructor"&&(Object.prototype.hasOwnProperty.call(t,n)?ic(t[n])||t[n]instanceof String||ic(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):H4n(t[n],e[n],r):t[n]=e[n]);return t},Qie=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Pza={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},Nza=t=>ic(t)?t.replace(/[&<>"'\/]/g,e=>Pza[e]):t,NSr=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}},wza=[" ",",","?","!",";"],xza=new NSr(20),Iza=(t,e,r)=>{e=e||"",r=r||"";let n=wza.filter(s=>!e.includes(s)&&!r.includes(s));if(n.length===0)return!0;let i=xza.getRegExp(`(${n.map(s=>s==="?"?"\\?":s).join("|")})`),a=!i.test(t);if(!a){let s=t.indexOf(r);s>0&&!i.test(t.substring(0,s))&&(a=!0)}return a},wSr=(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 a=0;a<n.length;){if(!i||typeof i!="object")return;let s,c="";for(let l=a;l<n.length;++l)if(l!==a&&(c+=r),c+=n[l],s=i[c],s!==void 0){if(["string","number","boolean"].includes(typeof s)&&l<n.length-1)continue;a+=l-a+1;break}i=s}return i},Sot=t=>t?.replace(/_/g,"-"),Dza={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)}},xSr=class t{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||Dza,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:(e=e.map(a=>ic(a)?a.replace(/[\r\n\x00-\x1F\x7F]/g," "):a),ic(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)}},mZ=new xSr,Tje=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)}}once(e,r){let n=(...i)=>{r(...i),this.off(e,n)};return this.on(e,n),this}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,a])=>{for(let s=0;s<a;s++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,a])=>{for(let s=0;s<a;s++)i(e,...r)})}},ODt=class extends Tje{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.includes(e)||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 a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,c;e.includes(".")?c=e.split("."):(c=[e,r],n&&(Array.isArray(n)?c.push(...n):ic(n)&&a?c.push(...n.split(a)):c.push(n)));let l=ADt(this.data,c);return!l&&!r&&!n&&e.includes(".")&&(e=c[0],r=c[1],n=c.slice(2).join(".")),l||!s||!ic(n)?l:wSr(this.data?.[e]?.[r],n,a)}addResource(e,r,n,i,a={silent:!1}){let s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=[e,r];n&&(c=c.concat(s?n.split(s):n)),e.includes(".")&&(c=e.split("."),i=r,r=c[1]),this.addNamespaces(r),V4n(this.data,c,i),a.silent||this.emit("added",e,r,n,i)}addResources(e,r,n,i={silent:!1}){for(let a in n)(ic(n[a])||Array.isArray(n[a]))&&this.addResource(e,r,a,n[a],{silent:!0});i.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,i,a,s={silent:!1,skipCopy:!1}){let c=[e,r];e.includes(".")&&(c=e.split("."),i=n,n=r,r=c[1]),this.addNamespaces(r);let l=ADt(this.data,c)||{};s.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?H4n(l,n,a):l={...l,...n},V4n(this.data,c,l),s.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}},z4n={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,i){return t.forEach(a=>{e=this.processors[a]?.process(e,r,n,i)??e}),e}},K4n=Symbol("i18next/PATH_KEY");function Rza(){let t=[],e=Object.create(null),r;return e.get=(n,i)=>(r?.revoke?.(),i===K4n?t:(t.push(i),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function vje(t,e){let{[K4n]:r}=t(Rza()),n=e?.keySeparator??".",i=e?.nsSeparator??":",a=e?.enableSelector==="strict";if(r.length>1&&i){let s=e?.ns,c=a?Array.isArray(s)?s:s?[s]:null:Array.isArray(s)?s:null;if(c&&(a?c:c.length>1?c.slice(1):[]).includes(r[0]))return`${r[0]}${i}${r.slice(1).join(n)}`}return r.join(n)}var CSr=t=>!ic(t)&&typeof t!="boolean"&&typeof t!="number",CDt=class t extends Tje{constructor(e,r={}){super(),Sza(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=mZ.create("translator"),this.checkedLoadedFor={}}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 a=CSr(i.res);return!(n.returnObjects===!1&&a)}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,a=r.ns||this.options.defaultNS||[],s=n&&e.includes(n),c=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Iza(e,n,i);if(s&&!c){let l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:ic(a)?[a]:a};let u=e.split(n);(n!==i||n===i&&this.options.ns.includes(u[0]))&&(a=u.shift()),e=u.join(i)}return{key:e,namespaces:ic(a)?[a]:a}}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=vje(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]),e=e.map(W=>typeof W=="function"?vje(W,{...this.options,...i}):String(W));let a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:c,namespaces:l}=this.extractFromKey(e[e.length-1],i),u=l[l.length-1],p=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;p===void 0&&(p=":");let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return f?a?{res:`${u}${p}${c}`,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${p}${c}`:a?{res:c,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:c;let h=this.resolve(e,i),m=h?.res,g=h?.usedKey||c,y=h?.exactUsedKey||c,_=["[object Number]","[object Function]","[object RegExp]"],v=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,C=i.count!==void 0&&!ic(i.count),O=t.hasDefaultValue(i),P=C?this.pluralResolver.getSuffix(d,i.count,i):"",N=i.ordinal&&C?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):"",D=C&&!i.ordinal&&i.count===0,M=D&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${P}`]||i[`defaultValue${N}`]||i.defaultValue,k=m;b&&!m&&O&&(k=M);let F=CSr(k),K=Object.prototype.toString.apply(k);if(b&&k&&F&&!_.includes(K)&&!(ic(v)&&Array.isArray(k))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let W=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,k,{...i,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return a?(h.res=W,h.usedParams=this.getUsedParamsDetails(i),h):W}if(s){let W=Array.isArray(k),G=W?[]:{},J=W?y:g;for(let ve in k)if(Object.prototype.hasOwnProperty.call(k,ve)){let Se=`${J}${s}${ve}`;O&&!m?G[ve]=this.translate(Se,{...i,defaultValue:CSr(M)?M[ve]:void 0,joinArrays:!1,ns:l}):G[ve]=this.translate(Se,{...i,joinArrays:!1,ns:l}),G[ve]===Se&&(G[ve]=k[ve])}m=G}}else if(b&&ic(v)&&Array.isArray(m))m=m.join(v),m&&(m=this.extendTranslation(m,e,i,n));else{let W=!1,G=!1;!this.isValidLookup(m)&&O&&(W=!0,m=M),this.isValidLookup(m)||(G=!0,m=c);let ve=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&G?void 0:m,Se=O&&M!==m&&this.options.updateMissing;if(G||W||Se){if(this.logger.log(Se?"updateKey":"missingKey",d,u,C&&!Se?`${c}${this.pluralResolver.getSuffix(d,i.count,i)}`:c,Se?M:m),s){let pe=this.resolve(c,{...i,keySeparator:!1});pe&&pe.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 fe=[],ne=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ne&&ne[0])for(let pe=0;pe<ne.length;pe++)fe.push(ne[pe]);else this.options.saveMissingTo==="all"?fe=this.languageUtils.toResolveHierarchy(i.lng||this.language):fe.push(i.lng||this.language);let se=(pe,le,Le)=>{let st=O&&Le!==m?Le:ve;this.options.missingKeyHandler?this.options.missingKeyHandler(pe,u,le,st,Se,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(pe,u,le,st,Se,i),this.emit("missingKey",pe,u,le,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?fe.forEach(pe=>{let le=this.pluralResolver.getSuffixes(pe,i);D&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!le.includes(`${this.options.pluralSeparator}zero`)&&le.push(`${this.options.pluralSeparator}zero`),le.forEach(Le=>{se([pe],c+Le,i[`defaultValue${Le}`]||M)})}):se(fe,c,M))}m=this.extendTranslation(m,e,i,h,n),G&&m===c&&this.options.appendNamespaceToMissingKey&&(m=`${u}${p}${c}`),(G||W)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${p}${c}`:c,W?m:void 0,i))}return a?(h.res=m,h.usedParams=this.getUsedParamsDetails(i),h):m}extendTranslation(e,r,n,i,a){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 l=ic(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(l){let d=e.match(this.interpolator.nestingRegexp);u=d&&d.length}let p=n.replace&&!ic(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),e=this.interpolator.interpolate(e,p,n.lng||this.language||i.usedLng,n),l){let d=e.match(this.interpolator.nestingRegexp),f=d&&d.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,(...d)=>a?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}let s=n.postProcess||this.options.postProcess,c=ic(s)?[s]:s;return e!=null&&c?.length&&n.applyPostProcessor!==!1&&(e=z4n.handle(c,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,i,a,s,c;return ic(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(l=>typeof l=="function"?vje(l,{...this.options,...r}):l)),e.forEach(l=>{if(this.isValidLookup(n))return;let u=this.extractFromKey(l,r),p=u.key;i=p;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));let f=r.count!==void 0&&!ic(r.count),h=f&&!r.ordinal&&r.count===0,m=r.context!==void 0&&(ic(r.context)||typeof r.context=="number")&&r.context!=="",g=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(y=>{this.isValidLookup(n)||(c=y,!this.checkedLoadedFor[`${g[0]}-${y}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(this.checkedLoadedFor[`${g[0]}-${y}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(_=>{if(this.isValidLookup(n))return;s=_;let v=[p];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(v,p,_,y,r);else{let C;f&&(C=this.pluralResolver.getSuffix(_,r.count,r));let O=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&C.startsWith(P)&&v.push(p+C.replace(P,this.options.pluralSeparator)),v.push(p+C),h&&v.push(p+O)),m){let N=`${p}${this.options.contextSeparator||"_"}${r.context}`;v.push(N),f&&(r.ordinal&&C.startsWith(P)&&v.push(N+C.replace(P,this.options.pluralSeparator)),v.push(N+C),h&&v.push(N+O))}}let b;for(;b=v.pop();)this.isValidLookup(n)||(a=b,n=this.getResource(_,y,b,r))}))})}),{res:n,usedKey:i,exactUsedKey:a,usedLng:s,usedNS:c}}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&&!ic(e.replace),i=n?e.replace:e;if(n&&typeof e.count<"u"&&(i={...i,count:e.count}),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let a of r)delete i[a]}return i}static hasDefaultValue(e){let r="defaultValue";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&n.startsWith(r)&&e[n]!==void 0)return!0;return!1}},PDt=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mZ.create("languageUtils")}getScriptPartFromCode(e){if(e=Sot(e),!e||!e.includes("-"))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=Sot(e),!e||!e.includes("-"))return e;let r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(ic(e)&&e.includes("-")){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.includes(e)}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 a=this.getLanguagePartFromCode(n);if(this.isSupportedCode(a))return r=a;r=this.options.supportedLngs.find(s=>s===a?!0:!s.includes("-")&&!a.includes("-")?!1:!!(s.includes("-")&&!a.includes("-")&&s.slice(0,s.indexOf("-"))===a||s.startsWith(a)&&a.length>1))}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),ic(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=[],a=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return ic(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(e))):ic(e)&&a(this.formatLanguageCode(e)),n.forEach(s=>{i.includes(s)||a(this.formatLanguageCode(s))}),i}},U4n={zero:0,one:1,two:2,few:3,many:4,other:5},j4n={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},ISr=class{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=mZ.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){let n=Sot(e==="dev"?"en":e),i=r.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:n,type:i});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let s;try{s=new Intl.PluralRules(n,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),j4n;if(!e.match(/-|_/))return j4n;let l=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(l,r)}return this.pluralRulesCache[a]=s,s}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,a)=>U4n[i]-U4n[a]).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))}},B4n=(t,e,r,n=".",i=!0)=>{let a=Cza(t,e,r);return!a&&i&&ic(r)&&(a=wSr(t,r,n),a===void 0&&(a=wSr(e,r,n))),a},Mza=t=>t.replace(/\$/g,"$$$$"),NDt=class{constructor(e={}){this.logger=mZ.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:a,prefixEscaped:s,suffix:c,suffixEscaped:l,formatSeparator:u,unescapeSuffix:p,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:m,nestingSuffixEscaped:g,nestingOptionsSeparator:y,maxReplaces:_,alwaysFormat:v}=e.interpolation;this.escape=r!==void 0?r:Nza,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=a?Qie(a):s||"{{",this.suffix=c?Qie(c):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":d?Qie(d):"-",this.unescapeSuffix=this.unescapePrefix?"":p?Qie(p):"",this.nestingPrefix=f?Qie(f):h||Qie("$t("),this.nestingSuffix=m?Qie(m):g||Qie(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=_||1e3,this.alwaysFormat=v!==void 0?v:!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 a,s,c,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(!h.includes(this.formatSeparator)){let _=B4n(r,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(_,void 0,n,{...i,...r,interpolationkey:h}):_}let m=h.split(this.formatSeparator),g=m.shift().trim(),y=m.join(this.formatSeparator).trim();return this.format(B4n(r,l,g,this.options.keySeparator,this.options.ignoreJSONStructure),y,n,{...i,...r,interpolationkey:g})};this.resetRegExp(),!this.escapeValue&&typeof e=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false \u2014 if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");let p=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>h},{regex:this.regexp,safeValue:h=>this.escapeValue?this.escape(h):h}].forEach(h=>{for(c=0;a=h.regex.exec(e);){let m=a[1].trim();if(s=u(m),s===void 0)if(typeof p=="function"){let y=p(e,a,i);s=ic(y)?y:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))s="";else if(d){s=a[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),s="";else!ic(s)&&!this.useRawValueToEscape&&(s=k4n(s));let g=h.safeValue(s);if(e=e.replace(a[0],Mza(g)),d?(h.regex.lastIndex+=g.length,h.regex.lastIndex-=a[0].length):h.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,r,n={}){let i,a,s,c=(l,u)=>{let p=this.nestingOptionsSeparator;if(!l.includes(p))return l;let d=l.split(new RegExp(`${Qie(p)}[ ]*{`)),f=`{${d[1]}`;l=d[0],f=this.interpolate(f,s);let h=f.match(/'/g),m=f.match(/"/g);((h?.length??0)%2===0&&!m||(m?.length??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),u&&(s={...u,...s})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${p}${f}`}return s.defaultValue&&s.defaultValue.includes(this.prefix)&&delete s.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];s={...n},s=s.replace&&!ic(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=/{.*}/s.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(l=i[1].slice(u).split(this.formatSeparator).map(p=>p.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),a=r(c.call(this,i[1].trim(),s),s),a&&i[0]===e&&!ic(a))return a;ic(a)||(a=k4n(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),a=""),l.length&&(a=l.reduce((p,d)=>this.format(p,d,n.lng,{...n,interpolationkey:i[1].trim()}),a.trim())),e=e.replace(i[0],a),this.regexp.lastIndex=0}return e}},Lza=t=>{let e=t.toLowerCase().trim(),r={};if(t.includes("(")){let n=t.split("(");e=n[0].toLowerCase().trim();let i=n[1].slice(0,-1);e==="currency"&&!i.includes(":")?r.currency||(r.currency=i.trim()):e==="relativetime"&&!i.includes(":")?r.range||(r.range=i.trim()):i.split(";").forEach(s=>{if(s){let[c,...l]=s.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),p=c.trim();r[p]||(r[p]=u),u==="false"&&(r[p]=!1),u==="true"&&(r[p]=!0),isNaN(u)||(r[p]=parseInt(u,10))}})}return{formatName:e,formatOptions:r}},q4n=t=>{let e={};return(r,n,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let s=n+JSON.stringify(a),c=e[s];return c||(c=t(Sot(n),i),e[s]=c),c(r)}},kza=t=>(e,r,n)=>t(Sot(r),n)(e),DSr=class{constructor(e={}){this.logger=mZ.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?q4n:kza;this.formats={number:n((i,a)=>{let s=new Intl.NumberFormat(i,{...a});return c=>s.format(c)}),currency:n((i,a)=>{let s=new Intl.NumberFormat(i,{...a,style:"currency"});return c=>s.format(c)}),datetime:n((i,a)=>{let s=new Intl.DateTimeFormat(i,{...a});return c=>s.format(c)}),relativetime:n((i,a)=>{let s=new Intl.RelativeTimeFormat(i,{...a});return c=>s.format(c,a.range||"day")}),list:n((i,a)=>{let s=new Intl.ListFormat(i,{...a});return c=>s.format(c)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=q4n(r)}format(e,r,n,i={}){if(!r||e==null)return e;let a=r.split(this.formatSeparator),s=[];for(let l=0;l<a.length;l++){let u=a[l];for(;u.indexOf("(")>-1&&!u.includes(")")&&l+1<a.length;)u=`${u}${this.formatSeparator}${a[++l]}`;s.push(u)}return s.reduce((l,u)=>{let{formatName:p,formatOptions:d}=Lza(u);if(this.formats[p]){let f=l;try{let h=i?.formatParams?.[i.interpolationkey]||{},m=h.locale||h.lng||i.locale||i.lng||n;f=this.formats[p](l,m,{...d,...i,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${p}`);return l},e)}},$za=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)},RSr=class extends Tje{constructor(e,r,n,i={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=mZ.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 a={},s={},c={},l={};return e.forEach(u=>{let p=!0;r.forEach(d=>{let f=`${u}|${d}`;!n.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,p=!1,s[f]===void 0&&(s[f]=!0),a[f]===void 0&&(a[f]=!0),l[d]===void 0&&(l[d]=!0)))}),p||(c[u]=!0)}),(Object.keys(a).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(a),pending:Object.keys(s),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(e,r,n){let i=e.split("|"),a=i[0],s=i[1];r&&this.emit("failedLoading",a,s,r),!r&&n&&this.store.addResourceBundle(a,s,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);let c={};this.queue.forEach(l=>{Oza(l.loaded,[a],s),$za(l,e),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{c[u]||(c[u]={});let p=l.loaded[u];p.length&&p.forEach(d=>{c[u][d]===void 0&&(c[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(e,r,n,i=0,a=this.retryTimeout,s){if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:i,wait:a,callback:s});return}this.readingCalls++;let c=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){let d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&p&&i<this.maxRetries){setTimeout(()=>{this.read(e,r,n,i+1,a*2,s)},a);return}s(u,p)},l=this.backend[n].bind(this.backend);if(l.length===2){try{let u=l(e,r);u&&typeof u.then=="function"?u.then(p=>c(null,p)).catch(c):c(null,u)}catch(u){c(u)}return}return l(e,r,c)}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();ic(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ic(r)&&(r=[r]);let a=this.queueLoad(e,r,n,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(s=>{this.loadOne(s)})}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],a=n[1];this.read(i,a,"read",void 0,void 0,(s,c)=>{s&&this.logger.warn(`${r}loading namespace ${a} for language ${i} failed`,s),!s&&c&&this.logger.log(`${r}loaded namespace ${a} for language ${i}`,c),this.loaded(e,s,c)})}saveMissing(e,r,n,i,a,s={},c=()=>{}){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 l={...s,isUpdate:a},u=this.backend.create.bind(this.backend);if(u.length<6)try{let p;u.length===5?p=u(e,r,n,i,l):p=u(e,r,n,i),p&&typeof p.then=="function"?p.then(d=>c(null,d)).catch(c):c(null,p)}catch(p){c(p)}else u(e,r,n,i,c,l)}!e||!e[0]||this.store.addResource(e[0],r,n,i)}}},PSr=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,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]),ic(t[1])&&(e.defaultValue=t[1]),ic(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,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),G4n=t=>(ic(t.ns)&&(t.ns=[t.ns]),ic(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ic(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&!t.supportedLngs.includes("cimode")&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),SDt=()=>{},Fza=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})},MSr=class t extends Tje{constructor(e={},r){if(super(),this.options=G4n(e),this.services={},this.logger=mZ,this.modules={external:[]},Fza(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&&(ic(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));let n=PSr();this.options={...n,...this.options,...G4n(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);let i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?mZ.init(i(this.modules.logger),this.options):mZ.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=DSr;let p=new PDt(this.options);this.store=new ODt(this.options.resources,this.options);let d=this.services;d.logger=mZ,d.resourceStore=this.store,d.languageUtils=p,d.pluralResolver=new ISr(p,{prepend:this.options.pluralSeparator}),u&&(d.formatter=i(u),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new NDt(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new RSr(i(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.languageDetector&&(d.languageDetector=i(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=i(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new CDt(this.services,this.options),this.translator.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,r||(r=SDt),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]=(...p)=>this.store[u](...p)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...p)=>(this.store[u](...p),this)});let c=Tot(),l=()=>{let u=(p,d)=>{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),c.resolve(d),r(p,d)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),c}loadResources(e,r=SDt){let n=r,i=ic(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 a=[],s=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(u=>{u!=="cimode"&&(a.includes(u)||a.push(u))})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload?.forEach?.(c=>s(c)),this.services.backendConnector.load(a,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(c)})}else n(null)}reloadResources(e,r,n){let i=Tot();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=SDt),this.services.backendConnector.reload(e,r,a=>{i.resolve(),n(a)}),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"&&z4n.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"].includes(e)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!["cimode","dev"].includes(n)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let n=Tot();this.emit("languageChanging",e);let i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,l)=>{l?this.isLanguageChangingTo===e&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),r&&r(c,(...u)=>this.t(...u))},s=c=>{!e&&!c&&this.services.languageDetector&&(c=[]);let l=ic(c)?c:c&&c[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(ic(c)?[c]:c);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,p=>{a(p,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),n}getFixedT(e,r,n,i){let a=i?.scopeNs,s=(c,l,...u)=>{let p;typeof l!="object"?p=this.options.overloadTranslationOptionHandler([c,l].concat(u)):p={...l},p.lng=p.lng||s.lng,p.lngs=p.lngs||s.lngs;let d=p.ns!==void 0&&p.ns!==null;p.ns=p.ns||s.ns,p.keyPrefix!==""&&(p.keyPrefix=p.keyPrefix||n||s.keyPrefix);let f={...this.options,...p};Array.isArray(a)&&!d&&(f.ns=a),typeof p.keyPrefix=="function"&&(p.keyPrefix=vje(p.keyPrefix,f));let h=this.options.keySeparator||".",m;return p.keyPrefix&&Array.isArray(c)?m=c.map(g=>(typeof g=="function"&&(g=vje(g,f)),`${p.keyPrefix}${h}${g}`)):(typeof c=="function"&&(c=vje(c,f)),m=p.keyPrefix?`${p.keyPrefix}${h}${c}`:c),this.t(m,p)};return ic(e)?s.lng=e:s.lngs=e,s.ns=r,s.keyPrefix=n,s}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,a=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let s=(c,l)=>{let u=this.services.backendConnector.state[`${c}|${l}`];return u===-1||u===0||u===2};if(r.precheck){let c=r.precheck(this,s);if(c!==void 0)return c}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(n,e)&&(!i||s(a,e)))}loadNamespaces(e,r){let n=Tot();return this.options.ns?(ic(e)&&(e=[e]),e.forEach(i=>{this.options.ns.includes(i)||this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){let n=Tot();ic(e)&&(e=[e]);let i=this.options.preload||[],a=e.filter(s=>!i.includes(s)&&this.services.languageUtils.isSupportedCode(s));return a.length?(this.options.preload=i.concat(a),this.loadResources(s=>{n.resolve(),r&&r(s)}),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 a=i.getTextInfo();if(a&&a.direction)return a.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 PDt(PSr());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.includes(n.getLanguagePartFromCode(e))||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=SDt){let n=e.forkResourceStore;n&&delete e.forkResourceStore;let i={...this.options,...e,isClone:!0},a=new t(i);if((e.debug!==void 0||e.prefix!==void 0)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(c=>{a[c]=this[c]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n){let c=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((p,d)=>(p[d]={...l[u][d]},p),l[u]),l),{});a.store=new ODt(c,i),a.services.resourceStore=a.store}if(e.interpolation){let l={...PSr().interpolation,...this.options.interpolation,...e.interpolation},u={...i,interpolation:l};a.services.interpolator=new NDt(u)}return a.translator=new CDt(a.services,i),a.translator.on("*",(c,...l)=>{a.emit(c,...l)}),a.init(i,r),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},Dy=MSr.createInstance(),sUl=Dy.createInstance,cUl=Dy.dir,lUl=Dy.init,uUl=Dy.loadResources,pUl=Dy.reloadResources,dUl=Dy.use,fUl=Dy.changeLanguage,hUl=Dy.getFixedT,mUl=Dy.t,gUl=Dy.exists,yUl=Dy.setDefaultNamespace,_Ul=Dy.hasLoadedNamespace,vUl=Dy.loadNamespaces,EUl=Dy.loadLanguages;var Y4n={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 LSr="nodejs-utils",Uza=Dy.createInstance();async function jza(){await Uza.init({lng:"en",fallbackLng:"en",defaultNS:LSr,ns:[LSr],resources:{en:{[LSr]:Y4n}},interpolation:{escapeValue:!1}})}jza().catch(()=>{});var Bza=async(t,e)=>{let r=await L4n({cwd:t});if(r)return e&&(0,Aot.lt)((0,Aot.coerce)(r.packageJson.version),e)?void 0:{packageJsonPath:r.path,packageInfo:r.packageJson,path:kSr(t,r.packageJson.main??"/generators/app")}};async function X4n(t,e){let r=await qza(e?.vscWorkspaceConfig),n=[],i=[];for(let a of r){let s=await(0,W4n.default)(`**/*${t}*`,{cwd:a,deep:2,onlyDirectories:!0,absolute:!0});s.length>0&&i.push(...s)}for(let a of i){let s=await Bza(a,e?.minVersion);s&&(!e?.keyword||e.keyword&&s.packageInfo.keywords?.includes(e.keyword))&&n.push(s)}return n}async function qza(t){let e=[];if(t){let s=t?.get("ApplicationWizard.installationLocation");s&&e.push(kSr(s,"node_modules"))}let r=new eUe,n=process.platform==="win32"?"npm.cmd":"npm",i=await r.run(n,["-g","root"]).then(a=>a).catch(()=>{});return i&&e.push(kSr(i.trim())),YC()&&process.env.NODE_PATH&&e.push(...process.env.NODE_PATH.split(":").filter(a=>a.endsWith("node_modules"))),e}async function wDt(t="1.18.5"){let e="@sap/generator-fiori";if((await X4n(e,{minVersion:t}))?.length<1)throw new Error(`Fiori generator not found. Please install the Fiori generator >=${t} with 'npm install -g ${e}' and retry this call`)}var xDt=Gza(Hza);var J4n="1.136.7",N_e="add-page",Zie="delete-page",IDt="create-controller-extension",DDt=/^[A-Za-z][A-Za-z0-9_-]*$/,Q4n="mcp-server-initialized",Z4n="mcp-list-tools";var sNe={version:"0.2",telemetryData:{generationSourceName:Wpn,generationSourceVersion:m$e},project:{sapux:!0}},RDt=Rp([So("FE_LROP").describe("List Report Object Page (OData V2/V4)."),So("FE_ALP").describe("Analytical List Page (OData V2/V4)."),So("FE_OVP").describe("Overview Page (OData V2/V4)."),So("FE_WORKLIST").describe("Worklist (OData V2/V4)."),So("FE_FEOP").describe("Form Entry Object Page (OData V4 only)."),So("FE_FPM").describe("Flexible Programming Model / Custom Page (OData V4 only)."),So("FF_SIMPLE").describe('Basic (SAPUI5 Freestyle template) \u2014 data source is optional for this template, supports "None".')]),MDt=ii({name:Fr().describe("Must be lowercase with dashes, e.g., 'sales-order-management'.").regex(/^[a-z0-9-]+$/),title:bf(Fr()),description:Fr(),targetFolder:Fr().describe("Absolute path to the project folder (projectPath). \u{1F6A8} The subfolder <targetFolder>/<project.name> MUST NOT already exist \u2014 the generator will refuse to run if it does. Do NOT pre-create that subfolder; only the parent targetFolder may exist."),ui5Version:Fr().default(J4n)}),e3n=ii({servicePath:Fr().describe("\u{1F6A8} DO NOT CONSTRUCT - This is provided by download_odata_service_metadata tool! The odata endpoint path returned from the metadata download tool. NEVER construct this yourself - always get it from download_odata_service_metadata output. Required for all floorplans except FF_SIMPLE."),host:QAt().describe("The host of the OData service. Must be an HTTPS endpoint. If the parameter is not provided, the agent should ask the user for it."),client:bf(Fr().describe("The client to be used for the OData service.")),destination:bf(Fr().describe("The BTP destination name to be used for the OData service. This must be provided on SAP Business Application Studio.")),metadataFilePath:bf(Fr().describe("Path to a local metadata.xml file."))}),t3n=ii({servicePath:Fr().describe("The odata endpoint as provided by the cds mcp or as fallback in case that tool is not available from the service cds file.").meta({examples:["/odata/v4/<servicename>/","/odata/v4/MyRiskService/","/odata/v2/MyOdataV2Service/","/odata/v4/MyOdataV4Service/","/odata/v4/<relative '@path' annotation from service cds file>/","<absolute '@path' annotation from service cds file>/","/myAbsolutePathFromServiceCdsFile/"]}),capService:ii({projectPath:Fr(),serviceName:Fr(),serviceCdsPath:Fr().describe("The path to the service cds file").meta({examples:["srv/service.cds","srv/my-service.cds","path/to/srv/service.cds","path/to/srv/my-service.cds"]}),capType:bf(So(["Node.js","Java"]))})}),LDt=ii({mainEntity:ii({entityName:Fr().describe("The name of the main entity. EntitySet Name attribute in OData Metadata. Required for all floorplans except FF_SIMPLE.").meta({examples:["SalesOrder","PurchaseOrderHeader","MyEntity"]})}),navigationEntity:ii({EntitySet:Fr().describe("The target EntitySet name from the navigation property in OData Metadata.").meta({examples:["Booking","SalesOrderItems","PurchaseOrderItems"]}),Name:Fr().describe("The navigation property name on the main entity.").meta({examples:["_Items","to_Item","Items"]})}).describe("Optional navigation entity. Defines the sub-entity reachable via a navigation property on the main entity.").optional(),generateFormAnnotations:Qy().describe("Whether to generate form annotations for the main entity if none exist.").default(!0),generateLROPAnnotations:Qy().describe("Whether to generate LROP annotations for the main entity if none exist.").default(!0)});var kDt=Uke.object({entityConfig:LDt.optional(),floorplan:RDt,project:MDt,service:e3n.optional()}).describe(`\u{1F6A8} READ THIS SCHEMA BEFORE CALLING \u{1F6A8}
3687
3687
 
3688
3688
  The configuration that will be used for the Application UI generation.
3689
3689
  The configuration **MUST** be a valid JSON object corresponding to the inputSchema of the functionality.
@@ -4530,6 +4530,9 @@ PGHZoN9jcvvvWDLUGtJkEotMgdFpEA2XWR83H4fVFVc=
4530
4530
  - **IMPORTANT**: On VSCode, if the service requires authentication and is not already stored, ask the user to store it first. Never ask for credentials directly.
4531
4531
 
4532
4532
  2. Parse the metadata.xml to understand the data model (entities, associations).
4533
+ Set mainEntity to the entity that best matches the user's request.
4534
+ If that entity has to-many navigation properties, set navigationEntity using
4535
+ the most relevant child EntitySet and navigation property Name.
4533
4536
 
4534
4537
  3. Generate the application once the config is complete and valid.
4535
4538
 
@@ -4552,6 +4555,7 @@ PGHZoN9jcvvvWDLUGtJkEotMgdFpEA2XWR83H4fVFVc=
4552
4555
  },
4553
4556
  "entityConfig": {
4554
4557
  "mainEntity": { "entityName": "Travel" },
4558
+ "navigationEntity": { "EntitySet": "Booking", "Name": "_Booking" },
4555
4559
  "generateFormAnnotations": true,
4556
4560
  "generateLROPAnnotations": true
4557
4561
  }
@@ -4581,7 +4585,7 @@ PGHZoN9jcvvvWDLUGtJkEotMgdFpEA2XWR83H4fVFVc=
4581
4585
  This is the **final step** of the workflow and performs the actual modification.
4582
4586
  You MUST provide the exact parameter information obtained from get_functionality_details (Step 2).`,annotations:{title:"Execute Fiori Functionality",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:R_(idn),outputSchema:R_(pdn)}];var Bht=class{applicationKey="";extensionName="";extensionVersion="";getApplicationKey(){return this.applicationKey}getExtensionVersion(){return this.extensionVersion}getExtensionName(){return this.extensionName}};var sjo=Nr(Win(),1);var FEt=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 Mk;(function(t){t[t.OnePercent=0]="OnePercent",t[t.TenPercent=1]="TenPercent",t[t.NoSampling=2]="NoSampling"})(Mk||(Mk={}));process.env.OTEL_RESOURCE_ATTRIBUTES??="service.name=masked,service.instance.id=masked";function QZt(t){if(t.setUseDiskRetryCaching)try{t.setUseDiskRetryCaching(!0)}catch{}t.context.tags??={},t.context.tags["ai.location.ip"]="0.0.0.0",t.context.tags["microsoft.client.ip"]="0.0.0.0",t.context.tags["ai.cloud.roleInstance"]="masked",t.context.tags["ai.cloud.role"]="masked",t.context.tags["ai.device.type"]="masked"}var Xin={name:"@sap-ux/telemetry",version:"2.0.8",description:"Library for sending usage telemetry data",type:"module",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/telemetry"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Atelemetry"},license:"Apache-2.0",private:!1,main:"dist/index.js",scripts:{build:"tsc --build",watch:"tsc --watch",clean:"rimraf --glob dist coverage *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",example:"ts-node example/index.ts"},dependencies:{"@sap-ux/store":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/nodejs-utils":"workspace:*",applicationinsights:"3.16.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 vC={azureInstrumentationKey:"",azureIngestionEndpoint:"https://westus2-0.in.applicationinsights.azure.com/",azureLiveEndpoint:"https://westus2.livediagnostics.monitor.azure.com/",telemetryEnabled:!0,telemetryLibName:Xin.name,telemetryLibVersion:Xin.version,consumerModuleName:"",consumerModuleVersion:""};process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL??="true";var VEt=class extends Bht{clients;constructor(e,r,n){super(),this.clients=new Map,this.applicationKey=e,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(Mk.OnePercent),a=this.createTelemetryClient(Mk.TenPercent),s=this.createTelemetryClient(Mk.NoSampling);this.clients.set(Mk.OnePercent,i),this.clients.set(Mk.TenPercent,a),this.clients.set(Mk.NoSampling,s)}reportBlocking(e,r,n,i,a=!1){if(!a||vC.telemetryEnabled){let{client:s,event:c}=this.prepareClientAndEvent(e,r,n,i);return this.trackEventBlocking(s,c)}return Promise.resolve()}async report(e,r,n,i,a,s){if(s!==void 0&&!s||!vC.telemetryEnabled)return;let{client:c,event:l}=this.prepareClientAndEvent(e,r,n,i);this.trackEvent(c,l)}prepareClientAndEvent(e,r,n,i=Mk.NoSampling){let a=this.clients.get(i),c={name:new FEt(this.extensionName,e).toString(),properties:r,measurements:n};return{client:a,event:c}}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 Mk.OnePercent:r=1;break;case Mk.TenPercent:r=10;break;case Mk.NoSampling:default:r=100;break}let n=new sjo.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,QZt(n),n}};var Jin=()=>{let t=new Date().getTime();return new Date(t).toISOString()};var UEt=class extends VEt{constructor(e,r,n){super(e,r,n)}async report(e,r,n,i,a,s){let c=await ZZt(a),l={v:this.extensionVersion,datetime:Jin()},u={...r,...c,...l};await super.report(e,u,n,i,a,s)}async reportEvent(e,r,n,i){let{finalProperties:a,finalMeasurements:s}=await this.collectToolsSuiteTelemetry(e,n);return super.report(e.eventName,a,s,r,n,i)}async reportEventBlocking(e,r,n,i){let{finalProperties:a,finalMeasurements:s}=await this.collectToolsSuiteTelemetry(e,n);return super.reportBlocking(e.eventName,a,s,r,i)}async collectToolsSuiteTelemetry(e,r){let n=await ZZt(r),i={v:this.extensionVersion,datetime:Jin()},a={...e.properties,...n,...i},s={...e.measurements};return{finalProperties:a,finalMeasurements:s}}};var cjo=Nr(qA(),1),ljo=Nr(D9e(),1);import MJ from"node:fs";import Lle from"node:path";var eer={internalFeature:!1};var jEt;(function(t){t.UNKNOWN="UNKNOWN",t.NO_TOOLS_ID="NO_TOOLS_ID"})(jEt||(jEt={}));var Ene;(function(t){t.CAPJava="CAPJava",t.CAPNode="CAPNode",t.ABAP="ABAP",t.UNKNOWN="UNKNOWN"})(Ene||(Ene={}));var _Me;(function(t){t.CF="CF",t.ABAP="ABAP",t.UNKNOWN_DEPLOY_CONFIG="UNKNOWN_DEPLOY_CONFIG",t.NO_DEPLOY_CONFIG="NO_DEPLOY_CONFIG"})(_Me||(_Me={}));var TC;(function(t){t.DevSpace="cmn.devspace",t.AppStudio="cmn.appstudio",t.AppStudioBackwardCompatible="appstudio",t.InternlVsExternal="cmn.internalFeatures",t.InternlVsExternalBackwardCompatible="internalVsExternal",t.TemplateType="cmn.template",t.DeployTargetType="cmn.deployTarget",t.ODataSourceType="cmn.odataSource",t.AppToolsId="cmn.toolsId",t.NodeVersion="cmn.nodeVersion",t.AppProgrammingLanguage="cmn.appLanguage",t.TemplateId="cmn.templateId",t.TemplateVersion="cmn.templateVersion",t.ApplicationType="cmn.applicationType",t.IdeType="cmn.ideType"})(TC||(TC={}));async function ZZt(t){let e=await Zin(),r={};return t&&(r=await Gsl(t.appPath)),{...e,...r}}async function Zin(){let t={};return t[TC.DevSpace]=await qsl(),t[TC.AppStudio]=YC(),t[TC.AppStudioBackwardCompatible]=t[TC.AppStudio],t[TC.InternlVsExternal]=Wsl(),t[TC.InternlVsExternalBackwardCompatible]=t[TC.InternlVsExternal],t[TC.NodeVersion]=await Jsl(),t[TC.IdeType]=eon(),t}async function qsl(){if(YC())try{if(!process.env.H2O_URL||!process.env.WORKSPACE_ID)return"";let t=process.env.H2O_URL,e=process.env.WORKSPACE_ID.replace("workspaces-",""),r=`${t}/ws-manager/api/v1/workspace/${e}`,n=await cjo.default.get(r);if(n.data)return n.data?.config?.annotations?.pack}catch{}return""}async function Gsl(t){if(!t)return{};let e=await Hsl(t),r=await Ysl(t),n=await RJe(t),i=await zsl(t);n==="Fiori Reuse"&&(i=Ene.UNKNOWN);let a=await Xsl(t),s=await Nxt(t),c={};return c[TC.TemplateType]=e,c[TC.DeployTargetType]=r,c[TC.ODataSourceType]=i,c[TC.AppToolsId]=a.toolsId??"",c[TC.AppProgrammingLanguage]=s,c[TC.TemplateId]=a.id??"",c[TC.TemplateVersion]=a.version??"",c[TC.ApplicationType]=n??"",c}async function Hsl(t){let e=Lle.join(t,"README.md"),r=Lle.join(t,".appGenInfo.json");if(MJ.existsSync(r)){let n=await MJ.promises.readFile(r,"utf-8"),i=JSON.parse(n);if(i?.generationParameters?.template)return i.generationParameters.template.trim()}if(MJ.existsSync(e)){let n=await MJ.promises.readFile(e,"utf-8");if(n){let i="",a=n.split(/\r?\n/);for(let s of a){let l=/\|\*\*Template Used\*\*<br>(.*?)\|/.exec(s);if(l&&l.length>=2){i=l[1].trim();break}}return i}}return""}async function zsl(t){try{let e;try{e=await Nie(t)}catch{}if(!e)try{let i=Lle.dirname(t);e=await Nie(i,!1)}catch{}let r=!1;if(!e){let i=Lle.dirname(t),a=Lle.dirname(i);r=await tJe(a),e=r?a:t}if(r)return Ene.CAPJava;let n=await GVe(e);return Ksl(n)}catch{return Ene.UNKNOWN}}function Ksl(t){return t==="EDMXBackend"?Ene.ABAP:t==="CAPNodejs"?Ene.CAPNode:t==="CAPJava"?Ene.CAPJava:Ene.UNKNOWN}async function Ysl(t){let e=_Me.NO_DEPLOY_CONFIG,r=Lle.join(t,"ui5-deploy.yaml");try{await MJ.promises.access(r);let n=await MJ.promises.readFile(r,"utf-8"),a=ljo.default.parse(n)?.builder?.customTasks;a?e=a.some(c=>c.name==="deploy-to-abap")?_Me.ABAP:_Me.CF:e=_Me.UNKNOWN_DEPLOY_CONFIG}catch{}return e}function Wsl(){return eer.internalFeature?"internal":"external"}async function Xsl(t){let e=await GC(t),r={manifest:Lle.join(e,"manifest.json"),appdescr:Lle.join(e,"manifest.appdescr_variant"),ui5Yaml:Lle.join(t,"ui5.yaml")};try{if(MJ.existsSync(r.manifest)){let n=await MJ.promises.readFile(r.manifest,"utf-8"),i=JSON.parse(n);return Qin(i["sap.app"]?.sourceTemplate??{})}if(MJ.existsSync(r.appdescr)&&MJ.existsSync(r.ui5Yaml)){let n=await MJ.promises.readFile(r.ui5Yaml,"utf-8"),a=(await fX.newInstance(n)).getCustomConfiguration("adp");return Qin(a?.support??{})}}catch{}return Qin({})}function Qin(t){return{id:t.id??"",version:t.version??"",toolsId:t.toolsId??jEt.NO_TOOLS_ID}}async function Jsl(){try{return(await new eUe().run("node",["-v"])??"unknown").replaceAll(/(?:^v)|([\r\n]{1,100})/g,"")}catch{return"unknown"}}function eon(){if(YC())return"appstudio";let t=process.env.VSCODE_CWD?.toLowerCase()??"",e=process.env.VSCODE_PID,r=process.env.TERM_PROGRAM??"",n=process.env.VSCODE_APPNAME?.toLowerCase()??"";return!e&&!t&&r!=="vscode"&&r!=="vscode-insiders"?"unknown":process.env.CURSOR_TRACE_ID||n.includes("cursor")||t.includes("cursor")?"cursor":n.includes("windsurf")||t.includes("windsurf")||t.includes("codeium")?"windsurf":n.includes("antigravity")||t.includes("antigravity")?"antigravity":n.includes("trae")||t.includes("trae")?"trae":n.includes("kiro")||t.includes("kiro")?"kiro":n.includes("vscodium")||n.includes("codium")||t.includes("vscodium")||t.includes("codium")?"vscodium":n.includes("code-server")||t.includes("code-server")||process.env.CODE_SERVER_SESSION?"code-server":n.includes("insiders")||t.includes("code - insiders")||t.includes("code insiders")||t.includes("vscode-insiders")||r==="vscode-insiders"?"vscode-insiders":e||r==="vscode"?"vscode":"unknown"}var ujo=Nr(Win(),1);var n5e;(function(t){t.Test="test",t.TELEMETRY_SETTINGS_INIT_FAILED="TELEMETRY_SETTINGS_INIT_FAILED",t.DISABLE_TELEMETRY="DISABLE_TELEMETRY"})(n5e||(n5e={}));var Qsl=t=>{let e=[/sap-ux.+/gi,/[-a-zA-Z]+\/ide-extension\/.+/gi,/(\/telemetry\/.+)/gi],r=[],n=t.split(`
4583
4587
  `).filter(i=>!!/^\s*at .*(\S+:\d+|\(native\))/m.exec(i));return n.length&&n.forEach(i=>{let a=i.replace(/^\s+/,""),c=/ (\((.+):(\d+):(\d+)\)$)/.exec(i);if(!c)return;let l=null,u=c[2].replace(/\\/g,"/");for(let m of e){let g=m.exec(u);if(g){l=g[0];break}}if(!l)return;a=a.replace(c[0],"");let p=a.split(/\s+/).slice(1).join(""),d=c[3],f=c[4],h=`${p} at (${l}:${d}:${f});`;r.push(h)}),r},ter,pjo=()=>(ter||(ter=new ujo.TelemetryClient(Nq.buildConnectionString(vC.azureInstrumentationKey)),QZt(ter)),ter),djo=t=>{let e={message:t.message};if(t.stack){let n=Qsl(t.stack);n.length&&(e.stack=n.join(`
4584
- `))}let r={name:n5e.TELEMETRY_SETTINGS_INIT_FAILED,properties:e,measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&pjo().trackEvent(r)},fjo=(t,e)=>{let r={name:n5e.DISABLE_TELEMETRY,properties:{disableTelemetry:`${!t}`,...e},measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&pjo().trackEvent(r)};import Zsl from"node:os";import ecl from"node:path";import tcl from"node:fs";var rcl={win32:"\\AppData\\Roaming\\Code\\User\\settings.json",darwin:"/Library/Application Support/Code/User/settings.json",linux:"/.config/Code/User/settings.json",theia:"/.theia/settings.json"},ncl=["sap.ux.annotation.lsp.enableTelemetry","sap.ux.applicationModeler.enableTelemetry","sap.ux.help.enableTelemetry","sap.ux.serviceModeler.enableTelemetry"],icl=t=>{let e=process.platform,r=t[e];if(YC()&&(r=t.theia),!r)return null;let n=Zsl.homedir();return ecl.join(n,r)};async function ocl(t){let e;try{e=await t.read(new ATe)}catch{}if(e)vC.telemetryEnabled=e.enableTelemetry;else{let r=icl(rcl);if(!r)await rer(!0);else{let n;try{n=await tcl.promises.readFile(r,"utf-8");let i=JSON.parse(n),s=ncl.map(c=>i[c]??!0).reduce((c,l)=>c&&l,!0);await rer(s)}catch{await rer(!0)}}}}function acl(t){dGt(JIe.TelemetrySetting,()=>{t.read(new ATe).then(e=>{e&&(vC.telemetryEnabled=e.enableTelemetry)}).catch(()=>{})})}var ton=async t=>{try{vC.consumerModuleName=t.consumerModule.name,vC.consumerModuleVersion=t.consumerModule.version,eer.internalFeature=t.internalFeature??!1,t.resourceId&&(vC.azureInstrumentationKey=t.resourceId),t.ingestionEndpoint&&(vC.azureIngestionEndpoint=t.ingestionEndpoint),t.liveEndpoint&&(vC.azureLiveEndpoint=t.liveEndpoint);let e=await MHe({entityName:"telemetrySetting"});await ocl(e),t.watchTelemetrySettingStore&&acl(e)}catch(e){djo(e)}};async function rer(t){try{let r=await MHe({entityName:"telemetrySetting"}),n=new kht({enableTelemetry:t});await r.write(n),vC.telemetryEnabled=t}catch{}let e=await Zin();fjo(t,e)}var scl="ApplicationInsightsInstrumentationKeyPLACEH0LDER",Nq=class t{static clientMap=new Map;static getTelemetryClient(){return t.getTelemetryClientByClass(UEt)}static getTelemetryClientByClass(e){let r=t.clientMap.get(e.name);if(r)return r;let n=t.buildConnectionString(vC.azureInstrumentationKey);return r=new e(n,vC.consumerModuleName,vC.consumerModuleVersion),t.clientMap.set(e.name,r),r}static buildConnectionString(e){return e?`InstrumentationKey=${e===scl?"00000000-0000-0000-0000-000000000000":e};IngestionEndpoint=${vC.azureIngestionEndpoint};LiveEndpoint=${vC.azureLiveEndpoint};`:""}};var c9;(function(t){t.START_MARK="START_MARK",t.END_MARK="END_MARK",t.MEASUREMENT="MEASUREMENT"})(c9||(c9={}));var ner=class{static initTiming;static enteries;static initialize;static startMark;static endMark;static measure;static getEntries;static getEntriesByName;static getEntriesByType;static getEntriesByNameType;static getMeasurementDuration;static clearEntries};var BEt=class{startTime;name;type;getStartTime(){return this.startTime}constructor(e,r,n){this.startTime=n,this.name=e,this.startTime=n,this.type=r}},ier=class extends BEt{startTime;duration;constructor(e,r,n){super(e,c9.MEASUREMENT,r),this.startTime=r,this.duration=n,this.duration=n}getDurationTime(){return this.duration}};import{performance as ccl}from"node:perf_hooks";var lcl=()=>ccl.now(),pI=class t extends ner{static initTiming;static now=lcl;static entries=[];static initialize(){t.initTiming=t.now()}static mark(e,r,n){let i=new BEt(e,r,n);t.entries.push(i)}static startMark(e){let r=t.now(),n=e+r;return t.mark(n,c9.START_MARK,r),n}static endMark(e){let r=t.now();t.mark(e,c9.END_MARK,r)}static measure(e){let r=t.getEntriesByNameType(e,c9.START_MARK).slice(-1)[0],n=t.getEntriesByNameType(e,c9.END_MARK).slice(-1)[0];if(!r&&!n)throw new Error(`Failed to execute 'measure': mark '${e}' doesn't exist.`);if(!r||!n){let l=r?c9.END_MARK:c9.START_MARK;throw new Error(`Failed to execute 'measure': mark '${e}'of type '${l}' doesn't exist.`)}let i=r.getStartTime(),s=n.getStartTime()-i,c=new ier(`${e}`,t.now(),s);t.entries.push(c)}static getEntries(){return t.entries}static getEntriesByName(e){return t.entries.filter(r=>r.name===e)}static getEntriesByNameType(e,r){return t.entries.filter(n=>n.name===e&&n.type===r)}static getEntriesByType(e){return t.entries.filter(r=>r.type===e)}static getMeasurementDuration(e){return t.getEntriesByNameType(e,c9.MEASUREMENT).slice(-1)[0].getDurationTime()}static clearEntries(){t.entries=[]}};pI.initialize();var ucl=(t,e)=>new Error(`Wrong path for '${t}' field is specified in instructions with index - ${e}`),pcl=(t,e,r,n)=>{let i=e.split("/"),a=t,s=0;for(;s<i.length;){if(a=a[i[s]],a===void 0)throw ucl(r,n);s++}return a},hjo=(t,e)=>{let r={},n={},i=null;e.paramIndex!==void 0&&(i=t[e.paramIndex]);let a=e.key?e.key:"data",s="";return typeof e.value=="string"?s=e.value:e.value!==void 0&&e.paramIndex!==void 0?s=pcl(i,e.value.path,"val",e.paramIndex):s=i,typeof s=="number"&&!Number.isNaN(s)?n[a]=s:r[a]=s,[r,n]},ron=(t,e)=>{let r,n,i={},a={};if(Array.isArray(e))for(let s of e)[r,n]=hjo(t,s),i={...i,...r},a={...a,...n};else[i,a]=hjo(t,e);return[i,a]};var mjo=(t,e,r,n)=>(...i)=>{let a=e.apply(t,i);return Nq.getTelemetryClient().report(r,{},{},n),a},gjo=(t,e,r,n)=>async(...i)=>{let a=await e.apply(t,i);return Nq.getTelemetryClient().report(r,{},{},n),a},yjo=(t,e,r,n)=>(...i)=>{let a=pI.startMark("mark"),s=e.apply(t,i);pI.endMark(a),pI.measure(a);let c=pI.getMeasurementDuration(a);return Nq.getTelemetryClient().report(r,{},{ms:c},n),s},_jo=(t,e,r,n)=>async(...i)=>{let a=pI.startMark("mark"),s=await e.apply(t,i);pI.endMark(a),pI.measure(a);let c=pI.getMeasurementDuration(a);return Nq.getTelemetryClient().report(r,{},{ms:c},n),s},vjo=(t,e,r,n,i)=>(...a)=>{let s=e.apply(t,a),[c,l]=ron(a,i);return Nq.getTelemetryClient().report(r,c,l,n),s},Ejo=(t,e,r,n,i)=>async(...a)=>{let s=await e.apply(t,a),[c,l]=ron(a,i);return Nq.getTelemetryClient().report(r,c,l,n),s};var $le;(function(t){t.NOTIFICATION="notify",t.DURATION="duration",t.CAPTURE_PARAM="captureParam"})($le||($le={}));var oer=new Map;oer.set($le.NOTIFICATION,mjo);oer.set($le.DURATION,yjo);oer.set($le.CAPTURE_PARAM,vjo);var aer=new Map;aer.set($le.NOTIFICATION,gjo);aer.set($le.DURATION,_jo);aer.set($le.CAPTURE_PARAM,Ejo);var non={AnnotationModeler:"sap.ux.annotationModeler",AppGenerator:"sap.ux.appGenerator",ApplicationModeler:"sap.ux.applicationModeler",Help:"sap.ux.help",ServiceModeler:"sap.ux.serviceModeler",Internal:"sap.ux.internal"},ion={"sap.ux.help.testBetaFeatures.enableAppStudioGDContribution":"c8c52f0b-0d7d-4697-997a-d6f29814f42e","sap.ux.help.testBetaFeatures.showTestGuides":"fbb03f42-0a86-4fd5-9fc4-8c9b38a4d1a3","sap.ux.help.testBetaFeatures.enableFioriAI":"165a0e31-35ea-4bee-8d47-b8593435a82d","sap.ux.help.testBetaFeatures.enableFioriAIJoule":"165a0e31-35ea-4bee-8d47-b8593435a82e","sap.ux.help.testBetaFeatures.enableFioriAIVsCode":"165a0e31-35ea-4bee-8d47-b8593435a82f","sap.ux.help.testBetaFeatures.enableFioriAIAppModeler":"165a0e31-35ea-4bee-8d47-b8593435a82g","sap.ux.help.testBetaFeatures.enableFioriAIRapGeneration":"165a0e31-35ea-4bee-8d47-b8593435a82h","sap.ux.applicationModeler.testBetaFeatures.manifestEditor":!0,"sap.ux.appGenerator.testBetaFeatures.newAnnotationAPI":!0},ser="testBetaFeatures",oon="sap.ux.applicationModeler.enableExperimentalFeatures";import{createRequire as fcl}from"node:module";var hcl=fcl(import.meta.url);function Tjo(){try{return hcl("vscode")}catch{return}}var mcl=Tjo(),cer=class t{static get vscode(){return mcl}static getFeatureToggle(e){let r,n=t.vscode;if((e.includes(ser)||e===oon)&&n){let a=e.slice(0,e.lastIndexOf(".")),s=e.slice(e.lastIndexOf(".")+1,e.length);r=n.workspace.getConfiguration(a)?.get(s)}else r=!1;return process.env.TOOLSUITE_FEATURES&&(r=process.env.TOOLSUITE_FEATURES.split(",").includes(e)?!0:r),ion[e]&&(ion[e]===r?r=!0:r=!1),{feature:e,isEnabled:r===!0?r:!1}}static getAllFeatureToggles(){let e=[],r=t.vscode;if(r)Object.keys(non).forEach(n=>{let i=`${non[n]}.${ser}`,a,s=[];try{a=r.workspace.getConfiguration(i),s=Object.keys(a).filter(c=>typeof a?.[c]!="function")}catch{}a&&s.forEach(c=>{let l=a.get(c),u={feature:`${i}.${c}`,isEnabled:l||!1};e.push(u)})});else if(process.env.TOOLSUITE_FEATURES){let n=process.env.TOOLSUITE_FEATURES.split(",");for(let i of n){let a={feature:i,isEnabled:!0};e.push(a)}}return e}};function aon(){let t="sap.ux.internal.enableInternalFeatures",e=!1,r=cer.vscode;return r&&(e=(r.workspace?r.workspace.getConfiguration().get(t):!1)??!1),process.env.TOOLSUITE_INTERNAL&&process.env.TOOLSUITE_INTERNAL==="true"&&(e=!0),e}var V2o=Nr(R2o(),1);import{randomUUID as Qll}from"node:crypto";var Yll=["@sap-ux","fiori-mcp-server"].join("/");var Wll="1.12.13",M2o={name:Yll,version:Wll};var L2o={telemetry:{unknownOs:"Unknown"}};var _on="fiori-mcp-server",k2o=Dy.createInstance();async function Jll(){await k2o.init({resources:{en:{[_on]:L2o}},lng:"en",fallbackLng:"en",defaultNS:_on,ns:[_on]})}function $2o(t,e){return k2o.t(t,e)}Jll().catch(()=>{});var{version:Zll}=M2o,F2o="@sap-ux/fiori-mcp-server",U2o="unknown-tool",eul="0a65e45d-6bf4-421d-b845-61e888c50e9e",Tne=class{static _telemetryData;static _previousEventTimestamp;static _sessionId;static get telemetryData(){return this._telemetryData}static get sessionId(){return this._sessionId}static initSessionId(){this._sessionId=Qll(),$i.info(`Telemetry session initialized with ID: ${this._sessionId}`)}static async initTelemetrySettings(e){this._sessionId||this.initSessionId();let r={consumerModule:{name:F2o,version:Zll},watchTelemetrySettingStore:!1,internalFeature:aon(),resourceId:eul,...e};try{await ton(r)}catch(n){$i.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e,r=!1){let n=new Date().getTime();if(this._previousEventTimestamp||(r=!1,this._previousEventTimestamp=n),!this._telemetryData){let i=$2o("telemetry.unknownOs");try{i=(0,V2o.default)()}catch{}this._telemetryData={Platform:YC()?"SBAS":"VSCode",OperatingSystem:i,SessionId:this.sessionId}}if(r){let i={...this._telemetryData,...e};if(Math.abs(this._previousEventTimestamp-n)<1e3&&JSON.stringify(i)===JSON.stringify(this._telemetryData))return}return this._previousEventTimestamp=n,this._telemetryData=Object.assign(this._telemetryData,e),this._telemetryData}static prepareTelemetryEvent(e,r){this.markToolsEndTime();let n=r.markName?pI.getMeasurementDuration(r.markName):void 0;return{eventName:e,properties:r,measurements:n?{RequestTime:n}:{}}}static markToolStartTime(){this.createTelemetryData({markName:pI.startMark("MCP_LOADING_TIME")})}static markToolsEndTime(){this._telemetryData?.markName&&(pI.endMark(this._telemetryData.markName),pI.measure(this._telemetryData.markName))}static async sendTelemetry(e,r,n){let i=this.createTelemetryData(r)??r,a=this.prepareTelemetryEvent(e,i);await Nq.getTelemetryClient().reportEvent(a,Mk.NoSampling,n?{appPath:n}:void 0)}static getTelemetryName(){return F2o}};var j2o="2024-11-05";function tul(t){return OCe.includes(t)?t:OCe.includes(j2o)?j2o:OCe[OCe.length-1]}var Oer=class{server;mcpClientName="unknown-client";mcpClientVersion="unknown-version";constructor(){this.server=new TCt({name:"fiori-mcp",version:m$e,icons:[{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.svg",mimeType:"image/svg+xml"},{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.png",mimeType:"image/png"}],title:"MCP Server for SAP Fiori"},{capabilities:{tools:{}}}),this.setupToolHandlers(),this.setupErrorHandling()}setupErrorHandling(){this.server.onerror=e=>$i.error(`[MCP Error] ${e}`),process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)})}async setupTelemetry(){await Tne.initTelemetrySettings()}setupToolHandlers(){this.server.setRequestHandler(c8e,async e=>{this.mcpClientName=e.params.clientInfo?.name||"unknown-client",this.mcpClientVersion=e.params.clientInfo?.version||"unknown-version",$i.info(`MCP Client connected: ${this.mcpClientName} v${this.mcpClientVersion}`);let r={mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};return await Tne.sendTelemetry(Q4n,r),{protocolVersion:tul(e.params.protocolVersion),capabilities:{tools:{}},serverInfo:{name:"fiori-mcp",version:m$e},instructions:`
4588
+ `))}let r={name:n5e.TELEMETRY_SETTINGS_INIT_FAILED,properties:e,measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&pjo().trackEvent(r)},fjo=(t,e)=>{let r={name:n5e.DISABLE_TELEMETRY,properties:{disableTelemetry:`${!t}`,...e},measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&pjo().trackEvent(r)};import Zsl from"node:os";import ecl from"node:path";import tcl from"node:fs";var rcl={win32:"\\AppData\\Roaming\\Code\\User\\settings.json",darwin:"/Library/Application Support/Code/User/settings.json",linux:"/.config/Code/User/settings.json",theia:"/.theia/settings.json"},ncl=["sap.ux.annotation.lsp.enableTelemetry","sap.ux.applicationModeler.enableTelemetry","sap.ux.help.enableTelemetry","sap.ux.serviceModeler.enableTelemetry"],icl=t=>{let e=process.platform,r=t[e];if(YC()&&(r=t.theia),!r)return null;let n=Zsl.homedir();return ecl.join(n,r)};async function ocl(t){let e;try{e=await t.read(new ATe)}catch{}if(e)vC.telemetryEnabled=e.enableTelemetry;else{let r=icl(rcl);if(!r)await rer(!0);else{let n;try{n=await tcl.promises.readFile(r,"utf-8");let i=JSON.parse(n),s=ncl.map(c=>i[c]??!0).reduce((c,l)=>c&&l,!0);await rer(s)}catch{await rer(!0)}}}}function acl(t){dGt(JIe.TelemetrySetting,()=>{t.read(new ATe).then(e=>{e&&(vC.telemetryEnabled=e.enableTelemetry)}).catch(()=>{})})}var ton=async t=>{try{vC.consumerModuleName=t.consumerModule.name,vC.consumerModuleVersion=t.consumerModule.version,eer.internalFeature=t.internalFeature??!1,t.resourceId&&(vC.azureInstrumentationKey=t.resourceId),t.ingestionEndpoint&&(vC.azureIngestionEndpoint=t.ingestionEndpoint),t.liveEndpoint&&(vC.azureLiveEndpoint=t.liveEndpoint);let e=await MHe({entityName:"telemetrySetting"});await ocl(e),t.watchTelemetrySettingStore&&acl(e)}catch(e){djo(e)}};async function rer(t){try{let r=await MHe({entityName:"telemetrySetting"}),n=new kht({enableTelemetry:t});await r.write(n),vC.telemetryEnabled=t}catch{}let e=await Zin();fjo(t,e)}var scl="ApplicationInsightsInstrumentationKeyPLACEH0LDER",Nq=class t{static clientMap=new Map;static getTelemetryClient(){return t.getTelemetryClientByClass(UEt)}static getTelemetryClientByClass(e){let r=t.clientMap.get(e.name);if(r)return r;let n=t.buildConnectionString(vC.azureInstrumentationKey);return r=new e(n,vC.consumerModuleName,vC.consumerModuleVersion),t.clientMap.set(e.name,r),r}static buildConnectionString(e){return e?`InstrumentationKey=${e===scl?"00000000-0000-0000-0000-000000000000":e};IngestionEndpoint=${vC.azureIngestionEndpoint};LiveEndpoint=${vC.azureLiveEndpoint};`:""}};var c9;(function(t){t.START_MARK="START_MARK",t.END_MARK="END_MARK",t.MEASUREMENT="MEASUREMENT"})(c9||(c9={}));var ner=class{static initTiming;static enteries;static initialize;static startMark;static endMark;static measure;static getEntries;static getEntriesByName;static getEntriesByType;static getEntriesByNameType;static getMeasurementDuration;static clearEntries};var BEt=class{startTime;name;type;getStartTime(){return this.startTime}constructor(e,r,n){this.startTime=n,this.name=e,this.startTime=n,this.type=r}},ier=class extends BEt{startTime;duration;constructor(e,r,n){super(e,c9.MEASUREMENT,r),this.startTime=r,this.duration=n,this.duration=n}getDurationTime(){return this.duration}};import{performance as ccl}from"node:perf_hooks";var lcl=()=>ccl.now(),pI=class t extends ner{static initTiming;static now=lcl;static entries=[];static initialize(){t.initTiming=t.now()}static mark(e,r,n){let i=new BEt(e,r,n);t.entries.push(i)}static startMark(e){let r=t.now(),n=e+r;return t.mark(n,c9.START_MARK,r),n}static endMark(e){let r=t.now();t.mark(e,c9.END_MARK,r)}static measure(e){let r=t.getEntriesByNameType(e,c9.START_MARK).slice(-1)[0],n=t.getEntriesByNameType(e,c9.END_MARK).slice(-1)[0];if(!r&&!n)throw new Error(`Failed to execute 'measure': mark '${e}' doesn't exist.`);if(!r||!n){let l=r?c9.END_MARK:c9.START_MARK;throw new Error(`Failed to execute 'measure': mark '${e}'of type '${l}' doesn't exist.`)}let i=r.getStartTime(),s=n.getStartTime()-i,c=new ier(`${e}`,t.now(),s);t.entries.push(c)}static getEntries(){return t.entries}static getEntriesByName(e){return t.entries.filter(r=>r.name===e)}static getEntriesByNameType(e,r){return t.entries.filter(n=>n.name===e&&n.type===r)}static getEntriesByType(e){return t.entries.filter(r=>r.type===e)}static getMeasurementDuration(e){return t.getEntriesByNameType(e,c9.MEASUREMENT).slice(-1)[0].getDurationTime()}static clearEntries(){t.entries=[]}};pI.initialize();var ucl=(t,e)=>new Error(`Wrong path for '${t}' field is specified in instructions with index - ${e}`),pcl=(t,e,r,n)=>{let i=e.split("/"),a=t,s=0;for(;s<i.length;){if(a=a[i[s]],a===void 0)throw ucl(r,n);s++}return a},hjo=(t,e)=>{let r={},n={},i=null;e.paramIndex!==void 0&&(i=t[e.paramIndex]);let a=e.key?e.key:"data",s="";return typeof e.value=="string"?s=e.value:e.value!==void 0&&e.paramIndex!==void 0?s=pcl(i,e.value.path,"val",e.paramIndex):s=i,typeof s=="number"&&!Number.isNaN(s)?n[a]=s:r[a]=s,[r,n]},ron=(t,e)=>{let r,n,i={},a={};if(Array.isArray(e))for(let s of e)[r,n]=hjo(t,s),i={...i,...r},a={...a,...n};else[i,a]=hjo(t,e);return[i,a]};var mjo=(t,e,r,n)=>(...i)=>{let a=e.apply(t,i);return Nq.getTelemetryClient().report(r,{},{},n),a},gjo=(t,e,r,n)=>async(...i)=>{let a=await e.apply(t,i);return Nq.getTelemetryClient().report(r,{},{},n),a},yjo=(t,e,r,n)=>(...i)=>{let a=pI.startMark("mark"),s=e.apply(t,i);pI.endMark(a),pI.measure(a);let c=pI.getMeasurementDuration(a);return Nq.getTelemetryClient().report(r,{},{ms:c},n),s},_jo=(t,e,r,n)=>async(...i)=>{let a=pI.startMark("mark"),s=await e.apply(t,i);pI.endMark(a),pI.measure(a);let c=pI.getMeasurementDuration(a);return Nq.getTelemetryClient().report(r,{},{ms:c},n),s},vjo=(t,e,r,n,i)=>(...a)=>{let s=e.apply(t,a),[c,l]=ron(a,i);return Nq.getTelemetryClient().report(r,c,l,n),s},Ejo=(t,e,r,n,i)=>async(...a)=>{let s=await e.apply(t,a),[c,l]=ron(a,i);return Nq.getTelemetryClient().report(r,c,l,n),s};var $le;(function(t){t.NOTIFICATION="notify",t.DURATION="duration",t.CAPTURE_PARAM="captureParam"})($le||($le={}));var oer=new Map;oer.set($le.NOTIFICATION,mjo);oer.set($le.DURATION,yjo);oer.set($le.CAPTURE_PARAM,vjo);var aer=new Map;aer.set($le.NOTIFICATION,gjo);aer.set($le.DURATION,_jo);aer.set($le.CAPTURE_PARAM,Ejo);var non={AnnotationModeler:"sap.ux.annotationModeler",AppGenerator:"sap.ux.appGenerator",ApplicationModeler:"sap.ux.applicationModeler",Help:"sap.ux.help",ServiceModeler:"sap.ux.serviceModeler",Internal:"sap.ux.internal"},ion={"sap.ux.help.testBetaFeatures.enableAppStudioGDContribution":"c8c52f0b-0d7d-4697-997a-d6f29814f42e","sap.ux.help.testBetaFeatures.showTestGuides":"fbb03f42-0a86-4fd5-9fc4-8c9b38a4d1a3","sap.ux.help.testBetaFeatures.enableFioriAI":"165a0e31-35ea-4bee-8d47-b8593435a82d","sap.ux.help.testBetaFeatures.enableFioriAIJoule":"165a0e31-35ea-4bee-8d47-b8593435a82e","sap.ux.help.testBetaFeatures.enableFioriAIVsCode":"165a0e31-35ea-4bee-8d47-b8593435a82f","sap.ux.help.testBetaFeatures.enableFioriAIAppModeler":"165a0e31-35ea-4bee-8d47-b8593435a82g","sap.ux.help.testBetaFeatures.enableFioriAIRapGeneration":"165a0e31-35ea-4bee-8d47-b8593435a82h","sap.ux.applicationModeler.testBetaFeatures.manifestEditor":!0,"sap.ux.appGenerator.testBetaFeatures.newAnnotationAPI":!0},ser="testBetaFeatures",oon="sap.ux.applicationModeler.enableExperimentalFeatures";import{createRequire as fcl}from"node:module";var hcl=fcl(import.meta.url);function Tjo(){try{return hcl("vscode")}catch{return}}var mcl=Tjo(),cer=class t{static get vscode(){return mcl}static getFeatureToggle(e){let r,n=t.vscode;if((e.includes(ser)||e===oon)&&n){let a=e.slice(0,e.lastIndexOf(".")),s=e.slice(e.lastIndexOf(".")+1,e.length);r=n.workspace.getConfiguration(a)?.get(s)}else r=!1;return process.env.TOOLSUITE_FEATURES&&(r=process.env.TOOLSUITE_FEATURES.split(",").includes(e)?!0:r),ion[e]&&(ion[e]===r?r=!0:r=!1),{feature:e,isEnabled:r===!0?r:!1}}static getAllFeatureToggles(){let e=[],r=t.vscode;if(r)Object.keys(non).forEach(n=>{let i=`${non[n]}.${ser}`,a,s=[];try{a=r.workspace.getConfiguration(i),s=Object.keys(a).filter(c=>typeof a?.[c]!="function")}catch{}a&&s.forEach(c=>{let l=a.get(c),u={feature:`${i}.${c}`,isEnabled:l||!1};e.push(u)})});else if(process.env.TOOLSUITE_FEATURES){let n=process.env.TOOLSUITE_FEATURES.split(",");for(let i of n){let a={feature:i,isEnabled:!0};e.push(a)}}return e}};function aon(){let t="sap.ux.internal.enableInternalFeatures",e=!1,r=cer.vscode;return r&&(e=(r.workspace?r.workspace.getConfiguration().get(t):!1)??!1),process.env.TOOLSUITE_INTERNAL&&process.env.TOOLSUITE_INTERNAL==="true"&&(e=!0),e}var V2o=Nr(R2o(),1);import{randomUUID as Qll}from"node:crypto";var Yll=["@sap-ux","fiori-mcp-server"].join("/");var Wll="1.13.0",M2o={name:Yll,version:Wll};var L2o={telemetry:{unknownOs:"Unknown"}};var _on="fiori-mcp-server",k2o=Dy.createInstance();async function Jll(){await k2o.init({resources:{en:{[_on]:L2o}},lng:"en",fallbackLng:"en",defaultNS:_on,ns:[_on]})}function $2o(t,e){return k2o.t(t,e)}Jll().catch(()=>{});var{version:Zll}=M2o,F2o="@sap-ux/fiori-mcp-server",U2o="unknown-tool",eul="0a65e45d-6bf4-421d-b845-61e888c50e9e",Tne=class{static _telemetryData;static _previousEventTimestamp;static _sessionId;static get telemetryData(){return this._telemetryData}static get sessionId(){return this._sessionId}static initSessionId(){this._sessionId=Qll(),$i.info(`Telemetry session initialized with ID: ${this._sessionId}`)}static async initTelemetrySettings(e){this._sessionId||this.initSessionId();let r={consumerModule:{name:F2o,version:Zll},watchTelemetrySettingStore:!1,internalFeature:aon(),resourceId:eul,...e};try{await ton(r)}catch(n){$i.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e,r=!1){let n=new Date().getTime();if(this._previousEventTimestamp||(r=!1,this._previousEventTimestamp=n),!this._telemetryData){let i=$2o("telemetry.unknownOs");try{i=(0,V2o.default)()}catch{}this._telemetryData={Platform:YC()?"SBAS":"VSCode",OperatingSystem:i,SessionId:this.sessionId}}if(r){let i={...this._telemetryData,...e};if(Math.abs(this._previousEventTimestamp-n)<1e3&&JSON.stringify(i)===JSON.stringify(this._telemetryData))return}return this._previousEventTimestamp=n,this._telemetryData=Object.assign(this._telemetryData,e),this._telemetryData}static prepareTelemetryEvent(e,r){this.markToolsEndTime();let n=r.markName?pI.getMeasurementDuration(r.markName):void 0;return{eventName:e,properties:r,measurements:n?{RequestTime:n}:{}}}static markToolStartTime(){this.createTelemetryData({markName:pI.startMark("MCP_LOADING_TIME")})}static markToolsEndTime(){this._telemetryData?.markName&&(pI.endMark(this._telemetryData.markName),pI.measure(this._telemetryData.markName))}static async sendTelemetry(e,r,n){let i=this.createTelemetryData(r)??r,a=this.prepareTelemetryEvent(e,i);await Nq.getTelemetryClient().reportEvent(a,Mk.NoSampling,n?{appPath:n}:void 0)}static getTelemetryName(){return F2o}};var j2o="2024-11-05";function tul(t){return OCe.includes(t)?t:OCe.includes(j2o)?j2o:OCe[OCe.length-1]}var Oer=class{server;mcpClientName="unknown-client";mcpClientVersion="unknown-version";constructor(){this.server=new TCt({name:"fiori-mcp",version:m$e,icons:[{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.svg",mimeType:"image/svg+xml"},{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.png",mimeType:"image/png"}],title:"MCP Server for SAP Fiori"},{capabilities:{tools:{}}}),this.setupToolHandlers(),this.setupErrorHandling()}setupErrorHandling(){this.server.onerror=e=>$i.error(`[MCP Error] ${e}`),process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)})}async setupTelemetry(){await Tne.initTelemetrySettings()}setupToolHandlers(){this.server.setRequestHandler(c8e,async e=>{this.mcpClientName=e.params.clientInfo?.name||"unknown-client",this.mcpClientVersion=e.params.clientInfo?.version||"unknown-version",$i.info(`MCP Client connected: ${this.mcpClientName} v${this.mcpClientVersion}`);let r={mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};return await Tne.sendTelemetry(Q4n,r),{protocolVersion:tul(e.params.protocolVersion),capabilities:{tools:{}},serverInfo:{name:"fiori-mcp",version:m$e},instructions:`
4585
4589
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
4586
4590
  \u{1F6A8}\u{1F6A8}\u{1F6A8} STOP - READ THIS BEFORE CALLING ANY TOOLS \u{1F6A8}\u{1F6A8}\u{1F6A8}
4587
4591
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-mcp-server",
3
3
  "description": "SAP Fiori - Model Context Protocol (MCP) server",
4
- "version": "1.12.13",
4
+ "version": "1.13.0",
5
5
  "mcpName": "io.github.SAP/fiori-mcp-server",
6
6
  "keywords": [
7
7
  "SAP Fiori tools",
@@ -57,22 +57,22 @@
57
57
  "xml-formatter": "3.7.0",
58
58
  "ts-node": "10.9.2",
59
59
  "zod": "4.4.3",
60
- "@sap-ux/axios-extension": "2.1.0",
61
- "@sap-ux/btp-utils": "2.0.6",
62
- "@sap-ux/feature-toggle": "1.0.5",
63
60
  "@sap-ux/fiori-annotation-api": "1.1.0",
64
61
  "@sap-ux/fiori-docs-embeddings": "1.2.7",
62
+ "@sap-ux/axios-extension": "2.1.0",
63
+ "@sap-ux/feature-toggle": "1.0.5",
64
+ "@sap-ux/btp-utils": "2.0.6",
65
65
  "@sap-ux/i18n": "1.0.4",
66
66
  "@sap-ux/logger": "1.0.3",
67
67
  "@sap-ux/nodejs-utils": "1.0.10",
68
- "@sap-ux/odata-annotation-core": "1.0.3",
69
68
  "@sap-ux/odata-annotation-core-types": "1.0.3",
70
69
  "@sap-ux/odata-service-writer": "1.0.23",
70
+ "@sap-ux/odata-annotation-core": "1.0.3",
71
71
  "@sap-ux/odata-entity-model": "1.0.1",
72
72
  "@sap-ux/project-access": "2.2.1",
73
- "@sap-ux/store": "2.0.7",
73
+ "@sap-ux/text-document-utils": "1.0.3",
74
74
  "@sap-ux/telemetry": "2.0.8",
75
- "@sap-ux/text-document-utils": "1.0.3"
75
+ "@sap-ux/store": "2.0.7"
76
76
  },
77
77
  "engines": {
78
78
  "node": ">=22.x"