@sap-ux/fiori-mcp-server 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1575,7 +1575,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
1575
1575
|
${n.message}`:h,_=[v,e,t].filter(Boolean).join(`
|
|
1576
1576
|
`);return m?(n.originalMessage=n.message,n.message=_):n=new Error(_),n.shortMessage=v,n.command=o,n.exitCode=a,n.signal=i,n.signalDescription=p,n.stdout=t,n.stderr=e,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!s,n.isCanceled=c,n.killed=u&&!s,n};lrr.exports=Jii});var drr=y((CXi,W2e)=>{"use strict";var ere=["stdin","stdout","stderr"],Qii=t=>ere.some(e=>t[e]!==void 0),frr=t=>{if(!t)return;let{stdio:e}=t;if(e===void 0)return ere.map(n=>t[n]);if(Qii(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${ere.map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return e;if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,ere.length);return Array.from({length:r},(n,i)=>e[i])};W2e.exports=frr;W2e.exports.node=t=>{let e=frr(t);return e==="ipc"?"ipc":e===void 0||typeof e=="string"?[e,e,e,"ipc"]:e.includes("ipc")?e:[...e,"ipc"]}});var hrr=y((xXi,tre)=>{tre.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&tre.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&tre.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var brr=y((PXi,YI)=>{var ia=global.process,DC=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};DC(ia)?(mrr=require("assert"),zI=hrr(),grr=/^win/i.test(ia.platform),Eq=require("events"),typeof Eq!="function"&&(Eq=Eq.EventEmitter),ia.__signal_exit_emitter__?gs=ia.__signal_exit_emitter__:(gs=ia.__signal_exit_emitter__=new Eq,gs.count=0,gs.emitted={}),gs.infinite||(gs.setMaxListeners(1/0),gs.infinite=!0),YI.exports=function(t,e){if(!DC(global.process))return function(){};mrr.equal(typeof t,"function","a callback must be provided for exit handler"),KI===!1&&X2e();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){gs.removeListener(r,t),gs.listeners("exit").length===0&&gs.listeners("afterexit").length===0&&rre()};return gs.on(r,t),n},rre=function(){!KI||!DC(global.process)||(KI=!1,zI.forEach(function(e){try{ia.removeListener(e,nre[e])}catch{}}),ia.emit=ire,ia.reallyExit=J2e,gs.count-=1)},YI.exports.unload=rre,wC=function(e,r,n){gs.emitted[e]||(gs.emitted[e]=!0,gs.emit(e,r,n))},nre={},zI.forEach(function(t){nre[t]=function(){if(DC(global.process)){var r=ia.listeners(t);r.length===gs.count&&(rre(),wC("exit",null,t),wC("afterexit",null,t),grr&&t==="SIGHUP"&&(t="SIGINT"),ia.kill(ia.pid,t))}}}),YI.exports.signals=function(){return zI},KI=!1,X2e=function(){KI||!DC(global.process)||(KI=!0,gs.count+=1,zI=zI.filter(function(e){try{return ia.on(e,nre[e]),!0}catch{return!1}}),ia.emit=vrr,ia.reallyExit=yrr)},YI.exports.load=X2e,J2e=ia.reallyExit,yrr=function(e){DC(global.process)&&(ia.exitCode=e||0,wC("exit",ia.exitCode,null),wC("afterexit",ia.exitCode,null),J2e.call(ia,ia.exitCode))},ire=ia.emit,vrr=function(e,r){if(e==="exit"&&DC(global.process)){r!==void 0&&(ia.exitCode=r);var n=ire.apply(this,arguments);return wC("exit",ia.exitCode,null),wC("afterexit",ia.exitCode,null),n}else return ire.apply(this,arguments)}):YI.exports=function(){return function(){}};var mrr,zI,grr,Eq,gs,rre,wC,nre,KI,X2e,J2e,yrr,ire,vrr});var _rr=y((DXi,Err)=>{"use strict";var Zii=require("os"),eai=brr(),tai=1e3*5,rai=(t,e="SIGTERM",r={})=>{let n=t(e);return nai(t,e,r,n),n},nai=(t,e,r,n)=>{if(!iai(e,r,n))return;let i=oai(r),a=setTimeout(()=>{t("SIGKILL")},i);a.unref&&a.unref()},iai=(t,{forceKillAfterTimeout:e},r)=>aai(t)&&e!==!1&&r,aai=t=>t===Zii.constants.signals.SIGTERM||typeof t=="string"&&t.toUpperCase()==="SIGTERM",oai=({forceKillAfterTimeout:t=!0})=>{if(t===!0)return tai;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},sai=(t,e)=>{t.kill()&&(e.isCanceled=!0)},cai=(t,e,r)=>{t.kill(e),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:e}))},uai=(t,{timeout:e,killSignal:r="SIGTERM"},n)=>{if(e===0||e===void 0)return n;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);let i,a=new Promise((s,c)=>{i=setTimeout(()=>{cai(t,r,c)},e)}),o=n.finally(()=>{clearTimeout(i)});return Promise.race([a,o])},lai=async(t,{cleanup:e,detached:r},n)=>{if(!e||r)return n;let i=eai(()=>{t.kill()});return n.finally(()=>{i()})};Err.exports={spawnedKill:rai,spawnedCancel:sai,setupTimeout:uai,setExitHandler:lai}});var Srr=y((wXi,Orr)=>{Orr.exports=Trr;function Trr(t,e){if(t&&e)return Trr(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(n){r[n]=t[n]}),r;function r(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var a=t.apply(this,n),o=n[n.length-1];return typeof a=="function"&&a!==o&&Object.keys(o).forEach(function(s){a[s]=o[s]}),a}}});var Z2e=y((NXi,Q2e)=>{var Arr=Srr();Q2e.exports=Arr(are);Q2e.exports.strict=Arr(Crr);are.proto=are(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return are(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Crr(this)},configurable:!0})});function are(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function Crr(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}});var Drr=y((IXi,Prr)=>{var pai=Z2e(),fai=function(){},dai=function(t){return t.setHeader&&typeof t.abort=="function"},hai=function(t){return t.stdio&&Array.isArray(t.stdio)&&t.stdio.length===3},xrr=function(t,e,r){if(typeof e=="function")return xrr(t,null,e);e||(e={}),r=pai(r||fai);var n=t._writableState,i=t._readableState,a=e.readable||e.readable!==!1&&t.readable,o=e.writable||e.writable!==!1&&t.writable,s=!1,c=function(){t.writable||u()},u=function(){o=!1,a||r.call(t)},l=function(){a=!1,o||r.call(t)},p=function(v){r.call(t,v?new Error("exited with error code: "+v):null)},d=function(v){r.call(t,v)},f=function(){process.nextTick(h)},h=function(){if(!s){if(a&&!(i&&i.ended&&!i.destroyed))return r.call(t,new Error("premature close"));if(o&&!(n&&n.ended&&!n.destroyed))return r.call(t,new Error("premature close"))}},m=function(){t.req.on("finish",u)};return dai(t)?(t.on("complete",u),t.on("abort",f),t.req?m():t.on("request",m)):o&&!n&&(t.on("end",c),t.on("close",c)),hai(t)&&t.on("exit",p),t.on("end",l),t.on("finish",u),e.error!==!1&&t.on("error",d),t.on("close",f),function(){s=!0,t.removeListener("complete",u),t.removeListener("abort",f),t.removeListener("request",m),t.req&&t.req.removeListener("finish",u),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",u),t.removeListener("exit",p),t.removeListener("end",l),t.removeListener("error",d),t.removeListener("close",f)}};Prr.exports=xrr});var Irr=y((RXi,Nrr)=>{var mai=Z2e(),gai=Drr(),eje=require("fs"),_q=function(){},yai=/^v?\.0/.test(process.version),ore=function(t){return typeof t=="function"},vai=function(t){return!yai||!eje?!1:(t instanceof(eje.ReadStream||_q)||t instanceof(eje.WriteStream||_q))&&ore(t.close)},bai=function(t){return t.setHeader&&ore(t.abort)},Eai=function(t,e,r,n){n=mai(n);var i=!1;t.on("close",function(){i=!0}),gai(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var a=!1;return function(o){if(!i&&!a){if(a=!0,vai(t))return t.close(_q);if(bai(t))return t.abort();if(ore(t.destroy))return t.destroy();n(o||new Error("stream was destroyed"))}}},wrr=function(t){t()},_ai=function(t,e){return t.pipe(e)},Tai=function(){var t=Array.prototype.slice.call(arguments),e=ore(t[t.length-1]||_q)&&t.pop()||_q;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r,n=t.map(function(i,a){var o=a<t.length-1,s=a>0;return Eai(i,o,s,function(c){r||(r=c),c&&n.forEach(wrr),!o&&(n.forEach(wrr),e(r))})});return t.reduce(_ai)};Nrr.exports=Tai});var Lrr=y((LXi,Rrr)=>{"use strict";var{PassThrough:Oai}=require("stream");Rrr.exports=t=>{t={...t};let{array:e}=t,{encoding:r}=t,n=r==="buffer",i=!1;e?i=!(r||n):r=r||"utf8",n&&(r=null);let a=new Oai({objectMode:i});r&&a.setEncoding(r);let o=0,s=[];return a.on("data",c=>{s.push(c),i?o=s.length:o+=c.length}),a.getBufferedValue=()=>e?s:n?Buffer.concat(s,o):s.join(""),a.getBufferedLength=()=>o,a}});var krr=y((kXi,WI)=>{"use strict";var{constants:Sai}=require("buffer"),Aai=Irr(),Cai=Lrr(),sre=class extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function cre(t,e){if(!t)return Promise.reject(new Error("Expected a stream"));e={maxBuffer:1/0,...e};let{maxBuffer:r}=e,n;return await new Promise((i,a)=>{let o=s=>{s&&n.getBufferedLength()<=Sai.MAX_LENGTH&&(s.bufferedData=n.getBufferedValue()),a(s)};n=Aai(t,Cai(e),s=>{if(s){o(s);return}i()}),n.on("data",()=>{n.getBufferedLength()>r&&o(new sre)})}),n.getBufferedValue()}WI.exports=cre;WI.exports.default=cre;WI.exports.buffer=(t,e)=>cre(t,{...e,encoding:"buffer"});WI.exports.array=(t,e)=>cre(t,{...e,array:!0});WI.exports.MaxBufferError=sre});var Mrr=y(($Xi,$rr)=>{"use strict";var{PassThrough:xai}=require("stream");$rr.exports=function(){var t=[],e=new xai({objectMode:!0});return e.setMaxListeners(0),e.add=r,e.isEmpty=n,e.on("unpipe",i),Array.prototype.slice.call(arguments).forEach(r),e;function r(a){return Array.isArray(a)?(a.forEach(r),this):(t.push(a),a.once("end",i.bind(null,a)),a.once("error",e.emit.bind(e,"error")),a.pipe(e,{end:!1}),this)}function n(){return t.length==0}function i(a){t=t.filter(function(o){return o!==a}),!t.length&&e.readable&&e.end()}}});var Urr=y((MXi,Vrr)=>{"use strict";var jrr=h5(),Frr=krr(),Pai=Mrr(),Dai=(t,e)=>{e===void 0||t.stdin===void 0||(jrr(e)?e.pipe(t.stdin):t.stdin.end(e))},wai=(t,{all:e})=>{if(!e||!t.stdout&&!t.stderr)return;let r=Pai();return t.stdout&&r.add(t.stdout),t.stderr&&r.add(t.stderr),r},tje=async(t,e)=>{if(t){t.destroy();try{return await e}catch(r){return r.bufferedData}}},rje=(t,{encoding:e,buffer:r,maxBuffer:n})=>{if(!(!t||!r))return e?Frr(t,{encoding:e,maxBuffer:n}):Frr.buffer(t,{maxBuffer:n})},Nai=async({stdout:t,stderr:e,all:r},{encoding:n,buffer:i,maxBuffer:a},o)=>{let s=rje(t,{encoding:n,buffer:i,maxBuffer:a}),c=rje(e,{encoding:n,buffer:i,maxBuffer:a}),u=rje(r,{encoding:n,buffer:i,maxBuffer:a*2});try{return await Promise.all([o,s,c,u])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},tje(t,s),tje(e,c),tje(r,u)])}},Iai=({input:t})=>{if(jrr(t))throw new TypeError("The `input` option cannot be a stream in sync mode")};Vrr.exports={handleInput:Dai,makeAllStream:wai,getSpawnedResult:Nai,validateInputSync:Iai}});var Brr=y((FXi,qrr)=>{"use strict";var Rai=(async()=>{})().constructor.prototype,Lai=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Rai,t)]),kai=(t,e)=>{for(let[r,n]of Lai){let i=typeof e=="function"?(...a)=>Reflect.apply(n.value,e(),a):n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}return t},$ai=t=>new Promise((e,r)=>{t.on("exit",(n,i)=>{e({exitCode:n,signal:i})}),t.on("error",n=>{r(n)}),t.stdin&&t.stdin.on("error",n=>{r(n)})});qrr.exports={mergePromise:kai,getSpawnedPromise:$ai}});var Grr=y((jXi,Hrr)=>{"use strict";var Mai=/ +/g,Fai=(t,e=[])=>Array.isArray(e)?[t,...e].join(" "):t,jai=t=>{let e=[];for(let r of t.trim().split(Mai)){let n=e[e.length-1];n&&n.endsWith("\\")?e[e.length-1]=`${n.slice(0,-1)} ${r}`:e.push(r)}return e};Hrr.exports={joinCommand:Fai,parseCommand:jai}});var Qrr=y((VXi,XI)=>{"use strict";var Vai=require("path"),nje=require("child_process"),Krr=Ytr(),Uai=Xtr(),qai=Ztr(),Bai=nrr(),ure=prr(),Yrr=drr(),{spawnedKill:Hai,spawnedCancel:Gai,setupTimeout:zai,setExitHandler:Kai}=_rr(),{handleInput:Yai,getSpawnedResult:Wai,makeAllStream:Xai,validateInputSync:Jai}=Urr(),{mergePromise:zrr,getSpawnedPromise:Qai}=Brr(),{joinCommand:Wrr,parseCommand:Xrr}=Grr(),Zai=1e3*1e3*100,eoi=({env:t,extendEnv:e,preferLocal:r,localDir:n,execPath:i})=>{let a=e?{...process.env,...t}:t;return r?qai.env({env:a,cwd:n,execPath:i}):a},Jrr=(t,e,r={})=>{let n=Krr._parse(t,e,r);return t=n.command,e=n.args,r=n.options,r={maxBuffer:Zai,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||process.cwd(),execPath:process.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r},r.env=eoi(r),r.stdio=Yrr(r),process.platform==="win32"&&Vai.basename(t,".exe")==="cmd"&&e.unshift("/q"),{file:t,args:e,options:r,parsed:n}},Tq=(t,e,r)=>typeof e!="string"&&!Buffer.isBuffer(e)?r===void 0?void 0:"":t.stripFinalNewline?Uai(e):e,lre=(t,e,r)=>{let n=Jrr(t,e,r),i=Wrr(t,e),a;try{a=nje.spawn(n.file,n.args,n.options)}catch(d){let f=new nje.ChildProcess,h=Promise.reject(ure({error:d,stdout:"",stderr:"",all:"",command:i,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return zrr(f,h)}let o=Qai(a),s=zai(a,n.options,o),c=Kai(a,n.options,s),u={isCanceled:!1};a.kill=Hai.bind(null,a.kill.bind(a)),a.cancel=Gai.bind(null,a,u);let p=Bai(async()=>{let[{error:d,exitCode:f,signal:h,timedOut:m},v,_,T]=await Wai(a,n.options,c),O=Tq(n.options,v),A=Tq(n.options,_),C=Tq(n.options,T);if(d||f!==0||h!==null){let P=ure({error:d,exitCode:f,signal:h,stdout:O,stderr:A,all:C,command:i,parsed:n,timedOut:m,isCanceled:u.isCanceled,killed:a.killed});if(!n.options.reject)return P;throw P}return{command:i,exitCode:0,stdout:O,stderr:A,all:C,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Krr._enoent.hookChildProcess(a,n.parsed),Yai(a,n.options.input),a.all=Xai(a,n.options),zrr(a,p)};XI.exports=lre;XI.exports.sync=(t,e,r)=>{let n=Jrr(t,e,r),i=Wrr(t,e);Jai(n.options);let a;try{a=nje.spawnSync(n.file,n.args,n.options)}catch(c){throw ure({error:c,stdout:"",stderr:"",all:"",command:i,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}let o=Tq(n.options,a.stdout,a.error),s=Tq(n.options,a.stderr,a.error);if(a.error||a.status!==0||a.signal!==null){let c=ure({stdout:o,stderr:s,error:a.error,signal:a.signal,exitCode:a.status,command:i,parsed:n,timedOut:a.error&&a.error.code==="ETIMEDOUT",isCanceled:!1,killed:a.signal!==null});if(!n.options.reject)return c;throw c}return{command:i,exitCode:0,stdout:o,stderr:s,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}};XI.exports.command=(t,e)=>{let[r,...n]=Xrr(t);return lre(r,n,e)};XI.exports.commandSync=(t,e)=>{let[r,...n]=Xrr(t);return lre.sync(r,n,e)};XI.exports.node=(t,e,r={})=>{e&&!Array.isArray(e)&&typeof e=="object"&&(r=e,e=[]);let n=Yrr.node(r),i=process.execArgv.filter(s=>!s.startsWith("--inspect")),{nodePath:a=process.execPath,nodeOptions:o=i}=r;return lre(a,[...o,t,...Array.isArray(e)?e:[]],{...r,stdin:void 0,stdout:void 0,stderr:void 0,stdio:n,shell:!1})}});var rnr=y((UXi,tnr)=>{"use strict";var Zrr=require("os"),enr=Qrr(),toi=new Map([["10.0","10"],["6.3","8.1"],["6.2","8"],["6.1","7"],["6.0","Vista"],["5.2","Server 2003"],["5.1","XP"],["5.0","2000"],["4.9","ME"],["4.1","98"],["4.0","95"]]),roi=t=>{let e=/\d+\.\d/.exec(t||Zrr.release());if(t&&!e)throw new Error("`release` argument doesn't match `n.n`");let r=(e||[])[0];if((!t||t===Zrr.release())&&["6.1","6.2","6.3","10.0"].includes(r)){let n;try{n=enr.sync("wmic",["os","get","Caption"]).stdout||""}catch{n=enr.sync("powershell",["(Get-CimInstance -ClassName Win32_OperatingSystem).caption"]).stdout||""}let i=(n.match(/2008|2012|2016|2019/)||[])[0];if(i)return`Server ${i}`}return toi.get(r)};tnr.exports=roi});var inr=y((qXi,nnr)=>{"use strict";var NC=require("os"),noi=Ntr(),ioi=rnr(),aoi=(t,e)=>{if(!t&&e)throw new Error("You can't specify a `release` without specifying `platform`");t=t||NC.platform();let r;if(t==="darwin"){!e&&NC.platform()==="darwin"&&(e=NC.release());let n=e?Number(e.split(".")[0])>15?"macOS":"OS X":"macOS";try{r=e?noi(e).name:""}catch{}return n+(r?" "+r:"")}return t==="linux"?(!e&&NC.platform()==="linux"&&(e=NC.release()),r=e?e.replace(/^(\d+\.\d+).*/,"$1"):"","Linux"+(r?" "+r:"")):t==="win32"?(!e&&NC.platform()==="win32"&&(e=NC.release()),r=e?ioi(e):"","Windows"+(r?" "+r:"")):t};nnr.exports=aoi});var gn;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(gn||(gn={}));var Tne;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Tne||(Tne={}));var ut=gn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wb=t=>{switch(typeof t){case"undefined":return ut.undefined;case"string":return ut.string;case"number":return isNaN(t)?ut.nan:ut.number;case"boolean":return ut.boolean;case"function":return ut.function;case"bigint":return ut.bigint;case"symbol":return ut.symbol;case"object":return Array.isArray(t)?ut.array:t===null?ut.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ut.promise:typeof Map<"u"&&t instanceof Map?ut.map:typeof Set<"u"&&t instanceof Set?ut.set:typeof Date<"u"&&t instanceof Date?ut.date:ut.object;default:return ut.unknown}},Me=gn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),rlr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ql=class t extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(o))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,gn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ql.create=t=>new ql(t);var YC=(t,e)=>{let r;switch(t.code){case Me.invalid_type:t.received===ut.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Me.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,gn.jsonStringifyReplacer)}`;break;case Me.unrecognized_keys:r=`Unrecognized key(s) in object: ${gn.joinValues(t.keys,", ")}`;break;case Me.invalid_union:r="Invalid input";break;case Me.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${gn.joinValues(t.options)}`;break;case Me.invalid_enum_value:r=`Invalid enum value. Expected ${gn.joinValues(t.options)}, received '${t.received}'`;break;case Me.invalid_arguments:r="Invalid function arguments";break;case Me.invalid_return_type:r="Invalid function return type";break;case Me.invalid_date:r="Invalid date";break;case Me.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:gn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Me.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Me.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Me.custom:r="Invalid input";break;case Me.invalid_intersection_types:r="Intersection results could not be merged";break;case Me.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Me.not_finite:r="Number must be finite";break;default:r=e.defaultError,gn.assertNever(t)}return{message:r}},EUe=YC;function nlr(t){EUe=t}function hB(){return EUe}var mB=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},ilr=[];function tt(t,e){let r=hB(),n=mB({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===YC?void 0:YC].filter(i=>!!i)});t.common.issues.push(n)}var zs=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Wt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Wt;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},Wt=Object.freeze({status:"aborted"}),KC=t=>({status:"dirty",value:t}),jc=t=>({status:"valid",value:t}),One=t=>t.status==="aborted",Sne=t=>t.status==="dirty",yR=t=>t.status==="valid",vR=t=>typeof Promise<"u"&&t instanceof Promise;function gB(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function _Ue(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}var Nt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Nt||(Nt={}));var mR,gR,Fp=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},vUe=(t,e)=>{if(yR(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ql(t.common.issues);return this._error=r,this._error}}};function Tr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{var c,u;let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:(c=l??n)!==null&&c!==void 0?c:s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:(u=l??r)!==null&&u!==void 0?u:s.defaultError}},description:i}}var Or=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return wb(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:wb(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new zs,ctx:{common:e.parent.common,data:e.data,parsedType:wb(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(vR(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wb(e)},a=this._parseSync({data:e,path:i.path,parent:i});return vUe(i,a)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wb(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(vR(i)?i:Promise.resolve(i));return vUe(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:Me.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Bl({schema:this,typeName:Yt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Mp.create(this,this._def)}nullable(){return Ph.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zg.create(this,this._def)}promise(){return Rb.create(this,this._def)}or(e){return uT.create([this,e],this._def)}and(e){return lT.create(this,e,this._def)}transform(e){return new Bl({...Tr(this._def),schema:this,typeName:Yt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new mT({...Tr(this._def),innerType:this,defaultValue:r,typeName:Yt.ZodDefault})}brand(){return new bR({typeName:Yt.ZodBranded,type:this,...Tr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new gT({...Tr(this._def),innerType:this,catchValue:r,typeName:Yt.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ER.create(this,e)}readonly(){return yT.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},alr=/^c[^\s-]{8,}$/i,olr=/^[0-9a-z]+$/,slr=/^[0-9A-HJKMNP-TV-Z]{26}$/,clr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ulr=/^[a-z0-9_-]{21}$/i,llr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,plr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,flr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_ne,dlr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hlr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,mlr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TUe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",glr=new RegExp(`^${TUe}$`);function OUe(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ylr(t){return new RegExp(`^${OUe(t)}$`)}function SUe(t){let e=`${TUe}T${OUe(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function vlr(t,e){return!!((e==="v4"||!e)&&dlr.test(t)||(e==="v6"||!e)&&hlr.test(t))}var Nb=class t extends Or{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ut.string){let a=this._getOrReturnCtx(e);return tt(a,{code:Me.invalid_type,expected:ut.string,received:a.parsedType}),Wt}let n=new zs,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?tt(i,{code:Me.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&tt(i,{code:Me.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")plr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"email",code:Me.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")_ne||(_ne=new RegExp(flr,"u")),_ne.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"emoji",code:Me.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")clr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"uuid",code:Me.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")ulr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"nanoid",code:Me.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")alr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"cuid",code:Me.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")olr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"cuid2",code:Me.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")slr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"ulid",code:Me.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),tt(i,{validation:"url",code:Me.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"regex",code:Me.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?SUe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?glr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ylr(a).test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?llr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"duration",code:Me.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?vlr(e.data,a.version)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"ip",code:Me.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?mlr.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"base64",code:Me.invalid_string,message:a.message}),n.dirty()):gn.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Me.invalid_string,...Nt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Nt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Nt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Nt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Nt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Nt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Nt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Nt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Nt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Nt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Nt.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...Nt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Nt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Nt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Nt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Nt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Nt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Nt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Nt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Nt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Nt.errToObj(r)})}nonempty(e){return this.min(1,Nt.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Nb.create=t=>{var e;return new Nb({checks:[],typeName:Yt.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Tr(t)})};function blr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var nT=class t extends Or{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ut.number){let a=this._getOrReturnCtx(e);return tt(a,{code:Me.invalid_type,expected:ut.number,received:a.parsedType}),Wt}let n,i=new zs;for(let a of this._def.checks)a.kind==="int"?gn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),tt(n,{code:Me.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:Me.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:Me.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?blr(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),tt(n,{code:Me.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),tt(n,{code:Me.not_finite,message:a.message}),i.dirty()):gn.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Nt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Nt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Nt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Nt.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Nt.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Nt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Nt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Nt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Nt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Nt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Nt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Nt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Nt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Nt.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&gn.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};nT.create=t=>new nT({checks:[],typeName:Yt.ZodNumber,coerce:t?.coerce||!1,...Tr(t)});var iT=class t extends Or{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ut.bigint){let a=this._getOrReturnCtx(e);return tt(a,{code:Me.invalid_type,expected:ut.bigint,received:a.parsedType}),Wt}let n,i=new zs;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:Me.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:Me.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:Me.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):gn.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Nt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Nt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Nt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Nt.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Nt.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Nt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Nt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Nt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Nt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Nt.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};iT.create=t=>{var e;return new iT({checks:[],typeName:Yt.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Tr(t)})};var aT=class extends Or{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ut.boolean){let n=this._getOrReturnCtx(e);return tt(n,{code:Me.invalid_type,expected:ut.boolean,received:n.parsedType}),Wt}return jc(e.data)}};aT.create=t=>new aT({typeName:Yt.ZodBoolean,coerce:t?.coerce||!1,...Tr(t)});var oT=class t extends Or{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ut.date){let a=this._getOrReturnCtx(e);return tt(a,{code:Me.invalid_type,expected:ut.date,received:a.parsedType}),Wt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return tt(a,{code:Me.invalid_date}),Wt}let n=new zs,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),tt(i,{code:Me.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):gn.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Nt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Nt.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};oT.create=t=>new oT({checks:[],coerce:t?.coerce||!1,typeName:Yt.ZodDate,...Tr(t)});var WC=class extends Or{_parse(e){if(this._getType(e)!==ut.symbol){let n=this._getOrReturnCtx(e);return tt(n,{code:Me.invalid_type,expected:ut.symbol,received:n.parsedType}),Wt}return jc(e.data)}};WC.create=t=>new WC({typeName:Yt.ZodSymbol,...Tr(t)});var sT=class extends Or{_parse(e){if(this._getType(e)!==ut.undefined){let n=this._getOrReturnCtx(e);return tt(n,{code:Me.invalid_type,expected:ut.undefined,received:n.parsedType}),Wt}return jc(e.data)}};sT.create=t=>new sT({typeName:Yt.ZodUndefined,...Tr(t)});var cT=class extends Or{_parse(e){if(this._getType(e)!==ut.null){let n=this._getOrReturnCtx(e);return tt(n,{code:Me.invalid_type,expected:ut.null,received:n.parsedType}),Wt}return jc(e.data)}};cT.create=t=>new cT({typeName:Yt.ZodNull,...Tr(t)});var Ib=class extends Or{constructor(){super(...arguments),this._any=!0}_parse(e){return jc(e.data)}};Ib.create=t=>new Ib({typeName:Yt.ZodAny,...Tr(t)});var Qg=class extends Or{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jc(e.data)}};Qg.create=t=>new Qg({typeName:Yt.ZodUnknown,...Tr(t)});var gd=class extends Or{_parse(e){let r=this._getOrReturnCtx(e);return tt(r,{code:Me.invalid_type,expected:ut.never,received:r.parsedType}),Wt}};gd.create=t=>new gd({typeName:Yt.ZodNever,...Tr(t)});var XC=class extends Or{_parse(e){if(this._getType(e)!==ut.undefined){let n=this._getOrReturnCtx(e);return tt(n,{code:Me.invalid_type,expected:ut.void,received:n.parsedType}),Wt}return jc(e.data)}};XC.create=t=>new XC({typeName:Yt.ZodVoid,...Tr(t)});var Zg=class t extends Or{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==ut.array)return tt(r,{code:Me.invalid_type,expected:ut.array,received:r.parsedType}),Wt;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(tt(r,{code:o?Me.too_big:Me.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(tt(r,{code:Me.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(tt(r,{code:Me.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new Fp(r,o,r.path,s)))).then(o=>zs.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new Fp(r,o,r.path,s)));return zs.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Nt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Nt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Nt.toString(r)}})}nonempty(e){return this.min(1,e)}};Zg.create=(t,e)=>new Zg({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Yt.ZodArray,...Tr(e)});function zC(t){if(t instanceof Pu){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Mp.create(zC(n))}return new Pu({...t._def,shape:()=>e})}else return t instanceof Zg?new Zg({...t._def,type:zC(t.element)}):t instanceof Mp?Mp.create(zC(t.unwrap())):t instanceof Ph?Ph.create(zC(t.unwrap())):t instanceof xh?xh.create(t.items.map(e=>zC(e))):t}var Pu=class t extends Or{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=gn.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==ut.object){let u=this._getOrReturnCtx(e);return tt(u,{code:Me.invalid_type,expected:ut.object,received:u.parsedType}),Wt}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof gd&&this._def.unknownKeys==="strip"))for(let u in i.data)o.includes(u)||s.push(u);let c=[];for(let u of o){let l=a[u],p=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Fp(i,p,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof gd){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")s.length>0&&(tt(i,{code:Me.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let p=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Fp(i,p,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let p=await l.key,d=await l.value;u.push({key:p,value:d,alwaysSet:l.alwaysSet})}return u}).then(u=>zs.mergeObjectSync(n,u)):zs.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Nt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,a,o,s;let c=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,r,n).message)!==null&&o!==void 0?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=Nt.errToObj(e).message)!==null&&s!==void 0?s:c}:{message:c}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Yt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return gn.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return gn.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return zC(this)}partial(e){let r={};return gn.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return gn.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Mp;)a=a._def.innerType;r[n]=a}}),new t({...this._def,shape:()=>r})}keyof(){return AUe(gn.objectKeys(this.shape))}};Pu.create=(t,e)=>new Pu({shape:()=>t,unknownKeys:"strip",catchall:gd.create(),typeName:Yt.ZodObject,...Tr(e)});Pu.strictCreate=(t,e)=>new Pu({shape:()=>t,unknownKeys:"strict",catchall:gd.create(),typeName:Yt.ZodObject,...Tr(e)});Pu.lazycreate=(t,e)=>new Pu({shape:t,unknownKeys:"strip",catchall:gd.create(),typeName:Yt.ZodObject,...Tr(e)});var uT=class extends Or{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new ql(s.ctx.common.issues));return tt(r,{code:Me.invalid_union,unionErrors:o}),Wt}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!a&&(a={result:l,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new ql(c));return tt(r,{code:Me.invalid_union,unionErrors:s}),Wt}}get options(){return this._def.options}};uT.create=(t,e)=>new uT({options:t,typeName:Yt.ZodUnion,...Tr(e)});var Jg=t=>t instanceof pT?Jg(t.schema):t instanceof Bl?Jg(t.innerType()):t instanceof fT?[t.value]:t instanceof dT?t.options:t instanceof hT?gn.objectValues(t.enum):t instanceof mT?Jg(t._def.innerType):t instanceof sT?[void 0]:t instanceof cT?[null]:t instanceof Mp?[void 0,...Jg(t.unwrap())]:t instanceof Ph?[null,...Jg(t.unwrap())]:t instanceof bR||t instanceof yT?Jg(t.unwrap()):t instanceof gT?Jg(t._def.innerType):[],yB=class t extends Or{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ut.object)return tt(r,{code:Me.invalid_type,expected:ut.object,received:r.parsedType}),Wt;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(tt(r,{code:Me.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Wt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=Jg(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:Yt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Tr(n)})}};function Ane(t,e){let r=wb(t),n=wb(e);if(t===e)return{valid:!0,data:t};if(r===ut.object&&n===ut.object){let i=gn.objectKeys(e),a=gn.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=Ane(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(r===ut.array&&n===ut.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],c=Ane(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===ut.date&&n===ut.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var lT=class extends Or{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(One(a)||One(o))return Wt;let s=Ane(a.value,o.value);return s.valid?((Sne(a)||Sne(o))&&r.dirty(),{status:r.value,value:s.data}):(tt(n,{code:Me.invalid_intersection_types}),Wt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};lT.create=(t,e,r)=>new lT({left:t,right:e,typeName:Yt.ZodIntersection,...Tr(r)});var xh=class t extends Or{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ut.array)return tt(n,{code:Me.invalid_type,expected:ut.array,received:n.parsedType}),Wt;if(n.data.length<this._def.items.length)return tt(n,{code:Me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Wt;!this._def.rest&&n.data.length>this._def.items.length&&(tt(n,{code:Me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Fp(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>zs.mergeArray(r,o)):zs.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};xh.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xh({items:t,typeName:Yt.ZodTuple,rest:null,...Tr(e)})};var vB=class t extends Or{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ut.object)return tt(n,{code:Me.invalid_type,expected:ut.object,received:n.parsedType}),Wt;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new Fp(n,s,n.path,s)),value:o._parse(new Fp(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?zs.mergeObjectAsync(r,i):zs.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Or?new t({keyType:e,valueType:r,typeName:Yt.ZodRecord,...Tr(n)}):new t({keyType:Nb.create(),valueType:e,typeName:Yt.ZodRecord,...Tr(r)})}},JC=class extends Or{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ut.map)return tt(n,{code:Me.invalid_type,expected:ut.map,received:n.parsedType}),Wt;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,c],u)=>({key:i._parse(new Fp(n,s,n.path,[u,"key"])),value:a._parse(new Fp(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return Wt;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of o){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return Wt;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};JC.create=(t,e,r)=>new JC({valueType:e,keyType:t,typeName:Yt.ZodMap,...Tr(r)});var QC=class t extends Or{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ut.set)return tt(n,{code:Me.invalid_type,expected:ut.set,received:n.parsedType}),Wt;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(tt(n,{code:Me.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(tt(n,{code:Me.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(c){let u=new Set;for(let l of c){if(l.status==="aborted")return Wt;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>a._parse(new Fp(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Nt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Nt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};QC.create=(t,e)=>new QC({valueType:t,minSize:null,maxSize:null,typeName:Yt.ZodSet,...Tr(e)});var bB=class t extends Or{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ut.function)return tt(r,{code:Me.invalid_type,expected:ut.function,received:r.parsedType}),Wt;function n(s,c){return mB({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hB(),YC].filter(u=>!!u),issueData:{code:Me.invalid_arguments,argumentsError:c}})}function i(s,c){return mB({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hB(),YC].filter(u=>!!u),issueData:{code:Me.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Rb){let s=this;return jc(async function(...c){let u=new ql([]),l=await s._def.args.parseAsync(c,a).catch(f=>{throw u.addIssue(n(c,f)),u}),p=await Reflect.apply(o,this,l);return await s._def.returns._def.type.parseAsync(p,a).catch(f=>{throw u.addIssue(i(p,f)),u})})}else{let s=this;return jc(function(...c){let u=s._def.args.safeParse(c,a);if(!u.success)throw new ql([n(c,u.error)]);let l=Reflect.apply(o,this,u.data),p=s._def.returns.safeParse(l,a);if(!p.success)throw new ql([i(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:xh.create(e).rest(Qg.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||xh.create([]).rest(Qg.create()),returns:r||Qg.create(),typeName:Yt.ZodFunction,...Tr(n)})}},pT=class extends Or{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};pT.create=(t,e)=>new pT({getter:t,typeName:Yt.ZodLazy,...Tr(e)});var fT=class extends Or{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return tt(r,{received:r.data,code:Me.invalid_literal,expected:this._def.value}),Wt}return{status:"valid",value:e.data}}get value(){return this._def.value}};fT.create=(t,e)=>new fT({value:t,typeName:Yt.ZodLiteral,...Tr(e)});function AUe(t,e){return new dT({values:t,typeName:Yt.ZodEnum,...Tr(e)})}var dT=class t extends Or{constructor(){super(...arguments),mR.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return tt(r,{expected:gn.joinValues(n),received:r.parsedType,code:Me.invalid_type}),Wt}if(gB(this,mR,"f")||_Ue(this,mR,new Set(this._def.values),"f"),!gB(this,mR,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return tt(r,{received:r.data,code:Me.invalid_enum_value,options:n}),Wt}return jc(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};mR=new WeakMap;dT.create=AUe;var hT=class extends Or{constructor(){super(...arguments),gR.set(this,void 0)}_parse(e){let r=gn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ut.string&&n.parsedType!==ut.number){let i=gn.objectValues(r);return tt(n,{expected:gn.joinValues(i),received:n.parsedType,code:Me.invalid_type}),Wt}if(gB(this,gR,"f")||_Ue(this,gR,new Set(gn.getValidEnumValues(this._def.values)),"f"),!gB(this,gR,"f").has(e.data)){let i=gn.objectValues(r);return tt(n,{received:n.data,code:Me.invalid_enum_value,options:i}),Wt}return jc(e.data)}get enum(){return this._def.values}};gR=new WeakMap;hT.create=(t,e)=>new hT({values:t,typeName:Yt.ZodNativeEnum,...Tr(e)});var Rb=class extends Or{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ut.promise&&r.common.async===!1)return tt(r,{code:Me.invalid_type,expected:ut.promise,received:r.parsedType}),Wt;let n=r.parsedType===ut.promise?r.data:Promise.resolve(r.data);return jc(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Rb.create=(t,e)=>new Rb({type:t,typeName:Yt.ZodPromise,...Tr(e)});var Bl=class extends Or{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Yt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{tt(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return Wt;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?Wt:c.status==="dirty"||r.value==="dirty"?KC(c.value):c});{if(r.value==="aborted")return Wt;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Wt:s.status==="dirty"||r.value==="dirty"?KC(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Wt:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Wt:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yR(o))return o;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>yR(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):o);gn.assertNever(i)}};Bl.create=(t,e,r)=>new Bl({schema:t,typeName:Yt.ZodEffects,effect:e,...Tr(r)});Bl.createWithPreprocess=(t,e,r)=>new Bl({schema:e,effect:{type:"preprocess",transform:t},typeName:Yt.ZodEffects,...Tr(r)});var Mp=class extends Or{_parse(e){return this._getType(e)===ut.undefined?jc(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Mp.create=(t,e)=>new Mp({innerType:t,typeName:Yt.ZodOptional,...Tr(e)});var Ph=class extends Or{_parse(e){return this._getType(e)===ut.null?jc(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ph.create=(t,e)=>new Ph({innerType:t,typeName:Yt.ZodNullable,...Tr(e)});var mT=class extends Or{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===ut.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};mT.create=(t,e)=>new mT({innerType:t,typeName:Yt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Tr(e)});var gT=class extends Or{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return vR(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ql(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ql(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};gT.create=(t,e)=>new gT({innerType:t,typeName:Yt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Tr(e)});var ZC=class extends Or{_parse(e){if(this._getType(e)!==ut.nan){let n=this._getOrReturnCtx(e);return tt(n,{code:Me.invalid_type,expected:ut.nan,received:n.parsedType}),Wt}return{status:"valid",value:e.data}}};ZC.create=t=>new ZC({typeName:Yt.ZodNaN,...Tr(t)});var Elr=Symbol("zod_brand"),bR=class extends Or{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ER=class t extends Or{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Wt:a.status==="dirty"?(r.dirty(),KC(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Wt:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Yt.ZodPipeline})}},yT=class extends Or{_parse(e){let r=this._def.innerType._parse(e),n=i=>(yR(i)&&(i.value=Object.freeze(i.value)),i);return vR(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};yT.create=(t,e)=>new yT({innerType:t,typeName:Yt.ZodReadonly,...Tr(e)});function CUe(t,e={},r){return t?Ib.create().superRefine((n,i)=>{var a,o;if(!t(n)){let s=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(o=(a=s.fatal)!==null&&a!==void 0?a:r)!==null&&o!==void 0?o:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:c})}}):Ib.create()}var _lr={object:Pu.lazycreate},Yt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Yt||(Yt={}));var Tlr=(t,e={message:`Input not instance of ${t.name}`})=>CUe(r=>r instanceof t,e),xUe=Nb.create,PUe=nT.create,Olr=ZC.create,Slr=iT.create,DUe=aT.create,Alr=oT.create,Clr=WC.create,xlr=sT.create,Plr=cT.create,Dlr=Ib.create,wlr=Qg.create,Nlr=gd.create,Ilr=XC.create,Rlr=Zg.create,Llr=Pu.create,klr=Pu.strictCreate,$lr=uT.create,Mlr=yB.create,Flr=lT.create,jlr=xh.create,Vlr=vB.create,Ulr=JC.create,qlr=QC.create,Blr=bB.create,Hlr=pT.create,Glr=fT.create,zlr=dT.create,Klr=hT.create,Ylr=Rb.create,bUe=Bl.create,Wlr=Mp.create,Xlr=Ph.create,Jlr=Bl.createWithPreprocess,Qlr=ER.create,Zlr=()=>xUe().optional(),epr=()=>PUe().optional(),tpr=()=>DUe().optional(),rpr={string:t=>Nb.create({...t,coerce:!0}),number:t=>nT.create({...t,coerce:!0}),boolean:t=>aT.create({...t,coerce:!0}),bigint:t=>iT.create({...t,coerce:!0}),date:t=>oT.create({...t,coerce:!0})},npr=Wt,k=Object.freeze({__proto__:null,defaultErrorMap:YC,setErrorMap:nlr,getErrorMap:hB,makeIssue:mB,EMPTY_PATH:ilr,addIssueToContext:tt,ParseStatus:zs,INVALID:Wt,DIRTY:KC,OK:jc,isAborted:One,isDirty:Sne,isValid:yR,isAsync:vR,get util(){return gn},get objectUtil(){return Tne},ZodParsedType:ut,getParsedType:wb,ZodType:Or,datetimeRegex:SUe,ZodString:Nb,ZodNumber:nT,ZodBigInt:iT,ZodBoolean:aT,ZodDate:oT,ZodSymbol:WC,ZodUndefined:sT,ZodNull:cT,ZodAny:Ib,ZodUnknown:Qg,ZodNever:gd,ZodVoid:XC,ZodArray:Zg,ZodObject:Pu,ZodUnion:uT,ZodDiscriminatedUnion:yB,ZodIntersection:lT,ZodTuple:xh,ZodRecord:vB,ZodMap:JC,ZodSet:QC,ZodFunction:bB,ZodLazy:pT,ZodLiteral:fT,ZodEnum:dT,ZodNativeEnum:hT,ZodPromise:Rb,ZodEffects:Bl,ZodTransformer:Bl,ZodOptional:Mp,ZodNullable:Ph,ZodDefault:mT,ZodCatch:gT,ZodNaN:ZC,BRAND:Elr,ZodBranded:bR,ZodPipeline:ER,ZodReadonly:yT,custom:CUe,Schema:Or,ZodSchema:Or,late:_lr,get ZodFirstPartyTypeKind(){return Yt},coerce:rpr,any:Dlr,array:Rlr,bigint:Slr,boolean:DUe,date:Alr,discriminatedUnion:Mlr,effect:bUe,enum:zlr,function:Blr,instanceof:Tlr,intersection:Flr,lazy:Hlr,literal:Glr,map:Ulr,nan:Olr,nativeEnum:Klr,never:Nlr,null:Plr,nullable:Xlr,number:PUe,object:Llr,oboolean:tpr,onumber:epr,optional:Wlr,ostring:Zlr,pipeline:Qlr,preprocess:Jlr,promise:Ylr,record:Vlr,set:qlr,strictObject:klr,string:xUe,symbol:Clr,transformer:bUe,tuple:jlr,undefined:xlr,union:$lr,unknown:wlr,void:Ilr,NEVER:npr,ZodIssueCode:Me,quotelessJson:rlr,ZodError:ql});var Cne="2025-06-18";var wUe=[Cne,"2025-03-26","2024-11-05","2024-10-07"],EB="2.0",NUe=k.union([k.string(),k.number().int()]),IUe=k.string(),ipr=k.object({progressToken:k.optional(NUe)}).passthrough(),jp=k.object({_meta:k.optional(ipr)}).passthrough(),Du=k.object({method:k.string(),params:k.optional(jp)}),_R=k.object({_meta:k.optional(k.object({}).passthrough())}).passthrough(),Dh=k.object({method:k.string(),params:k.optional(_R)}),Vp=k.object({_meta:k.optional(k.object({}).passthrough())}).passthrough(),_B=k.union([k.string(),k.number().int()]),RUe=k.object({jsonrpc:k.literal(EB),id:_B}).merge(Du).strict(),LUe=t=>RUe.safeParse(t).success,kUe=k.object({jsonrpc:k.literal(EB)}).merge(Dh).strict(),$Ue=t=>kUe.safeParse(t).success,MUe=k.object({jsonrpc:k.literal(EB),id:_B,result:Vp}).strict(),xne=t=>MUe.safeParse(t).success,yd;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(yd||(yd={}));var FUe=k.object({jsonrpc:k.literal(EB),id:_B,error:k.object({code:k.number().int(),message:k.string(),data:k.optional(k.unknown())})}).strict(),jUe=t=>FUe.safeParse(t).success,VUe=k.union([RUe,kUe,MUe,FUe]),TB=Vp.strict(),OB=Dh.extend({method:k.literal("notifications/cancelled"),params:_R.extend({requestId:_B,reason:k.string().optional()})}),TR=k.object({name:k.string(),title:k.optional(k.string())}).passthrough(),UUe=TR.extend({version:k.string()}),apr=k.object({experimental:k.optional(k.object({}).passthrough()),sampling:k.optional(k.object({}).passthrough()),elicitation:k.optional(k.object({}).passthrough()),roots:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough())}).passthrough(),Pne=Du.extend({method:k.literal("initialize"),params:jp.extend({protocolVersion:k.string(),capabilities:apr,clientInfo:UUe})});var opr=k.object({experimental:k.optional(k.object({}).passthrough()),logging:k.optional(k.object({}).passthrough()),completions:k.optional(k.object({}).passthrough()),prompts:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough()),resources:k.optional(k.object({subscribe:k.optional(k.boolean()),listChanged:k.optional(k.boolean())}).passthrough()),tools:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough())}).passthrough(),spr=Vp.extend({protocolVersion:k.string(),capabilities:opr,serverInfo:UUe,instructions:k.optional(k.string())}),Dne=Dh.extend({method:k.literal("notifications/initialized")});var SB=Du.extend({method:k.literal("ping")}),cpr=k.object({progress:k.number(),total:k.optional(k.number()),message:k.optional(k.string())}).passthrough(),AB=Dh.extend({method:k.literal("notifications/progress"),params:_R.merge(cpr).extend({progressToken:NUe})}),CB=Du.extend({params:jp.extend({cursor:k.optional(IUe)}).optional()}),xB=Vp.extend({nextCursor:k.optional(IUe)}),qUe=k.object({uri:k.string(),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}).passthrough(),BUe=qUe.extend({text:k.string()}),wne=k.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),HUe=qUe.extend({blob:wne}),GUe=TR.extend({uri:k.string(),description:k.optional(k.string()),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}),upr=TR.extend({uriTemplate:k.string(),description:k.optional(k.string()),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}),lpr=CB.extend({method:k.literal("resources/list")}),ppr=xB.extend({resources:k.array(GUe)}),fpr=CB.extend({method:k.literal("resources/templates/list")}),dpr=xB.extend({resourceTemplates:k.array(upr)}),hpr=Du.extend({method:k.literal("resources/read"),params:jp.extend({uri:k.string()})}),mpr=Vp.extend({contents:k.array(k.union([BUe,HUe]))}),gpr=Dh.extend({method:k.literal("notifications/resources/list_changed")}),ypr=Du.extend({method:k.literal("resources/subscribe"),params:jp.extend({uri:k.string()})}),vpr=Du.extend({method:k.literal("resources/unsubscribe"),params:jp.extend({uri:k.string()})}),bpr=Dh.extend({method:k.literal("notifications/resources/updated"),params:_R.extend({uri:k.string()})}),Epr=k.object({name:k.string(),description:k.optional(k.string()),required:k.optional(k.boolean())}).passthrough(),_pr=TR.extend({description:k.optional(k.string()),arguments:k.optional(k.array(Epr)),_meta:k.optional(k.object({}).passthrough())}),Tpr=CB.extend({method:k.literal("prompts/list")}),Opr=xB.extend({prompts:k.array(_pr)}),Spr=Du.extend({method:k.literal("prompts/get"),params:jp.extend({name:k.string(),arguments:k.optional(k.record(k.string()))})}),Nne=k.object({type:k.literal("text"),text:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),Ine=k.object({type:k.literal("image"),data:wne,mimeType:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),Rne=k.object({type:k.literal("audio"),data:wne,mimeType:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),Apr=k.object({type:k.literal("resource"),resource:k.union([BUe,HUe]),_meta:k.optional(k.object({}).passthrough())}).passthrough(),Cpr=GUe.extend({type:k.literal("resource_link")}),zUe=k.union([Nne,Ine,Rne,Cpr,Apr]),xpr=k.object({role:k.enum(["user","assistant"]),content:zUe}).passthrough(),Ppr=Vp.extend({description:k.optional(k.string()),messages:k.array(xpr)}),Dpr=Dh.extend({method:k.literal("notifications/prompts/list_changed")}),wpr=k.object({title:k.optional(k.string()),readOnlyHint:k.optional(k.boolean()),destructiveHint:k.optional(k.boolean()),idempotentHint:k.optional(k.boolean()),openWorldHint:k.optional(k.boolean())}).passthrough(),Npr=TR.extend({description:k.optional(k.string()),inputSchema:k.object({type:k.literal("object"),properties:k.optional(k.object({}).passthrough()),required:k.optional(k.array(k.string()))}).passthrough(),outputSchema:k.optional(k.object({type:k.literal("object"),properties:k.optional(k.object({}).passthrough()),required:k.optional(k.array(k.string()))}).passthrough()),annotations:k.optional(wpr),_meta:k.optional(k.object({}).passthrough())}),Lne=CB.extend({method:k.literal("tools/list")}),Ipr=xB.extend({tools:k.array(Npr)}),KUe=Vp.extend({content:k.array(zUe).default([]),structuredContent:k.object({}).passthrough().optional(),isError:k.optional(k.boolean())}),poi=KUe.or(Vp.extend({toolResult:k.unknown()})),kne=Du.extend({method:k.literal("tools/call"),params:jp.extend({name:k.string(),arguments:k.optional(k.record(k.unknown()))})}),Rpr=Dh.extend({method:k.literal("notifications/tools/list_changed")}),OR=k.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),$ne=Du.extend({method:k.literal("logging/setLevel"),params:jp.extend({level:OR})}),Lpr=Dh.extend({method:k.literal("notifications/message"),params:_R.extend({level:OR,logger:k.optional(k.string()),data:k.unknown()})}),kpr=k.object({name:k.string().optional()}).passthrough(),$pr=k.object({hints:k.optional(k.array(kpr)),costPriority:k.optional(k.number().min(0).max(1)),speedPriority:k.optional(k.number().min(0).max(1)),intelligencePriority:k.optional(k.number().min(0).max(1))}).passthrough(),Mpr=k.object({role:k.enum(["user","assistant"]),content:k.union([Nne,Ine,Rne])}).passthrough(),Fpr=Du.extend({method:k.literal("sampling/createMessage"),params:jp.extend({messages:k.array(Mpr),systemPrompt:k.optional(k.string()),includeContext:k.optional(k.enum(["none","thisServer","allServers"])),temperature:k.optional(k.number()),maxTokens:k.number().int(),stopSequences:k.optional(k.array(k.string())),metadata:k.optional(k.object({}).passthrough()),modelPreferences:k.optional($pr)})}),Mne=Vp.extend({model:k.string(),stopReason:k.optional(k.enum(["endTurn","stopSequence","maxTokens"]).or(k.string())),role:k.enum(["user","assistant"]),content:k.discriminatedUnion("type",[Nne,Ine,Rne])}),jpr=k.object({type:k.literal("boolean"),title:k.optional(k.string()),description:k.optional(k.string()),default:k.optional(k.boolean())}).passthrough(),Vpr=k.object({type:k.literal("string"),title:k.optional(k.string()),description:k.optional(k.string()),minLength:k.optional(k.number()),maxLength:k.optional(k.number()),format:k.optional(k.enum(["email","uri","date","date-time"]))}).passthrough(),Upr=k.object({type:k.enum(["number","integer"]),title:k.optional(k.string()),description:k.optional(k.string()),minimum:k.optional(k.number()),maximum:k.optional(k.number())}).passthrough(),qpr=k.object({type:k.literal("string"),title:k.optional(k.string()),description:k.optional(k.string()),enum:k.array(k.string()),enumNames:k.optional(k.array(k.string()))}).passthrough(),Bpr=k.union([jpr,Vpr,Upr,qpr]),Hpr=Du.extend({method:k.literal("elicitation/create"),params:jp.extend({message:k.string(),requestedSchema:k.object({type:k.literal("object"),properties:k.record(k.string(),Bpr),required:k.optional(k.array(k.string()))}).passthrough()})}),Fne=Vp.extend({action:k.enum(["accept","decline","cancel"]),content:k.optional(k.record(k.string(),k.unknown()))}),Gpr=k.object({type:k.literal("ref/resource"),uri:k.string()}).passthrough();var zpr=k.object({type:k.literal("ref/prompt"),name:k.string()}).passthrough(),Kpr=Du.extend({method:k.literal("completion/complete"),params:jp.extend({ref:k.union([zpr,Gpr]),argument:k.object({name:k.string(),value:k.string()}).passthrough(),context:k.optional(k.object({arguments:k.optional(k.record(k.string(),k.string()))}))})}),Ypr=Vp.extend({completion:k.object({values:k.array(k.string()).max(100),total:k.optional(k.number().int()),hasMore:k.optional(k.boolean())}).passthrough()}),Wpr=k.object({uri:k.string().startsWith("file://"),name:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}).passthrough(),Xpr=Du.extend({method:k.literal("roots/list")}),jne=Vp.extend({roots:k.array(Wpr)}),Jpr=Dh.extend({method:k.literal("notifications/roots/list_changed")}),foi=k.union([SB,Pne,Kpr,$ne,Spr,Tpr,lpr,fpr,hpr,ypr,vpr,kne,Lne]),doi=k.union([OB,AB,Dne,Jpr]),hoi=k.union([TB,Mne,Fne,jne]),moi=k.union([SB,Fpr,Hpr,Xpr]),goi=k.union([OB,AB,Lpr,bpr,gpr,Rpr,Dpr]),yoi=k.union([TB,spr,Ypr,Ppr,Opr,ppr,dpr,mpr,KUe,Ipr]),vd=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}};var Qpr=6e4,PB=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(OB,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(AB,r=>{this._onprogress(r)}),this.setRequestHandler(SB,r=>({}))}_setupTimeout(e,r,n,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new vd(yd.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let a=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{a?.(),this._onclose()};let o=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{o?.(c),this._onerror(c)};let s=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(c,u)=>{s?.(c,u),xne(c)||jUe(c)?this._onresponse(c):LUe(c)?this._onrequest(c,u):$Ue(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new vd(yd.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;let a=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,o=this._transport;if(a===void 0){o?.send({jsonrpc:"2.0",id:e.id,error:{code:yd.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let c={signal:s.signal,sessionId:o?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,l,p)=>this.request(u,l,{...p,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>a(e,c)).then(u=>{if(!s.signal.aborted)return o?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var l;if(!s.signal.aborted)return o?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:yd.InternalError,message:(l=u.message)!==null&&l!==void 0?l:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){o(c);return}a(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),xne(e))n(e);else{let i=new vd(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}=n??{};return new Promise((s,c)=>{var u,l,p,d,f,h;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(l=n?.signal)===null||l===void 0||l.throwIfAborted();let m=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),v.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:m}});let _=A=>{var C;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),(C=this._transport)===null||C===void 0||C.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(A)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`))),c(A)};this._responseHandlers.set(m,A=>{var C;if(!(!((C=n?.signal)===null||C===void 0)&&C.aborted)){if(A instanceof Error)return c(A);try{let P=r.parse(A.result);s(P)}catch(P){c(P)}}}),(d=n?.signal)===null||d===void 0||d.addEventListener("abort",()=>{var A;_((A=n?.signal)===null||A===void 0?void 0:A.reason)});let T=(f=n?.timeout)!==null&&f!==void 0?f:Qpr,O=()=>_(new vd(yd.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(m,T,n?.maxTotalTimeout,O,(h=n?.resetTimeoutOnProgress)!==null&&h!==void 0?h:!1),this._transport.send(v,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(A=>{this._cleanupTimeout(m),c(A)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(l=>this._onerror(l))});return}let s={...e,jsonrpc:"2.0"};await this._transport.send(s,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>Promise.resolve(r(e.parse(i),a)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function YUe(t,e){return Object.entries(e).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...t})}var XBe=Tt(WBe(),1),zB=class extends PB{constructor(e,r){var n;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(OR.options.map((i,a)=>[i,a])),this.isMessageIgnored=(i,a)=>{let o=this._loggingLevels.get(a);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this.setRequestHandler(Pne,i=>this._oninitialize(i)),this.setNotificationHandler(Dne,()=>{var i;return(i=this.oninitialized)===null||i===void 0?void 0:i.call(this)}),this._capabilities.logging&&this.setRequestHandler($ne,async(i,a)=>{var o;let s=a.sessionId||((o=a.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:c}=i.params,u=OR.safeParse(c);return s&&u.success&&this._loggingLevels.set(s,u.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=YUe(this._capabilities,e)}assertCapabilityForMethod(e){var r,n,i;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((i=this._clientCapabilities)===null||i===void 0)&&i.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:wUe.includes(r)?r:Cne,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},TB)}async createMessage(e,r){return this.request({method:"sampling/createMessage",params:e},Mne,r)}async elicitInput(e,r){let n=await this.request({method:"elicitation/create",params:e},Fne,r);if(n.action==="accept"&&n.content)try{let i=new XBe.default,a=i.compile(e.requestedSchema);if(!a(n.content))throw new vd(yd.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorsText(a.errors)}`)}catch(i){throw i instanceof vd?i:new vd(yd.InternalError,`Error validating elicitation response: ${i}`)}return n}async listRoots(e,r){return this.request({method:"roots/list",params:e},jne,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&(!r||!this.isMessageIgnored(e.level,r)))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var lie=Tt(require("node:process"),1);var KB=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
1577
1577
|
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Ndr(r)}clear(){this._buffer=void 0}};function Ndr(t){return VUe.parse(JSON.parse(t))}function JBe(t){return JSON.stringify(t)+`
|
|
1578
|
-
`}var YB=class{constructor(e=lie.default.stdin,r=lie.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new KB,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let n=JBe(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var ZBe="0.4.5";var AR={name:"@sap-ux/fiori-mcp-server",description:"SAP Fiori - Model Context Protocol (MCP) server",version:ZBe,keywords:["SAP Fiori tools","SAP Fiori elements","SAP Fiori freestyle","MCP","AI"],repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/fiori-mcp-server"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-mcp-server"},license:"Apache-2.0",main:"dist/index.js",scripts:{"build-esbuild-base":"esbuild --bundle --platform=node --target=node20 --outdir=dist --external:vscode --external:@lancedb/lancedb --external:@xenova/transformers --external:@sap-ux/fiori-docs-embeddings --external:@sap-ux/store --main-fields=module,main src/index.ts","build-dev":"pnpm run build-esbuild-base --sourcemap=inline","build-compile":"tsc --noEmit","build-bundle":"pnpm run build-esbuild-base --minify",build:"npm-run-all build-compile build-bundle",watch:"tsc --watch",bundle:"npm-run-all build tgz:package tgz:rename","tgz:package":"pnpm pack","tgz:rename":"node -e \"const fs=require('fs'), p=require('./package.json'), d=new Date().toISOString().split('T')[0], oldName=p.name.startsWith('@') ? `${p.name.replace('@', '').replace('/', '-')}-${p.version}.tgz` : `${p.name}-${p.version}.tgz`; fs.renameSync(oldName, `${oldName.replace('.tgz','')}-${d}.tgz`)\"",clean:"rimraf --glob dist test/test-output *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix",test:"jest --ci --forceExit --detectOpenHandles --colors",inspector:"npx @modelcontextprotocol/inspector node dist/index.js",start:'npx -y supergateway --port 9881 --sessionTimeout 300000 --stdio "node ./dist/index.js"',"view:integration":"promptfoo view -y","test:integration:once":"promptfoo eval --config test/integration/scenarios/promptfooconfig.yaml --max-concurrency 1 --repeat 1 --output reports/integration.txt","test:integration:dev":"promptfoo eval --config test/integration/scenarios/test-dev.yaml --max-concurrency 1 --repeat 1 --output reports/integration.txt","test:integration:multiple":"npm run test:promptfoo -- --repeat 5"},files:["LICENSE","dist","!dist/**/*.map"],bin:{"fiori-mcp":"./dist/index.js"},devDependencies:{"npm-run-all2":"8.0.4",esbuild:"0.25.6","@modelcontextprotocol/sdk":"1.17.5","@sap-ux/axios-extension":"workspace:*","@sap/ux-specification":"1.136.6","@sap-ux/project-access":"workspace:*","@sap-ux/fiori-annotation-api":"workspace:*","@sap-ux/annotation-converter":"0.10.8","@sap-ux/fiori-docs-embeddings":"workspace:*","@sap-ux/i18n":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/odata-annotation-core-types":"workspace:*","@sap-ux/odata-entity-model":"workspace:*","@sap-ux/text-document-utils":"workspace:*","@types/diff":"5.0.9","@types/json-schema":"7.0.5","@types/mem-fs":"1.1.2","@types/mem-fs-editor":"7.0.1","@sap-ux/btp-utils":"workspace:*","@sap-ux/feature-toggle":"workspace:*","@sap-ux/nodejs-utils":"workspace:*","@sap-ux/telemetry":"workspace:*",i18next:"25.3.0","os-name":"4.0.1",zod:"4.1.5","@sap-ai-sdk/foundation-models":"2.0.0","@sap-ai-sdk/langchain":"2.0.0",promptfoo:"0.118.6","@langchain/mcp-adapters":"0.6.0","@langchain/core":"0.3.75"},dependencies:{"@sap-ux/fiori-docs-embeddings":"*","@sap-ux/store":"workspace:*","@xenova/transformers":"2.17.2","@lancedb/lancedb":"0.22.0","mem-fs":"2.1.0","mem-fs-editor":"9.4.0"},engines:{node:">=20.x"}};var yx={};Ri(yx,{$brand:()=>fie,$input:()=>Doe,$output:()=>Poe,NEVER:()=>pie,TimePrecision:()=>Ioe,ZodAny:()=>T4e,ZodArray:()=>C4e,ZodBase64:()=>Wse,ZodBase64URL:()=>Xse,ZodBigInt:()=>uL,ZodBigIntFormat:()=>Zse,ZodBoolean:()=>cL,ZodCIDRv4:()=>Kse,ZodCIDRv6:()=>Yse,ZodCUID:()=>Vse,ZodCUID2:()=>Use,ZodCatch:()=>H4e,ZodCodec:()=>sce,ZodCustom:()=>e4,ZodCustomStringFormat:()=>oL,ZodDate:()=>Q3,ZodDefault:()=>F4e,ZodDiscriminatedUnion:()=>x4e,ZodE164:()=>Jse,ZodEmail:()=>$se,ZodEmoji:()=>Fse,ZodEnum:()=>iL,ZodError:()=>_se,ZodFile:()=>k4e,ZodFirstPartyTypeKind:()=>cce,ZodFunction:()=>Z4e,ZodGUID:()=>z3,ZodIPv4:()=>Gse,ZodIPv6:()=>zse,ZodISODate:()=>q3,ZodISODateTime:()=>U3,ZodISODuration:()=>H3,ZodISOTime:()=>B3,ZodIntersection:()=>P4e,ZodIssueCode:()=>syr,ZodJWT:()=>Qse,ZodKSUID:()=>Hse,ZodLazy:()=>X4e,ZodLiteral:()=>L4e,ZodMap:()=>I4e,ZodNaN:()=>z4e,ZodNanoID:()=>jse,ZodNever:()=>S4e,ZodNonOptional:()=>ace,ZodNull:()=>E4e,ZodNullable:()=>M4e,ZodNumber:()=>sL,ZodNumberFormat:()=>hx,ZodObject:()=>Z3,ZodOptional:()=>ice,ZodPipe:()=>oce,ZodPrefault:()=>V4e,ZodPromise:()=>Q4e,ZodReadonly:()=>K4e,ZodRealError:()=>Iu,ZodRecord:()=>rce,ZodSet:()=>R4e,ZodString:()=>aL,ZodStringFormat:()=>vi,ZodSuccess:()=>B4e,ZodSymbol:()=>v4e,ZodTemplateLiteral:()=>W4e,ZodTransform:()=>$4e,ZodTuple:()=>w4e,ZodType:()=>Nr,ZodULID:()=>qse,ZodURL:()=>W3,ZodUUID:()=>iy,ZodUndefined:()=>b4e,ZodUnion:()=>tce,ZodUnknown:()=>O4e,ZodVoid:()=>A4e,ZodXID:()=>Bse,_ZodString:()=>kse,_default:()=>j4e,_function:()=>eyr,any:()=>J3,array:()=>Uc,base64:()=>Egr,base64url:()=>_gr,bigint:()=>Igr,boolean:()=>AT,catch:()=>G4e,check:()=>tyr,cidrv4:()=>vgr,cidrv6:()=>bgr,clone:()=>Vc,codec:()=>Jgr,coerce:()=>uce,config:()=>ro,core:()=>ny,cuid:()=>pgr,cuid2:()=>fgr,custom:()=>ryr,date:()=>Fgr,decode:()=>xse,decodeAsync:()=>Dse,discriminatedUnion:()=>qgr,e164:()=>Tgr,email:()=>rgr,emoji:()=>ugr,encode:()=>Cse,encodeAsync:()=>Pse,endsWith:()=>XR,enum:()=>qc,file:()=>Kgr,flattenError:()=>LR,float32:()=>Pgr,float64:()=>Dgr,formatError:()=>kR,function:()=>eyr,getErrorMap:()=>uyr,globalRegistry:()=>Nh,gt:()=>ty,gte:()=>Nu,guid:()=>ngr,hash:()=>xgr,hex:()=>Cgr,hostname:()=>Agr,httpUrl:()=>cgr,includes:()=>YR,instanceof:()=>nyr,int:()=>Lse,int32:()=>wgr,int64:()=>Rgr,intersection:()=>D4e,ipv4:()=>ggr,ipv6:()=>ygr,iso:()=>G3,json:()=>ayr,jwt:()=>Ogr,keyof:()=>jgr,ksuid:()=>mgr,lazy:()=>J4e,length:()=>fx,literal:()=>gx,locales:()=>UR,looseObject:()=>Ugr,lowercase:()=>zR,lt:()=>ey,lte:()=>qp,map:()=>Hgr,maxLength:()=>px,maxSize:()=>lx,mime:()=>JR,minLength:()=>Bb,minSize:()=>ST,multipleOf:()=>OT,nan:()=>Xgr,nanoid:()=>lgr,nativeEnum:()=>zgr,negative:()=>sse,never:()=>ece,nonnegative:()=>use,nonoptional:()=>q4e,nonpositive:()=>cse,normalize:()=>QR,null:()=>_4e,nullable:()=>K3,nullish:()=>Ygr,number:()=>X3,object:()=>Xn,optional:()=>ay,overwrite:()=>ry,parse:()=>Tse,parseAsync:()=>Ose,partialRecord:()=>Bgr,pipe:()=>Y3,positive:()=>ose,prefault:()=>U4e,preprocess:()=>oyr,prettifyError:()=>Oie,promise:()=>Zgr,property:()=>lse,readonly:()=>Y4e,record:()=>mx,refine:()=>e5e,regex:()=>GR,regexes:()=>Up,registry:()=>E3,safeDecode:()=>Nse,safeDecodeAsync:()=>Rse,safeEncode:()=>wse,safeEncodeAsync:()=>Ise,safeParse:()=>Sse,safeParseAsync:()=>Ase,set:()=>Ggr,setErrorMap:()=>cyr,size:()=>HR,startsWith:()=>WR,strictObject:()=>Vgr,string:()=>qt,stringFormat:()=>Sgr,stringbool:()=>iyr,success:()=>Wgr,superRefine:()=>t5e,symbol:()=>kgr,templateLiteral:()=>Qgr,toJSONSchema:()=>nL,toLowerCase:()=>eL,toUpperCase:()=>tL,transform:()=>nce,treeifyError:()=>Tie,trim:()=>ZR,tuple:()=>N4e,uint32:()=>Ngr,uint64:()=>Lgr,ulid:()=>dgr,undefined:()=>$gr,union:()=>Rh,unknown:()=>Ih,uppercase:()=>KR,url:()=>Mse,util:()=>Fe,uuid:()=>igr,uuidv4:()=>agr,uuidv6:()=>ogr,uuidv7:()=>sgr,void:()=>Mgr,xid:()=>hgr});var ny={};Ri(ny,{$ZodAny:()=>Jae,$ZodArray:()=>roe,$ZodAsyncError:()=>bd,$ZodBase64:()=>Uae,$ZodBase64URL:()=>qae,$ZodBigInt:()=>g3,$ZodBigIntFormat:()=>Kae,$ZodBoolean:()=>jR,$ZodCIDRv4:()=>Fae,$ZodCIDRv6:()=>jae,$ZodCUID:()=>xae,$ZodCUID2:()=>Pae,$ZodCatch:()=>boe,$ZodCheck:()=>Li,$ZodCheckBigIntFormat:()=>nae,$ZodCheckEndsWith:()=>mae,$ZodCheckGreaterThan:()=>u3,$ZodCheckIncludes:()=>dae,$ZodCheckLengthEquals:()=>uae,$ZodCheckLessThan:()=>c3,$ZodCheckLowerCase:()=>pae,$ZodCheckMaxLength:()=>sae,$ZodCheckMaxSize:()=>iae,$ZodCheckMimeType:()=>yae,$ZodCheckMinLength:()=>cae,$ZodCheckMinSize:()=>aae,$ZodCheckMultipleOf:()=>tae,$ZodCheckNumberFormat:()=>rae,$ZodCheckOverwrite:()=>vae,$ZodCheckProperty:()=>gae,$ZodCheckRegex:()=>lae,$ZodCheckSizeEquals:()=>oae,$ZodCheckStartsWith:()=>hae,$ZodCheckStringFormat:()=>cx,$ZodCheckUpperCase:()=>fae,$ZodCodec:()=>VR,$ZodCustom:()=>xoe,$ZodCustomStringFormat:()=>Gae,$ZodDate:()=>toe,$ZodDefault:()=>moe,$ZodDiscriminatedUnion:()=>ioe,$ZodE164:()=>Bae,$ZodEmail:()=>Oae,$ZodEmoji:()=>Aae,$ZodEncodeError:()=>Mb,$ZodEnum:()=>uoe,$ZodError:()=>RR,$ZodFile:()=>poe,$ZodFunction:()=>Soe,$ZodGUID:()=>_ae,$ZodIPv4:()=>$ae,$ZodIPv6:()=>Mae,$ZodISODate:()=>Rae,$ZodISODateTime:()=>Iae,$ZodISODuration:()=>kae,$ZodISOTime:()=>Lae,$ZodIntersection:()=>aoe,$ZodJWT:()=>Hae,$ZodKSUID:()=>Nae,$ZodLazy:()=>Coe,$ZodLiteral:()=>loe,$ZodMap:()=>soe,$ZodNaN:()=>Eoe,$ZodNanoID:()=>Cae,$ZodNever:()=>Zae,$ZodNonOptional:()=>yoe,$ZodNull:()=>Xae,$ZodNullable:()=>hoe,$ZodNumber:()=>m3,$ZodNumberFormat:()=>zae,$ZodObject:()=>S3e,$ZodObjectJIT:()=>noe,$ZodOptional:()=>doe,$ZodPipe:()=>_oe,$ZodPrefault:()=>goe,$ZodPromise:()=>Aoe,$ZodReadonly:()=>Toe,$ZodRealError:()=>wu,$ZodRecord:()=>ooe,$ZodRegistry:()=>ux,$ZodSet:()=>coe,$ZodString:()=>TT,$ZodStringFormat:()=>li,$ZodSuccess:()=>voe,$ZodSymbol:()=>Yae,$ZodTemplateLiteral:()=>Ooe,$ZodTransform:()=>foe,$ZodTuple:()=>v3,$ZodType:()=>ir,$ZodULID:()=>Dae,$ZodURL:()=>Sae,$ZodUUID:()=>Tae,$ZodUndefined:()=>Wae,$ZodUnion:()=>y3,$ZodUnknown:()=>Qae,$ZodVoid:()=>eoe,$ZodXID:()=>wae,$brand:()=>fie,$constructor:()=>ue,$input:()=>Doe,$output:()=>Poe,Doc:()=>FR,JSONSchema:()=>m4e,JSONSchemaGenerator:()=>rL,NEVER:()=>pie,TimePrecision:()=>Ioe,_any:()=>Zoe,_array:()=>pse,_base64:()=>M3,_base64url:()=>F3,_bigint:()=>zoe,_boolean:()=>Hoe,_catch:()=>Ymr,_check:()=>h4e,_cidrv4:()=>k3,_cidrv6:()=>$3,_coercedBigint:()=>Koe,_coercedBoolean:()=>Goe,_coercedDate:()=>ise,_coercedNumber:()=>Foe,_coercedString:()=>Noe,_cuid:()=>P3,_cuid2:()=>D3,_custom:()=>dse,_date:()=>nse,_decode:()=>e3,_decodeAsync:()=>r3,_default:()=>Gmr,_discriminatedUnion:()=>Rmr,_e164:()=>j3,_email:()=>_3,_emoji:()=>C3,_encode:()=>ZB,_encodeAsync:()=>t3,_endsWith:()=>XR,_enum:()=>jmr,_file:()=>fse,_float32:()=>Voe,_float64:()=>Uoe,_gt:()=>ty,_gte:()=>Nu,_guid:()=>qR,_includes:()=>YR,_int:()=>joe,_int32:()=>qoe,_int64:()=>Yoe,_intersection:()=>Lmr,_ipv4:()=>R3,_ipv6:()=>L3,_isoDate:()=>Loe,_isoDateTime:()=>Roe,_isoDuration:()=>$oe,_isoTime:()=>koe,_jwt:()=>V3,_ksuid:()=>I3,_lazy:()=>Qmr,_length:()=>fx,_literal:()=>Umr,_lowercase:()=>zR,_lt:()=>ey,_lte:()=>qp,_map:()=>Mmr,_max:()=>qp,_maxLength:()=>px,_maxSize:()=>lx,_mime:()=>JR,_min:()=>Nu,_minLength:()=>Bb,_minSize:()=>ST,_multipleOf:()=>OT,_nan:()=>ase,_nanoid:()=>x3,_nativeEnum:()=>Vmr,_negative:()=>sse,_never:()=>tse,_nonnegative:()=>use,_nonoptional:()=>zmr,_nonpositive:()=>cse,_normalize:()=>QR,_null:()=>Qoe,_nullable:()=>Hmr,_number:()=>Moe,_optional:()=>Bmr,_overwrite:()=>ry,_parse:()=>ix,_parseAsync:()=>ax,_pipe:()=>Wmr,_positive:()=>ose,_promise:()=>Zmr,_property:()=>lse,_readonly:()=>Xmr,_record:()=>$mr,_refine:()=>hse,_regex:()=>GR,_safeDecode:()=>i3,_safeDecodeAsync:()=>o3,_safeEncode:()=>n3,_safeEncodeAsync:()=>a3,_safeParse:()=>ox,_safeParseAsync:()=>sx,_set:()=>Fmr,_size:()=>HR,_startsWith:()=>WR,_string:()=>woe,_stringFormat:()=>dx,_stringbool:()=>gse,_success:()=>Kmr,_superRefine:()=>mse,_symbol:()=>Xoe,_templateLiteral:()=>Jmr,_toLowerCase:()=>eL,_toUpperCase:()=>tL,_transform:()=>qmr,_trim:()=>ZR,_tuple:()=>kmr,_uint32:()=>Boe,_uint64:()=>Woe,_ulid:()=>w3,_undefined:()=>Joe,_union:()=>Imr,_unknown:()=>ese,_uppercase:()=>KR,_url:()=>BR,_uuid:()=>T3,_uuidv4:()=>O3,_uuidv6:()=>S3,_uuidv7:()=>A3,_void:()=>rse,_xid:()=>N3,clone:()=>Vc,config:()=>ro,decode:()=>ahr,decodeAsync:()=>shr,encode:()=>ihr,encodeAsync:()=>ohr,flattenError:()=>LR,formatError:()=>kR,globalConfig:()=>CR,globalRegistry:()=>Nh,isValidBase64:()=>Vae,isValidBase64URL:()=>E3e,isValidJWT:()=>_3e,locales:()=>UR,parse:()=>JB,parseAsync:()=>QB,prettifyError:()=>Oie,regexes:()=>Up,registry:()=>E3,safeDecode:()=>uhr,safeDecodeAsync:()=>phr,safeEncode:()=>chr,safeEncodeAsync:()=>lhr,safeParse:()=>Sie,safeParseAsync:()=>Aie,toDotPath:()=>i3e,toJSONSchema:()=>nL,treeifyError:()=>Tie,util:()=>Fe,version:()=>bae});var pie=Object.freeze({status:"aborted"});function ue(t,e,r){function n(s,c){var u;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(u=s._zod).traits??(u.traits=new Set),s._zod.traits.add(t),e(s,c);for(let l in o.prototype)l in s||Object.defineProperty(s,l,{value:o.prototype[l].bind(s)});s._zod.constr=o,s._zod.def=c}let i=r?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:t});function o(s){var c;let u=r?.Parent?new a:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}var fie=Symbol("zod_brand"),bd=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Mb=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},CR={};function ro(t){return t&&Object.assign(CR,t),CR}var Fe={};Ri(Fe,{BIGINT_FORMAT_RANGES:()=>_ie,Class:()=>hie,NUMBER_FORMAT_RANGES:()=>Eie,aborted:()=>qb,allowsEval:()=>gie,assert:()=>$dr,assertEqual:()=>Idr,assertIs:()=>Ldr,assertNever:()=>kdr,assertNotEqual:()=>Rdr,assignProp:()=>jb,base64ToUint8Array:()=>t3e,base64urlToUint8Array:()=>Zdr,cached:()=>rx,captureStackTrace:()=>XB,cleanEnum:()=>Qdr,cleanRegex:()=>DR,clone:()=>Vc,cloneDef:()=>Fdr,createTransparentProxy:()=>Hdr,defineLazy:()=>Yr,esc:()=>WB,escapeRegex:()=>wh,extend:()=>Kdr,finalizeIssue:()=>Gl,floatSafeRemainder:()=>mie,getElementAtPath:()=>jdr,getEnumValues:()=>PR,getLengthableOrigin:()=>IR,getParsedType:()=>Bdr,getSizableOrigin:()=>NR,hexToUint8Array:()=>thr,isObject:()=>ET,isPlainObject:()=>Ub,issue:()=>nx,joinValues:()=>_e,jsonStringifyReplacer:()=>tx,merge:()=>Wdr,mergeDefs:()=>Vb,normalizeParams:()=>Be,nullish:()=>Fb,numKeys:()=>qdr,objectClone:()=>Mdr,omit:()=>zdr,optionalKeys:()=>bie,partial:()=>Xdr,pick:()=>Gdr,prefixIssues:()=>Hl,primitiveTypes:()=>vie,promiseAllObject:()=>Vdr,propertyKeyTypes:()=>wR,randomString:()=>Udr,required:()=>Jdr,safeExtend:()=>Ydr,shallowClone:()=>yie,stringifyPrimitive:()=>ze,uint8ArrayToBase64:()=>r3e,uint8ArrayToBase64url:()=>ehr,uint8ArrayToHex:()=>rhr,unwrapMessage:()=>xR});function Idr(t){return t}function Rdr(t){return t}function Ldr(t){}function kdr(t){throw new Error}function $dr(t){}function PR(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function _e(t,e="|"){return t.map(r=>ze(r)).join(e)}function tx(t,e){return typeof e=="bigint"?e.toString():e}function rx(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Fb(t){return t==null}function DR(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function mie(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(i=Number.parseInt(c[1]))}let a=r>i?r:i,o=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return o%s/10**a}var e3e=Symbol("evaluating");function Yr(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==e3e)return n===void 0&&(n=e3e,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Mdr(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function jb(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Vb(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Fdr(t){return Vb(t._zod.def)}function jdr(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Vdr(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let a=0;a<e.length;a++)i[e[a]]=n[a];return i})}function Udr(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function WB(t){return JSON.stringify(t)}var XB="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ET(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var gie=rx(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Ub(t){if(ET(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(ET(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function yie(t){return Ub(t)?{...t}:t}function qdr(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Bdr=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},wR=new Set(["string","number","symbol"]),vie=new Set(["string","number","bigint","boolean","symbol","undefined"]);function wh(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vc(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Be(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Hdr(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,a){return e??(e=t()),Reflect.set(e,n,i,a)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function ze(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function bie(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Eie={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},_ie={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Gdr(t,e){let r=t._zod.def,n=Vb(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return jb(this,"shape",i),i},checks:[]});return Vc(t,n)}function zdr(t,e){let r=t._zod.def,n=Vb(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return jb(this,"shape",i),i},checks:[]});return Vc(t,n)}function Kdr(t,e){if(!Ub(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=Vb(t._zod.def,{get shape(){let a={...t._zod.def.shape,...e};return jb(this,"shape",a),a},checks:[]});return Vc(t,i)}function Ydr(t,e){if(!Ub(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return jb(this,"shape",n),n},checks:t._zod.def.checks};return Vc(t,r)}function Wdr(t,e){let r=Vb(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return jb(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Vc(t,r)}function Xdr(t,e,r){let n=Vb(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=t?new t({type:"optional",innerType:i[o]}):i[o])}else for(let o in i)a[o]=t?new t({type:"optional",innerType:i[o]}):i[o];return jb(this,"shape",a),a},checks:[]});return Vc(e,n)}function Jdr(t,e,r){let n=Vb(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(let o in i)a[o]=new t({type:"nonoptional",innerType:i[o]});return jb(this,"shape",a),a},checks:[]});return Vc(e,n)}function qb(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Hl(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function xR(t){return typeof t=="string"?t:t?.message}function Gl(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=xR(t.inst?._zod.def?.error?.(t))??xR(e?.error?.(t))??xR(r.customError?.(t))??xR(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function NR(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function IR(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function nx(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Qdr(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function t3e(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function r3e(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Zdr(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return t3e(e+r)}function ehr(t){return r3e(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function thr(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function rhr(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var hie=class{constructor(...e){}};var n3e=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,tx,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},RR=ue("$ZodError",n3e),wu=ue("$ZodError",n3e,{Parent:Error});function LR(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function kR(t,e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(o))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return i(t),n}function Tie(t,e){let r=e||function(a){return a.message},n={errors:[]},i=(a,o=[])=>{var s,c;for(let u of a.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(l=>i({issues:l},u.path));else if(u.code==="invalid_key")i({issues:u.issues},u.path);else if(u.code==="invalid_element")i({issues:u.issues},u.path);else{let l=[...o,...u.path];if(l.length===0){n.errors.push(r(u));continue}let p=n,d=0;for(;d<l.length;){let f=l[d],h=d===l.length-1;typeof f=="string"?(p.properties??(p.properties={}),(s=p.properties)[f]??(s[f]={errors:[]}),p=p.properties[f]):(p.items??(p.items=[]),(c=p.items)[f]??(c[f]={errors:[]}),p=p.items[f]),h&&p.errors.push(r(u)),d++}}};return i(t),n}function i3e(t){let e=[],r=t.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function Oie(t){let e=[],r=[...t.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${i3e(n.path)}`);return e.join(`
|
|
1578
|
+
`}var YB=class{constructor(e=lie.default.stdin,r=lie.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new KB,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let n=JBe(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var ZBe="0.4.6";var AR={name:"@sap-ux/fiori-mcp-server",description:"SAP Fiori - Model Context Protocol (MCP) server",version:ZBe,keywords:["SAP Fiori tools","SAP Fiori elements","SAP Fiori freestyle","MCP","AI"],repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/fiori-mcp-server"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-mcp-server"},license:"Apache-2.0",main:"dist/index.js",scripts:{"build-esbuild-base":"esbuild --bundle --platform=node --target=node20 --outdir=dist --external:vscode --external:@lancedb/lancedb --external:@xenova/transformers --external:@sap-ux/fiori-docs-embeddings --external:@sap-ux/store --main-fields=module,main src/index.ts","build-dev":"pnpm run build-esbuild-base --sourcemap=inline","build-compile":"tsc --noEmit","build-bundle":"pnpm run build-esbuild-base --minify",build:"npm-run-all build-compile build-bundle",watch:"tsc --watch",bundle:"npm-run-all build tgz:package tgz:rename","tgz:package":"pnpm pack","tgz:rename":"node -e \"const fs=require('fs'), p=require('./package.json'), d=new Date().toISOString().split('T')[0], oldName=p.name.startsWith('@') ? `${p.name.replace('@', '').replace('/', '-')}-${p.version}.tgz` : `${p.name}-${p.version}.tgz`; fs.renameSync(oldName, `${oldName.replace('.tgz','')}-${d}.tgz`)\"",clean:"rimraf --glob dist test/test-output *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix",test:"jest --ci --forceExit --detectOpenHandles --colors",inspector:"npx @modelcontextprotocol/inspector node dist/index.js",start:'npx -y supergateway --port 9881 --sessionTimeout 300000 --stdio "node ./dist/index.js"',"view:integration":"promptfoo view -y","test:integration:once":"promptfoo eval --config test/integration/scenarios/promptfooconfig.yaml --max-concurrency 1 --repeat 1 --output reports/integration.txt","test:integration:dev":"promptfoo eval --config test/integration/scenarios/test-dev.yaml --max-concurrency 1 --repeat 1 --output reports/integration.txt","test:integration:multiple":"npm run test:promptfoo -- --repeat 5"},files:["LICENSE","dist","!dist/**/*.map"],bin:{"fiori-mcp":"./dist/index.js"},devDependencies:{"npm-run-all2":"8.0.4",esbuild:"0.25.6","@modelcontextprotocol/sdk":"1.17.5","@sap-ux/axios-extension":"workspace:*","@sap/ux-specification":"1.136.6","@sap-ux/project-access":"workspace:*","@sap-ux/fiori-annotation-api":"workspace:*","@sap-ux/annotation-converter":"0.10.8","@sap-ux/fiori-docs-embeddings":"workspace:*","@sap-ux/i18n":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/odata-annotation-core-types":"workspace:*","@sap-ux/odata-entity-model":"workspace:*","@sap-ux/text-document-utils":"workspace:*","@types/diff":"5.0.9","@types/json-schema":"7.0.5","@types/mem-fs":"1.1.2","@types/mem-fs-editor":"7.0.1","@sap-ux/btp-utils":"workspace:*","@sap-ux/feature-toggle":"workspace:*","@sap-ux/nodejs-utils":"workspace:*","@sap-ux/telemetry":"workspace:*",i18next:"25.3.0","os-name":"4.0.1",zod:"4.1.5","@sap-ai-sdk/foundation-models":"2.0.0","@sap-ai-sdk/langchain":"2.0.0",promptfoo:"0.118.6","@langchain/mcp-adapters":"0.6.0","@langchain/core":"0.3.75"},dependencies:{"@sap-ux/fiori-docs-embeddings":"*","@sap-ux/store":"workspace:*","@xenova/transformers":"2.17.2","@lancedb/lancedb":"0.22.0","mem-fs":"2.1.0","mem-fs-editor":"9.4.0"},engines:{node:">=20.x"}};var yx={};Ri(yx,{$brand:()=>fie,$input:()=>Doe,$output:()=>Poe,NEVER:()=>pie,TimePrecision:()=>Ioe,ZodAny:()=>T4e,ZodArray:()=>C4e,ZodBase64:()=>Wse,ZodBase64URL:()=>Xse,ZodBigInt:()=>uL,ZodBigIntFormat:()=>Zse,ZodBoolean:()=>cL,ZodCIDRv4:()=>Kse,ZodCIDRv6:()=>Yse,ZodCUID:()=>Vse,ZodCUID2:()=>Use,ZodCatch:()=>H4e,ZodCodec:()=>sce,ZodCustom:()=>e4,ZodCustomStringFormat:()=>oL,ZodDate:()=>Q3,ZodDefault:()=>F4e,ZodDiscriminatedUnion:()=>x4e,ZodE164:()=>Jse,ZodEmail:()=>$se,ZodEmoji:()=>Fse,ZodEnum:()=>iL,ZodError:()=>_se,ZodFile:()=>k4e,ZodFirstPartyTypeKind:()=>cce,ZodFunction:()=>Z4e,ZodGUID:()=>z3,ZodIPv4:()=>Gse,ZodIPv6:()=>zse,ZodISODate:()=>q3,ZodISODateTime:()=>U3,ZodISODuration:()=>H3,ZodISOTime:()=>B3,ZodIntersection:()=>P4e,ZodIssueCode:()=>syr,ZodJWT:()=>Qse,ZodKSUID:()=>Hse,ZodLazy:()=>X4e,ZodLiteral:()=>L4e,ZodMap:()=>I4e,ZodNaN:()=>z4e,ZodNanoID:()=>jse,ZodNever:()=>S4e,ZodNonOptional:()=>ace,ZodNull:()=>E4e,ZodNullable:()=>M4e,ZodNumber:()=>sL,ZodNumberFormat:()=>hx,ZodObject:()=>Z3,ZodOptional:()=>ice,ZodPipe:()=>oce,ZodPrefault:()=>V4e,ZodPromise:()=>Q4e,ZodReadonly:()=>K4e,ZodRealError:()=>Iu,ZodRecord:()=>rce,ZodSet:()=>R4e,ZodString:()=>aL,ZodStringFormat:()=>vi,ZodSuccess:()=>B4e,ZodSymbol:()=>v4e,ZodTemplateLiteral:()=>W4e,ZodTransform:()=>$4e,ZodTuple:()=>w4e,ZodType:()=>Nr,ZodULID:()=>qse,ZodURL:()=>W3,ZodUUID:()=>iy,ZodUndefined:()=>b4e,ZodUnion:()=>tce,ZodUnknown:()=>O4e,ZodVoid:()=>A4e,ZodXID:()=>Bse,_ZodString:()=>kse,_default:()=>j4e,_function:()=>eyr,any:()=>J3,array:()=>Uc,base64:()=>Egr,base64url:()=>_gr,bigint:()=>Igr,boolean:()=>AT,catch:()=>G4e,check:()=>tyr,cidrv4:()=>vgr,cidrv6:()=>bgr,clone:()=>Vc,codec:()=>Jgr,coerce:()=>uce,config:()=>ro,core:()=>ny,cuid:()=>pgr,cuid2:()=>fgr,custom:()=>ryr,date:()=>Fgr,decode:()=>xse,decodeAsync:()=>Dse,discriminatedUnion:()=>qgr,e164:()=>Tgr,email:()=>rgr,emoji:()=>ugr,encode:()=>Cse,encodeAsync:()=>Pse,endsWith:()=>XR,enum:()=>qc,file:()=>Kgr,flattenError:()=>LR,float32:()=>Pgr,float64:()=>Dgr,formatError:()=>kR,function:()=>eyr,getErrorMap:()=>uyr,globalRegistry:()=>Nh,gt:()=>ty,gte:()=>Nu,guid:()=>ngr,hash:()=>xgr,hex:()=>Cgr,hostname:()=>Agr,httpUrl:()=>cgr,includes:()=>YR,instanceof:()=>nyr,int:()=>Lse,int32:()=>wgr,int64:()=>Rgr,intersection:()=>D4e,ipv4:()=>ggr,ipv6:()=>ygr,iso:()=>G3,json:()=>ayr,jwt:()=>Ogr,keyof:()=>jgr,ksuid:()=>mgr,lazy:()=>J4e,length:()=>fx,literal:()=>gx,locales:()=>UR,looseObject:()=>Ugr,lowercase:()=>zR,lt:()=>ey,lte:()=>qp,map:()=>Hgr,maxLength:()=>px,maxSize:()=>lx,mime:()=>JR,minLength:()=>Bb,minSize:()=>ST,multipleOf:()=>OT,nan:()=>Xgr,nanoid:()=>lgr,nativeEnum:()=>zgr,negative:()=>sse,never:()=>ece,nonnegative:()=>use,nonoptional:()=>q4e,nonpositive:()=>cse,normalize:()=>QR,null:()=>_4e,nullable:()=>K3,nullish:()=>Ygr,number:()=>X3,object:()=>Xn,optional:()=>ay,overwrite:()=>ry,parse:()=>Tse,parseAsync:()=>Ose,partialRecord:()=>Bgr,pipe:()=>Y3,positive:()=>ose,prefault:()=>U4e,preprocess:()=>oyr,prettifyError:()=>Oie,promise:()=>Zgr,property:()=>lse,readonly:()=>Y4e,record:()=>mx,refine:()=>e5e,regex:()=>GR,regexes:()=>Up,registry:()=>E3,safeDecode:()=>Nse,safeDecodeAsync:()=>Rse,safeEncode:()=>wse,safeEncodeAsync:()=>Ise,safeParse:()=>Sse,safeParseAsync:()=>Ase,set:()=>Ggr,setErrorMap:()=>cyr,size:()=>HR,startsWith:()=>WR,strictObject:()=>Vgr,string:()=>qt,stringFormat:()=>Sgr,stringbool:()=>iyr,success:()=>Wgr,superRefine:()=>t5e,symbol:()=>kgr,templateLiteral:()=>Qgr,toJSONSchema:()=>nL,toLowerCase:()=>eL,toUpperCase:()=>tL,transform:()=>nce,treeifyError:()=>Tie,trim:()=>ZR,tuple:()=>N4e,uint32:()=>Ngr,uint64:()=>Lgr,ulid:()=>dgr,undefined:()=>$gr,union:()=>Rh,unknown:()=>Ih,uppercase:()=>KR,url:()=>Mse,util:()=>Fe,uuid:()=>igr,uuidv4:()=>agr,uuidv6:()=>ogr,uuidv7:()=>sgr,void:()=>Mgr,xid:()=>hgr});var ny={};Ri(ny,{$ZodAny:()=>Jae,$ZodArray:()=>roe,$ZodAsyncError:()=>bd,$ZodBase64:()=>Uae,$ZodBase64URL:()=>qae,$ZodBigInt:()=>g3,$ZodBigIntFormat:()=>Kae,$ZodBoolean:()=>jR,$ZodCIDRv4:()=>Fae,$ZodCIDRv6:()=>jae,$ZodCUID:()=>xae,$ZodCUID2:()=>Pae,$ZodCatch:()=>boe,$ZodCheck:()=>Li,$ZodCheckBigIntFormat:()=>nae,$ZodCheckEndsWith:()=>mae,$ZodCheckGreaterThan:()=>u3,$ZodCheckIncludes:()=>dae,$ZodCheckLengthEquals:()=>uae,$ZodCheckLessThan:()=>c3,$ZodCheckLowerCase:()=>pae,$ZodCheckMaxLength:()=>sae,$ZodCheckMaxSize:()=>iae,$ZodCheckMimeType:()=>yae,$ZodCheckMinLength:()=>cae,$ZodCheckMinSize:()=>aae,$ZodCheckMultipleOf:()=>tae,$ZodCheckNumberFormat:()=>rae,$ZodCheckOverwrite:()=>vae,$ZodCheckProperty:()=>gae,$ZodCheckRegex:()=>lae,$ZodCheckSizeEquals:()=>oae,$ZodCheckStartsWith:()=>hae,$ZodCheckStringFormat:()=>cx,$ZodCheckUpperCase:()=>fae,$ZodCodec:()=>VR,$ZodCustom:()=>xoe,$ZodCustomStringFormat:()=>Gae,$ZodDate:()=>toe,$ZodDefault:()=>moe,$ZodDiscriminatedUnion:()=>ioe,$ZodE164:()=>Bae,$ZodEmail:()=>Oae,$ZodEmoji:()=>Aae,$ZodEncodeError:()=>Mb,$ZodEnum:()=>uoe,$ZodError:()=>RR,$ZodFile:()=>poe,$ZodFunction:()=>Soe,$ZodGUID:()=>_ae,$ZodIPv4:()=>$ae,$ZodIPv6:()=>Mae,$ZodISODate:()=>Rae,$ZodISODateTime:()=>Iae,$ZodISODuration:()=>kae,$ZodISOTime:()=>Lae,$ZodIntersection:()=>aoe,$ZodJWT:()=>Hae,$ZodKSUID:()=>Nae,$ZodLazy:()=>Coe,$ZodLiteral:()=>loe,$ZodMap:()=>soe,$ZodNaN:()=>Eoe,$ZodNanoID:()=>Cae,$ZodNever:()=>Zae,$ZodNonOptional:()=>yoe,$ZodNull:()=>Xae,$ZodNullable:()=>hoe,$ZodNumber:()=>m3,$ZodNumberFormat:()=>zae,$ZodObject:()=>S3e,$ZodObjectJIT:()=>noe,$ZodOptional:()=>doe,$ZodPipe:()=>_oe,$ZodPrefault:()=>goe,$ZodPromise:()=>Aoe,$ZodReadonly:()=>Toe,$ZodRealError:()=>wu,$ZodRecord:()=>ooe,$ZodRegistry:()=>ux,$ZodSet:()=>coe,$ZodString:()=>TT,$ZodStringFormat:()=>li,$ZodSuccess:()=>voe,$ZodSymbol:()=>Yae,$ZodTemplateLiteral:()=>Ooe,$ZodTransform:()=>foe,$ZodTuple:()=>v3,$ZodType:()=>ir,$ZodULID:()=>Dae,$ZodURL:()=>Sae,$ZodUUID:()=>Tae,$ZodUndefined:()=>Wae,$ZodUnion:()=>y3,$ZodUnknown:()=>Qae,$ZodVoid:()=>eoe,$ZodXID:()=>wae,$brand:()=>fie,$constructor:()=>ue,$input:()=>Doe,$output:()=>Poe,Doc:()=>FR,JSONSchema:()=>m4e,JSONSchemaGenerator:()=>rL,NEVER:()=>pie,TimePrecision:()=>Ioe,_any:()=>Zoe,_array:()=>pse,_base64:()=>M3,_base64url:()=>F3,_bigint:()=>zoe,_boolean:()=>Hoe,_catch:()=>Ymr,_check:()=>h4e,_cidrv4:()=>k3,_cidrv6:()=>$3,_coercedBigint:()=>Koe,_coercedBoolean:()=>Goe,_coercedDate:()=>ise,_coercedNumber:()=>Foe,_coercedString:()=>Noe,_cuid:()=>P3,_cuid2:()=>D3,_custom:()=>dse,_date:()=>nse,_decode:()=>e3,_decodeAsync:()=>r3,_default:()=>Gmr,_discriminatedUnion:()=>Rmr,_e164:()=>j3,_email:()=>_3,_emoji:()=>C3,_encode:()=>ZB,_encodeAsync:()=>t3,_endsWith:()=>XR,_enum:()=>jmr,_file:()=>fse,_float32:()=>Voe,_float64:()=>Uoe,_gt:()=>ty,_gte:()=>Nu,_guid:()=>qR,_includes:()=>YR,_int:()=>joe,_int32:()=>qoe,_int64:()=>Yoe,_intersection:()=>Lmr,_ipv4:()=>R3,_ipv6:()=>L3,_isoDate:()=>Loe,_isoDateTime:()=>Roe,_isoDuration:()=>$oe,_isoTime:()=>koe,_jwt:()=>V3,_ksuid:()=>I3,_lazy:()=>Qmr,_length:()=>fx,_literal:()=>Umr,_lowercase:()=>zR,_lt:()=>ey,_lte:()=>qp,_map:()=>Mmr,_max:()=>qp,_maxLength:()=>px,_maxSize:()=>lx,_mime:()=>JR,_min:()=>Nu,_minLength:()=>Bb,_minSize:()=>ST,_multipleOf:()=>OT,_nan:()=>ase,_nanoid:()=>x3,_nativeEnum:()=>Vmr,_negative:()=>sse,_never:()=>tse,_nonnegative:()=>use,_nonoptional:()=>zmr,_nonpositive:()=>cse,_normalize:()=>QR,_null:()=>Qoe,_nullable:()=>Hmr,_number:()=>Moe,_optional:()=>Bmr,_overwrite:()=>ry,_parse:()=>ix,_parseAsync:()=>ax,_pipe:()=>Wmr,_positive:()=>ose,_promise:()=>Zmr,_property:()=>lse,_readonly:()=>Xmr,_record:()=>$mr,_refine:()=>hse,_regex:()=>GR,_safeDecode:()=>i3,_safeDecodeAsync:()=>o3,_safeEncode:()=>n3,_safeEncodeAsync:()=>a3,_safeParse:()=>ox,_safeParseAsync:()=>sx,_set:()=>Fmr,_size:()=>HR,_startsWith:()=>WR,_string:()=>woe,_stringFormat:()=>dx,_stringbool:()=>gse,_success:()=>Kmr,_superRefine:()=>mse,_symbol:()=>Xoe,_templateLiteral:()=>Jmr,_toLowerCase:()=>eL,_toUpperCase:()=>tL,_transform:()=>qmr,_trim:()=>ZR,_tuple:()=>kmr,_uint32:()=>Boe,_uint64:()=>Woe,_ulid:()=>w3,_undefined:()=>Joe,_union:()=>Imr,_unknown:()=>ese,_uppercase:()=>KR,_url:()=>BR,_uuid:()=>T3,_uuidv4:()=>O3,_uuidv6:()=>S3,_uuidv7:()=>A3,_void:()=>rse,_xid:()=>N3,clone:()=>Vc,config:()=>ro,decode:()=>ahr,decodeAsync:()=>shr,encode:()=>ihr,encodeAsync:()=>ohr,flattenError:()=>LR,formatError:()=>kR,globalConfig:()=>CR,globalRegistry:()=>Nh,isValidBase64:()=>Vae,isValidBase64URL:()=>E3e,isValidJWT:()=>_3e,locales:()=>UR,parse:()=>JB,parseAsync:()=>QB,prettifyError:()=>Oie,regexes:()=>Up,registry:()=>E3,safeDecode:()=>uhr,safeDecodeAsync:()=>phr,safeEncode:()=>chr,safeEncodeAsync:()=>lhr,safeParse:()=>Sie,safeParseAsync:()=>Aie,toDotPath:()=>i3e,toJSONSchema:()=>nL,treeifyError:()=>Tie,util:()=>Fe,version:()=>bae});var pie=Object.freeze({status:"aborted"});function ue(t,e,r){function n(s,c){var u;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(u=s._zod).traits??(u.traits=new Set),s._zod.traits.add(t),e(s,c);for(let l in o.prototype)l in s||Object.defineProperty(s,l,{value:o.prototype[l].bind(s)});s._zod.constr=o,s._zod.def=c}let i=r?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:t});function o(s){var c;let u=r?.Parent?new a:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}var fie=Symbol("zod_brand"),bd=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Mb=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},CR={};function ro(t){return t&&Object.assign(CR,t),CR}var Fe={};Ri(Fe,{BIGINT_FORMAT_RANGES:()=>_ie,Class:()=>hie,NUMBER_FORMAT_RANGES:()=>Eie,aborted:()=>qb,allowsEval:()=>gie,assert:()=>$dr,assertEqual:()=>Idr,assertIs:()=>Ldr,assertNever:()=>kdr,assertNotEqual:()=>Rdr,assignProp:()=>jb,base64ToUint8Array:()=>t3e,base64urlToUint8Array:()=>Zdr,cached:()=>rx,captureStackTrace:()=>XB,cleanEnum:()=>Qdr,cleanRegex:()=>DR,clone:()=>Vc,cloneDef:()=>Fdr,createTransparentProxy:()=>Hdr,defineLazy:()=>Yr,esc:()=>WB,escapeRegex:()=>wh,extend:()=>Kdr,finalizeIssue:()=>Gl,floatSafeRemainder:()=>mie,getElementAtPath:()=>jdr,getEnumValues:()=>PR,getLengthableOrigin:()=>IR,getParsedType:()=>Bdr,getSizableOrigin:()=>NR,hexToUint8Array:()=>thr,isObject:()=>ET,isPlainObject:()=>Ub,issue:()=>nx,joinValues:()=>_e,jsonStringifyReplacer:()=>tx,merge:()=>Wdr,mergeDefs:()=>Vb,normalizeParams:()=>Be,nullish:()=>Fb,numKeys:()=>qdr,objectClone:()=>Mdr,omit:()=>zdr,optionalKeys:()=>bie,partial:()=>Xdr,pick:()=>Gdr,prefixIssues:()=>Hl,primitiveTypes:()=>vie,promiseAllObject:()=>Vdr,propertyKeyTypes:()=>wR,randomString:()=>Udr,required:()=>Jdr,safeExtend:()=>Ydr,shallowClone:()=>yie,stringifyPrimitive:()=>ze,uint8ArrayToBase64:()=>r3e,uint8ArrayToBase64url:()=>ehr,uint8ArrayToHex:()=>rhr,unwrapMessage:()=>xR});function Idr(t){return t}function Rdr(t){return t}function Ldr(t){}function kdr(t){throw new Error}function $dr(t){}function PR(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function _e(t,e="|"){return t.map(r=>ze(r)).join(e)}function tx(t,e){return typeof e=="bigint"?e.toString():e}function rx(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Fb(t){return t==null}function DR(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function mie(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(i=Number.parseInt(c[1]))}let a=r>i?r:i,o=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return o%s/10**a}var e3e=Symbol("evaluating");function Yr(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==e3e)return n===void 0&&(n=e3e,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Mdr(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function jb(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Vb(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Fdr(t){return Vb(t._zod.def)}function jdr(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Vdr(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let a=0;a<e.length;a++)i[e[a]]=n[a];return i})}function Udr(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function WB(t){return JSON.stringify(t)}var XB="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ET(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var gie=rx(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Ub(t){if(ET(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(ET(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function yie(t){return Ub(t)?{...t}:t}function qdr(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Bdr=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},wR=new Set(["string","number","symbol"]),vie=new Set(["string","number","bigint","boolean","symbol","undefined"]);function wh(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vc(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Be(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Hdr(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,a){return e??(e=t()),Reflect.set(e,n,i,a)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function ze(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function bie(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Eie={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},_ie={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Gdr(t,e){let r=t._zod.def,n=Vb(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return jb(this,"shape",i),i},checks:[]});return Vc(t,n)}function zdr(t,e){let r=t._zod.def,n=Vb(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return jb(this,"shape",i),i},checks:[]});return Vc(t,n)}function Kdr(t,e){if(!Ub(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=Vb(t._zod.def,{get shape(){let a={...t._zod.def.shape,...e};return jb(this,"shape",a),a},checks:[]});return Vc(t,i)}function Ydr(t,e){if(!Ub(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return jb(this,"shape",n),n},checks:t._zod.def.checks};return Vc(t,r)}function Wdr(t,e){let r=Vb(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return jb(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Vc(t,r)}function Xdr(t,e,r){let n=Vb(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=t?new t({type:"optional",innerType:i[o]}):i[o])}else for(let o in i)a[o]=t?new t({type:"optional",innerType:i[o]}):i[o];return jb(this,"shape",a),a},checks:[]});return Vc(e,n)}function Jdr(t,e,r){let n=Vb(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(let o in i)a[o]=new t({type:"nonoptional",innerType:i[o]});return jb(this,"shape",a),a},checks:[]});return Vc(e,n)}function qb(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Hl(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function xR(t){return typeof t=="string"?t:t?.message}function Gl(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=xR(t.inst?._zod.def?.error?.(t))??xR(e?.error?.(t))??xR(r.customError?.(t))??xR(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function NR(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function IR(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function nx(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Qdr(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function t3e(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function r3e(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Zdr(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return t3e(e+r)}function ehr(t){return r3e(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function thr(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function rhr(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var hie=class{constructor(...e){}};var n3e=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,tx,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},RR=ue("$ZodError",n3e),wu=ue("$ZodError",n3e,{Parent:Error});function LR(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function kR(t,e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(o))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return i(t),n}function Tie(t,e){let r=e||function(a){return a.message},n={errors:[]},i=(a,o=[])=>{var s,c;for(let u of a.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(l=>i({issues:l},u.path));else if(u.code==="invalid_key")i({issues:u.issues},u.path);else if(u.code==="invalid_element")i({issues:u.issues},u.path);else{let l=[...o,...u.path];if(l.length===0){n.errors.push(r(u));continue}let p=n,d=0;for(;d<l.length;){let f=l[d],h=d===l.length-1;typeof f=="string"?(p.properties??(p.properties={}),(s=p.properties)[f]??(s[f]={errors:[]}),p=p.properties[f]):(p.items??(p.items=[]),(c=p.items)[f]??(c[f]={errors:[]}),p=p.items[f]),h&&p.errors.push(r(u)),d++}}};return i(t),n}function i3e(t){let e=[],r=t.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function Oie(t){let e=[],r=[...t.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${i3e(n.path)}`);return e.join(`
|
|
1579
1579
|
`)}var ix=t=>(e,r,n,i)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},o=e._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new bd;if(o.issues.length){let s=new(i?.Err??t)(o.issues.map(c=>Gl(c,a,ro())));throw XB(s,i?.callee),s}return o.value},JB=ix(wu),ax=t=>async(e,r,n,i)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??t)(o.issues.map(c=>Gl(c,a,ro())));throw XB(s,i?.callee),s}return o.value},QB=ax(wu),ox=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new bd;return a.issues.length?{success:!1,error:new(t??RR)(a.issues.map(o=>Gl(o,i,ro())))}:{success:!0,data:a.value}},Sie=ox(wu),sx=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new t(a.issues.map(o=>Gl(o,i,ro())))}:{success:!0,data:a.value}},Aie=sx(wu),ZB=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ix(t)(e,r,i)},ihr=ZB(wu),e3=t=>(e,r,n)=>ix(t)(e,r,n),ahr=e3(wu),t3=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ax(t)(e,r,i)},ohr=t3(wu),r3=t=>async(e,r,n)=>ax(t)(e,r,n),shr=r3(wu),n3=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ox(t)(e,r,i)},chr=n3(wu),i3=t=>(e,r,n)=>ox(t)(e,r,n),uhr=i3(wu),a3=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return sx(t)(e,r,i)},lhr=a3(wu),o3=t=>async(e,r,n)=>sx(t)(e,r,n),phr=o3(wu);var Up={};Ri(Up,{base64:()=>Vie,base64url:()=>s3,bigint:()=>Kie,boolean:()=>Xie,browserEmail:()=>Ehr,cidrv4:()=>Fie,cidrv6:()=>jie,cuid:()=>Cie,cuid2:()=>xie,date:()=>Bie,datetime:()=>Gie,domain:()=>Thr,duration:()=>Iie,e164:()=>qie,email:()=>Lie,emoji:()=>kie,extendedDuration:()=>fhr,guid:()=>Rie,hex:()=>Ohr,hostname:()=>Uie,html5Email:()=>ghr,idnEmail:()=>bhr,integer:()=>Yie,ipv4:()=>$ie,ipv6:()=>Mie,ksuid:()=>wie,lowercase:()=>Zie,md5_base64:()=>Ahr,md5_base64url:()=>Chr,md5_hex:()=>Shr,nanoid:()=>Nie,null:()=>Jie,number:()=>Wie,rfc5322Email:()=>yhr,sha1_base64:()=>Phr,sha1_base64url:()=>Dhr,sha1_hex:()=>xhr,sha256_base64:()=>Nhr,sha256_base64url:()=>Ihr,sha256_hex:()=>whr,sha384_base64:()=>Lhr,sha384_base64url:()=>khr,sha384_hex:()=>Rhr,sha512_base64:()=>Mhr,sha512_base64url:()=>Fhr,sha512_hex:()=>$hr,string:()=>zie,time:()=>Hie,ulid:()=>Pie,undefined:()=>Qie,unicodeEmail:()=>vhr,uppercase:()=>eae,uuid:()=>_T,uuid4:()=>dhr,uuid6:()=>hhr,uuid7:()=>mhr,xid:()=>Die});var Cie=/^[cC][^\s-]{8,}$/,xie=/^[0-9a-z]+$/,Pie=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Die=/^[0-9a-vA-V]{20}$/,wie=/^[A-Za-z0-9]{27}$/,Nie=/^[a-zA-Z0-9_-]{21}$/,Iie=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fhr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rie=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,_T=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,dhr=_T(4),hhr=_T(6),mhr=_T(7),Lie=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ghr=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,yhr=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,vhr=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,bhr=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ehr=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,_hr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function kie(){return new RegExp(_hr,"u")}var $ie=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mie=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Fie=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,jie=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vie=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,s3=/^[A-Za-z0-9_-]*$/,Uie=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Thr=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,qie=/^\+(?:[0-9]){6,14}[0-9]$/,a3e="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Bie=new RegExp(`^${a3e}$`);function o3e(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Hie(t){return new RegExp(`^${o3e(t)}$`)}function Gie(t){let e=o3e({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${a3e}T(?:${n})$`)}var zie=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Kie=/^\d+n?$/,Yie=/^\d+$/,Wie=/^-?\d+(?:\.\d+)?/i,Xie=/true|false/i,Jie=/null/i;var Qie=/undefined/i;var Zie=/^[^A-Z]*$/,eae=/^[^a-z]*$/,Ohr=/^[0-9a-fA-F]*$/;function $R(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function MR(t){return new RegExp(`^[A-Za-z0-9-_]{${t}}$`)}var Shr=/^[0-9a-fA-F]{32}$/,Ahr=$R(22,"=="),Chr=MR(22),xhr=/^[0-9a-fA-F]{40}$/,Phr=$R(27,"="),Dhr=MR(27),whr=/^[0-9a-fA-F]{64}$/,Nhr=$R(43,"="),Ihr=MR(43),Rhr=/^[0-9a-fA-F]{96}$/,Lhr=$R(64,""),khr=MR(64),$hr=/^[0-9a-fA-F]{128}$/,Mhr=$R(86,"=="),Fhr=MR(86);var Li=ue("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),c3e={number:"number",bigint:"bigint",object:"date"},c3=ue("$ZodCheckLessThan",(t,e)=>{Li.init(t,e);let r=c3e[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,a=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),u3=ue("$ZodCheckGreaterThan",(t,e)=>{Li.init(t,e);let r=c3e[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,a=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),tae=ue("$ZodCheckMultipleOf",(t,e)=>{Li.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):mie(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),rae=ue("$ZodCheckNumberFormat",(t,e)=>{Li.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,a]=Eie[e.format];t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,s.minimum=i,s.maximum=a,r&&(s.pattern=Yie)}),t._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s)){o.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inst:t})}}),nae=ue("$ZodCheckBigIntFormat",(t,e)=>{Li.init(t,e);let[r,n]=_ie[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=r,a.maximum=n}),t._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inst:t})}}),iae=ue("$ZodCheckMaxSize",(t,e)=>{var r;Li.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Fb(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;i.size<=e.maximum||n.issues.push({origin:NR(i),code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),aae=ue("$ZodCheckMinSize",(t,e)=>{var r;Li.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Fb(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;i.size>=e.minimum||n.issues.push({origin:NR(i),code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),oae=ue("$ZodCheckSizeEquals",(t,e)=>{var r;Li.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Fb(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=n=>{let i=n.value,a=i.size;if(a===e.size)return;let o=a>e.size;n.issues.push({origin:NR(i),...o?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),sae=ue("$ZodCheckMaxLength",(t,e)=>{var r;Li.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Fb(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let o=IR(i);n.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),cae=ue("$ZodCheckMinLength",(t,e)=>{var r;Li.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Fb(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let o=IR(i);n.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),uae=ue("$ZodCheckLengthEquals",(t,e)=>{var r;Li.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Fb(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,a=i.length;if(a===e.length)return;let o=IR(i),s=a>e.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),cx=ue("$ZodCheckStringFormat",(t,e)=>{var r,n;Li.init(t,e),t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),lae=ue("$ZodCheckRegex",(t,e)=>{cx.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),pae=ue("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Zie),cx.init(t,e)}),fae=ue("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=eae),cx.init(t,e)}),dae=ue("$ZodCheckIncludes",(t,e)=>{Li.init(t,e);let r=wh(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),hae=ue("$ZodCheckStartsWith",(t,e)=>{Li.init(t,e);let r=new RegExp(`^${wh(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),mae=ue("$ZodCheckEndsWith",(t,e)=>{Li.init(t,e);let r=new RegExp(`.*${wh(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function s3e(t,e,r){t.issues.length&&e.issues.push(...Hl(r,t.issues))}var gae=ue("$ZodCheckProperty",(t,e)=>{Li.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>s3e(i,r,e.property));s3e(n,r,e.property)}}),yae=ue("$ZodCheckMimeType",(t,e)=>{Li.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),vae=ue("$ZodCheckOverwrite",(t,e)=>{Li.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var FR=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
1580
1580
|
`).filter(o=>o),i=Math.min(...n.map(o=>o.length-o.trimStart().length)),a=n.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(let o of a)this.content.push(o)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(a=>` ${a}`)];return new e(...r,i.join(`
|
|
1581
1581
|
`))}};var bae={major:4,minor:1,patch:5};var ir=ue("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=bae;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let a of i._zod.onattach)a(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(o,s,c)=>{let u=qb(o),l;for(let p of s){if(p._zod.def.when){if(!p._zod.def.when(o))continue}else if(u)continue;let d=o.issues.length,f=p._zod.check(o);if(f instanceof Promise&&c?.async===!1)throw new bd;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,o.issues.length!==d&&(u||(u=qb(o,d)))});else{if(o.issues.length===d)continue;u||(u=qb(o,d))}}return l?l.then(()=>o):o},a=(o,s,c)=>{if(qb(o))return o.aborted=!0,o;let u=i(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new bd;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(o,s)=>{if(s.skipChecks)return t._zod.parse(o,s);if(s.direction==="backward"){let u=t._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>a(l,o,s)):a(u,o,s)}let c=t._zod.parse(o,s);if(c instanceof Promise){if(s.async===!1)throw new bd;return c.then(u=>i(u,n,s))}return i(c,n,s)}}t["~standard"]={validate:i=>{try{let a=Sie(t,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Aie(t,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}}),TT=ue("$ZodString",(t,e)=>{ir.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??zie(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),li=ue("$ZodStringFormat",(t,e)=>{cx.init(t,e),TT.init(t,e)}),_ae=ue("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Rie),li.init(t,e)}),Tae=ue("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=_T(n))}else e.pattern??(e.pattern=_T());li.init(t,e)}),Oae=ue("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Lie),li.init(t,e)}),Sae=ue("$ZodURL",(t,e)=>{li.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Uie.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Aae=ue("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=kie()),li.init(t,e)}),Cae=ue("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Nie),li.init(t,e)}),xae=ue("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Cie),li.init(t,e)}),Pae=ue("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=xie),li.init(t,e)}),Dae=ue("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Pie),li.init(t,e)}),wae=ue("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Die),li.init(t,e)}),Nae=ue("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=wie),li.init(t,e)}),Iae=ue("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Gie(e)),li.init(t,e)}),Rae=ue("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Bie),li.init(t,e)}),Lae=ue("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Hie(e)),li.init(t,e)}),kae=ue("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Iie),li.init(t,e)}),$ae=ue("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=$ie),li.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),Mae=ue("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Mie),li.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Fae=ue("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Fie),li.init(t,e)}),jae=ue("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=jie),li.init(t,e),t._zod.check=r=>{let[n,i]=r.value.split("/");try{if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Vae(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Uae=ue("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Vie),li.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Vae(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function E3e(t){if(!s3.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Vae(r)}var qae=ue("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=s3),li.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{E3e(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Bae=ue("$ZodE164",(t,e)=>{e.pattern??(e.pattern=qie),li.init(t,e)});function _3e(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}var Hae=ue("$ZodJWT",(t,e)=>{li.init(t,e),t._zod.check=r=>{_3e(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Gae=ue("$ZodCustomStringFormat",(t,e)=>{li.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),m3=ue("$ZodNumber",(t,e)=>{ir.init(t,e),t._zod.pattern=t._zod.bag.pattern??Wie,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...a?{received:a}:{}}),r}}),zae=ue("$ZodNumber",(t,e)=>{rae.init(t,e),m3.init(t,e)}),jR=ue("$ZodBoolean",(t,e)=>{ir.init(t,e),t._zod.pattern=Xie,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),g3=ue("$ZodBigInt",(t,e)=>{ir.init(t,e),t._zod.pattern=Kie,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Kae=ue("$ZodBigInt",(t,e)=>{nae.init(t,e),g3.init(t,e)}),Yae=ue("$ZodSymbol",(t,e)=>{ir.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:t}),r}}),Wae=ue("$ZodUndefined",(t,e)=>{ir.init(t,e),t._zod.pattern=Qie,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:t}),r}}),Xae=ue("$ZodNull",(t,e)=>{ir.init(t,e),t._zod.pattern=Jie,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),Jae=ue("$ZodAny",(t,e)=>{ir.init(t,e),t._zod.parse=r=>r}),Qae=ue("$ZodUnknown",(t,e)=>{ir.init(t,e),t._zod.parse=r=>r}),Zae=ue("$ZodNever",(t,e)=>{ir.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),eoe=ue("$ZodVoid",(t,e)=>{ir.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:t}),r}}),toe=ue("$ZodDate",(t,e)=>{ir.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:t}),r}});function l3e(t,e,r){t.issues.length&&e.issues.push(...Hl(r,t.issues)),e.value[r]=t.value}var roe=ue("$ZodArray",(t,e)=>{ir.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let a=[];for(let o=0;o<i.length;o++){let s=i[o],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?a.push(c.then(u=>l3e(u,r,o))):l3e(c,r,o)}return a.length?Promise.all(a).then(()=>r):r}});function h3(t,e,r,n){t.issues.length&&e.issues.push(...Hl(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function T3e(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape[n]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=bie(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function O3e(t,e,r,n,i,a){let o=[],s=i.keySet,c=i.catchall._zod,u=c.def.type;for(let l of Object.keys(e)){if(s.has(l))continue;if(u==="never"){o.push(l);continue}let p=c.run({value:e[l],issues:[]},n);p instanceof Promise?t.push(p.then(d=>h3(d,r,l,e))):h3(p,r,l,e)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:a}),t.length?Promise.all(t).then(()=>r):r}var S3e=ue("$ZodObject",(t,e)=>{ir.init(t,e);let r=rx(()=>T3e(e));Yr(t._zod,"propValues",()=>{let o=e.shape,s={};for(let c in o){let u=o[c]._zod;if(u.values){s[c]??(s[c]=new Set);for(let l of u.values)s[c].add(l)}}return s});let n=ET,i=e.catchall,a;t._zod.parse=(o,s)=>{a??(a=r.value);let c=o.value;if(!n(c))return o.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),o;o.value={};let u=[],l=a.shape;for(let p of a.keys){let f=l[p]._zod.run({value:c[p],issues:[]},s);f instanceof Promise?u.push(f.then(h=>h3(h,o,p,c))):h3(f,o,p,c)}return i?O3e(u,c,o,s,r.value,t):u.length?Promise.all(u).then(()=>o):o}}),noe=ue("$ZodObjectJIT",(t,e)=>{S3e.init(t,e);let r=t._zod.parse,n=rx(()=>T3e(e)),i=d=>{let f=new FR(["shape","payload","ctx"]),h=n.value,m=O=>{let A=WB(O);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};f.write("const input = payload.value;");let v=Object.create(null),_=0;for(let O of h.keys)v[O]=`key_${_++}`;f.write("const newResult = {}");for(let O of h.keys){let A=v[O],C=WB(O);f.write(`const ${A} = ${m(O)};`),f.write(`
|
|
@@ -1600,7 +1600,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
1600
1600
|
`,c+=`${l.document.content}
|
|
1601
1601
|
`,c+=`---
|
|
1602
1602
|
|
|
1603
|
-
`;return c}else return{query:r,searchType:"hybrid",results:s.map(c=>({title:c.document.title,category:c.document.category,path:c.document.path,score:c.score,matches:[],excerpt:c.document.metadata?.excerpt,content:c.document.content,uri:`sap-fiori://docs/${c.document.category}/${c.document.id}`})),total:s.length}}catch(i){return kt.warn(`Embeddings data not available, providing limited search capability: ${i}`),{query:r,searchType:"limited_fallback",error:"Embeddings data not available. Please install @sap-ux/fiori-docs-embeddings for full search capabilities.",results:[],total:0,suggestion:"Try running: npm install -g @sap-ux/fiori-docs-embeddings"}}}var sK=Tt(kd()),Ext=require("node:path");async function GSe(t){let{searchPath:e=[]}=t,n=(await(0,sK.findFioriArtifacts)({wsFolders:e,artifacts:["applications"]})).applications??[];return{applications:await Promise.all(n.map(async i=>{let a=await(0,sK.getProjectType)(i.projectRoot);return{name:i.manifest["sap.app"]?.id??(0,Ext.basename)(i.appRoot),appPath:i.appRoot,projectPath:i.projectRoot,projectType:a,odataVersion:i.manifest["sap.app"]?.dataSources?.mainService?.settings?.odataVersion??"4.0"}}))??[]}}var zwt=Tt(mc());var sr=t=>typeof t=="string",JF=()=>{let t,e,r=new Promise((n,i)=>{t=n,e=i});return r.resolve=t,r.reject=e,r},HDt=t=>t==null?"":""+t,xbn=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},Pbn=/###/g,GDt=t=>t&&t.indexOf("###")>-1?t.replace(Pbn,"."):t,zDt=t=>!t||sr(t),QF=(t,e,r)=>{let n=sr(e)?e.split("."):e,i=0;for(;i<n.length-1;){if(zDt(t))return{};let a=GDt(n[i]);!t[a]&&r&&(t[a]=new r),Object.prototype.hasOwnProperty.call(t,a)?t=t[a]:t={},++i}return zDt(t)?{}:{obj:t,k:GDt(n[i])}},KDt=(t,e,r)=>{let{obj:n,k:i}=QF(t,e,Object);if(n!==void 0||e.length===1){n[i]=r;return}let a=e[e.length-1],o=e.slice(0,e.length-1),s=QF(t,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=QF(t,o,Object),s?.obj&&typeof s.obj[`${s.k}.${a}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=r},Dbn=(t,e,r,n)=>{let{obj:i,k:a}=QF(t,e,Object);i[a]=i[a]||[],i[a].push(r)},EK=(t,e)=>{let{obj:r,k:n}=QF(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},wbn=(t,e,r)=>{let n=EK(t,r);return n!==void 0?n:EK(e,r)},rwt=(t,e,r)=>{for(let n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?sr(t[n])||t[n]instanceof String||sr(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):rwt(t[n],e[n],r):t[n]=e[n]);return t},SD=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Nbn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},Ibn=t=>sr(t)?t.replace(/[&<>"'\/]/g,e=>Nbn[e]):t,tAe=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}},Rbn=[" ",",","?","!",";"],Lbn=new tAe(20),kbn=(t,e,r)=>{e=e||"",r=r||"";let n=Rbn.filter(o=>e.indexOf(o)<0&&r.indexOf(o)<0);if(n.length===0)return!0;let i=Lbn.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),a=!i.test(t);if(!a){let o=t.indexOf(r);o>0&&!i.test(t.substring(0,o))&&(a=!0)}return a},rAe=(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 o,s="";for(let c=a;c<n.length;++c)if(c!==a&&(s+=r),s+=n[c],o=i[s],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<n.length-1)continue;a+=c-a+1;break}i=o}return i},ZF=t=>t?.replace("_","-"),$bn={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)}},nAe=class t{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||$bn,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,i){return i&&!this.debug?null:(sr(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new t(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new t(this.logger,e)}},Pm=new nAe,AD=class{constructor(){this.observers={}}on(e,r){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let i=this.observers[n].get(r)||0;this.observers[n].set(r,i+1)}),this}off(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i.apply(i,[e,...r])})}},_K=class extends AD{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,r,n,i={}){let a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,s;e.indexOf(".")>-1?s=e.split("."):(s=[e,r],n&&(Array.isArray(n)?s.push(...n):sr(n)&&a?s.push(...n.split(a)):s.push(n)));let c=EK(this.data,s);return!c&&!r&&!n&&e.indexOf(".")>-1&&(e=s[0],r=s[1],n=s.slice(2).join(".")),c||!o||!sr(n)?c:rAe(this.data?.[e]?.[r],n,a)}addResource(e,r,n,i,a={silent:!1}){let o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,s=[e,r];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(s=e.split("."),i=r,r=s[1]),this.addNamespaces(r),KDt(this.data,s,i),a.silent||this.emit("added",e,r,n,i)}addResources(e,r,n,i={silent:!1}){for(let a in n)(sr(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,o={silent:!1,skipCopy:!1}){let s=[e,r];e.indexOf(".")>-1&&(s=e.split("."),i=n,n=r,r=s[1]),this.addNamespaces(r);let c=EK(this.data,s)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?rwt(c,n,a):c={...c,...n},KDt(this.data,s,c),o.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},nwt={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}},YDt={},WDt=t=>!sr(t)&&typeof t!="boolean"&&typeof t!="number",TK=class t extends AD{constructor(e,r={}){super(),xbn(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Pm.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){let n={...r};return e==null?!1:this.resolve(e,n)?.res!==void 0}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||[],o=n&&e.indexOf(n)>-1,s=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!kbn(e,n,i);if(o&&!s){let c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:sr(a)?[a]:a};let u=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(u[0])>-1)&&(a=u.shift()),e=u.join(i)}return{key:e,namespaces:sr(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 options=="object"&&(i={...i}),i||(i={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);let a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:s,namespaces:c}=this.extractFromKey(e[e.length-1],i),u=c[c.length-1],l=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");let p=i.lng||this.language,d=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p?.toLowerCase()==="cimode")return d?a?{res:`${u}${l}${s}`,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${l}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:s;let f=this.resolve(e,i),h=f?.res,m=f?.usedKey||s,v=f?.exactUsedKey||s,_=["[object Number]","[object Function]","[object RegExp]"],T=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,A=i.count!==void 0&&!sr(i.count),C=t.hasDefaultValue(i),P=A?this.pluralResolver.getSuffix(p,i.count,i):"",I=i.ordinal&&A?this.pluralResolver.getSuffix(p,i.count,{ordinal:!1}):"",$=A&&!i.ordinal&&i.count===0,R=$&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${P}`]||i[`defaultValue${I}`]||i.defaultValue,G=h;O&&!h&&C&&(G=R);let L=WDt(G),U=Object.prototype.toString.apply(G);if(O&&G&&L&&_.indexOf(U)<0&&!(sr(T)&&Array.isArray(G))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let H=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,G,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(f.res=H,f.usedParams=this.getUsedParamsDetails(i),f):H}if(o){let H=Array.isArray(G),K=H?[]:{},V=H?v:m;for(let q in G)if(Object.prototype.hasOwnProperty.call(G,q)){let Y=`${V}${o}${q}`;C&&!h?K[q]=this.translate(Y,{...i,defaultValue:WDt(R)?R[q]:void 0,joinArrays:!1,ns:c}):K[q]=this.translate(Y,{...i,joinArrays:!1,ns:c}),K[q]===Y&&(K[q]=G[q])}h=K}}else if(O&&sr(T)&&Array.isArray(h))h=h.join(T),h&&(h=this.extendTranslation(h,e,i,n));else{let H=!1,K=!1;!this.isValidLookup(h)&&C&&(H=!0,h=R),this.isValidLookup(h)||(K=!0,h=s);let q=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&K?void 0:h,Y=C&&R!==h&&this.options.updateMissing;if(K||H||Y){if(this.logger.log(Y?"updateKey":"missingKey",p,u,s,Y?R:h),o){let le=this.resolve(s,{...i,keySeparator:!1});le&&le.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 W=[],ie=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ie&&ie[0])for(let le=0;le<ie.length;le++)W.push(ie[le]);else this.options.saveMissingTo==="all"?W=this.languageUtils.toResolveHierarchy(i.lng||this.language):W.push(i.lng||this.language);let be=(le,je,Qe)=>{let Ve=C&&Qe!==h?Qe:q;this.options.missingKeyHandler?this.options.missingKeyHandler(le,u,je,Ve,Y,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(le,u,je,Ve,Y,i),this.emit("missingKey",le,u,je,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&A?W.forEach(le=>{let je=this.pluralResolver.getSuffixes(le,i);$&&i[`defaultValue${this.options.pluralSeparator}zero`]&&je.indexOf(`${this.options.pluralSeparator}zero`)<0&&je.push(`${this.options.pluralSeparator}zero`),je.forEach(Qe=>{be([le],s+Qe,i[`defaultValue${Qe}`]||R)})}):be(W,s,R))}h=this.extendTranslation(h,e,i,f,n),K&&h===s&&this.options.appendNamespaceToMissingKey&&(h=`${u}${l}${s}`),(K||H)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${l}${s}`:s,H?h:void 0,i))}return a?(f.res=h,f.usedParams=this.getUsedParamsDetails(i),f):h}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 c=sr(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(c){let p=e.match(this.interpolator.nestingRegexp);u=p&&p.length}let l=n.replace&&!sr(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||i.usedLng,n),c){let p=e.match(this.interpolator.nestingRegexp),d=p&&p.length;u<d&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...p)=>a?.[0]===p[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${r[0]}`),null):this.translate(...p,r),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,s=sr(o)?[o]:o;return e!=null&&s?.length&&n.applyPostProcessor!==!1&&(e=nwt.handle(s,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,i,a,o,s;return sr(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(n))return;let u=this.extractFromKey(c,r),l=u.key;i=l;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));let d=r.count!==void 0&&!sr(r.count),f=d&&!r.ordinal&&r.count===0,h=r.context!==void 0&&(sr(r.context)||typeof r.context=="number")&&r.context!=="",m=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);p.forEach(v=>{this.isValidLookup(n)||(s=v,!YDt[`${m[0]}-${v}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(YDt[`${m[0]}-${v}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(_=>{if(this.isValidLookup(n))return;o=_;let T=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(T,l,_,v,r);else{let A;d&&(A=this.pluralResolver.getSuffix(_,r.count,r));let C=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(T.push(l+A),r.ordinal&&A.indexOf(P)===0&&T.push(l+A.replace(P,this.options.pluralSeparator)),f&&T.push(l+C)),h){let I=`${l}${this.options.contextSeparator}${r.context}`;T.push(I),d&&(T.push(I+A),r.ordinal&&A.indexOf(P)===0&&T.push(I+A.replace(P,this.options.pluralSeparator)),f&&T.push(I+C))}}let O;for(;O=T.pop();)this.isValidLookup(n)||(a=O,n=this.getResource(_,v,O,r))}))})}),{res:n,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,i):this.resourceStore.getResource(e,r,n,i)}getUsedParamsDetails(e={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!sr(e.replace),i=n?e.replace:e;if(n&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let 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)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}},OK=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Pm.create("languageUtils")}getScriptPartFromCode(e){if(e=ZF(e),!e||e.indexOf("-")<0)return null;let r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=ZF(e),!e||e.indexOf("-")<0)return e;let r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(sr(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&e.forEach(n=>{if(r)return;let i=this.getScriptPartFromCode(n);if(this.isSupportedCode(i))return r=i;let a=this.getLanguagePartFromCode(n);if(this.isSupportedCode(a))return r=a;r=this.options.supportedLngs.find(o=>{if(o===a)return o;if(!(o.indexOf("-")<0&&a.indexOf("-")<0)&&(o.indexOf("-")>0&&a.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===a||o.indexOf(a)===0&&a.length>1))return o})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),sr(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),i=[],a=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return sr(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(e))):sr(e)&&a(this.formatLanguageCode(e)),n.forEach(o=>{i.indexOf(o)<0&&a(this.formatLanguageCode(o))}),i}},XDt={zero:0,one:1,two:2,few:3,many:4,other:5},JDt={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},iAe=class{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=Pm.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,r){this.rules[e]=r}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){let n=ZF(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 o;try{o=new Intl.PluralRules(n,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),JDt;if(!e.match(/-|_/))return JDt;let c=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(c,r)}return this.pluralRulesCache[a]=o,o}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(i=>`${r}${i}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,a)=>XDt[i]-XDt[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))}},QDt=(t,e,r,n=".",i=!0)=>{let a=wbn(t,e,r);return!a&&i&&sr(r)&&(a=rAe(t,r,n),a===void 0&&(a=rAe(e,r,n))),a},eAe=t=>t.replace(/\$/g,"$$$$"),aAe=class{constructor(e={}){this.logger=Pm.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:o,suffix:s,suffixEscaped:c,formatSeparator:u,unescapeSuffix:l,unescapePrefix:p,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:h,nestingSuffixEscaped:m,nestingOptionsSeparator:v,maxReplaces:_,alwaysFormat:T}=e.interpolation;this.escape=r!==void 0?r:Ibn,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=a?SD(a):o||"{{",this.suffix=s?SD(s):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=l?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=d?SD(d):f||SD("$t("),this.nestingSuffix=h?SD(h):m||SD(")"),this.nestingOptionsSeparator=v||",",this.maxReplaces=_||1e3,this.alwaysFormat=T!==void 0?T:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,r,n,i){let a,o,s,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=f=>{if(f.indexOf(this.formatSeparator)<0){let _=QDt(r,c,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(_,void 0,n,{...i,...r,interpolationkey:f}):_}let h=f.split(this.formatSeparator),m=h.shift().trim(),v=h.join(this.formatSeparator).trim();return this.format(QDt(r,c,m,this.options.keySeparator,this.options.ignoreJSONStructure),v,n,{...i,...r,interpolationkey:m})};this.resetRegExp();let l=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>eAe(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?eAe(this.escape(f)):eAe(f)}].forEach(f=>{for(s=0;a=f.regex.exec(e);){let h=a[1].trim();if(o=u(h),o===void 0)if(typeof l=="function"){let v=l(e,a,i);o=sr(v)?v:""}else if(i&&Object.prototype.hasOwnProperty.call(i,h))o="";else if(p){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${h} for interpolating ${e}`),o="";else!sr(o)&&!this.useRawValueToEscape&&(o=HDt(o));let m=f.safeValue(o);if(e=e.replace(a[0],m),p?(f.regex.lastIndex+=o.length,f.regex.lastIndex-=a[0].length):f.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,r,n={}){let i,a,o,s=(c,u)=>{let l=this.nestingOptionsSeparator;if(c.indexOf(l)<0)return c;let p=c.split(new RegExp(`${l}[ ]*{`)),d=`{${p[1]}`;c=p[0],d=this.interpolate(d,o);let f=d.match(/'/g),h=d.match(/"/g);((f?.length??0)%2===0&&!h||h.length%2!==0)&&(d=d.replace(/'/g,'"'));try{o=JSON.parse(d),u&&(o={...u,...o})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${l}${d}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(e);){let c=[];o={...n},o=o.replace&&!sr(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(c=i[1].slice(u).split(this.formatSeparator).map(l=>l.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),a=r(s.call(this,i[1].trim(),o),o),a&&i[0]===e&&!sr(a))return a;sr(a)||(a=HDt(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),a=""),c.length&&(a=c.reduce((l,p)=>this.format(l,p,n.lng,{...n,interpolationkey:i[1].trim()}),a.trim())),e=e.replace(i[0],a),this.regexp.lastIndex=0}return e}},Mbn=t=>{let e=t.toLowerCase().trim(),r={};if(t.indexOf("(")>-1){let n=t.split("(");e=n[0].toLowerCase().trim();let i=n[1].substring(0,n[1].length-1);e==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(o=>{if(o){let[s,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),l=s.trim();r[l]||(r[l]=u),u==="false"&&(r[l]=!1),u==="true"&&(r[l]=!0),isNaN(u)||(r[l]=parseInt(u,10))}})}return{formatName:e,formatOptions:r}},ZDt=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 o=n+JSON.stringify(a),s=e[o];return s||(s=t(ZF(n),i),e[o]=s),s(r)}},Fbn=t=>(e,r,n)=>t(ZF(r),n)(e),oAe=class{constructor(e={}){this.logger=Pm.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?ZDt:Fbn;this.formats={number:n((i,a)=>{let o=new Intl.NumberFormat(i,{...a});return s=>o.format(s)}),currency:n((i,a)=>{let o=new Intl.NumberFormat(i,{...a,style:"currency"});return s=>o.format(s)}),datetime:n((i,a)=>{let o=new Intl.DateTimeFormat(i,{...a});return s=>o.format(s)}),relativetime:n((i,a)=>{let o=new Intl.RelativeTimeFormat(i,{...a});return s=>o.format(s,a.range||"day")}),list:n((i,a)=>{let o=new Intl.ListFormat(i,{...a});return s=>o.format(s)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=ZDt(r)}format(e,r,n,i={}){let a=r.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(s=>s.indexOf(")")>-1)){let s=a.findIndex(c=>c.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,s)].join(this.formatSeparator)}return a.reduce((s,c)=>{let{formatName:u,formatOptions:l}=Mbn(c);if(this.formats[u]){let p=s;try{let d=i?.formatParams?.[i.interpolationkey]||{},f=d.locale||d.lng||i.locale||i.lng||n;p=this.formats[u](s,f,{...l,...i,...d})}catch(d){this.logger.warn(d)}return p}else this.logger.warn(`there was no format function for ${u}`);return s},e)}},jbn=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)},sAe=class extends AD{constructor(e,r,n,i={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=Pm.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={},o={},s={},c={};return e.forEach(u=>{let l=!0;r.forEach(p=>{let d=`${u}|${p}`;!n.reload&&this.store.hasResourceBundle(u,p)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?o[d]===void 0&&(o[d]=!0):(this.state[d]=1,l=!1,o[d]===void 0&&(o[d]=!0),a[d]===void 0&&(a[d]=!0),c[p]===void 0&&(c[p]=!0)))}),l||(s[u]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(c)}}loaded(e,r,n){let i=e.split("|"),a=i[0],o=i[1];r&&this.emit("failedLoading",a,o,r),!r&&n&&this.store.addResourceBundle(a,o,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);let s={};this.queue.forEach(c=>{Dbn(c.loaded,[a],o),jbn(c,e),r&&c.errors.push(r),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{s[u]||(s[u]={});let l=c.loaded[u];l.length&&l.forEach(p=>{s[u][p]===void 0&&(s[u][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(c=>!c.done)}read(e,r,n,i=0,a=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:i,wait:a,callback:o});return}this.readingCalls++;let s=(u,l)=>{if(this.readingCalls--,this.waitingReads.length>0){let p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&l&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,i+1,a*2,o)},a);return}o(u,l)},c=this.backend[n].bind(this.backend);if(c.length===2){try{let u=c(e,r);u&&typeof u.then=="function"?u.then(l=>s(null,l)).catch(s):s(null,u)}catch(u){s(u)}return}return c(e,r,s)}prepareLoading(e,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();sr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),sr(r)&&(r=[r]);let a=this.queueLoad(e,r,n,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(o=>{this.loadOne(o)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){let n=e.split("|"),i=n[0],a=n[1];this.read(i,a,"read",void 0,void 0,(o,s)=>{o&&this.logger.warn(`${r}loading namespace ${a} for language ${i} failed`,o),!o&&s&&this.logger.log(`${r}loaded namespace ${a} for language ${i}`,s),this.loaded(e,o,s)})}saveMissing(e,r,n,i,a,o={},s=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){let c={...o,isUpdate:a},u=this.backend.create.bind(this.backend);if(u.length<6)try{let l;u.length===5?l=u(e,r,n,i,c):l=u(e,r,n,i),l&&typeof l.then=="function"?l.then(p=>s(null,p)).catch(s):s(null,l)}catch(l){s(l)}else u(e,r,n,i,s,c)}!e||!e[0]||this.store.addResource(e[0],r,n,i)}}},ewt=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),sr(t[1])&&(e.defaultValue=t[1]),sr(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){let r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),twt=t=>(sr(t.ns)&&(t.ns=[t.ns]),sr(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),sr(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),bK=()=>{},Vbn=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})},SK=class t extends AD{constructor(e={},r){if(super(),this.options=twt(e),this.services={},this.logger=Pm,this.modules={external:[]},Vbn(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(sr(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));let n=ewt();this.options={...n,...this.options,...twt(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);let i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Pm.init(i(this.modules.logger),this.options):Pm.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=oAe;let l=new OK(this.options);this.store=new _K(this.options.resources,this.options);let p=this.services;p.logger=Pm,p.resourceStore=this.store,p.languageUtils=l,p.pluralResolver=new iAe(l,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(p.formatter=i(u),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new aAe(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new sAe(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new TK(this.services,this.options),this.translator.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,r||(r=bK),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...l)=>this.store[u](...l)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...l)=>(this.store[u](...l),this)});let s=JF(),c=()=>{let u=(l,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(p),r(l,p)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),s}loadResources(e,r=bK){let n=r,i=sr(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let a=[],o=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{u!=="cimode"&&a.indexOf(u)<0&&a.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload?.forEach?.(s=>o(s)),this.services.backendConnector.load(a,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(s)})}else n(null)}reloadResources(e,r,n){let i=JF();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=bK),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"&&nwt.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let n=JF();this.emit("languageChanging",e);let i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?this.isLanguageChangingTo===e&&(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),r&&r(s,(...u)=>this.t(...u))},o=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);let c=sr(s)?s:s&&s[0],u=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(sr(s)?[s]:s);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,l=>{a(l,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),n}getFixedT(e,r,n){let i=(a,o,...s)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([a,o].concat(s)):c={...o},c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||n||i.keyPrefix);let u=this.options.keySeparator||".",l;return c.keyPrefix&&Array.isArray(a)?l=a.map(p=>`${c.keyPrefix}${u}${p}`):l=c.keyPrefix?`${c.keyPrefix}${u}${a}`:a,this.t(l,c)};return sr(e)?i.lng=e:i.lngs=e,i.ns=r,i.keyPrefix=n,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let o=(s,c)=>{let u=this.services.backendConnector.state[`${s}|${c}`];return u===-1||u===0||u===2};if(r.precheck){let s=r.precheck(this,o);if(s!==void 0)return s}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,e)&&(!i||o(a,e)))}loadNamespaces(e,r){let n=JF();return this.options.ns?(sr(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){let n=JF();sr(e)&&(e=[e]);let i=this.options.preload||[],a=e.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return a.length?(this.options.preload=i.concat(a),this.loadResources(o=>{n.resolve(),r&&r(o)}),n):(r&&r(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";if(Intl.Locale){let i=new Intl.Locale(e);if(i&&i.getTextInfo){let a=i.getTextInfo();if(a&&a.direction)return a.direction}}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 OK(ewt());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){return new t(e,r)}cloneInstance(e={},r=bK){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(s=>{a[s]=this[s]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n){let s=Object.keys(this.store.data).reduce((c,u)=>(c[u]={...this.store.data[u]},c[u]=Object.keys(c[u]).reduce((l,p)=>(l[p]={...c[u][p]},l),c[u]),c),{});a.store=new _K(s,i),a.services.resourceStore=a.store}return a.translator=new TK(a.services,i),a.translator.on("*",(s,...c)=>{a.emit(s,...c)}),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}}},Et=SK.createInstance();Et.createInstance=SK.createInstance;var t1i=Et.createInstance,r1i=Et.dir,n1i=Et.init,i1i=Et.loadResources,a1i=Et.reloadResources,o1i=Et.use,s1i=Et.changeLanguage,c1i=Et.getFixedT,u1i=Et.t,l1i=Et.exists,p1i=Et.setDefaultNamespace,f1i=Et.hasLoadedNamespace,d1i=Et.loadNamespaces,h1i=Et.loadLanguages;var e2=Tt(mc());var iwt="genericActions";var AK="DataFieldForAction",CK="DataFieldForIntentBasedNavigation",awt="DataFieldForActionGroup",cAe="::",t2="customView(";var uAe=new Map([[e2.v2.TableTypeV2.ResponsiveTable,"ResponsiveTableColumnsExtension"],[e2.v2.TableTypeV2.GridTable,"GridTableColumnsExtension"],[e2.v2.TableTypeV2.AnalyticalTable,"AnalyticalTableColumnsExtension"],[e2.v2.TableTypeV2.TreeTable,"TreeTableColumnsExtension"]]),CD="annotation",ho="schema";var lAe="Facet ID: ",owt=new Map([...uAe.entries()].map(([t,e])=>[e,t]));var swt="@com.sap.vocabularies.UI.v1";var cwt="annotation",uwt="service",lwt="ui5";var xK=class{schema;value;pattern;freeText;disabled;state=0;description;required;isAtomic;i18nClassification;name;displayName;artifactType;minimum;messages;locations;constructor(e,r){this.schema=structuredClone(e),this.name=r}};function f_(t){return t?.tooComplex===!0}var fwt=new Map;fwt.set("com.sap.vocabularies.UI.v1.HeaderInfo",new Set(["com.sap.vocabularies.UI.v1.HeaderFacets","com.sap.vocabularies.UI.v1.Identification"]));var Ubn=["com.sap.vocabularies.UI.v1.DeleteHidden","com.sap.vocabularies.UI.v1.UpdateHidden"],pwt=t=>(t||"").split("/@").pop()||"";function dwt(t,e){let r=t.nodes.find(n=>n?.nodeId&&n.nodeId[0]===e[0]);for(let n=1;n<e.length;n++){if(r&&f_(r))return r;r=r?.subnodes.find(i=>i.nodeId[n]===e[n])}return r}function hwt(t){return f_(t)?t.tooComplexLocations??[]:t.location?[t.location]:[]}function pAe(t,e,r,n){let i=qbn(e,n);for(let a of i){let o=e[a],s=o.annotationPath.split("/").map((c,u)=>u===1?c.split(".").slice(-1)[0]??c:c).join("/");if(t===o.annotationPath||t===s)return o;if(!r&&!f_(o)&&o.subnodes.length>0){let c=pAe(t,o.subnodes,void 0,n);if(c)return c}}}function mwt(t,e,r,n,i){let a=pwt(t),o=pAe(t,r,void 0,i);return!o&&Ubn.includes(a)&&(o=e.find(c=>c.nodeType===iwt)?.subnodes.find(c=>c.annotationPath===t)),!o&&fwt.get(pwt(n))?.has(a)&&(o=pAe(t,e,!0,i)),o}function qbn(t,e){let r=[];e!==void 0&&t.length>e&&r.push(e);for(let n=0;n<t.length;n++)n!==e&&r.push(n);return r}var fAe="i18n",Bbn=(t="",e=!1,r)=>{if(/^{{[^\\{}:]+}}$/.exec(t)&&(!e||r))return t.toString().substring(2,t.length-2);let n=e?`(${fAe}|@${fAe})`:`${fAe}`,i=e?2:1,a=new RegExp(`^{${n}>([^\\{}:]+)}$`).exec(t);return a?a[i]:void 0},dAe=(t,e={})=>{let r=Bbn(t,!0,!0);if(r){let n=e[r];if(n?.length>0)return n[0].value?.value}},gwt=(t,e,r,n="EDMXBackend")=>["CAPJava","CAPNodejs"].includes(n)&&!t&&e?uwt:r?cwt:lwt;var SS=(t,e)=>!t||!e?t===e:t.length===e.length&&t.every(function(r,n){return r===e[n]}),hAe=(t,e)=>{if(!t||!e||e.length>t.length)return!1;let r=t.length-1,n=e.length-1;for(;n>=0;){if(e[n]!==t[r])return!1;r--,n--}return!0},AS=(t,e)=>{let r=t;for(let n of e)if(n!==void 0)if(typeof r=="object"&&n in r)r=r[n];else return;return r};var Hbn=()=>({bundles:{annotation:{},app:{},service:{},ui5:{}}}),xD=(t,e=!1)=>{let r=t[t.length-1];if(r){let n=r.toString(),i=n.includes(":::")?":::":"::",a=r.toString().split(i);if(n=a[0],!e&&a.length>1&&(a.splice(0,1),n=a.join("/")),n)return n}},vwt=(t,e)=>{let r,n=0,i=!1;for(let o in t.aggregations)t.aggregations[o].custom?i=!0:(r=n>0?void 0:t.aggregations[o],n++);if(!i||!r?.actions)return;let a=r.actions.findIndex(o=>o==="Delete"||typeof o=="object"&&o.type==="Delete");if(a!==-1){let o=r.actions[a];typeof o!="object"&&(o={type:o}),o.disabled=!0,o.title=Et.t(e),r.actions[a]=o}},ov=(t,e,r,n)=>{e||(t.state=1,t.messages=[{text:r,type:"warning"}],t.inactive=!0,n&&t.properties[n]&&mAe(t.properties[n],[{text:r}]))},PD=(t,e=t.value)=>{let r=e&&typeof e=="object"?e:{},n="key"in r&&!!r.key;ov(t,n,Et.t("PAGE_EDITOR_CUSTOM_EXTENSION_NO_KEY"),"key")};var DK=(t,e)=>{let r=t.name==="position"?t.parent?.name:t.name;if(e.enum){let n={...e,enum:[...e.enum]},i=n.enum.findIndex(a=>a===r);return i!==-1&&n.enum.splice(i,1),n}else if(e.oneOf){let n=Hbn(),i={...e,oneOf:[...e.oneOf]};for(let a=0;a<i.oneOf.length;a++){let o=i.oneOf[a];o.bundle=gwt(o.custom,!0,!!o.annotationNodeId,n.projectType),o.const===r&&(i.oneOf[a]={...o,hidden:!0})}return i}return e};function mAe(t,e){t.messages??=[],t.messages.push(...e)}function gAe(t){let e="",r=!0;for(let n=0;n<t.length;n++){let i=t[n];if(i==="_"||i==="-"||i===" "){e.endsWith(" ")||(e+=" "),r=!0;continue}let a=t[n-1],o=t[n+1];n>0&&(a>="a"&&a<="z"&&i>="A"&&i<="Z"||a>="A"&&a<="Z"&&i>="A"&&i<="Z"&&o&&o>="a"&&o<="z")&&(e+=" ",r=!0),r?(e+=i.toUpperCase(),r=!1):e+=i}return e.trim()}var bwt={top:["header","filterBar"]},yAe=["anchor","relatedFacet"],Jt=class t{path=[];aggregations={};properties={};additionalProperties;variants=[];childClass;additionalText;locations;actions;inactive;schema;annotationCreationForms=[];allowedAnnotationCreationForms=[];schemaCreationForms=[];formSchema;sortableList;sortableItem;sortableReadonlyTooltip;sortableConfigOnly;order;description;i18nKey;state=0;messages;value;type="Object";parent;custom=!1;isViewNode;isTable=!1;pattern;name;union;sortableCollection;annotationNodeId;dropUINodes;pending;hidden;artifactType;virtual;icon;isAtomic;constructor(e,r){e&&(this.aggregations=e.aggregations,this.properties=e.properties),r&&(this.schema=r)}addAggregation(e,r,n,i,a){if(this.aggregations[e]&&!a)return this.aggregations[e];if(r.name=e,i!==void 0&&!Number.isNaN(i)){for(let o in this.aggregations){let s=this.aggregations[o].order;s!==void 0&&!Number.isNaN(s)&&s>=i&&(this.aggregations[o].order=s+1)}r.order=i}else r.order=Object.keys(this.aggregations).length;return Object.defineProperty(r,"parent",{value:this,writable:!1}),this.aggregations[e]=r,this.updatePath(this.aggregations[e],n),r}addProperty(e,r){yAe.includes(e)&&(r=DK(this,r));let n=r.displayName||gAe(e),i=new xK(r,n);return this.properties[e]=i,i}getDisplayName(e={}){let r=[()=>{let i=this.getRawDisplayName(),a=dAe(i,e);return a||i},this.getTechnicalName.bind(this),()=>{let i=this.getFormattedName();return i?gAe(i):void 0}],n="";for(let i of r)if(n=i()||"",n)break;return n}getSupportedActions(){let e=[...this.actions??[]];return this.locations?.length&&e.push("OpenSource"),e}getKeys(){if(this.schema?.keys)return this.schema.keys}getValueOfSchemaKey(e){return this.getKeys()?.find(n=>n.name===e)?.value}getTechnicalName(){}getRawDisplayName(){if(this.isViewNode){let e=this.formatTextForDisplay(this.description);if(e)return e}return this.formatTextForDisplay(this.schema?.title)}formatTextForDisplay(e=""){return e.trim()}updateValues(e){let r=Object.keys(this.properties),n=Object.keys(this.aggregations);if(e)for(let i in e)r.includes(i)&&(this.properties[i].value=e[i]),n.includes(i)&&(this.aggregations[i].value=e[i])}updatePropertiesValues(e,r,n,i,a,o){this.updateValues(e),this.updateAnnotationData(a),this.annotationCreationForms=this.getNativeNodeCreationForms(a);for(let s in this.aggregations){let c=this.type==="Array"?Number.parseInt(s,10):s,u=this.aggregations[s].union?.originalNames||[s];for(let l of u)this.aggregations[s].updatePropertiesValues(e?.[l],r,n,i.concat([c]),a,o);this.aggregations[s].onPropertiesUpdated()}this.isAtomic&&this.handleAtomicObject(e,i)}onPropertiesUpdated(){}updateAnnotationData(e){let r=this.getCurrentUINode(e),n=r?.direct?r.node:void 0;this.setAllowedParents(e,n),this.updateLocations(e,n),r?.node&&!f_(r.node)&&r.node.readonly&&this.applyReadonlyAnnotationNode(r.node.readonlyTooltip),!this.custom&&this.sortableItem==="Enabled"&&!this.annotationNodeId&&(this.sortableItem="Readonly",this.removeAction("Delete"))}setAllowedParents(e,r){r&&(this.dropUINodes=r?.allowedParentNodes)}updateLocations(e,r){this.locations=this.locations||[];let n=this.locations.length;if(!r||n&&this.isMacrosNode())return;let i=hwt(r);if(i.length>0){if(n)for(let a of this.locations)i.some(o=>o.fileUri!==a.fileUri)&&i.push(a);this.locations=i}}getNativeNodeCreationForms(e){return!this.name||!e?[]:this.annotationNodeId||this.getParentAnnotationNodeId()?[]:this.getDefaultNativeCreationForms(e)}getDefaultNativeCreationForms(e){return[]}getParentAnnotationNodeId(){let e=this.parent;for(;e;){if(e.annotationNodeId)return e.annotationNodeId;e=e?e.parent:void 0}}getProperties(){return this.properties}getCopy(e=t){let r=JSON.parse(JSON.stringify(this,(i,a)=>{if(i!=="parent")return a})),n=new e(r);return this.createAggregations(n,e),new e(n)}createAggregations(e,r=t){if(e.aggregations){for(let n in e.aggregations)e.aggregations[n]=new r(e.aggregations[n]),this.createAggregations(e.aggregations[n]);e.additionalProperties?.aggregations&&(e.additionalProperties=new r(e.additionalProperties))}}aggregationOrderSorter(e,r){let n=this.aggregations[e]&&this.aggregations[e].order||-1,i=this.aggregations[r]&&this.aggregations[r].order||-1;return n===i?0:n>i?1:-1}getAggregationKeys(e=!1,r){let n=Object.keys(this.aggregations).sort(this.aggregationOrderSorter.bind(this));return this.sortableList||(n=n.sort((i,a)=>{let o=bwt.top.indexOf(i),s=bwt.top.indexOf(a);return o!==-1&&s!==-1&&o>s?1:o!==-1?-1:s!==-1?1:0})),e&&(n=n.filter(i=>this.aggregations[i].isViewNode&&!this.aggregations[i].hidden)),r==="ViewNode"&&(n=n.sort(this.getViewNodeSorter.bind(this))),n}getViewNodeSorter(e,r){let n=this.aggregations[e].isViewNode,i=this.aggregations[r].isViewNode;return n===i&&!n?e===r?0:e>r?1:-1:this.aggregations[e].isViewNode===this.aggregations[r].isViewNode?0:this.aggregations[e].isViewNode?1:-1}updatePath(e,r){if(e.setPath(r),e.aggregations)for(let n in e.aggregations)this.updatePath(e.aggregations[n],r.concat([n]))}setPath(e){this.path=e}getMaxOrder(){let e=0;for(let r in this.aggregations){let n=this.aggregations[r].order||0;e<n&&(e=n)}return e}findMatchingParent(e=t){let r=this.parent;for(;r;){if(r instanceof e)return r;r=r?r.parent:void 0}}addUnionName(e,r){let n=this.union?.originalNames||[];n.includes(r)||n.push(r),this.union={name:e,originalNames:n}}getFormattedName(){return this.name}getCurrentUINode(e){if(this.name&&e){let r=this.annotationNodeId||this.getParentAnnotationNodeId();if(r){let n=dwt(e,r);if(n)return{node:n,direct:!!this.annotationNodeId}}}}applyReadonlyAnnotationNode(e){let r=i=>{for(let a=0;a<i.length;a++){let o=i[a];typeof o=="string"&&(i[a]=o={type:o}),o.disabled=!0,o.title=e}},n=i=>{i.sortableItem="Readonly",e&&(i.sortableReadonlyTooltip=e)};for(let i in this.aggregations){let a=this.aggregations[i];a.actions&&!a.custom&&r(a.actions),a.sortableItem==="Enabled"&&n(a)}this.actions&&r(this.actions),this.sortableItem==="Enabled"&&n(this)}removeAction(e){if(this.actions){let r=this.actions.indexOf(e);r!==-1&&this.actions.splice(r,1)}}nodeIdToString(e){return`[${e.join(",")}]`}findDropableCollectionsByCollection(e,r){let n=[];if(e.sortableList&&e.sortableCollection===r)n.push(e);else for(let i in e.aggregations){let a=e.aggregations[i],o=this.findDropableCollectionsByCollection(a,r);n.push(...o)}return n}getAllowedDropRange(e){}findAllowedDropAggregations(e,r=this){let{dropUINodes:n={},sortableCollection:i}=e,a=[];if(r.annotationNodeId&&n[this.nodeIdToString(r.annotationNodeId)]){let o=this.findDropableCollectionsByCollection(r,i);a.push(...o.map(s=>{let c=s.getAllowedDropRange(e);return{path:s.path,range:c}}))}for(let o in r.aggregations){let s=r.aggregations[o],c=this.findAllowedDropAggregations(e,s);a.push(...c)}return a}isMacrosNode(){return!!this.schema?.metadata}convertAtomicPropertyToAggregation(e,r){let n=new t,i=e.toString();this.properties[e]&&(n.properties[i]=this.properties[e],n.properties[i].isAtomic=!0),this.addAggregation(e.toString(),n,r.concat(e))}handleAtomicObject(e,r){if(typeof e=="object"){if(Array.isArray(e))for(let n=0;n<e.length;n++)this.convertAtomicPropertyToAggregation(n,r);else for(let n in e)this.convertAtomicPropertyToAggregation(n,r);this.properties={}}}};var CS=class extends Jt{actions=["Delete"];sortableItem="Enabled";isViewNode=!0;sortableCollection="actions";data;getTechnicalName(){let e=this.path[this.path.length-1];if(e&&typeof e=="string"){let r=e.split("::"),n="";if(r[r.length-1].includes("."))for(let i=0;i<r.length;i++)r[i]===AK&&r[i+1]&&(n=r[i+1]);else n=r[r.length-1];if(n){let i=n.split(".");return i[i.length-1]}}return super.getTechnicalName()}markAsCustomAction(){this.custom=!0,this.actions=["OpenSource"],this.sortableItem="Enabled",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_ACTION"),this.i18nKey=this.parent?.i18nKey,this.isMacrosNode()?PD(this):this.actions.push("Delete");let e=this.aggregations.position?.properties.anchor;e?.value&&((e.schema.oneOf||[]).some(n=>n.const===e.value)||ov(this,!1,Et.t("PAGE_EDITOR_CUSTOM_EXTENSION_NO_ANCHOR")))}markAsStandardAction(){this.sortableItem="Readonly",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_STANDARD_ACTION"),this.i18nKey=this.parent?.i18nKey,this.removeAction("Delete")}getActionType(){return typeof this.schema?.actionType=="string"?this.schema.actionType:void 0}};var wK=class extends Jt{sortableList=!0;childClass=CS;allowedAnnotationCreationForms=["NativeAction","NativeNavigation"];sortableCollection="actions";i18nKey="ACTIONS";constructor(e,r){super(e,r),r?.properties&&this.schema?.additionalProperties&&this.schema?.metadata?.type!=="Aggregation"&&(this.schemaCreationForms=[{name:"CustomAction",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_ACTIONS_TITLE",disabled:!1}])}addAggregation(e,r,n,i,a){if(r=super.addAggregation(e,r,n,i,a),r instanceof CS&&r.name)switch(r.schema?.actionType){case"Standard":{r.markAsStandardAction();break}case"Copy":{r.sortableItem="Readonly";break}}return r}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.formSchema=this.additionalProperties?.aggregations.actions;let o=e||{};for(let s in o){let c=this.aggregations[s];c?.name&&c.schema?.actionType==="Standard"?c.markAsStandardAction():c?.schema&&(c.schema.actionType==="Custom"||!c.schema.annotationPath)&&c.markAsCustomAction()}}getNativeNodeCreationForms(e){return this.parent&&this.parent.name==="footer"&&(this.allowedAnnotationCreationForms=["NativeAction"]),super.getNativeNodeCreationForms(e)}getActionType(e){let r=e.schema?.actionType;return r?r==="Standard"&&!e.schema?.annotationPath?"StandardWithoutAnnotation":r:e.custom?"Custom":"Annotation"}calculateDropRangeEdges(e,r){let n={top:-1,bottom:-1},i={top:["Standard","Copy","Annotation"],bottom:["Criticality","Standard","Copy"]};for(let a=0;a<e.length;a++){let o=e[a],s=this.aggregations[o],c=this.getActionType(s);if(c&&i.top.includes(c)){n.top=a;break}}if(r!=="Custom")for(let a=0;a<e.length;a++){let o=e[a],s=this.aggregations[o],c=this.getActionType(s);c&&i.bottom.includes(c)&&(n.bottom=a+1)}else n.bottom=n.top;return n}getActionsContainers(e){let r=this.getAggregationKeys(!0),n=0;for(let a=r.length-1;a>=0;a--){let o=r[a],s=this.aggregations[o];if(this.getActionType(s)!=="StandardWithoutAnnotation")break;n++}if(e==="Custom"&&n===0)return;let i=this.calculateDropRangeEdges(r,e);if(i.top===-1&&(i.top=i.bottom),i.bottom===-1&&(i.bottom=i.top),!(i.top===-1||i.bottom===-1))return{top:{from:0,to:i.top},bottom:{from:i.bottom,to:r.length-n}}}getAllowedDropRange(e){let r=this.getActionType(e),n=this.getActionsContainers(r),i;if(n)switch(r){case"Custom":{i=[n.top,n.bottom];break}case"Copy":case"Standard":case"StandardWithoutAnnotation":{i=[];break}case"Criticality":{i=[n.top];break}case"Annotation":{i=[n.bottom];break}}return i}};var NK=class extends Jt{actions=["Delete"];getDisplayName(){return this.name?this.name:super.getDisplayName()}};var IK=class extends Jt{sortableList=!1;childClass=NK;i18nKey="ADDITIONALOBJECTS";constructor(e,r){super(e,r),this.schemaCreationForms=[{name:"Generic",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_GENERIC_TITLE",disabled:!1}]}addAggregation(e,r,n,i,a){return r.custom=!0,super.addAggregation(e,r,n,i,a)}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.name&&(this.formSchema=this.additionalProperties?.aggregations[this.name])}};var RK=class{validate(e,r){if(e.state===0&&e.variants.length>=1){let n=this.validateVariants(e.variants,e);for(let i in n){let a=e.properties[i]||e.aggregations[i];a&&(a.state=n[i],a.state===1&&mAe(a,[{text:Et.t("PAGE_EDITOR_PROPERTIES_PROPERTY_WARNING_PROPERTY_NOT_ALLOWED",{name:i}),deletable:!0}]))}}for(let n in e.aggregations)this.validate(e.aggregations[n],r?r[n]:{})}validateVariants(e,r){let n={};for(let s in r.properties)r.properties[s].value!==void 0&&(n[s]=r.properties[s].value);for(let s in r.aggregations)r.aggregations[s].value!==void 0&&(n[s]=r.aggregations[s].value);let i=[...e];for(let s in n)i=i.filter(c=>this.validateVariant(c,r,s)===0);if(i.length===0){i=[...e];for(let s in n)i=i.filter(c=>this.validateVariant(c,r,s,!0)===0)}this.unifyVariants(r,i);let a={},o=[...Object.keys(r.properties),...Object.keys(r.aggregations)];for(let s of o)i.some(u=>s in u.properties||s in u.aggregations)?a[s]=0:s in n?a[s]=1:a[s]=2;return a}validateVariant(e,r,n,i=!1){let a=e.aggregations[n]||e.properties[n];if(a===void 0)return i?0:2;let s=(r.properties[n]||r.aggregations[n]||{}).value;if(a.schema){if(a.schema.pattern&&!new RegExp(a.schema.pattern).exec(s.toString()))return 2;if(a.schema.enum&&!a.schema.enum.includes(s)&&!a.freeText)return 2}return 0}*iterateVariantAggregations(e){for(let r of e)for(let[n,i]of Object.entries(r.aggregations))yield[n,i]}unifyVariants(e,r){let n={};for(let[i,a]of this.iterateVariantAggregations(r))a.union&&!n[i]&&(this.applyContextPath(e.aggregations[i],a.path),e.aggregations[i].name=a.path[a.path.length-1].toString(),n[i]=!0);if(Object.keys(n).length){for(let i in n)e.aggregations[i].variants=[];for(let i of r)for(let a in n){let o=i.aggregations[a];o&&(e.aggregations[a].variants=[...e.aggregations[a].variants,...o.variants.length?o.variants:[o]])}}}applyContextPath(e,r){e.path=e.path.slice();for(let n=0;n<r.length;n++)e.path[n]=r[n];for(let n in e.aggregations)this.applyContextPath(e.aggregations[n],r)}};var r2=class extends Jt{type="Array";constructor(e,r){super(e,r),this.schemaCreationForms=[{name:"Generic",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_GENERIC_TITLE",disabled:!1}]}addAggregation(e,r,n,i){return super.addAggregation(e,r,n,i),this.sortableList=!0,r.sortableItem="Enabled",r.actions=["Delete"],r.schema&&!r.schema.title&&(r.schema.title=Et.t("PAGE_EDITOR_OUTLINE_ARRAY_ITEM",{name:Number.parseInt(e,10)+1})),r.custom=!0,r}updatePropertiesValues(e,r,n,i){if(super.updatePropertiesValues(e,r,n,i),!!Array.isArray(e))for(let a=0;a<e.length;a++){let o=this.aggregations[a];if(!o)continue;let s;if(this.isAtomic)s=e[a];else{let c=this.getPrimaryKey(o);s=c?e[a][c]:void 0}typeof s!="object"&&(o.additionalText=s)}}getPrimaryKey(e){let r=["id","title","key","name"],n=e.schema?e.schema.properties||{}:{},i;for(let a of r)if(a in n){i=a;break}for(let a in n)if(n[a].type==="string"){i=a;break}return i}};var d_=class extends Jt{allowedAnnotationCreationForms=["AnalyticalChart"];name="root";getDefaultNativeCreationForms(){return this.annotationCreationForms}updateAnnotationData(e){this.annotationCreationForms=[],super.updateAnnotationData(e);let r=!!this.aggregations.chart?.isViewNode;if(!!(this.aggregations.table?.aggregations.views?.isViewNode&&!r)&&e?.dialogsContext?.analyticalChartSupport!==void 0){let i={name:"AnalyticalChart",title:e.dialogsContext.analyticalChartSupport.creationTooltip,disabled:!e.dialogsContext.analyticalChartSupport.creationEnabled,kind:CD,visualizationIcon:"Add",buttonText:Et.t("ADD_CHART"),buttonId:"add-chart"};i.disabled&&(i.disabledTitle=i.title),this.annotationCreationForms.push(i)}}};var LK=class extends Jt{updateAnnotationData(e){let r=e?.dialogsContext?.analyticalChartSupport;if(this.actions=[],r){let n=this.getDeletionSupport(r),i={type:"Delete",title:n.deletionTooltip};i.disabled=!n.deletionEnabled,this.actions.push(i)}super.updateAnnotationData(e)}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),!!this.schema?.properties?.annotationPath&&!e?.annotationPath&&(this.hidden=!0)}getDeletionSupport(e={}){if(e?.deletionEnabled){let r=this.findMatchingParent(d_);if(!r?.schema?.properties?.defaultTemplateAnnotationPath&&r){let i=r.aggregations.table?.value;if(typeof i=="object"){let a=i?.annotationPath;this.isComplexScenario(a)&&(e={deletionEnabled:!1,deletionTooltip:Et.t("CHART_DELETION_UNSUPPORTED_BY_SPEC")})}}}return e}isComplexScenario(e){let r=e.split("."),n=r[r.length-1]||"";return n.startsWith("SelectionPresentationVariant")||n.startsWith("PresentationVariant#")}};var xS=class extends Jt{actions=["Delete"];sortableItem="Enabled";isViewNode=!0;sortableCollection="fields";getRawDisplayName(){let e=super.getRawDisplayName();if(!e){let r=this.getTechnicalName();if(r)return r}return e}getTechnicalName(){return xD(this.path)}};var kK=class extends Jt{sortableList=!0;childClass=xS;allowedAnnotationCreationForms=["NativeField","NativeContactField","NativeConnectedFields"];sortableCollection="fields";i18nKey="FIELDS";updateAnnotationData(e){super.updateAnnotationData(e),this.path[0]==="header"&&this.allowedAnnotationCreationForms.splice(this.allowedAnnotationCreationForms.indexOf("NativeConnectedFields"))}};var $K=class extends xS{sortableList=!0;childClass=xS};var DD=class extends Jt{actions=["Delete"];sortableItem="Enabled";isViewNode=!0;getRawDisplayName(){let e=super.getRawDisplayName();if(!e){let r=this.getTechnicalName();if(r)return r}return e}getTechnicalName(){let e=this.path[this.path.length-1];if(e){let n=e.toString().split("::"),i=n[n.length-1];if(i)return i}}markAsCustomFilterField(){this.custom=!0,this.actions=["OpenSource"],this.isMacrosNode()||this.actions.push("Delete"),this.sortableItem="Enabled",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_FILTER_FIELD"),this.i18nKey=this.parent?.i18nKey,this.isMacrosNode()&&PD(this);let e=this.properties.anchor;e?.value&&((e.schema.oneOf||[]).some(n=>n.const===e.value)||ov(this,!1,Et.t("PAGE_EDITOR_CUSTOM_EXTENSION_NO_ANCHOR")))}addProperty(e,r){let n=super.addProperty(e,r);return e==="property"&&(n.disabled=!0),n}};var MK=class extends Jt{sortableList=!0;allowedAnnotationCreationForms=["NativeFilterFields"];childClass=DD;i18nKey="FILTER_FIELDS";constructor(e,r){super(e,r);let n=r?.additionalProperties;typeof n=="object"&&n.$ref&&!this.isMacrosNode()&&(this.schemaCreationForms=[{name:"CustomFilterField",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_FILTER_FIELDS_TITLE",disabled:!1}])}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.formSchema=this.additionalProperties?.aggregations.selectionFields;let o=e||{};for(let s in o){let c=this.aggregations[s];c?.schema&&!c.schema.annotationPath&&c.markAsCustomFilterField()}}};var _wt=require("node:path");var Twt=Tt(kd()),sv=class extends Jt{filePath;constructor(e,r){super(e,r),this.path=["macros"],this.isViewNode=!0,this.virtual=!0,this.allowedAnnotationCreationForms=[];let n=this.getCreationForms();this.annotationCreationForms=n.internal,this.schemaCreationForms=n.external;let i=this.schema?.metadata?.filePath;i&&this.setFilePath(i)}getCreationForms(){return{internal:[{name:"MacrosChart",kind:CD,disabled:!1,title:"ADD_BUILDING_BLOCK_CHART"},{name:"MacrosFilterBar",kind:CD,disabled:!1,title:"ADD_BUILDING_BLOCK_FILTERBAR"},{name:"MacrosTable",kind:CD,disabled:!1,title:"ADD_BUILDING_BLOCK_TABLE"}],external:[]}}getDisplayName(){return Et.t("PAGE_EDITOR_OUTLINE_NODE_BUILDING_BLOCK")}getNativeNodeCreationForms(){return this.annotationNodeId?this.annotationCreationForms:[]}setFilePath(e){this.filePath=(0,_wt.join)(Twt.DirName.Webapp,e)}updateAnnotationData(e){if(super.updateAnnotationData(e),e?.dialogsContext?.analyticalChartSupport!==void 0){let r=this.annotationCreationForms.find(n=>n.name==="MacrosChart");r&&(r.disabled=!e.dialogsContext.analyticalChartSupport.creationEnabled,r.disabled&&(r.tooltip=e.dialogsContext.analyticalChartSupport.creationTooltip))}}};var Dwt=require("node:path"),ND=Tt(mc());var wm=class extends Jt{actions=["Delete"];title;id;position;data;useDescriptionAsId;isViewNode=!0;sortableCollection="sections";constructor(e,r){super(e,r),this.sortableItem="Enabled"}setTitle(e){this.title=e}setId(e){this.id=e}getRawDisplayName(){return this.title||this.getSectionId()||super.getRawDisplayName()}getSectionId(e=!0){if(this.schema){if(this.schema.title?.startsWith(lAe)){let r=this.schema.title.split(lAe);return r.length>1?r[r.length-1]:r[0]}else if(e&&this.useDescriptionAsId&&this.schema.description)return this.schema.description}if(this.data&&"id"in this.data)return this.data.id}markAsReplaced(e){this.inactive=!0,this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_SECTION_REPLACED_WITH",{section:e})}markAsCustomSection(e,r,n){this.custom=!0,this.actions=["Delete",n||"OpenSource"],this.sortableItem="Enabled",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_SECTION"),this.data=e,this.i18nKey=r}getTechnicalName(){return this.getSectionId()}getFormattedName(){let e=this.name,r=`${swt}.`;return e?.includes(r)&&(e=e.replace(r,"")),e}};var Cf=Tt(mc());var n2="custom",wD=class extends Jt{customSections=[];sections=[];sortingApproach="Normal";allowedAnnotationCreationForms=void 0;sortableCollection="sections";constructor(e,r){super(e,r),this.childClass=wm,r?.properties?.custom&&(this.schemaCreationForms=[{name:"CustomSection",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE",disabled:!1}]),this.sortableList=!0,this.i18nKey="SECTIONS"}updatePropertiesValues(e,r,n,i,a,o){if(super.updatePropertiesValues(e,r,n,i,a,o),this.formSchema=this.aggregations[n2],this.sortingApproach=this.getSortingApproach(),delete this.aggregations[n2],this.correctSectionData(),this.formSchema&&(this.customSections=e&&n2 in e?e[n2]:[],this.customSections.length)){this.sections=Object.keys(this.aggregations);let s=[...this.sections];for(let p in s){let d=this.aggregations[s[p]];this.traverseCustomSections(d.getSectionId()||s[p],this.customSectionFactory.bind(this,r,n,i,o))}let c=this.customSections.filter(p=>{for(let d in this.aggregations)if(this.aggregations[d].data===p)return!1;return!0});for(let p of c)this.customSectionFactory(r,n,i,o,p);let u=this.aggregations;this.aggregations={};let l=0;for(let p of this.sections)this.aggregations[p]=u[p],this.aggregations[p].order=l,l++}}onPropertiesUpdated(){this.customSections.length&&!this.isV4()&&vwt(this,"SECTION_UNDELETABLE_LAST_NATIVE_NODE")}traverseCustomSections(e,r){let n=this.customSections.filter(a=>this.isSectionMatchesRelatedFacet(a.relatedFacet,e)),i=this.sortingApproach==="WithIds";for(let a of n)r(a),i&&"id"in a&&this.traverseCustomSections(a.id,r)}customSectionFactory(e,r,n,i,a){if(!this.formSchema)return;let o=this.customSections.indexOf(a),s=this.formSchema.getCopy(wm);if(s.markAsCustomSection(a,this.i18nKey),i){let p=a,{fragmentName:d}=p,f=i?.definitions[`CustomExtensionFragment<${d}>`];if(f&&s.aggregations.controls){let h=new sv(void 0,f);s.addAggregation("controls",h,s.path,void 0,!0),i.parse(s.aggregations.controls,f,void 0,void 0,n,{filePath:f.metadata?.filePath})}}s.updatePropertiesValues(a,e,r,n,i?.annotations),s.setTitle(a.title),s.position=a.relativePosition;let c=this.storeSection(a);this.addAggregation(c,s,this.path.concat([n2,o]));for(let p of yAe){let d=s.properties[p];d&&(d.schema=DK(s,d.schema))}let u=this.formSchema.properties.relatedFacet?.schema.oneOf?this.formSchema.properties.relatedFacet?.schema.oneOf:[],l=this.isV4()&&!a.relatedFacet?!0:u.some(p=>p.const===a.relatedFacet);ov(s,l,Et.t("PAGE_EDITOR_CUSTOM_SECTION_NO_FACET"))}correctSectionData(){let e=this.formSchema?.properties.relatedFacet?.schema.oneOf?this.formSchema.properties.relatedFacet.schema.oneOf:[];for(let r in this.aggregations){let n=this.aggregations[r];if(n.custom)continue;this.isV4()&&(n.useDescriptionAsId=!0),n.description&&n.setTitle(n.description);let i=n.getSectionId()||r,a=e.find(o=>this.isSectionMatchesRelatedFacet(i,o.const));a?.description&&(n.setTitle(a.description),n.setId(a.const))}}isSectionMatchesRelatedFacet(e="",r=""){return e.replace(/@/g,"")===r.replace(/@/g,"")}findSectionInsertPosition(e){let{relativePosition:r,relatedFacet:n}=e,i=this.checkRelatedPosition(r,Cf.v2.SectionPosition.AfterFacet,Cf.v2.SectionPosition.ReplaceFacet),a=this.findReferenceSection(n);if(!a)return this.sections.length;let o=this.checkRelatedPosition(r,Cf.v2.SectionPosition.ReplaceFacet),s=this.checkRelatedPosition(r,Cf.v2.SectionPosition.BeforeFacet),c=o?[Cf.v2.SectionPosition.ReplaceFacet]:[Cf.v2.SectionPosition.AfterFacet,Cf.v2.SectionPosition.ReplaceFacet],u=a.index;if(i&&this.sortingApproach==="Normal")for(let l=u+1;l<this.sections.length;l++){let p=this.aggregations[this.sections[l]];if(p?.custom&&p.position&&this.checkRelatedPosition(p.position,...c))u++;else break}return u+(s?0:1)}findReferenceSection(e){for(let r=0;r<this.sections.length;r++){let n=this.sections[r],i=this.aggregations[n],a=i?.getSectionId?.()??n;if(a&&this.isSectionMatchesRelatedFacet(a,e))return{index:r,aggregation:i}}}storeSection(e){let r=this.findSectionInsertPosition(e),n=this.getFreeSectionId("id"in e&&typeof e.id=="string"?e.id:e.title);this.sections.splice(r,0,n);let i=this.findReferenceSection(e.relatedFacet);return i?.aggregation&&this.checkRelatedPosition(e.relativePosition,Cf.v2.SectionPosition.ReplaceFacet)&&i.aggregation.markAsReplaced(e.title),n}getFreeSectionId(e){let r=1,n=e??"missingId";e=n;let i=Object.keys(this.aggregations).filter(o=>this.sections.indexOf(o)===-1),a=[...this.sections,...i];for(;a.includes(e);)e=n+r,r++;return e}checkRelatedPosition(e="",...r){let n=new Map([[Cf.v2.SectionPosition.AfterFacet,"after"],[Cf.v2.SectionPosition.BeforeFacet,"before"],[Cf.v2.SectionPosition.ReplaceFacet,"replace"]]);e=e.toLowerCase();for(let i of r){let a=n.get(i);if(a&&e.includes(a))return!0}return!1}getSortingApproach(){return this.isV4()?"WithIds":"Normal"}isV4(){return!!this.formSchema?.properties.id}getNativeNodeCreationForms(e){if(!e)return[];let r=super.getNativeNodeCreationForms(e),n=r.find(i=>i.name==="AnalyticalChart");return n&&!n.disabled&&(n.disabled=!e.dialogsContext?.analyticalChartSupport?.creationEnabled,e.dialogsContext?.analyticalChartSupport?.creationTooltip&&(n.disabledTitle=e.dialogsContext.analyticalChartSupport.creationTooltip)),r}};var Owt=Tt(mc()),PS=class extends Jt{title;originalIndex;isViewNode=!0;actions=["Delete"];sortableItem="Enabled";criticality;setTitle(e){this.title=e}getRawDisplayName(){return this.title||super.getRawDisplayName()}validateColumnPositioning(){let e=this.value&&typeof this.value=="object"?this.value:{},r=this.aggregations.position?.schema?.properties?.anchor?.enum,n=this.schema?.properties?.anchor?.oneOf,i=!1;if(this.isMacrosNode()){PD(this,e);let a=n??[],o=AS(e,["anchor"]);i=o?a.some(s=>s.const===o):!0}else{let a=r??[],o=AS(e,["position","anchor"]);i=o?a.includes(o):!0}ov(this,i,Et.t("PAGE_EDITOR_CUSTOM_EXTENSION_NO_ANCHOR"))}markAsCustomColumn(e){let{pageType:r,originalIndex:n,columnExtension:i,isExtensionTypeSupported:a,i18nKey:o,tableExtension:s="ResponsiveTableColumnsExtension",isV4:c=!1,tabkey:u}=e;this.custom=!0,this.actions=["OpenSource"],this.isMacrosNode()||this.actions.push("Delete"),this.sortableItem=!a||s===i?"Enabled":"Excluded";let l=i??"Unknown";u&&r===Owt.PageType.ListReport?this.additionalText=a?Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_WITH_EXTENSION_TAB",{tabkey:u,extension:Et.t(`PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_${l}`)}):Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_TAB",{tabkey:u}):this.additionalText=a?Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_WITH_EXTENSION",{extension:Et.t(`PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_${l}`)}):Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN"),this.originalIndex=n,this.i18nKey=o,a&&s!==l&&(this.state=1,this.messages=[{text:Et.t("PAGE_EDITOR_CUSTOM_COLUMN_UNUSED_COLUMN",{tableType:owt.get(s)}),type:"info"}],this.inactive=!0),c&&this.validateColumnPositioning()}getTechnicalName(){return xD(this.path)}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.updateMoveProperties()}updateMoveProperties(){(this.isActionColumn()||this.isNavigationColumn())&&(this.sortableCollection=!this.criticality||this.criticality==="None"?"actions":void 0,this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_ACTION_COLUMN"))}isActionColumn(){return!!this.name?.startsWith(`${AK}${cAe}`)}isNavigationColumn(){return!!this.name?.startsWith(`${CK}${cAe}`)}};var h_=Tt(mc());var Awt=Tt(mc()),Swt=t=>!t.type||t.type===Awt.ArtifactType.Annotation,FK=t=>{let e=[],r=t.locations?[...t.locations]:[];for(let n=r.length-1;n>=0;n--){let i=r[n];Swt(i)&&(e.push(i),r.splice(n,1))}if(t.parent&&e.length){let n=t.parent.locations||[];t.parent.locations=n.filter(i=>!Swt(i)),t.parent.locations.unshift(...e)}t.locations=r};var i2="custom",zbn=new Map([[h_.PageType.ObjectPage,"ResponsiveTableColumnsExtension"],[h_.PageType.ListReport,"ResponsiveTableColumnsExtension"],[h_.PageType.AnalyticalListPage,"AnalyticalTableColumnsExtension"]]),jK=class extends Jt{customColumns=[];columnKeys=[];tableColumnExtensionType;allowedAnnotationCreationForms=["Basic","Rating","Chart","Progress","NativeAction","Contact","NativeNavigation"];isV4;sectionId;sortableCollection="actions";constructor(e,r){if(super(e,r),this.childClass=PS,r?.properties){let n;r.properties?.custom?n="CustomColumn":typeof r.additionalProperties=="object"&&r.additionalProperties.$ref&&r.additionalProperties.$ref.indexOf("TableCustomColumn")>-1?(n="CustomColumnV4",this.isV4=!0):this.isMacrosNode()&&(this.isV4=!0),n&&(this.schemaCreationForms=[{name:n,kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_COLUMNS_TITLE",disabled:!1}])}this.sortableList=!0,this.i18nKey="COLUMNS"}groupCustomColumnsByExtension(){let e=new Map,r=[...this.customColumns].sort((n,i)=>{let a=n.columnIndex??0,o=i.columnIndex??0;return a===o?0:a>o?1:-1});for(let n of r){let i=e.get(n.extensionType);i||(i=[],e.set(n.extensionType,i)),i.push(n)}return e}ensureColumnOrder(){let e=this.getAggregationKeys();for(let r=0;r<e.length;r++){let n=this.aggregations[e[r]];n&&(n.order=r)}}updatePropertiesFromCustomAggregation(e,r,n,i){let a=this.formSchema;this.customColumns=e&&i2 in e?e[i2]:[],n===h_.PageTypeV2.ObjectPage&&(this.sectionId=this.parent?.parent?.schema?.keys?.reduce(o=>o.name==="ID").value),this.customColumns.length&&(this.ensureColumnOrder(),this.columnKeys=Object.keys(this.aggregations),this.groupCustomColumnsByExtension().forEach(s=>{for(let c in s){let u=a?.getCopy(PS),l=s[c],p=this.customColumns.indexOf(l);u.markAsCustomColumn({pageType:n,originalIndex:p,columnExtension:l.extensionType,isExtensionTypeSupported:this.isExtensionTypeSupported(),i18nKey:this.i18nKey,tableExtension:this.tableColumnExtensionType,isV4:this.isV4,tabkey:l.tabKey}),u.updatePropertiesValues(l,r,n,i),u.setTitle(l.text);let d=this.getFreeId(l.id||l.columnKey||"customColumn",this.columnKeys);this.columnKeys.push(d);let f=this.doesColumnExtensionMatchTableType(l)?l.columnIndex:this.getMaxColumnIndex(this.customColumns)+1;this.addAggregation(d,u,this.path.concat([i2,p]),f)}}))}updatePropertiesValues(e,r,n,i,a){if(super.updatePropertiesValues(e,r,n,i,a),this.resolveTableColumnExtensionType(r,n,i),!this.isV4)this.formSchema=this.aggregations[i2],delete this.aggregations[i2],this.updatePropertiesFromCustomAggregation(e,r,n,i);else{this.formSchema=this.additionalProperties?.aggregations.columns;let o=e||{};for(let s in o){let c=this.aggregations[s];c.schema&&!c.schema.annotationPath&&(c.originalIndex=c.schema.propertyIndex,c.markAsCustomColumn({pageType:n,originalIndex:c.schema.propertyIndex,columnExtension:this.tableColumnExtensionType,isExtensionTypeSupported:this.isExtensionTypeSupported(),i18nKey:this.i18nKey,tableExtension:this.tableColumnExtensionType,isV4:this.isV4,tabkey:c.properties.tabkey?.value}))}}}getFreeId(e,r){let n=1,i=e;for(;r.includes(e);)e=i+n,n++;return e}resolveTableColumnExtensionType(e,r,n){let i=n.splice(0,n.length-1);i.push("type");let a=AS(e,i);this.tableColumnExtensionType=typeof a=="string"&&a in h_.v2.TableTypeV2?uAe.get(a):zbn.get(r)}doesColumnExtensionMatchTableType(e){return!this.isExtensionTypeSupported()||e.extensionType===this.tableColumnExtensionType}isExtensionTypeSupported(){return!!this.formSchema?.properties.extensionType}getMaxColumnIndex(e){let r=this.getMaxOrder();for(let n of e)n.columnIndex!==void 0&&r<n.columnIndex&&(r=n.columnIndex);return r}updateLocations(e,r){super.updateLocations(e,r),FK(this)}};var VK=class extends Jt{getTechnicalName(){return(this.parent?xD(this.parent.path,!0):void 0)||super.getTechnicalName()}};var UK=class extends Jt{updateLocations(e,r){super.updateLocations(e,r),FK(this)}};var qK=class extends Jt{sortableCollection="visualFilters";actions=["Delete"];isViewNode=!0};var BK=class extends Jt{sortableList=!0;childClass=qK;i18nKey="VISUAL_FILTERS"};var m_=class extends wD{constructor(e,r){super(e,r);let n=r?.additionalProperties;typeof n=="object"&&n.$ref&&(this.schemaCreationForms=[{name:"CustomSection",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE",disabled:!1}])}updatePropertiesValues(e,r,n,i,a,o){super.updatePropertiesValues(e,r,n,i,a,o),this.formSchema=this.additionalProperties?.aggregations?.sections;let s=e||{};this.removeObsoleteAggregations();for(let u in s){let l=this.aggregations[u];l?.schema&&!l.schema.annotationPath&&(l.markAsCustomSection(),o&&this.parseBuildingBlocks({parser:o,page:r,pageType:n},l,u,s,i))}if(this.isSectionsMerged())for(let u in this.aggregations)this.aggregations[u].custom&&(this.aggregations[u].sortableItem="Excluded")}removeObsoleteAggregations(){let e=this.schema?.properties||{};for(let r in this.aggregations)r in e||delete this.aggregations[r]}parseBuildingBlocks(e,r,n,i,a){let{parser:o,page:s,pageType:c}=e,u=i[n],{fragmentName:l}=u,p=o?.definitions[`CustomExtensionFragment<${l}>`];if(p&&r.aggregations.controls){let d=new sv(void 0,p);r.addAggregation("controls",d,a.concat(r.path[r.path.length-1],"controls"),0,!0),o.parse(d,p,void 0,void 0,d.path,{filePath:p.metadata?.filePath});let f=AS(r.value||{},["controls"]);f&&typeof f=="object"&&d.updatePropertiesValues(f,s,c,a,o?.annotations)}}isSectionsMerged(){return!1}};var HK=class extends m_{allowedAnnotationCreationForms=["NativeSection","DataPointSection","ProgressSection","RatingSection","ChartSection"];constructor(e,r){super(e,r);let n=r?.additionalProperties;typeof n=="object"&&n.$ref&&(this.schemaCreationForms=[{name:"CustomHeaderSection",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE",disabled:!1}])}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.formSchema=this.additionalProperties?.aggregations?.sections;let o=e||{};for(let s in o){let c=this.aggregations[s];if(c?.schema&&!c.schema.annotationPath){let u=c.properties.templateEdit?.value,l=c.properties.fragmentName?.value,p;typeof l=="string"&&typeof u=="string"&&(p={type:"OpenSource",subActions:[{id:l,text:Et.t("CUSTOM_HEADER_SECTION_TEMPLATE")},{id:u,text:Et.t("CUSTOM_HEADER_SECTION_TEMPLATE_EDIT")}]}),c.markAsCustomSection(void 0,void 0,p)}}}};var GK=class extends m_{constructor(e,r){super(e,r);let n=r?.additionalProperties;typeof n=="object"&&n.$ref&&(this.schemaCreationForms=[{name:"CustomSubSection",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE",disabled:!1}])}updatePropertiesValues(e,r,n,i,a,o){super.updatePropertiesValues(e,r,n,i,a,o),this.formSchema=this.additionalProperties?.aggregations?.subsections}isSectionsMerged(){let e=0;for(let r in this.aggregations){let n=this.aggregations[r];if("subsections"in n.aggregations)return!1;n.custom||e++}return e>0}};var DS=class extends Jt{title;actions=[];sortableItem="Enabled";sortableCollection="views";constructor(e,r){super(e,r),r?.key&&!r.annotationPath&&!r.properties?.annotationPath&&(r.annotationPath=`${t2}${r.key})`)}getRawDisplayName(){return this.title||super.getRawDisplayName()}markAsCustomView(){this.custom=!0,this.actions=["Delete","OpenSource"],this.sortableItem="Enabled",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_VIEW"),this.i18nKey=this.parent?.i18nKey,this.properties.label?.value&&(this.title=this.properties.label.value)}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.isTableView()?this.icon="Table":this.isChartView()?this.icon="Chart":this.icon="Sections",this.isAnnotationView()&&!this.schema?.annotationPath&&this.properties.annotationPath&&(this.properties.annotationPath.messages=[{type:"warning",text:Et.t("PAGE_EDITOR_PROPERTIES_VIEW_NO_ANNOTATION_PATH")}])}isTableView(){return"columns"in this.aggregations}isChartView(){return!("columns"in this.aggregations)&&"toolBar"in this.aggregations}isAnnotationView(){return!this.custom&&"annotationPath"in this.properties||!this.custom&&this.schema?.annotationPath&&!this.schema?.annotationPath.startsWith(t2)}};var wS=class extends Jt{sortableList=!0;childClass=DS;allowedAnnotationCreationForms=["TableView","AnalyticalChartView","CustomViewV4"];sortableCollection="views";sortableConfigOnly=!0;i18nKey="VIEWS";updateAnnotationData(e){if(super.updateAnnotationData(e),e){this.toggleChartForm(this.annotationCreationForms,e);for(let r in this.aggregations){let n=this.aggregations[r],i=this.getViewDeleteAction(n,e),a=n.actions||[];a.push(i),n.actions=a}}}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.formSchema=this.additionalProperties?.aggregations.views,this.formSchema?.properties?.template&&(this.schemaCreationForms=[{name:"CustomViewV4",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_VIEW_TITLE",disabled:!1}]);let o=e||{};if(Object.keys(o).length!==0)for(let s in o){let c=this.aggregations[s];c?.schema&&!c?.schema.properties?.annotationPath&&(!c.schema.annotationPath||c.schema.annotationPath.startsWith(t2))&&c.markAsCustomView()}}getViewDeleteAction(e,r){let n=e.annotationNodeId,i=!0,a=this.getAnnotationViewCount();return n?i=SS(r.dialogsContext?.suppressTableViewDeletionNodeId||[],n):(a>1||a===1&&e.custom)&&(i=!1),{type:"Delete",disabled:i,title:Et.t(i?"TABLE_VIEW_DELETE_DISABLED_TOOLTIP":"PAGE_EDITOR_OUTLINE_DELETE_TOOLTIP")}}toggleChartForm(e,r){let n=e.find(i=>i.name==="AnalyticalChartView");n&&r.dialogsContext?.analyticalChartSupport&&(r.dialogsContext.analyticalChartSupport.addToMultiViewEnabled?(n.disabled=!1,delete n.disabledTitle):(n.disabled=!0,n.disabledTitle=r.dialogsContext.analyticalChartSupport.addToMultiViewTooltip))}getAnnotationViewCount(){let e=0;for(let r in this.aggregations){let n=this.aggregations[r];n instanceof DS&&n.isAnnotationView()&&e++}return e}};var Kbn="array",Cwt="object",vAe="sap.fe.macros.Table",xwt=[["table","quickVariantSelection","variants"],["table","quickVariantSelectionX","variants"]],bAe=(t,e,r)=>{let n=r,i=t.split("/").length-1,a=0;for(;a<i;)n=n?.parent,a++;return e.endsWith(`table/${t}`)||n instanceof DS&&e.endsWith(`/${t}`)},Ybn=(t,e,r)=>!!r?.additionalProperties?.$ref?.includes("CustomSectionActionOP")&&!!e?.name&&t.endsWith(`${e.name}/actions`),EAe=(t,e)=>e?.schema?.metadata?.controlName===t,Wbn=(t,e)=>e?.metadata?.controlName===t,Pwt=(t,e)=>{let r=e?.additionalProperties;return e?.metadata?.type==="Aggregation"&&typeof r=="object"&&r.$ref===`#/definitions/${t}`},Xbn=[{aggregation:m_,fn:(t,e,r)=>{let i=r?.additionalProperties?.$ref?.includes("ObjectPageCustomSectionFragment");return t==="sections"&&!!i}},{aggregation:wD,fn:t=>t==="sections"},{aggregation:jK,fn:(t,e,r)=>bAe("columns",t,e)||Pwt("sap.fe.macros.table.Column",r)&&EAe(vAe,e)},{aggregation:UK,fn:(t,e)=>bAe("toolBar",t,e)},{aggregation:kK,fn:t=>t.endsWith("form/fields")},{aggregation:IK,fn:t=>t.endsWith("actions/RelatedApps/additionalSemanticObjects")},{aggregation:$K,fn:(t,e,r)=>r?.dataType==="ConnectedFields"},{aggregation:wK,fn:(t,e,r)=>Ybn(t,e,r)||["form/actions","header/actions","footer/actions"].some(n=>t.endsWith(n))||bAe("toolBar/actions",t,e)||Pwt("sap.fe.macros.table.Action",r)&&EAe(vAe,e)},{aggregation:MK,fn:(t,e)=>t.endsWith("filterBar/selectionFields")||t.endsWith("/filterFields")&&EAe("sap.fe.macros.FilterBar",e)},{aggregation:BK,fn:t=>t.endsWith("filterBar/visualFilters")},{aggregation:VK,fn:(t,e,r)=>t==="table"||t.endsWith("/table")&&e instanceof wm||Wbn(vAe,r)},{aggregation:HK,fn:t=>t.endsWith("header/sections")},{aggregation:d_,fn:t=>t===""},{aggregation:LK,fn:t=>t==="chart"},{aggregation:wS,fn:t=>t.endsWith("table/views")},{aggregation:GK,fn:(t,e)=>t.endsWith("/subsections")&&e instanceof wm}],Jbn=["annotationPath"],zK=class{name;pageType;root=this.prepareAggregation();data;originalData;definitions={};excludeProperties=["$schema"];schema;validator=new RK;pendingNodes=[];constructor(e,r,n,i,a){this.name=e,this.pageType=r,this.data=n,this.originalData={page:structuredClone(this.data),annotations:a,schema:i},this.schema=JSON.parse(i),this.init(a)}init(e){if(this.schema.definitions)for(let i in this.schema.definitions)this.definitions[`#/definitions/${i}`]=this.schema.definitions[i];let r=JSON.parse(this.originalData.schema);this.root=this.prepareAggregation(void 0,{properties:r.properties}),this.parseSchema(this.root,r,{subnodes:e.nodes},void 0,[],{filePath:this.data.$filePath}),this.readAdvancedPropertiesData(this.root,this.data);let n={definitions:this.schema.definitions,parse:this.parseSchema.bind(this),annotations:e};this.root.updatePropertiesValues(this.data,this.data,this.pageType,[],e,n),this.validator.validate(this.root,this.data),this.updateViewNodes(this.root),this.pendingNodes=[],this.afterInit(e)}updatePropertyFromSchema(e,r,n){if(!(e in r.properties))r.properties[e]=r.addProperty(e,n),r.properties[e].freeText=this.isFreeText(n);else if(n.enum){let i=r.properties[e].schema.enum;i=i?i.concat(n.enum):n.enum,r.properties[e].schema.enum=i?i.filter((a,o)=>i&&i.indexOf(a)===o):[]}}getContextForMacrosNode(e,r){for(let n in r){let i=r[n],a="subnodes"in i?i.subnodes:[];for(let o in a)if(a[o].macroNodeId===e)return i}}schemaParsers=[e=>(e.currentNode.const&&!e.currentNode.enum&&(e.currentNode.enum=[e.currentNode.const]),!0),e=>{let{currentNode:r}=e;return!r.hidden},e=>{let{currentNode:r,name:n}=e;if(n===void 0)return!0;if(this.isAggregation(r)){e.path=e.path.concat([e.aggregation.type==="Array"?Number.parseInt(n,10):n]);let i=r.displayName||n,a=r.type===Cwt?"Object":"Array";if(e.aggregation=e.aggregation.addAggregation(i,e.aggregation.aggregations[i]||this.prepareAggregation(e.path,r,e.aggregation,a),e.path),e.aggregation.type==="Array")return e.aggregation.schema=r,this.updateFormSchema(e.aggregation),this.copySchemaProperties(e.aggregation,r,n),!1}else this.isProperty(r)&&this.updatePropertyFromSchema(n,e.aggregation,r);return!0},e=>{let{aggregation:r,currentNode:n}=e,i=e.currentAnnotationNode;if(r instanceof sv&&(i=this.originalData.annotations.nodes.find(a=>"nodeType"in a&&a.nodeType==="macros"),r.annotationNodeId=i?.nodeId),n.metadata?.internalId&&!i){let a=this.originalData.annotations.nodes;a=a.filter(o=>"nodeType"in o&&o.nodeType==="macros"),i=e.currentAnnotationNode=this.getContextForMacrosNode(n.metadata.internalId,a)}if(!n.$ref&&n.annotationPath){let a=[];i&&!f_(i)&&(a=i.subnodes);let o=mwt(n.annotationPath,this.originalData.annotations.nodes,a,i?.annotationPath,r.order);o&&(e.currentAnnotationNode=o,r.annotationNodeId=o.nodeId)}return!0},e=>{for(let r of Array.from(this.schemaReferenceParsers))if(r[1](e))break;return!0},e=>{let{aggregation:r,currentNode:n,name:i}=e;return this.copySchemaProperties(r,n,i),!0},e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,name:a,path:o,context:s}=e;return typeof n.additionalProperties=="object"&&(r.additionalProperties=this.prepareAggregation(),this.parseSchema(r.additionalProperties,n.additionalProperties,i,a,o,s),this.isSchemaAtomic(n.additionalProperties)&&this.updateFormSchema(r,a)),!0},e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,name:a,path:o,context:s}=e;return typeof n.patternProperties=="object"&&(r.pattern=Object.keys(n.patternProperties)[0],n.additionalProperties=n.patternProperties[r.pattern],r.additionalProperties=this.prepareAggregation(),this.parseSchema(r.additionalProperties,n.patternProperties[r.pattern],i,a,o,s),this.updateFormSchema(r,a)),!0},e=>{let{aggregation:r,currentNode:n}=e;if(n.required)for(let i of n.required){let a=r.properties[i];a&&(a.required=!0)}return!0},e=>{let{aggregation:r,currentNode:n,name:i}=e;return n.displayName&&i&&n.type==="object"&&r.addUnionName(n.displayName,i),!0},e=>{let{name:r="",aggregation:n,currentNode:i,context:a}=e,{metadata:o}=i,s=n.properties[r];if(a.filePath&&o){let{position:c}=o,u=[];c&&u.push({fileUri:(0,Dwt.join)(ND.DirName.Webapp,a.filePath),range:{start:{line:c.startLine-1,character:c.startColumn-1},end:{line:c.endLine-1,character:c.endColumn}},relative:!0,type:ND.ArtifactType.XMLProperty}),s?s.locations=u:n.name===r&&(n.locations=u)}return!0},e=>{let{path:r,name:n="",aggregation:i}=e;return r&&xwt.some(a=>hAe(r,a))&&this.updateFormSchema(i,n),!0}];schemaReferenceParsers=new Map([["$ref",e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,name:a,path:o,context:s}=e;if(!n.$ref)return!1;let c=this.definitions[n.$ref]?{...this.definitions[n.$ref]}:{};for(let u of Object.keys(n)){let l=Jbn.includes(u);u!=="$ref"&&!(l&&c[u])&&(c[u]=n[u])}return this.parseSchema(r,c,i,a,o,s),!0}],["anyOf",e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,name:a,path:o,context:s}=e;if(!n.anyOf)return!1;for(let c of n.anyOf)this.parseSchema(r,c,i,a,o,s);return(Object.keys(n.anyOf).length>1||Array.isArray(n.anyOf)&&n.anyOf.length>1)&&this.createAnyOfPropertiesVariations(n.anyOf,e),!0}],["properties",e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,path:a,context:o}=e;if(!n.properties)return!1;let s=Object.keys(n.properties).filter(l=>!this.excludeProperties.includes(l)),c=n.properties,u=s.some(l=>n.properties&&n.properties[l]?.propertyIndex!==void 0);c&&s.length&&u&&s.sort(this.propertySorter.bind(this,c));for(let l of s)this.parseSchema(r,n.properties[l],i,l,a,o);return!0}],["items",e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,path:a,context:o}=e;if(!n.items)return!1;if(Array.isArray(n.items))for(let s=0;s<n.items.length;s++)this.parseSchema(r,n.items[s],i,s.toString(),a,o);else this.parseSchema(r,n.items,i,void 0,a,o);return!0}]]);createAnyOfPropertiesVariations(e,r){let{aggregation:n,currentAnnotationNode:i,name:a,path:o,context:s}=r;for(let c of e){let u=this.prepareAggregation();this.parseSchema(u,c,i,a,o,s);let l=a;if(a&&!u.aggregations[a]){let d=Object.keys(u.aggregations);l=d.length>0?d[0]:a}let p=n;l&&(p=n.aggregations[l],u=u.aggregations[l]),u&&p&&p.variants.push({aggregations:u.aggregations,properties:u.properties})}a&&n.properties[a]&&(n.properties[a].freeText=this.isFreeText(e))}parseSchema(e,r,n,i,a,o){let s={aggregation:e,currentNode:r,currentAnnotationNode:n,name:i,path:a,context:o};for(let c of this.schemaParsers)if(!c.call(this,s))break}copySchemaProperties(e,r,n){if(n)if(e.properties[n])this.storeInnerProperties(e.properties[n],["pattern","description","i18nClassification","artifactType","minimum","displayName","messages"],r);else{let i=e.aggregations[n]||e;this.storeInnerProperties(i,["description","isViewNode","artifactType","messages"],r)}}isProperty(e){return!e.$ref&&e.type!=="object"&&e.type!=="array"&&!e.anyOf}isAggregation(e){return(e.type===Cwt||e.type===Kbn)&&!e.$ref}handleAdditionalProperties(e,r){let n=[...Object.keys(e.properties),...Object.keys(e.aggregations)];for(let i of Object.keys(r))if(!n.includes(i)&&e.additionalProperties){let a=e.schema?e.schema.additionalProperties||e.schema.additionalItems:void 0;if(typeof a=="object"){this.parseSchema(e,a,void 0,i,e.path,{});let o=e.aggregations[i];o?.isViewNode&&o.description&&delete o.description}}}readAdvancedPropertiesData(e,r){if(this.handleAdditionalProperties(e,r),e&&e.type==="Array"&&e.schema){let n=e.schema,i=this.getSchemaArrayItem(n);if(i&&Array.isArray(r))for(let a=0;a<r.length;a++)this.parseSchema(e,i,void 0,a.toString(),e.path,{})}for(let n in e.aggregations){let i=e.aggregations[n].union?.originalNames||[n];for(let a of i)typeof r=="object"&&a in r&&this.readAdvancedPropertiesData(e.aggregations[n],r[a])}}readPropertiesData(e,r){let n=Object.keys(e.properties);for(let i in r)n.includes(i)&&(e.properties[i].value=r[i]);for(let i in e.aggregations)i in r&&this.readPropertiesData(e.aggregations[i],r[i])}prepareAggregation(e,r,n,i="Object"){let a=(e||[]).join("/");for(let s of Xbn)if(s.fn(a,n,r))return new s.aggregation(void 0,r);let o;if(n?.childClass)o=new n.childClass(void 0,r);else{let s=i==="Object"?Jt:r2;o=new s(void 0,r)}return e&&xwt.some(s=>hAe(e,s))&&(o.isTable=!0),o}isFreeText(e){let r=n=>n.type==="string"&&!n.enum;return Array.isArray(e)?e.some(r):r(e)}storeInnerProperties(e,r,n){for(let i of r)if(n[i]!==void 0||i==="i18nClassification"&&i in n){if(!this.isCorrectSchemaProperty(i,n[i])){kt.error(Et.t("SCHEMA_PARSING_ERROR_UNEXPECTED_VALUE",{name:i,value:JSON.stringify(n[i])}));return}e[i]=n[i]}}getSchemaArrayItem(e){let r=Array.isArray(e.items)?e.additionalItems:e.items;return typeof r=="object"?r:void 0}updateArrayFormSchema(e){let r=this.getSchemaArrayItem(e.schema||{});if(typeof r=="object"){let n=this.prepareAggregation();e.isAtomic=!!r.type,this.parseSchema(n,r,void 0,e.isAtomic?"":void 0,e.path,{}),Object.keys(n.properties).length&&(e.formSchema=n)}(!e.formSchema||!Object.keys(e.formSchema.properties).length)&&(e.schemaCreationForms=[])}updateFormSchema(e,r){if(e instanceof r2)this.updateArrayFormSchema(e);else if(r&&e.additionalProperties?.aggregations[r]){let n=this.prepareAggregation();this.parseSchema(n,e.additionalProperties.aggregations[r].schema||{},void 0,void 0,e.path,{}),Object.keys(n.properties).length&&(e.formSchema=n)}else if(typeof e.schema?.additionalProperties=="object"&&this.isSchemaAtomic(e.schema?.additionalProperties)){e.isAtomic=!0,e.isTable=!0;let n=this.prepareAggregation();this.parseSchema(n,e.schema.additionalProperties,void 0,"",e.path,{}),Object.keys(n.properties).length&&(e.formSchema=n)}}updateViewNodes(e){for(let r in e.aggregations){let n=e.aggregations[r];this.updateViewNodes(n)&&!e.isViewNode&&(e.isViewNode=!0)}return e.isViewNode||!1}isCorrectSchemaProperty(e,r){let n=!0;switch(e){case"description":case"pattern":case"i18nClassification":{n=r===void 0||typeof r=="string";break}case"isViewNode":{n=r===void 0||typeof r=="boolean";break}}return n}propertySorter(e,r,n){let i=e[r].propertyIndex!==void 0?e[r].propertyIndex:0,a=e[n].propertyIndex!==void 0?e[n].propertyIndex:0;return i===a?0:i>a?1:-1}afterInit(e){if(this.pageType===ND.PageType.FPMCustomPage){let r=new sv(void 0,void 0);typeof this.data.$filePath=="string"&&(r.setFilePath(this.data.$filePath),r.annotationNodeId=e.nodes[0]?.nodeId),r.aggregations=this.root.aggregations,this.root.aggregations={macros:r}}}isSchemaAtomic(e){let r=["string","number","boolean"];return typeof e=="object"&&typeof e.type=="string"&&r.includes(e.type)}};var Nwt=Tt(mc());var Qbn="True",Zbn="False",eEn=[CK,awt];function tEn(t){return`outline-node${t.replace(/\//g,"-")}`}function Iwt(t,e,r,n){return{schemaPath:n,artifactType:r.artifactType,description:r.description??"",name:t,displayName:e,type:"string",value:r.value,schema:r.schema??{}}}var wwt=t=>!Number.isNaN(t)&&!Number.isNaN(t-0),Rwt=t=>{let e=[];e.push({key:"",text:""});for(let r of t){let n=r;typeof r=="boolean"?(n=r?Qbn:Zbn,e.push({key:r,text:n})):typeof r=="string"?wwt(parseFloat(r))?e.push({key:parseFloat(r),text:r?.toString()}):e.push({key:r,text:r}):typeof r=="number"&&wwt(r)&&e.push({key:r,text:r?.toString()})}return e};function rEn(t,e){if(e.enum||e.oneOf){let r=[];e.enum?r=Rwt(e.enum):e.oneOf&&(r=e.oneOf.map(n=>{let i=n.const;return{key:n.const,text:i}}),r.unshift({key:"",text:"",reset:!0})),t.options=r}}function nEn(t,e,r,n){let i=r.schema.type,a=Iwt(t,e,r,n);switch(i){case"string":a.type="string",rEn(a,r.schema);break;case"number":{a.type="number";break}case"boolean":{a.type="boolean",a.options=[{key:void 0,text:""},{key:!0,text:"True"},{key:!1,text:"False"}];break}default:{r.schema.enum?Rwt(r.schema.enum):kt.warn(`Unhandled property: ${JSON.stringify(r)}`);break}}return a}function Lwt(t,e=[]){let r=[],n=Object.keys(t.properties);n.length&&n.forEach(i=>{let a=t.properties[i],o=t.path.concat(i),s=nEn(i,a.name,a,o);s&&r.push(s)});for(let i in t.aggregations){let a=t.aggregations[i];if(a.isViewNode)continue;let o=Iwt(i,a.name??i,a,a.path);o.type="object";let s=Lwt(a,[...e,t]);s.length&&(o.properties=s),r.push(o)}return r}function kwt(t,e){let{text:r,level:n,model:i}=e,{path:a}=e,o=[],s=t.getAggregationKeys(!0),c=tEn(t===i.root?"root-node":`${a}-node`);t.virtual&&i.pageType===Nwt.PageTypeV4.FPMCustomPage&&(a="");for(let l of s){let p=a+"/"+l,d=t.aggregations[l],f=d.getDisplayName(),h=kwt(d,{...e,level:n+1,path:p,text:f});o.push(h)}let u=t.annotationNodeId;return!u&&(t instanceof d_||t instanceof wS)&&(u=[]),{id:c,path:t.path.map(l=>l),children:o,text:r,additionalText:t.additionalText,moveProps:iEn(i,t),title:t.getTechnicalName(),properties:Lwt(t),annotationNodeId:u,type:oEn(t),value:t.value,schema:t.schema??{}}}function iEn(t,e){if(t.root!==e){let n={movable:e.sortableItem==="Enabled"&&!0,allowedParents:aEn(t.root,e),allowedChildTypes:e.sortableList&&e.sortableCollection?[e.sortableCollection]:void 0,type:e.sortableCollection};return e.sortableItem==="Excluded"&&(n.dropRestricted=!0),n}}function aEn(t,e){let r;if(e.custom){let n=e.parent?.getAllowedDropRange(e);r=[],e.parent&&n&&r.push({path:e.parent.path,allowedRanges:n})}else if(e.dropUINodes){let n=t.findAllowedDropAggregations(e);eEn.some(i=>e.name?.startsWith(i))&&(n=n.filter(i=>!SS(i.path,["footer","actions"]))),r=n.map(i=>({path:i.path,allowedRanges:i.range}))}return r}function oEn(t){let e;return t.custom?t instanceof CS?e="customAction":t instanceof PS?e="customColumn":t instanceof DD?e="customFilterField":t instanceof wm&&(e="customSection"):t.path.length===0?e="rootNode":t instanceof wS&&(e="views"),e}function _Ae(t,e,r,n){let i=new zK("Root",r,e,t,n??{dynamicNodes:{},nodes:[]}),a=kwt(i.root,{level:0,path:"",text:i.name,model:i});return a.root=!0,a.schema=i.schema,a}function KK(t,e){for(let r of t){if(SS(r.path,e))return{node:r};for(let i of r.properties){if(SS(i.schemaPath,e))return{property:i};let a=$wt(i,e);if(a)return{node:r,property:a}}let n=r.children?KK(r.children,e):void 0;if(n)return n}}function $wt(t,e){if(t.properties)for(let r of t.properties){if(SS(r.schemaPath,e))return r;let n=$wt(r,e);if(n)return n}}var Gd=Tt(mc()),xf=require("node:path"),xAe=Tt(kd());var Hd=Tt(kd()),TAe=Tt(mc()),OAe=require("node:fs"),a2=require("node:fs/promises"),SAe=require("node:path");function Mwt(t){let e=t.getAppId(),r=t.project,n;if(e===void 0){let i=Object.keys(r.apps);n=r.apps[i[0]].mainService}else{let i=r.apps[e];if(!i)throw new Error("ERROR_INVALID_APP_ID");n=i.mainService}return n??"mainService"}async function ID(t){let e=Mwt(t);return(t.projectType==="CAPJava"||t.projectType==="CAPNodejs")&&(e=await(0,Hd.getCapServiceName)(t.project.root,t.app?.services?.[e].uri??"")),e}async function Fwt(t){let e=[],r=Mwt(t),n=t.app?.services?.[r];if(!n)return[];if(n.uri&&(t.projectType==="CAPJava"||t.projectType==="CAPNodejs")){let i=n?.uri??"";if(i){let a=await(0,Hd.readCapServiceMetadataEdmx)(t.root,i);e.push({fileContent:a,dataSourceUri:i})}}else{if(n.local){let a=await(0,a2.readFile)(n.local);e.push({dataSourceUri:n.local,fileContent:a.toString()})}let{annotations:i=[]}=n;for(let a of i)if(a.local){let o=await(0,a2.readFile)(a.local);e.push({dataSourceUri:a.local,fileContent:o.toString()})}}return e}async function o2(t){let e=await(0,Hd.getWebappPath)(t.app.appRoot),r=(0,SAe.join)(e,Hd.FileName.Manifest);if(!(0,OAe.existsSync)(r))return;let n=await(0,a2.readFile)(r);return JSON.parse(n.toString())}async function AAe(t){let e=await o2(t),r=e?(0,Hd.getMinimumUI5Version)(e):void 0;return r!==void 0&&Number.isNaN(parseFloat(r))&&(r="latest"),r??"latest"}async function jwt(t){let e,r=(0,SAe.join)(t,Hd.FileName.Package);if((0,OAe.existsSync)(r)){let n=await(0,a2.readFile)(r);try{e=JSON.parse(n.toString())}catch(i){kt.error(String(i))}}return e?.sapuxLayer==="VENDOR"?TAe.FlexChangeLayer.Vendor:TAe.FlexChangeLayer.Customer}var NS=require("node:path"),CAe=require("node:fs"),YK=require("node:fs/promises"),Uwt=Tt(XH()),qwt=Tt(VG());function sEn(t){return t??(0,qwt.create)((0,Uwt.create)())}function Bwt(t,e,r){let n={},i=fEn(e),a=uEn(r);if(a)for(;a.length>0;){let o=a.pop();dEn(i,o)||o.content.newValue!==null&&(n[(0,NS.join)(t,`${o.fileName}.change`)]=o)}return pEn(t,i,n),n}async function Hwt(t,e,r){r=sEn(r),await cEn(t,e,r),Object.keys(e).length>0&&!(0,CAe.existsSync)((0,NS.join)(t))&&await(0,YK.mkdir)(t);for(let n in e){let i="";(0,CAe.existsSync)(n)&&(i=await r.read(n));let a=JSON.stringify(e[n],void 0,4);a!==i&&await r.write(n,a)}return r}async function cEn(t,e,r){let n=Object.keys(e);try{let i=await(0,YK.readdir)(t);i=i.map(o=>(0,NS.join)(t,o));let a=i.filter(o=>!n.includes(o));for(let o of a)try{await r.delete(o)}catch(s){kt.error(`Failed to delete deprecated file "${o}": ${s}`);continue}}catch(i){kt.error(`Error while removing deprecated flex change files: ${i}`);return}}function uEn(t=[]){let e=[];for(let r of t){let n=Gwt(r);n&&e.push(n)}return e}function Gwt(t){try{return JSON.parse(t)}catch(e){kt.error(`Error while prsing flex change file: ${e}`)}}function Vwt(t,e){return(t.changeType==="propertyChange"||t.changeType==="propertyBindingChange")&&t.changeType===e.changeType&&t.content?.property===e.content?.property&&t.selector?.id===e.selector?.id}function lEn(t,e){for(let r=t.length-1;r>=0;r--){let n=t[r].change;e.selector.id===n.selector.id&&e.content.property===n.content.property&&t.splice(r,1)}}function pEn(t,e,r){if(e)for(let n of e)r[(0,NS.join)(t,`${n.filename}`)]=n.change}function fEn(t){let e=[];for(let r in t){let n=Gwt(t[r]);n&&e.push({filename:r,change:n})}return e}function dEn(t,e){let r=t?.filter(n=>Vwt(e,n.change));if(r&&r.length>0)if(r.length===1){let n=r[0].change;if(n.content.newValue!==void 0&&e.content.newValue!==void 0&&n.content.newValue===e.content.newValue||n.content.newBinding!==void 0&&e.content.newBinding!==void 0&&n.content.newBinding===e.content.newBinding)return!0;e.fileName=(0,NS.parse)(r[0]?.filename).name;let i=t.findIndex(a=>Vwt(e,a.change));t.splice(i,1)}else lEn(t,e);return!1}var $o=class{appAccess;constructor(e){this.appAccess=e}async getSpecification(){return this.appAccess.getSpecification()}getAppId(e){return e["sap.app"]?.id??""}async getVirtualFiles(){let e=await o2(this.appAccess);if(!e)return[];let r=await this.getSpecification(),n=await Fwt(this.appAccess),i=await(0,xAe.readFlexChanges)(this.appAccess.app.changes);return r.importProject({manifest:e,annotations:n,flex:Object.values(i)})}async readApp(e){e??=await this.getVirtualFiles();let r=e.find(o=>o.dataSourceUri===Gd.FileName.App),n=JSON.parse(r?.fileContent??"{}"),i=(0,xf.join)(".schemas",(0,xf.basename)((0,xf.join)(n?.$schema??""))),a=e.find(o=>(0,xf.join)(o.dataSourceUri)===i);if(a){let o=JSON.parse(a.fileContent);o.properties?.settings&&(o.properties.settings.isViewNode=!0),a.fileContent=JSON.stringify(o)}return{config:n,schema:a?.fileContent??"{}"}}async readPageData(e){try{let r=await this.getVirtualFiles(),n=(0,xf.join)(Gd.DirName.Pages,`${e}.json`),i=r.find(c=>(0,xf.join)(c.dataSourceUri)===n),a=i?.fileContent?JSON.parse(i.fileContent):void 0,o=(0,xf.join)(".schemas",(0,xf.basename)((0,xf.join)(a?.$schema??""))),s=r.find(c=>(0,xf.join)(c.dataSourceUri)===o);if(a&&s){let u=(await this.readApp(r)).config.pages?.[e];if(u){let l=u.pageType;return{pageId:e,pageType:l??Gd.PageTypeV4.ListReport,config:a,page:u,schema:s.fileContent,entitySet:u.entitySet,entityType:"entityType"in u&&typeof u.entityType=="string"?u.entityType:void 0,contextPath:u.contextPath}}}}catch(r){kt.error(String(r))}}async writePage(e){let r=await o2(this.appAccess);if(!r)return;let n=await this.getSpecification(),a={[e.pageType===Gd.PageTypeV4.ObjectPage?Gd.SchemaType.ObjectPage:Gd.SchemaType.ListReport]:{appId:this.getAppId(r),jsonSchema:JSON.parse(e.schema),manifest:r,page:{...e.page,name:e.pageId,config:e.config}}},o=await this.getExportConfigParameters(r,a),s=n.exportConfig(o);s.manifestChangeIndicator==="Updated"&&await this.appAccess.updateManifestJSON(s.manifest);let c=this.appAccess.app.changes,u=await(0,xAe.readFlexChanges)(this.appAccess.app.changes),l=Bwt(c,u,s.flexChanges),p=await Hwt(c,l);return await p.commit(()=>{}),s.flexChanges=Object.keys(p.dump()),s}async writeApp(e){let{config:r,schema:n}=e,i=await o2(this.appAccess);if(!i)return;let a=await this.getSpecification(),o={[Gd.SchemaType.Application]:{application:r,manifest:i,jsonSchema:JSON.parse(n)}},s=await this.getExportConfigParameters(i,o),c=a.exportConfig(s);return await this.appAccess.updateManifestJSON(c.manifest),c}async writeFPM(e){e.data&&(e.data.minUI5Version=await AAe(this.appAccess));let n=await(await this.getSpecification()).generateCustomExtension(e);return await n?.commit(()=>{}),n?Object.keys(n.dump()):[]}async getExportConfigParameters(e,r){let i=e["sap.app"]?.dataSources?.mainService?.settings?.odataVersion==="2.0"?{v2:r}:{v4:r};return i.ui5Version=await AAe(this.appAccess),i.layer=await jwt(this.appAccess.root),i}};function PAe(t,e,r,n=!1){hEn(t,e,r!==void 0,(i,a)=>{if(typeof i!="object"||i===null)return;let o=i;r!==void 0?n&&Array.isArray(o[a])?o[a].push(r):o[a]=n?[r]:r:Array.isArray(o)?o.splice(typeof a=="string"?Number.parseInt(a,10):a,1):delete o[a]})}function hEn(t,e,r,n){let i=t;for(let a=0;a<e.length;a++)if(e[a]!==void 0){if(a===e.length-1&&n(i,e[a]),i[e[a]]===void 0&&r){let o=e[a+1]!==void 0&&typeof e[a+1]=="number";i[e[a]]=o?[]:{}}if(i=i[e[a]],!i)break}}var cv=class{constructor(e,r){this.appAccess=e;this.pageId=r;this.ftfsIO=new $o(e)}ftfsIO;async getPageTree(e){let r={children:[],path:[],properties:[],text:"",schema:{}};if(this.pageId){let n=await this.ftfsIO.readPageData(this.pageId);n&&(r=_Ae(n.schema,n.config,n.pageType,e))}else{let n=await this.ftfsIO.readApp();n&&(r=_Ae(n.schema,n.config,zwt.PageTypeV4.ListReport))}return r}async changeProperty(e,r){if(this.pageId){let n=await this.ftfsIO.readPageData(this.pageId);if(n)return PAe(n.config,e,r),this.ftfsIO.writePage(n)}else{let n=await this.ftfsIO.readApp();return PAe(n.config,e,r),this.ftfsIO.writeApp(n)}}async getApplication(){return this.ftfsIO.readApp()}async updateApplication(e){await this.ftfsIO.writeApp(e)}};var dl=Tt(mc());var pVt=require("node:path");var cVt=Tt(kjt()),uVt=Tt(kd()),lVt=Tt(sVt()),SX=class{constructor(e){this.options=e}metadataService;annotationService;nodes=[];nodesMap=new Map;namespace="";async loadMetadata(e=!1){if(!e&&this.metadataService)return;let{project:r,serviceName:n,appName:i}=this.options,a=await(0,uVt.getProject)(r.root);this.annotationService=await cVt.FioriAnnotationService.createService(a,n,i),await this.annotationService.sync(),this.metadataService=this.annotationService.getMetadataService(),this.namespace=[...this.metadataService.getNamespaces()][0],this.metadataService.visitMetadataElements(this.visitMdElement.bind(this))}visitMdElement(e){let{path:r,name:n}=e,i=this.metadataService?.getEdmTargetKinds(r)[0]||"",a={path:r,name:n,mdElement:e,kind:i};this.nodes?.push(a),this.nodesMap.set(r,a)}async getNamespace(){return await this.loadMetadata(),this.namespace}async getAllowedEntities(e=!1){if(await this.loadMetadata(e),!this.annotationService)return[];let r=[],n=this.annotationService.getSchema(),i=(0,lVt.convert)(n);for(let a of i.entitySets)r.push({entitySet:a.name,entityType:a.entityType.name,navigations:a.entityType.navigationProperties.filter(o=>o.isCollection).map(o=>{let s=o.targetType,c=i.entitySets.find(u=>u.entityTypeName===s.name);return{name:o.name,fullyQualifiedName:o.fullyQualifiedName,entitySet:c?.name??s.name}})});return r}async getAllowedNavigations(e,r,n=!1){return(await this.getAllowedEntities(n)).find(a=>a.entitySet===e||a.entityType===r)?.navigations??[]}};var HDe=new Map;function e$n(t){return(0,pVt.join)(t.project.root,t.appName,t.serviceName)}async function GDe(t){let e=e$n(t);HDe.has(e)||HDe.set(e,new SX(t));let r=HDe.get(e);if(!r)throw new Error(`No service: '${e}'`);return r}var Uf=Tt(mc()),t$n=new Map([[Uf.PageTypeV4.ListReport,"List"],[Uf.PageTypeV4.ObjectPage,Uf.PageTypeV4.ObjectPage],[Uf.PageTypeV4.CustomPage,"Page"],[Uf.PageTypeV4.FPMCustomPage,"Page"],[Uf.PageTypeV4.AnalyticalListPage,"ALP"]]);function r$n(t,e,r){let n="",i=[];if(t.pageType===Uf.PageTypeV4.CustomPage||t.pageType===Uf.PageTypeV4.FPMCustomPage){let o=(t.viewName??"").split(".");n=o[o.length-1]}else n=t.contextPath?t.contextPath.slice(1).replace(/\//g,"_"):t.entitySet;return i=[n],e&&r&&(!t.contextPath||t.contextPath.indexOf(r)===-1)&&i.push(r),i[i.length-1]+=t$n.get(t.pageType),i}function n$n(t){let e=[];return e.push(t.pageType),t.entitySet&&e.push(t.entitySet),e}function zDe(t,e,r,n,i){let a=[];n===Uf.FioriElementsVersion.v2?a=n$n(t):a=r$n(t,e,i);let o=a.join("_"),s=r.map(u=>u.pageId),c=0;for(;s.indexOf(o)>-1;)o+=c.toString(),c++;return o}function Ij(t){return t.config.target?.fioriElements??Uf.FioriElementsVersion.v4}var dVt=Tt(kd()),hVt=require("node:path");var fVt="1.136.7",gA="generate-fiori-ui-application-cap",U_="add-page",$v="delete-page",AX="create-controller-extension",CX=/^[A-Za-z][A-Za-z0-9_-]*$/;var q_=class{serviceName;appData;appId;applicationAccess;params;version;constructor({params:e,applicationAccess:r,appId:n,serviceName:i,appData:a}){this.params=e,this.serviceName=i,this.appData=a,this.appId=n,this.applicationAccess=r,this.version=Ij(a)}getAllowedNavigationsOutput(e){return e.map(r=>r.name).join(", ")}getMissingNavigationMessage(e,r,n){let i="";switch(e){case 1:{i="page does not have valid navigation for add";break}case 2:{i=`provided 'navigation' was not found. ${n} has following navigations available: ${this.getAllowedNavigationsOutput(r)}`;break}case 3:{i="provide 'entitySet' for very first page";break}case 4:{i=`provided 'entitySet' was not found. Following entitySets available: ${this.getAllowedNavigationsOutput(r)}`;break}}return i}calculateContextPath(e,r,n){let i;return!e||e.pageType===dl.PageTypeV4.ListReport?i=`/${n}`:e.contextPath?i=r&&e.routePattern!==":?query:"?`${e.contextPath}/${r}`:`/${n}`:e.entitySet&&(i=this.calculateContextPathBasedOnEntitySet(e,r)),i}calculateContextPathBasedOnEntitySet(e,r){let n,a=e.routePattern?.replace(":?query:","").replace(/\({[^}]*}\)/g,"");return a?n=r&&r!==""?`/${a}/${r}`:`/${a}`:n=r&&r!==""?`/${e.entitySet}/${r}`:`/${e.entitySet}`,n}createErrorResponse(e){return{functionalityId:U_,status:"Failed",message:e,parameters:[],appPath:this.params.appPath,changes:[],timestamp:new Date().toISOString()}}async validatePageCreationInput(e,r,n){if(r.length&&!e.parent)return this.createErrorResponse('Provide "parentPage" for page creation');if(e.pageType===dl.PageTypeV4.CustomPage){let i=this.validateCustomPageViewName(n);if(i)return i}return null}validateCustomPageViewName(e){let r=".view.xml",n=e?.endsWith(r)?e.slice(0,-r.length):e;return n?/^[a-z][a-z0-9_-]*$/i.exec(n)?null:this.createErrorResponse("'viewName' must not contain spaces, must start with an upper-case letter, and may contain letters, digits, and underscores."):this.createErrorResponse('Provide "viewName" for CustomPage')}async validateNavigationInput(e,r,n,i=[]){if(i.length&&!e)return this.createErrorResponse('provided "parentPage" was not found');let a=await this.getAllowedNavigations(e);if(e&&!a.length){let s=this.getMissingNavigationMessage(1,a);return this.createErrorResponse(s)}let o=this.findTargetNavigation(a,r,n);if(e&&!o){let s=this.getMissingNavigationMessage(2,a,e.pageId);return this.createErrorResponse(s)}if(!e&&!n){let s=this.getMissingNavigationMessage(3,a);return this.createErrorResponse(s)}if(!e&&!o){let s=this.getMissingNavigationMessage(4,a);return this.createErrorResponse(s)}return null}findTargetNavigation(e,r,n){return e.find(i=>{let a=i.name.toLocaleLowerCase();return a===r?.toLocaleLowerCase()||a===n?.toLocaleLowerCase()})}async generatePageV4(e,r,n,i,a,o){let s=r?{sourceEntity:r.entitySet,sourcePage:r.pageId,navEntity:n?.name,navKey:!0}:void 0,c=this.calculateContextPath(r,n?.name,n?.entitySet??o),u=zDe({entitySet:n?.entitySet??o??"",pageId:"",pageType:e.pageType,contextPath:c,viewName:a},r?.pageId,i,this.version,n?.name),l={id:u,entity:n?.entitySet??o??"",navigation:s,contextPath:c,name:e.pageType===dl.PageTypeV4.CustomPage?a:void 0},p=await this.writeFPM(e.pageType,l,a);return{pageID:u,changes:p}}async generatePageV2(e,r,n,i,a,o){let s=this.appData.config;s.pages||(s.pages={});let c=zDe({entitySet:n?.entitySet??o??"",pageId:"",pageType:e.pageType,contextPath:"",viewName:a},r?.pageId,i,this.version,n?.name);s.pages[c]={pageType:e.pageType,entitySet:n?.entitySet??o,navigationProperty:n?.name,navigation:{}};let u=r?s.pages[r.pageId]:void 0;if(u){u.navigation||(u.navigation={});let p=u.entitySet??"";u.navigation[c]=n?.name?`${p}.${n.name}`:p}return await new $o(this.applicationAccess).writeApp(this.appData),{pageID:c,changes:[this.applicationAccess.app.manifest]}}async writeFPM(e,r,n){let i=new $o(this.applicationAccess),a=dl.CustomExtensionType.ListReport;e===dl.PageTypeV4.ObjectPage&&(a=dl.CustomExtensionType.ObjectPage),e===dl.PageTypeV4.CustomPage&&n&&(a=dl.CustomExtensionType.CustomPage);let o=qz(dVt.DirName.View);return i.writeFPM({customExtension:a,basePath:(0,hVt.join)(this.applicationAccess.project.root,this.appId),data:{...r,folder:o}})}deleteNavigationLinks(e,r){if(e){for(let n in e)if(this.findPageByNavigation(e,n)===r){delete e[n];break}}}findPageByNavigation(e,r){let n=e?.[r];return typeof n=="string"?r:n?.route}deletePageRecursively(e,r){if(!r)return;let{pages:n}=e,i=e.settings??{};if(n?.[r]){let a=n?.[r];delete n[r];let o=`${a.pageType}#${r}`;if(i.controllerExtensions?.[o]&&delete i.controllerExtensions[o],a.navigation)for(let s in a.navigation){let c=this.findPageByNavigation(a.navigation,s);this.deletePageRecursively(e,c)}}}getPages(){let{config:e}=this.appData,{pages:r={}}=e,n=[];for(let i in r){let a=r[i];n.push({pageId:i,pageType:a.pageType??dl.PageTypeV4.ListReport,entitySet:a.entitySet??"",contextPath:a.contextPath,routePattern:"routePattern"in a&&typeof a.routePattern=="string"?a.routePattern:void 0})}return n}async getAllowedNavigations(e,r=!1){return!e||e?.pageType==="ListReport"?this.getRootPageNavigationOptions(r):(await(await GDe({appName:this.appId,project:this.applicationAccess.project,serviceName:this.serviceName})).getAllowedNavigations(e?.entitySet,e?.entitySet,r)).map(i=>({...i,isNavigation:!0}))}async getRootPageNavigationOptions(e=!1){return(await(await GDe({appName:this.appId,project:this.applicationAccess.project,serviceName:this.serviceName})).getAllowedEntities(e)).map(i=>({entitySet:i.entitySet,name:i.entitySet}))}async getCreationNavigationOptions(){let e={navigations:{}},r=this.getPages();if(r.length){let n=!0;for(let i of r)e.navigations[i.pageId]=await this.getAllowedNavigations(i,n),n=!1}else e.entities=await this.getAllowedNavigations();return e}async createPage(e){let{parent:r,navigation:n,pageType:i,entitySet:a}=e,o=e.pageType===dl.PageTypeV4.CustomPage?e.viewName:void 0,s=this.getPages(),c=await this.validatePageCreationInput(e,s,o);if(c)return c;let u=s.find(v=>v.pageId===r),l=await this.validateNavigationInput(u,n,a,s);if(l)return l;let p=await this.getAllowedNavigations(u),d=this.findTargetNavigation(p,n,a),f=this.version===dl.FioriElementsVersion.v2?this.generatePageV2:this.generatePageV4,{pageID:h,changes:m}=await f.call(this,e,u,d,s,o,a);return{functionalityId:U_,status:m.length?"success":"skipped",message:m.length?`Page with id '${h}' of type '${i}' was created successfully in application '${this.appId}'`:`No changes were made for '${i}'`,parameters:[],appPath:this.params.appPath,changes:m,timestamp:new Date().toISOString()}}async deletePage(e){let{pageId:r}=e,n=structuredClone(this.appData),{config:i}=n,a=!1,{pages:o={}}=i;if(o?.[r]){for(let s in o)o[s].navigation&&this.deleteNavigationLinks(o[s].navigation,r);this.deletePageRecursively(i,r),a=!0}return Object.keys(o).length===0&&delete i.home,a?(await new $o(this.applicationAccess).writeApp(n),{functionalityId:$v,status:"success",message:`Page with id '${r}' was deleted successfully in application '${this.appId}'`,parameters:[],appPath:this.params.appPath,changes:[],timestamp:new Date().toISOString()}):{functionalityId:$v,status:"unchanged",message:`Page with id '${r}' was not found in application '${this.appId}'`,parameters:[],appPath:this.params.appPath,changes:[],timestamp:new Date().toISOString()}}};var qf=Tt(mc());var mVt=qc([qf.PageTypeV4.ListReport,qf.PageTypeV4.ObjectPage,qf.PageTypeV4.CustomPage]),gVt=qc([qf.PageTypeV4.ObjectPage]),i$n=(t,e)=>{let r=e===qf.FioriElementsVersion.v2?gVt:mVt;return Xn({pageType:r.describe("Type of page to be created. First try to extract page type from user input, if not possible suggest content defined in options."),entitySet:qc(t.map(n=>n.name)).describe("Entity set for the new page. First try to extract entity from user input, if not possible suggest content defined in options.")})},a$n=(t,e,r)=>{let n=r===qf.FioriElementsVersion.v2?gVt:mVt,i={parentPage:gx(t).describe("Parent page is id/name of parent page. First try to extract parent page from user input, if not possible suggest content defined in options"),pageNavigation:qc(e.map(o=>o.name)),pageType:n.describe("Type of page to be created. First try to extract page type from user input, if not possible suggest content defined in options.")};r===qf.FioriElementsVersion.v4&&(i.pageViewName=qt().regex(CX).optional().describe('Required if pageType is "CustomPage". Name of custom view file. First try to extract view name from user input that satisfies the pattern, if not possible ask user to provide view name'));let a=Xn(i);return r===qf.FioriElementsVersion.v4&&(a=a.refine(o=>!(o.pageType===qf.PageTypeV4.CustomPage&&!o.pageViewName),{path:["pageViewName"],message:"A pageViewName must be provided when using PageTypeV4.CustomPage"})),a};function xX(t,e=[],r=qf.FioriElementsVersion.v4){let n=Object.keys(t);return n.length?Rh(n.map(i=>a$n(i,t[i],r))):i$n(e,r)}function PX(t=[]){let e=t.map(r=>r.pageId);return Xn({pageId:qc(e).describe("Page id to be deleted. First try to extract page id from user input, if not possible suggest content defined in options")})}var yVt=Tt(mc());var Rj={functionalityId:U_,name:"Add new page to application by updating manifest.json",description:"Create new fiori elements page like ListReport, ObjectPage, CustomPage",parameters:Ta(xX({}))};async function o$n(t){let{appPath:e}=t,r=await eu(e);if(!r?.applicationAccess)return{...Rj,parameters:{},name:"Invalid Project Root or Application Path",description:`To add a new page, provide a valid project root or application path. "${e}" is not valid`};let{appId:n,applicationAccess:i}=r,o=await new $o(i).readApp(),s=await ID(i),u=await new q_({params:t,applicationAccess:i,serviceName:s,appId:n,appData:o}).getCreationNavigationOptions();return{...Rj,parameters:Ta(xX(u.navigations,u.entities,Ij(o)))}}async function s$n(t){let{appPath:e,parameters:r}=t,n=await eu(e);if(!n?.applicationAccess)return{functionalityId:U_,status:"Failed",message:`Project root not found for app path: ${e}`,parameters:[],appPath:e,changes:[],timestamp:new Date().toISOString()};let{appId:i,applicationAccess:a}=n,s=await new $o(a).readApp(),c=await ID(a),u=new q_({params:t,applicationAccess:a,serviceName:c,appId:i,appData:s}),l=await u.getCreationNavigationOptions(),p=xX(l.navigations,l.entities,Ij(s)),d=sm(p,r),f=d.pageType??yVt.PageTypeV4.ObjectPage,h="parentPage"in d?d.parentPage:void 0,m="entitySet"in d?d.entitySet?.toString():void 0,v="pageNavigation"in d?d.pageNavigation.toString():void 0,_="pageViewName"in d&&d.pageViewName&&typeof d.pageViewName=="string"?d.pageViewName:"";return u.createPage({pageType:f,parent:h,navigation:v,entitySet:m,viewName:_})}var KDe={getFunctionalityDetails:o$n,executeFunctionality:s$n};var DX={functionalityId:$v,name:"Delete page from application by updating manifest.json",description:"Remove existing fiori elements page from the application",parameters:Ta(PX())};async function c$n(t){let{appPath:e}=t,r=await eu(e);if(!r?.applicationAccess)return{functionalityId:$v,name:"Invalid Project Root or Application Path",description:`To delete a page, provide a valid project root or application path. "${e}" is not valid`,parameters:{}};let{appId:n,applicationAccess:i}=r,o=await new $o(i).readApp(),s=await ID(i),c=new q_({params:t,applicationAccess:i,serviceName:s,appId:n,appData:o});return{...DX,parameters:Ta(PX(c.getPages()))}}async function u$n(t){let{appPath:e,parameters:r}=t,n=await eu(e);if(!n?.applicationAccess)return{functionalityId:$v,status:"Failed",message:`Project root not found for app path: ${e}`,parameters:[],appPath:e,changes:[],timestamp:new Date().toISOString()};let{appId:i,applicationAccess:a}=n,s=await new $o(a).readApp(),c=await ID(a),u=new q_({params:t,applicationAccess:a,serviceName:c,appId:i,appData:s}),l=PX(u.getPages()),p=sm(l,r);return u.deletePage({pageId:p.pageId})}var YDe={getFunctionalityDetails:c$n,executeFunctionality:u$n};var NX=Tt(mc());var vVt=require("node:path");var wX=Xn({pageType:qc(["ListReport","ObjectPage"]).describe("Type of page").default("ListReport"),controllerName:qt().regex(CX).describe("Name of new controller extension file")});async function WDe(t){let e=[];if(t){let r=await t.readApp();e=Object.keys(r.config.pages??{})}return e.length>0?wX.extend({pageId:qc(e).optional().describe("If controller extension should be assigned for specific page, then pageId should be provided")}):wX}var XDe={functionalityId:AX,name:"Add new controller extension by creating javascript or typescript file and updates manifest.json with entry",description:"Add new controller extension by creating javascript or typescript file and updates manifest.json with entry. Controller extensions allow users to extensiate default behaviour with custom controllers code.",parameters:Ta(wX)};async function l$n(t){let e=await eu(t.appPath);if(!e?.applicationAccess)throw new Error("Invalid Project Root or Application Path");let r=new $o(e.applicationAccess);return{...XDe,parameters:Ta(await WDe(r))}}async function p$n(t){let{parameters:e,appPath:r}=t,n=await eu(r),i=[];if(n?.applicationAccess){let{appId:a,root:o}=n,s=new $o(n.applicationAccess),c=await WDe(s),u=sm(c,e),{pageId:l,controllerName:p,pageType:d}=u,f=await f$n(s,d,l);if(f&&typeof f=="string"){let h={pageId:typeof l=="string"?l:void 0,pageType:f};i=await s.writeFPM({customExtension:NX.CustomExtensionType.ControllerExtension,basePath:(0,vVt.join)(o,a),data:{extension:h,folder:qz(NX.DirName.Controller),name:p}})}}return{functionalityId:t.functionalityId,status:i.length?"success":"skipped",message:i.length?"Controller extension is created":"Controller extension is not created",parameters:e,appPath:r,changes:i,timestamp:new Date().toISOString()}}async function f$n(t,e,r){if(r&&typeof r=="string"&&(e=(await t.readApp()).config.pages?.[r]?.pageType),e&&typeof e=="string")return e}var bVt={getFunctionalityDetails:l$n,executeFunctionality:p$n};var Fw=require("node:fs"),Lj=require("node:path");var yA={version:"0.2",telemetryData:{generationSourceName:AR.name,generationSourceVersion:AR.version},project:{sapux:!0}},IX=gx(["FE_FPM","FE_LROP","FE_OVP","FE_ALP","FE_FEOP","FE_WORKLIST","FF_SIMPLE"]).describe("SAP Fiori Elements floor plan type."),RX=Xn({name:qt().describe("Must be lowercase with dashes, e.g., 'sales-order-management'.").regex(/^[a-z0-9-]+$/),title:ay(qt()),description:qt(),targetFolder:qt().describe("Absolute path to the project folder (projectPath)."),ui5Version:qt().default(fVt)}),EVt=Xn({servicePath:qt().describe("The odata endpoint. If the parameter is not provided, the agent should ask the user for it.").meta({examples:["odata/v4/<servicename>/","odata/v4/MyRiskService/","odata/v4/MyOdataV4Service/","odata/v4/<relative '@path' annotation from service cds file>/","<absolute '@path' annotation from service cds file>/","myAbsolutePathFromServiceCdsFile/"]}),host:Mse().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:ay(qt().describe("The client to be used for the OData service.")),metadataFilePath:ay(qt().describe("Path to a local metadata.xml file."))}),_Vt=Xn({capService:Xn({projectPath:qt(),serviceName:qt(),serviceCdsPath:qt().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:ay(gx(["Node.js","Java"]))})}),LX=Xn({mainEntity:Xn({entityName:qt().describe("The name of the main entity. EntitySet Name attribute in OData Metadata").meta({examples:["'SalesOrder'","'PurchaseOrderHeader'","'MyEntity'"]})}),generateFormAnnotations:AT(),generateLROPAnnotations:AT()});var JDe=yx.object({entityConfig:LX,floorplan:IX,project:RX,service:EVt}).describe(`The configuration that will be used for the Application UI generation.
|
|
1603
|
+
`;return c}else return{query:r,searchType:"hybrid",results:s.map(c=>({title:c.document.title,category:c.document.category,path:c.document.path,score:c.score,matches:[],excerpt:c.document.metadata?.excerpt,content:c.document.content,uri:`sap-fiori://docs/${c.document.category}/${c.document.id}`})),total:s.length}}catch(i){return kt.warn(`Embeddings data not available, providing limited search capability: ${i}`),{query:r,searchType:"limited_fallback",error:"Embeddings data not available. Please install @sap-ux/fiori-docs-embeddings for full search capabilities.",results:[],total:0,suggestion:"Try running: npm install -g @sap-ux/fiori-docs-embeddings"}}}var sK=Tt(kd()),Ext=require("node:path");async function GSe(t){let{searchPath:e=[]}=t,n=(await(0,sK.findFioriArtifacts)({wsFolders:e,artifacts:["applications"]})).applications??[];return{applications:await Promise.all(n.map(async i=>{let a=await(0,sK.getProjectType)(i.projectRoot);return{name:i.manifest["sap.app"]?.id??(0,Ext.basename)(i.appRoot),appPath:i.appRoot,projectPath:i.projectRoot,projectType:a,odataVersion:i.manifest["sap.app"]?.dataSources?.mainService?.settings?.odataVersion??"4.0"}}))??[]}}var zwt=Tt(mc());var sr=t=>typeof t=="string",JF=()=>{let t,e,r=new Promise((n,i)=>{t=n,e=i});return r.resolve=t,r.reject=e,r},HDt=t=>t==null?"":""+t,xbn=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},Pbn=/###/g,GDt=t=>t&&t.indexOf("###")>-1?t.replace(Pbn,"."):t,zDt=t=>!t||sr(t),QF=(t,e,r)=>{let n=sr(e)?e.split("."):e,i=0;for(;i<n.length-1;){if(zDt(t))return{};let a=GDt(n[i]);!t[a]&&r&&(t[a]=new r),Object.prototype.hasOwnProperty.call(t,a)?t=t[a]:t={},++i}return zDt(t)?{}:{obj:t,k:GDt(n[i])}},KDt=(t,e,r)=>{let{obj:n,k:i}=QF(t,e,Object);if(n!==void 0||e.length===1){n[i]=r;return}let a=e[e.length-1],o=e.slice(0,e.length-1),s=QF(t,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=QF(t,o,Object),s?.obj&&typeof s.obj[`${s.k}.${a}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=r},Dbn=(t,e,r,n)=>{let{obj:i,k:a}=QF(t,e,Object);i[a]=i[a]||[],i[a].push(r)},EK=(t,e)=>{let{obj:r,k:n}=QF(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},wbn=(t,e,r)=>{let n=EK(t,r);return n!==void 0?n:EK(e,r)},rwt=(t,e,r)=>{for(let n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?sr(t[n])||t[n]instanceof String||sr(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):rwt(t[n],e[n],r):t[n]=e[n]);return t},SD=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Nbn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},Ibn=t=>sr(t)?t.replace(/[&<>"'\/]/g,e=>Nbn[e]):t,tAe=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}},Rbn=[" ",",","?","!",";"],Lbn=new tAe(20),kbn=(t,e,r)=>{e=e||"",r=r||"";let n=Rbn.filter(o=>e.indexOf(o)<0&&r.indexOf(o)<0);if(n.length===0)return!0;let i=Lbn.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),a=!i.test(t);if(!a){let o=t.indexOf(r);o>0&&!i.test(t.substring(0,o))&&(a=!0)}return a},rAe=(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 o,s="";for(let c=a;c<n.length;++c)if(c!==a&&(s+=r),s+=n[c],o=i[s],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<n.length-1)continue;a+=c-a+1;break}i=o}return i},ZF=t=>t?.replace("_","-"),$bn={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)}},nAe=class t{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||$bn,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,i){return i&&!this.debug?null:(sr(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new t(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new t(this.logger,e)}},Pm=new nAe,AD=class{constructor(){this.observers={}}on(e,r){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let i=this.observers[n].get(r)||0;this.observers[n].set(r,i+1)}),this}off(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i.apply(i,[e,...r])})}},_K=class extends AD{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,r,n,i={}){let a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,s;e.indexOf(".")>-1?s=e.split("."):(s=[e,r],n&&(Array.isArray(n)?s.push(...n):sr(n)&&a?s.push(...n.split(a)):s.push(n)));let c=EK(this.data,s);return!c&&!r&&!n&&e.indexOf(".")>-1&&(e=s[0],r=s[1],n=s.slice(2).join(".")),c||!o||!sr(n)?c:rAe(this.data?.[e]?.[r],n,a)}addResource(e,r,n,i,a={silent:!1}){let o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,s=[e,r];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(s=e.split("."),i=r,r=s[1]),this.addNamespaces(r),KDt(this.data,s,i),a.silent||this.emit("added",e,r,n,i)}addResources(e,r,n,i={silent:!1}){for(let a in n)(sr(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,o={silent:!1,skipCopy:!1}){let s=[e,r];e.indexOf(".")>-1&&(s=e.split("."),i=n,n=r,r=s[1]),this.addNamespaces(r);let c=EK(this.data,s)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?rwt(c,n,a):c={...c,...n},KDt(this.data,s,c),o.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},nwt={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}},YDt={},WDt=t=>!sr(t)&&typeof t!="boolean"&&typeof t!="number",TK=class t extends AD{constructor(e,r={}){super(),xbn(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Pm.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){let n={...r};return e==null?!1:this.resolve(e,n)?.res!==void 0}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||[],o=n&&e.indexOf(n)>-1,s=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!kbn(e,n,i);if(o&&!s){let c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:sr(a)?[a]:a};let u=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(u[0])>-1)&&(a=u.shift()),e=u.join(i)}return{key:e,namespaces:sr(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 options=="object"&&(i={...i}),i||(i={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);let a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:s,namespaces:c}=this.extractFromKey(e[e.length-1],i),u=c[c.length-1],l=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");let p=i.lng||this.language,d=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p?.toLowerCase()==="cimode")return d?a?{res:`${u}${l}${s}`,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${l}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:s;let f=this.resolve(e,i),h=f?.res,m=f?.usedKey||s,v=f?.exactUsedKey||s,_=["[object Number]","[object Function]","[object RegExp]"],T=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,A=i.count!==void 0&&!sr(i.count),C=t.hasDefaultValue(i),P=A?this.pluralResolver.getSuffix(p,i.count,i):"",I=i.ordinal&&A?this.pluralResolver.getSuffix(p,i.count,{ordinal:!1}):"",$=A&&!i.ordinal&&i.count===0,R=$&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${P}`]||i[`defaultValue${I}`]||i.defaultValue,G=h;O&&!h&&C&&(G=R);let L=WDt(G),U=Object.prototype.toString.apply(G);if(O&&G&&L&&_.indexOf(U)<0&&!(sr(T)&&Array.isArray(G))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let H=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,G,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(f.res=H,f.usedParams=this.getUsedParamsDetails(i),f):H}if(o){let H=Array.isArray(G),K=H?[]:{},V=H?v:m;for(let q in G)if(Object.prototype.hasOwnProperty.call(G,q)){let Y=`${V}${o}${q}`;C&&!h?K[q]=this.translate(Y,{...i,defaultValue:WDt(R)?R[q]:void 0,joinArrays:!1,ns:c}):K[q]=this.translate(Y,{...i,joinArrays:!1,ns:c}),K[q]===Y&&(K[q]=G[q])}h=K}}else if(O&&sr(T)&&Array.isArray(h))h=h.join(T),h&&(h=this.extendTranslation(h,e,i,n));else{let H=!1,K=!1;!this.isValidLookup(h)&&C&&(H=!0,h=R),this.isValidLookup(h)||(K=!0,h=s);let q=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&K?void 0:h,Y=C&&R!==h&&this.options.updateMissing;if(K||H||Y){if(this.logger.log(Y?"updateKey":"missingKey",p,u,s,Y?R:h),o){let le=this.resolve(s,{...i,keySeparator:!1});le&&le.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 W=[],ie=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ie&&ie[0])for(let le=0;le<ie.length;le++)W.push(ie[le]);else this.options.saveMissingTo==="all"?W=this.languageUtils.toResolveHierarchy(i.lng||this.language):W.push(i.lng||this.language);let be=(le,je,Qe)=>{let Ve=C&&Qe!==h?Qe:q;this.options.missingKeyHandler?this.options.missingKeyHandler(le,u,je,Ve,Y,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(le,u,je,Ve,Y,i),this.emit("missingKey",le,u,je,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&A?W.forEach(le=>{let je=this.pluralResolver.getSuffixes(le,i);$&&i[`defaultValue${this.options.pluralSeparator}zero`]&&je.indexOf(`${this.options.pluralSeparator}zero`)<0&&je.push(`${this.options.pluralSeparator}zero`),je.forEach(Qe=>{be([le],s+Qe,i[`defaultValue${Qe}`]||R)})}):be(W,s,R))}h=this.extendTranslation(h,e,i,f,n),K&&h===s&&this.options.appendNamespaceToMissingKey&&(h=`${u}${l}${s}`),(K||H)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${l}${s}`:s,H?h:void 0,i))}return a?(f.res=h,f.usedParams=this.getUsedParamsDetails(i),f):h}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 c=sr(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(c){let p=e.match(this.interpolator.nestingRegexp);u=p&&p.length}let l=n.replace&&!sr(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||i.usedLng,n),c){let p=e.match(this.interpolator.nestingRegexp),d=p&&p.length;u<d&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...p)=>a?.[0]===p[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${r[0]}`),null):this.translate(...p,r),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,s=sr(o)?[o]:o;return e!=null&&s?.length&&n.applyPostProcessor!==!1&&(e=nwt.handle(s,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,i,a,o,s;return sr(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(n))return;let u=this.extractFromKey(c,r),l=u.key;i=l;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));let d=r.count!==void 0&&!sr(r.count),f=d&&!r.ordinal&&r.count===0,h=r.context!==void 0&&(sr(r.context)||typeof r.context=="number")&&r.context!=="",m=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);p.forEach(v=>{this.isValidLookup(n)||(s=v,!YDt[`${m[0]}-${v}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(YDt[`${m[0]}-${v}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(_=>{if(this.isValidLookup(n))return;o=_;let T=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(T,l,_,v,r);else{let A;d&&(A=this.pluralResolver.getSuffix(_,r.count,r));let C=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(T.push(l+A),r.ordinal&&A.indexOf(P)===0&&T.push(l+A.replace(P,this.options.pluralSeparator)),f&&T.push(l+C)),h){let I=`${l}${this.options.contextSeparator}${r.context}`;T.push(I),d&&(T.push(I+A),r.ordinal&&A.indexOf(P)===0&&T.push(I+A.replace(P,this.options.pluralSeparator)),f&&T.push(I+C))}}let O;for(;O=T.pop();)this.isValidLookup(n)||(a=O,n=this.getResource(_,v,O,r))}))})}),{res:n,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,i):this.resourceStore.getResource(e,r,n,i)}getUsedParamsDetails(e={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!sr(e.replace),i=n?e.replace:e;if(n&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let 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)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}},OK=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Pm.create("languageUtils")}getScriptPartFromCode(e){if(e=ZF(e),!e||e.indexOf("-")<0)return null;let r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=ZF(e),!e||e.indexOf("-")<0)return e;let r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(sr(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&e.forEach(n=>{if(r)return;let i=this.getScriptPartFromCode(n);if(this.isSupportedCode(i))return r=i;let a=this.getLanguagePartFromCode(n);if(this.isSupportedCode(a))return r=a;r=this.options.supportedLngs.find(o=>{if(o===a)return o;if(!(o.indexOf("-")<0&&a.indexOf("-")<0)&&(o.indexOf("-")>0&&a.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===a||o.indexOf(a)===0&&a.length>1))return o})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),sr(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),i=[],a=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return sr(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(e))):sr(e)&&a(this.formatLanguageCode(e)),n.forEach(o=>{i.indexOf(o)<0&&a(this.formatLanguageCode(o))}),i}},XDt={zero:0,one:1,two:2,few:3,many:4,other:5},JDt={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},iAe=class{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=Pm.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,r){this.rules[e]=r}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){let n=ZF(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 o;try{o=new Intl.PluralRules(n,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),JDt;if(!e.match(/-|_/))return JDt;let c=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(c,r)}return this.pluralRulesCache[a]=o,o}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(i=>`${r}${i}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,a)=>XDt[i]-XDt[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))}},QDt=(t,e,r,n=".",i=!0)=>{let a=wbn(t,e,r);return!a&&i&&sr(r)&&(a=rAe(t,r,n),a===void 0&&(a=rAe(e,r,n))),a},eAe=t=>t.replace(/\$/g,"$$$$"),aAe=class{constructor(e={}){this.logger=Pm.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:o,suffix:s,suffixEscaped:c,formatSeparator:u,unescapeSuffix:l,unescapePrefix:p,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:h,nestingSuffixEscaped:m,nestingOptionsSeparator:v,maxReplaces:_,alwaysFormat:T}=e.interpolation;this.escape=r!==void 0?r:Ibn,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=a?SD(a):o||"{{",this.suffix=s?SD(s):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=l?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=d?SD(d):f||SD("$t("),this.nestingSuffix=h?SD(h):m||SD(")"),this.nestingOptionsSeparator=v||",",this.maxReplaces=_||1e3,this.alwaysFormat=T!==void 0?T:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,r,n,i){let a,o,s,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=f=>{if(f.indexOf(this.formatSeparator)<0){let _=QDt(r,c,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(_,void 0,n,{...i,...r,interpolationkey:f}):_}let h=f.split(this.formatSeparator),m=h.shift().trim(),v=h.join(this.formatSeparator).trim();return this.format(QDt(r,c,m,this.options.keySeparator,this.options.ignoreJSONStructure),v,n,{...i,...r,interpolationkey:m})};this.resetRegExp();let l=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>eAe(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?eAe(this.escape(f)):eAe(f)}].forEach(f=>{for(s=0;a=f.regex.exec(e);){let h=a[1].trim();if(o=u(h),o===void 0)if(typeof l=="function"){let v=l(e,a,i);o=sr(v)?v:""}else if(i&&Object.prototype.hasOwnProperty.call(i,h))o="";else if(p){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${h} for interpolating ${e}`),o="";else!sr(o)&&!this.useRawValueToEscape&&(o=HDt(o));let m=f.safeValue(o);if(e=e.replace(a[0],m),p?(f.regex.lastIndex+=o.length,f.regex.lastIndex-=a[0].length):f.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,r,n={}){let i,a,o,s=(c,u)=>{let l=this.nestingOptionsSeparator;if(c.indexOf(l)<0)return c;let p=c.split(new RegExp(`${l}[ ]*{`)),d=`{${p[1]}`;c=p[0],d=this.interpolate(d,o);let f=d.match(/'/g),h=d.match(/"/g);((f?.length??0)%2===0&&!h||h.length%2!==0)&&(d=d.replace(/'/g,'"'));try{o=JSON.parse(d),u&&(o={...u,...o})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${l}${d}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(e);){let c=[];o={...n},o=o.replace&&!sr(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(c=i[1].slice(u).split(this.formatSeparator).map(l=>l.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),a=r(s.call(this,i[1].trim(),o),o),a&&i[0]===e&&!sr(a))return a;sr(a)||(a=HDt(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),a=""),c.length&&(a=c.reduce((l,p)=>this.format(l,p,n.lng,{...n,interpolationkey:i[1].trim()}),a.trim())),e=e.replace(i[0],a),this.regexp.lastIndex=0}return e}},Mbn=t=>{let e=t.toLowerCase().trim(),r={};if(t.indexOf("(")>-1){let n=t.split("(");e=n[0].toLowerCase().trim();let i=n[1].substring(0,n[1].length-1);e==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(o=>{if(o){let[s,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),l=s.trim();r[l]||(r[l]=u),u==="false"&&(r[l]=!1),u==="true"&&(r[l]=!0),isNaN(u)||(r[l]=parseInt(u,10))}})}return{formatName:e,formatOptions:r}},ZDt=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 o=n+JSON.stringify(a),s=e[o];return s||(s=t(ZF(n),i),e[o]=s),s(r)}},Fbn=t=>(e,r,n)=>t(ZF(r),n)(e),oAe=class{constructor(e={}){this.logger=Pm.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?ZDt:Fbn;this.formats={number:n((i,a)=>{let o=new Intl.NumberFormat(i,{...a});return s=>o.format(s)}),currency:n((i,a)=>{let o=new Intl.NumberFormat(i,{...a,style:"currency"});return s=>o.format(s)}),datetime:n((i,a)=>{let o=new Intl.DateTimeFormat(i,{...a});return s=>o.format(s)}),relativetime:n((i,a)=>{let o=new Intl.RelativeTimeFormat(i,{...a});return s=>o.format(s,a.range||"day")}),list:n((i,a)=>{let o=new Intl.ListFormat(i,{...a});return s=>o.format(s)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=ZDt(r)}format(e,r,n,i={}){let a=r.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(s=>s.indexOf(")")>-1)){let s=a.findIndex(c=>c.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,s)].join(this.formatSeparator)}return a.reduce((s,c)=>{let{formatName:u,formatOptions:l}=Mbn(c);if(this.formats[u]){let p=s;try{let d=i?.formatParams?.[i.interpolationkey]||{},f=d.locale||d.lng||i.locale||i.lng||n;p=this.formats[u](s,f,{...l,...i,...d})}catch(d){this.logger.warn(d)}return p}else this.logger.warn(`there was no format function for ${u}`);return s},e)}},jbn=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)},sAe=class extends AD{constructor(e,r,n,i={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=Pm.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={},o={},s={},c={};return e.forEach(u=>{let l=!0;r.forEach(p=>{let d=`${u}|${p}`;!n.reload&&this.store.hasResourceBundle(u,p)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?o[d]===void 0&&(o[d]=!0):(this.state[d]=1,l=!1,o[d]===void 0&&(o[d]=!0),a[d]===void 0&&(a[d]=!0),c[p]===void 0&&(c[p]=!0)))}),l||(s[u]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(c)}}loaded(e,r,n){let i=e.split("|"),a=i[0],o=i[1];r&&this.emit("failedLoading",a,o,r),!r&&n&&this.store.addResourceBundle(a,o,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);let s={};this.queue.forEach(c=>{Dbn(c.loaded,[a],o),jbn(c,e),r&&c.errors.push(r),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{s[u]||(s[u]={});let l=c.loaded[u];l.length&&l.forEach(p=>{s[u][p]===void 0&&(s[u][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(c=>!c.done)}read(e,r,n,i=0,a=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:i,wait:a,callback:o});return}this.readingCalls++;let s=(u,l)=>{if(this.readingCalls--,this.waitingReads.length>0){let p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&l&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,i+1,a*2,o)},a);return}o(u,l)},c=this.backend[n].bind(this.backend);if(c.length===2){try{let u=c(e,r);u&&typeof u.then=="function"?u.then(l=>s(null,l)).catch(s):s(null,u)}catch(u){s(u)}return}return c(e,r,s)}prepareLoading(e,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();sr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),sr(r)&&(r=[r]);let a=this.queueLoad(e,r,n,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(o=>{this.loadOne(o)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){let n=e.split("|"),i=n[0],a=n[1];this.read(i,a,"read",void 0,void 0,(o,s)=>{o&&this.logger.warn(`${r}loading namespace ${a} for language ${i} failed`,o),!o&&s&&this.logger.log(`${r}loaded namespace ${a} for language ${i}`,s),this.loaded(e,o,s)})}saveMissing(e,r,n,i,a,o={},s=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){let c={...o,isUpdate:a},u=this.backend.create.bind(this.backend);if(u.length<6)try{let l;u.length===5?l=u(e,r,n,i,c):l=u(e,r,n,i),l&&typeof l.then=="function"?l.then(p=>s(null,p)).catch(s):s(null,l)}catch(l){s(l)}else u(e,r,n,i,s,c)}!e||!e[0]||this.store.addResource(e[0],r,n,i)}}},ewt=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),sr(t[1])&&(e.defaultValue=t[1]),sr(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){let r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),twt=t=>(sr(t.ns)&&(t.ns=[t.ns]),sr(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),sr(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),bK=()=>{},Vbn=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})},SK=class t extends AD{constructor(e={},r){if(super(),this.options=twt(e),this.services={},this.logger=Pm,this.modules={external:[]},Vbn(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(sr(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));let n=ewt();this.options={...n,...this.options,...twt(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);let i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Pm.init(i(this.modules.logger),this.options):Pm.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=oAe;let l=new OK(this.options);this.store=new _K(this.options.resources,this.options);let p=this.services;p.logger=Pm,p.resourceStore=this.store,p.languageUtils=l,p.pluralResolver=new iAe(l,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(p.formatter=i(u),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new aAe(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new sAe(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new TK(this.services,this.options),this.translator.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,r||(r=bK),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...l)=>this.store[u](...l)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...l)=>(this.store[u](...l),this)});let s=JF(),c=()=>{let u=(l,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(p),r(l,p)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),s}loadResources(e,r=bK){let n=r,i=sr(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let a=[],o=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{u!=="cimode"&&a.indexOf(u)<0&&a.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload?.forEach?.(s=>o(s)),this.services.backendConnector.load(a,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(s)})}else n(null)}reloadResources(e,r,n){let i=JF();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=bK),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"&&nwt.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let n=JF();this.emit("languageChanging",e);let i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?this.isLanguageChangingTo===e&&(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),r&&r(s,(...u)=>this.t(...u))},o=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);let c=sr(s)?s:s&&s[0],u=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(sr(s)?[s]:s);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,l=>{a(l,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),n}getFixedT(e,r,n){let i=(a,o,...s)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([a,o].concat(s)):c={...o},c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||n||i.keyPrefix);let u=this.options.keySeparator||".",l;return c.keyPrefix&&Array.isArray(a)?l=a.map(p=>`${c.keyPrefix}${u}${p}`):l=c.keyPrefix?`${c.keyPrefix}${u}${a}`:a,this.t(l,c)};return sr(e)?i.lng=e:i.lngs=e,i.ns=r,i.keyPrefix=n,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let o=(s,c)=>{let u=this.services.backendConnector.state[`${s}|${c}`];return u===-1||u===0||u===2};if(r.precheck){let s=r.precheck(this,o);if(s!==void 0)return s}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,e)&&(!i||o(a,e)))}loadNamespaces(e,r){let n=JF();return this.options.ns?(sr(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){let n=JF();sr(e)&&(e=[e]);let i=this.options.preload||[],a=e.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return a.length?(this.options.preload=i.concat(a),this.loadResources(o=>{n.resolve(),r&&r(o)}),n):(r&&r(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";if(Intl.Locale){let i=new Intl.Locale(e);if(i&&i.getTextInfo){let a=i.getTextInfo();if(a&&a.direction)return a.direction}}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 OK(ewt());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){return new t(e,r)}cloneInstance(e={},r=bK){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(s=>{a[s]=this[s]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n){let s=Object.keys(this.store.data).reduce((c,u)=>(c[u]={...this.store.data[u]},c[u]=Object.keys(c[u]).reduce((l,p)=>(l[p]={...c[u][p]},l),c[u]),c),{});a.store=new _K(s,i),a.services.resourceStore=a.store}return a.translator=new TK(a.services,i),a.translator.on("*",(s,...c)=>{a.emit(s,...c)}),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}}},Et=SK.createInstance();Et.createInstance=SK.createInstance;var t1i=Et.createInstance,r1i=Et.dir,n1i=Et.init,i1i=Et.loadResources,a1i=Et.reloadResources,o1i=Et.use,s1i=Et.changeLanguage,c1i=Et.getFixedT,u1i=Et.t,l1i=Et.exists,p1i=Et.setDefaultNamespace,f1i=Et.hasLoadedNamespace,d1i=Et.loadNamespaces,h1i=Et.loadLanguages;var e2=Tt(mc());var iwt="genericActions";var AK="DataFieldForAction",CK="DataFieldForIntentBasedNavigation",awt="DataFieldForActionGroup",cAe="::",t2="customView(";var uAe=new Map([[e2.v2.TableTypeV2.ResponsiveTable,"ResponsiveTableColumnsExtension"],[e2.v2.TableTypeV2.GridTable,"GridTableColumnsExtension"],[e2.v2.TableTypeV2.AnalyticalTable,"AnalyticalTableColumnsExtension"],[e2.v2.TableTypeV2.TreeTable,"TreeTableColumnsExtension"]]),CD="annotation",ho="schema";var lAe="Facet ID: ",owt=new Map([...uAe.entries()].map(([t,e])=>[e,t]));var swt="@com.sap.vocabularies.UI.v1";var cwt="annotation",uwt="service",lwt="ui5";var xK=class{schema;value;pattern;freeText;disabled;state=0;description;required;isAtomic;i18nClassification;name;displayName;artifactType;minimum;messages;locations;constructor(e,r){this.schema=structuredClone(e),this.name=r}};function f_(t){return t?.tooComplex===!0}var fwt=new Map;fwt.set("com.sap.vocabularies.UI.v1.HeaderInfo",new Set(["com.sap.vocabularies.UI.v1.HeaderFacets","com.sap.vocabularies.UI.v1.Identification"]));var Ubn=["com.sap.vocabularies.UI.v1.DeleteHidden","com.sap.vocabularies.UI.v1.UpdateHidden"],pwt=t=>(t||"").split("/@").pop()||"";function dwt(t,e){let r=t.nodes.find(n=>n?.nodeId&&n.nodeId[0]===e[0]);for(let n=1;n<e.length;n++){if(r&&f_(r))return r;r=r?.subnodes.find(i=>i.nodeId[n]===e[n])}return r}function hwt(t){return f_(t)?t.tooComplexLocations??[]:t.location?[t.location]:[]}function pAe(t,e,r,n){let i=qbn(e,n);for(let a of i){let o=e[a],s=o.annotationPath.split("/").map((c,u)=>u===1?c.split(".").slice(-1)[0]??c:c).join("/");if(t===o.annotationPath||t===s)return o;if(!r&&!f_(o)&&o.subnodes.length>0){let c=pAe(t,o.subnodes,void 0,n);if(c)return c}}}function mwt(t,e,r,n,i){let a=pwt(t),o=pAe(t,r,void 0,i);return!o&&Ubn.includes(a)&&(o=e.find(c=>c.nodeType===iwt)?.subnodes.find(c=>c.annotationPath===t)),!o&&fwt.get(pwt(n))?.has(a)&&(o=pAe(t,e,!0,i)),o}function qbn(t,e){let r=[];e!==void 0&&t.length>e&&r.push(e);for(let n=0;n<t.length;n++)n!==e&&r.push(n);return r}var fAe="i18n",Bbn=(t="",e=!1,r)=>{if(/^{{[^\\{}:]+}}$/.exec(t)&&(!e||r))return t.toString().substring(2,t.length-2);let n=e?`(${fAe}|@${fAe})`:`${fAe}`,i=e?2:1,a=new RegExp(`^{${n}>([^\\{}:]+)}$`).exec(t);return a?a[i]:void 0},dAe=(t,e={})=>{let r=Bbn(t,!0,!0);if(r){let n=e[r];if(n?.length>0)return n[0].value?.value}},gwt=(t,e,r,n="EDMXBackend")=>["CAPJava","CAPNodejs"].includes(n)&&!t&&e?uwt:r?cwt:lwt;var SS=(t,e)=>!t||!e?t===e:t.length===e.length&&t.every(function(r,n){return r===e[n]}),hAe=(t,e)=>{if(!t||!e||e.length>t.length)return!1;let r=t.length-1,n=e.length-1;for(;n>=0;){if(e[n]!==t[r])return!1;r--,n--}return!0},AS=(t,e)=>{let r=t;for(let n of e)if(n!==void 0)if(typeof r=="object"&&n in r)r=r[n];else return;return r};var Hbn=()=>({bundles:{annotation:{},app:{},service:{},ui5:{}}}),xD=(t,e=!1)=>{let r=t[t.length-1];if(r){let n=r.toString(),i=n.includes(":::")?":::":"::",a=r.toString().split(i);if(n=a[0],!e&&a.length>1&&(a.splice(0,1),n=a.join("/")),n)return n}},vwt=(t,e)=>{let r,n=0,i=!1;for(let o in t.aggregations)t.aggregations[o].custom?i=!0:(r=n>0?void 0:t.aggregations[o],n++);if(!i||!r?.actions)return;let a=r.actions.findIndex(o=>o==="Delete"||typeof o=="object"&&o.type==="Delete");if(a!==-1){let o=r.actions[a];typeof o!="object"&&(o={type:o}),o.disabled=!0,o.title=Et.t(e),r.actions[a]=o}},ov=(t,e,r,n)=>{e||(t.state=1,t.messages=[{text:r,type:"warning"}],t.inactive=!0,n&&t.properties[n]&&mAe(t.properties[n],[{text:r}]))},PD=(t,e=t.value)=>{let r=e&&typeof e=="object"?e:{},n="key"in r&&!!r.key;ov(t,n,Et.t("PAGE_EDITOR_CUSTOM_EXTENSION_NO_KEY"),"key")};var DK=(t,e)=>{let r=t.name==="position"?t.parent?.name:t.name;if(e.enum){let n={...e,enum:[...e.enum]},i=n.enum.findIndex(a=>a===r);return i!==-1&&n.enum.splice(i,1),n}else if(e.oneOf){let n=Hbn(),i={...e,oneOf:[...e.oneOf]};for(let a=0;a<i.oneOf.length;a++){let o=i.oneOf[a];o.bundle=gwt(o.custom,!0,!!o.annotationNodeId,n.projectType),o.const===r&&(i.oneOf[a]={...o,hidden:!0})}return i}return e};function mAe(t,e){t.messages??=[],t.messages.push(...e)}function gAe(t){let e="",r=!0;for(let n=0;n<t.length;n++){let i=t[n];if(i==="_"||i==="-"||i===" "){e.endsWith(" ")||(e+=" "),r=!0;continue}let a=t[n-1],o=t[n+1];n>0&&(a>="a"&&a<="z"&&i>="A"&&i<="Z"||a>="A"&&a<="Z"&&i>="A"&&i<="Z"&&o&&o>="a"&&o<="z")&&(e+=" ",r=!0),r?(e+=i.toUpperCase(),r=!1):e+=i}return e.trim()}var bwt={top:["header","filterBar"]},yAe=["anchor","relatedFacet"],Jt=class t{path=[];aggregations={};properties={};additionalProperties;variants=[];childClass;additionalText;locations;actions;inactive;schema;annotationCreationForms=[];allowedAnnotationCreationForms=[];schemaCreationForms=[];formSchema;sortableList;sortableItem;sortableReadonlyTooltip;sortableConfigOnly;order;description;i18nKey;state=0;messages;value;type="Object";parent;custom=!1;isViewNode;isTable=!1;pattern;name;union;sortableCollection;annotationNodeId;dropUINodes;pending;hidden;artifactType;virtual;icon;isAtomic;constructor(e,r){e&&(this.aggregations=e.aggregations,this.properties=e.properties),r&&(this.schema=r)}addAggregation(e,r,n,i,a){if(this.aggregations[e]&&!a)return this.aggregations[e];if(r.name=e,i!==void 0&&!Number.isNaN(i)){for(let o in this.aggregations){let s=this.aggregations[o].order;s!==void 0&&!Number.isNaN(s)&&s>=i&&(this.aggregations[o].order=s+1)}r.order=i}else r.order=Object.keys(this.aggregations).length;return Object.defineProperty(r,"parent",{value:this,writable:!1}),this.aggregations[e]=r,this.updatePath(this.aggregations[e],n),r}addProperty(e,r){yAe.includes(e)&&(r=DK(this,r));let n=r.displayName||gAe(e),i=new xK(r,n);return this.properties[e]=i,i}getDisplayName(e={}){let r=[()=>{let i=this.getRawDisplayName(),a=dAe(i,e);return a||i},this.getTechnicalName.bind(this),()=>{let i=this.getFormattedName();return i?gAe(i):void 0}],n="";for(let i of r)if(n=i()||"",n)break;return n}getSupportedActions(){let e=[...this.actions??[]];return this.locations?.length&&e.push("OpenSource"),e}getKeys(){if(this.schema?.keys)return this.schema.keys}getValueOfSchemaKey(e){return this.getKeys()?.find(n=>n.name===e)?.value}getTechnicalName(){}getRawDisplayName(){if(this.isViewNode){let e=this.formatTextForDisplay(this.description);if(e)return e}return this.formatTextForDisplay(this.schema?.title)}formatTextForDisplay(e=""){return e.trim()}updateValues(e){let r=Object.keys(this.properties),n=Object.keys(this.aggregations);if(e)for(let i in e)r.includes(i)&&(this.properties[i].value=e[i]),n.includes(i)&&(this.aggregations[i].value=e[i])}updatePropertiesValues(e,r,n,i,a,o){this.updateValues(e),this.updateAnnotationData(a),this.annotationCreationForms=this.getNativeNodeCreationForms(a);for(let s in this.aggregations){let c=this.type==="Array"?Number.parseInt(s,10):s,u=this.aggregations[s].union?.originalNames||[s];for(let l of u)this.aggregations[s].updatePropertiesValues(e?.[l],r,n,i.concat([c]),a,o);this.aggregations[s].onPropertiesUpdated()}this.isAtomic&&this.handleAtomicObject(e,i)}onPropertiesUpdated(){}updateAnnotationData(e){let r=this.getCurrentUINode(e),n=r?.direct?r.node:void 0;this.setAllowedParents(e,n),this.updateLocations(e,n),r?.node&&!f_(r.node)&&r.node.readonly&&this.applyReadonlyAnnotationNode(r.node.readonlyTooltip),!this.custom&&this.sortableItem==="Enabled"&&!this.annotationNodeId&&(this.sortableItem="Readonly",this.removeAction("Delete"))}setAllowedParents(e,r){r&&(this.dropUINodes=r?.allowedParentNodes)}updateLocations(e,r){this.locations=this.locations||[];let n=this.locations.length;if(!r||n&&this.isMacrosNode())return;let i=hwt(r);if(i.length>0){if(n)for(let a of this.locations)i.some(o=>o.fileUri!==a.fileUri)&&i.push(a);this.locations=i}}getNativeNodeCreationForms(e){return!this.name||!e?[]:this.annotationNodeId||this.getParentAnnotationNodeId()?[]:this.getDefaultNativeCreationForms(e)}getDefaultNativeCreationForms(e){return[]}getParentAnnotationNodeId(){let e=this.parent;for(;e;){if(e.annotationNodeId)return e.annotationNodeId;e=e?e.parent:void 0}}getProperties(){return this.properties}getCopy(e=t){let r=JSON.parse(JSON.stringify(this,(i,a)=>{if(i!=="parent")return a})),n=new e(r);return this.createAggregations(n,e),new e(n)}createAggregations(e,r=t){if(e.aggregations){for(let n in e.aggregations)e.aggregations[n]=new r(e.aggregations[n]),this.createAggregations(e.aggregations[n]);e.additionalProperties?.aggregations&&(e.additionalProperties=new r(e.additionalProperties))}}aggregationOrderSorter(e,r){let n=this.aggregations[e]&&this.aggregations[e].order||-1,i=this.aggregations[r]&&this.aggregations[r].order||-1;return n===i?0:n>i?1:-1}getAggregationKeys(e=!1,r){let n=Object.keys(this.aggregations).sort(this.aggregationOrderSorter.bind(this));return this.sortableList||(n=n.sort((i,a)=>{let o=bwt.top.indexOf(i),s=bwt.top.indexOf(a);return o!==-1&&s!==-1&&o>s?1:o!==-1?-1:s!==-1?1:0})),e&&(n=n.filter(i=>this.aggregations[i].isViewNode&&!this.aggregations[i].hidden)),r==="ViewNode"&&(n=n.sort(this.getViewNodeSorter.bind(this))),n}getViewNodeSorter(e,r){let n=this.aggregations[e].isViewNode,i=this.aggregations[r].isViewNode;return n===i&&!n?e===r?0:e>r?1:-1:this.aggregations[e].isViewNode===this.aggregations[r].isViewNode?0:this.aggregations[e].isViewNode?1:-1}updatePath(e,r){if(e.setPath(r),e.aggregations)for(let n in e.aggregations)this.updatePath(e.aggregations[n],r.concat([n]))}setPath(e){this.path=e}getMaxOrder(){let e=0;for(let r in this.aggregations){let n=this.aggregations[r].order||0;e<n&&(e=n)}return e}findMatchingParent(e=t){let r=this.parent;for(;r;){if(r instanceof e)return r;r=r?r.parent:void 0}}addUnionName(e,r){let n=this.union?.originalNames||[];n.includes(r)||n.push(r),this.union={name:e,originalNames:n}}getFormattedName(){return this.name}getCurrentUINode(e){if(this.name&&e){let r=this.annotationNodeId||this.getParentAnnotationNodeId();if(r){let n=dwt(e,r);if(n)return{node:n,direct:!!this.annotationNodeId}}}}applyReadonlyAnnotationNode(e){let r=i=>{for(let a=0;a<i.length;a++){let o=i[a];typeof o=="string"&&(i[a]=o={type:o}),o.disabled=!0,o.title=e}},n=i=>{i.sortableItem="Readonly",e&&(i.sortableReadonlyTooltip=e)};for(let i in this.aggregations){let a=this.aggregations[i];a.actions&&!a.custom&&r(a.actions),a.sortableItem==="Enabled"&&n(a)}this.actions&&r(this.actions),this.sortableItem==="Enabled"&&n(this)}removeAction(e){if(this.actions){let r=this.actions.indexOf(e);r!==-1&&this.actions.splice(r,1)}}nodeIdToString(e){return`[${e.join(",")}]`}findDropableCollectionsByCollection(e,r){let n=[];if(e.sortableList&&e.sortableCollection===r)n.push(e);else for(let i in e.aggregations){let a=e.aggregations[i],o=this.findDropableCollectionsByCollection(a,r);n.push(...o)}return n}getAllowedDropRange(e){}findAllowedDropAggregations(e,r=this){let{dropUINodes:n={},sortableCollection:i}=e,a=[];if(r.annotationNodeId&&n[this.nodeIdToString(r.annotationNodeId)]){let o=this.findDropableCollectionsByCollection(r,i);a.push(...o.map(s=>{let c=s.getAllowedDropRange(e);return{path:s.path,range:c}}))}for(let o in r.aggregations){let s=r.aggregations[o],c=this.findAllowedDropAggregations(e,s);a.push(...c)}return a}isMacrosNode(){return!!this.schema?.metadata}convertAtomicPropertyToAggregation(e,r){let n=new t,i=e.toString();this.properties[e]&&(n.properties[i]=this.properties[e],n.properties[i].isAtomic=!0),this.addAggregation(e.toString(),n,r.concat(e))}handleAtomicObject(e,r){if(typeof e=="object"){if(Array.isArray(e))for(let n=0;n<e.length;n++)this.convertAtomicPropertyToAggregation(n,r);else for(let n in e)this.convertAtomicPropertyToAggregation(n,r);this.properties={}}}};var CS=class extends Jt{actions=["Delete"];sortableItem="Enabled";isViewNode=!0;sortableCollection="actions";data;getTechnicalName(){let e=this.path[this.path.length-1];if(e&&typeof e=="string"){let r=e.split("::"),n="";if(r[r.length-1].includes("."))for(let i=0;i<r.length;i++)r[i]===AK&&r[i+1]&&(n=r[i+1]);else n=r[r.length-1];if(n){let i=n.split(".");return i[i.length-1]}}return super.getTechnicalName()}markAsCustomAction(){this.custom=!0,this.actions=["OpenSource"],this.sortableItem="Enabled",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_ACTION"),this.i18nKey=this.parent?.i18nKey,this.isMacrosNode()?PD(this):this.actions.push("Delete");let e=this.aggregations.position?.properties.anchor;e?.value&&((e.schema.oneOf||[]).some(n=>n.const===e.value)||ov(this,!1,Et.t("PAGE_EDITOR_CUSTOM_EXTENSION_NO_ANCHOR")))}markAsStandardAction(){this.sortableItem="Readonly",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_STANDARD_ACTION"),this.i18nKey=this.parent?.i18nKey,this.removeAction("Delete")}getActionType(){return typeof this.schema?.actionType=="string"?this.schema.actionType:void 0}};var wK=class extends Jt{sortableList=!0;childClass=CS;allowedAnnotationCreationForms=["NativeAction","NativeNavigation"];sortableCollection="actions";i18nKey="ACTIONS";constructor(e,r){super(e,r),r?.properties&&this.schema?.additionalProperties&&this.schema?.metadata?.type!=="Aggregation"&&(this.schemaCreationForms=[{name:"CustomAction",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_ACTIONS_TITLE",disabled:!1}])}addAggregation(e,r,n,i,a){if(r=super.addAggregation(e,r,n,i,a),r instanceof CS&&r.name)switch(r.schema?.actionType){case"Standard":{r.markAsStandardAction();break}case"Copy":{r.sortableItem="Readonly";break}}return r}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.formSchema=this.additionalProperties?.aggregations.actions;let o=e||{};for(let s in o){let c=this.aggregations[s];c?.name&&c.schema?.actionType==="Standard"?c.markAsStandardAction():c?.schema&&(c.schema.actionType==="Custom"||!c.schema.annotationPath)&&c.markAsCustomAction()}}getNativeNodeCreationForms(e){return this.parent&&this.parent.name==="footer"&&(this.allowedAnnotationCreationForms=["NativeAction"]),super.getNativeNodeCreationForms(e)}getActionType(e){let r=e.schema?.actionType;return r?r==="Standard"&&!e.schema?.annotationPath?"StandardWithoutAnnotation":r:e.custom?"Custom":"Annotation"}calculateDropRangeEdges(e,r){let n={top:-1,bottom:-1},i={top:["Standard","Copy","Annotation"],bottom:["Criticality","Standard","Copy"]};for(let a=0;a<e.length;a++){let o=e[a],s=this.aggregations[o],c=this.getActionType(s);if(c&&i.top.includes(c)){n.top=a;break}}if(r!=="Custom")for(let a=0;a<e.length;a++){let o=e[a],s=this.aggregations[o],c=this.getActionType(s);c&&i.bottom.includes(c)&&(n.bottom=a+1)}else n.bottom=n.top;return n}getActionsContainers(e){let r=this.getAggregationKeys(!0),n=0;for(let a=r.length-1;a>=0;a--){let o=r[a],s=this.aggregations[o];if(this.getActionType(s)!=="StandardWithoutAnnotation")break;n++}if(e==="Custom"&&n===0)return;let i=this.calculateDropRangeEdges(r,e);if(i.top===-1&&(i.top=i.bottom),i.bottom===-1&&(i.bottom=i.top),!(i.top===-1||i.bottom===-1))return{top:{from:0,to:i.top},bottom:{from:i.bottom,to:r.length-n}}}getAllowedDropRange(e){let r=this.getActionType(e),n=this.getActionsContainers(r),i;if(n)switch(r){case"Custom":{i=[n.top,n.bottom];break}case"Copy":case"Standard":case"StandardWithoutAnnotation":{i=[];break}case"Criticality":{i=[n.top];break}case"Annotation":{i=[n.bottom];break}}return i}};var NK=class extends Jt{actions=["Delete"];getDisplayName(){return this.name?this.name:super.getDisplayName()}};var IK=class extends Jt{sortableList=!1;childClass=NK;i18nKey="ADDITIONALOBJECTS";constructor(e,r){super(e,r),this.schemaCreationForms=[{name:"Generic",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_GENERIC_TITLE",disabled:!1}]}addAggregation(e,r,n,i,a){return r.custom=!0,super.addAggregation(e,r,n,i,a)}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.name&&(this.formSchema=this.additionalProperties?.aggregations[this.name])}};var RK=class{validate(e,r){if(e.state===0&&e.variants.length>=1){let n=this.validateVariants(e.variants,e);for(let i in n){let a=e.properties[i]||e.aggregations[i];a&&(a.state=n[i],a.state===1&&mAe(a,[{text:Et.t("PAGE_EDITOR_PROPERTIES_PROPERTY_WARNING_PROPERTY_NOT_ALLOWED",{name:i}),deletable:!0}]))}}for(let n in e.aggregations)this.validate(e.aggregations[n],r?r[n]:{})}validateVariants(e,r){let n={};for(let s in r.properties)r.properties[s].value!==void 0&&(n[s]=r.properties[s].value);for(let s in r.aggregations)r.aggregations[s].value!==void 0&&(n[s]=r.aggregations[s].value);let i=[...e];for(let s in n)i=i.filter(c=>this.validateVariant(c,r,s)===0);if(i.length===0){i=[...e];for(let s in n)i=i.filter(c=>this.validateVariant(c,r,s,!0)===0)}this.unifyVariants(r,i);let a={},o=[...Object.keys(r.properties),...Object.keys(r.aggregations)];for(let s of o)i.some(u=>s in u.properties||s in u.aggregations)?a[s]=0:s in n?a[s]=1:a[s]=2;return a}validateVariant(e,r,n,i=!1){let a=e.aggregations[n]||e.properties[n];if(a===void 0)return i?0:2;let s=(r.properties[n]||r.aggregations[n]||{}).value;if(a.schema){if(a.schema.pattern&&!new RegExp(a.schema.pattern).exec(s.toString()))return 2;if(a.schema.enum&&!a.schema.enum.includes(s)&&!a.freeText)return 2}return 0}*iterateVariantAggregations(e){for(let r of e)for(let[n,i]of Object.entries(r.aggregations))yield[n,i]}unifyVariants(e,r){let n={};for(let[i,a]of this.iterateVariantAggregations(r))a.union&&!n[i]&&(this.applyContextPath(e.aggregations[i],a.path),e.aggregations[i].name=a.path[a.path.length-1].toString(),n[i]=!0);if(Object.keys(n).length){for(let i in n)e.aggregations[i].variants=[];for(let i of r)for(let a in n){let o=i.aggregations[a];o&&(e.aggregations[a].variants=[...e.aggregations[a].variants,...o.variants.length?o.variants:[o]])}}}applyContextPath(e,r){e.path=e.path.slice();for(let n=0;n<r.length;n++)e.path[n]=r[n];for(let n in e.aggregations)this.applyContextPath(e.aggregations[n],r)}};var r2=class extends Jt{type="Array";constructor(e,r){super(e,r),this.schemaCreationForms=[{name:"Generic",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_GENERIC_TITLE",disabled:!1}]}addAggregation(e,r,n,i){return super.addAggregation(e,r,n,i),this.sortableList=!0,r.sortableItem="Enabled",r.actions=["Delete"],r.schema&&!r.schema.title&&(r.schema.title=Et.t("PAGE_EDITOR_OUTLINE_ARRAY_ITEM",{name:Number.parseInt(e,10)+1})),r.custom=!0,r}updatePropertiesValues(e,r,n,i){if(super.updatePropertiesValues(e,r,n,i),!!Array.isArray(e))for(let a=0;a<e.length;a++){let o=this.aggregations[a];if(!o)continue;let s;if(this.isAtomic)s=e[a];else{let c=this.getPrimaryKey(o);s=c?e[a][c]:void 0}typeof s!="object"&&(o.additionalText=s)}}getPrimaryKey(e){let r=["id","title","key","name"],n=e.schema?e.schema.properties||{}:{},i;for(let a of r)if(a in n){i=a;break}for(let a in n)if(n[a].type==="string"){i=a;break}return i}};var d_=class extends Jt{allowedAnnotationCreationForms=["AnalyticalChart"];name="root";getDefaultNativeCreationForms(){return this.annotationCreationForms}updateAnnotationData(e){this.annotationCreationForms=[],super.updateAnnotationData(e);let r=!!this.aggregations.chart?.isViewNode;if(!!(this.aggregations.table?.aggregations.views?.isViewNode&&!r)&&e?.dialogsContext?.analyticalChartSupport!==void 0){let i={name:"AnalyticalChart",title:e.dialogsContext.analyticalChartSupport.creationTooltip,disabled:!e.dialogsContext.analyticalChartSupport.creationEnabled,kind:CD,visualizationIcon:"Add",buttonText:Et.t("ADD_CHART"),buttonId:"add-chart"};i.disabled&&(i.disabledTitle=i.title),this.annotationCreationForms.push(i)}}};var LK=class extends Jt{updateAnnotationData(e){let r=e?.dialogsContext?.analyticalChartSupport;if(this.actions=[],r){let n=this.getDeletionSupport(r),i={type:"Delete",title:n.deletionTooltip};i.disabled=!n.deletionEnabled,this.actions.push(i)}super.updateAnnotationData(e)}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),!!this.schema?.properties?.annotationPath&&!e?.annotationPath&&(this.hidden=!0)}getDeletionSupport(e={}){if(e?.deletionEnabled){let r=this.findMatchingParent(d_);if(!r?.schema?.properties?.defaultTemplateAnnotationPath&&r){let i=r.aggregations.table?.value;if(typeof i=="object"){let a=i?.annotationPath;this.isComplexScenario(a)&&(e={deletionEnabled:!1,deletionTooltip:Et.t("CHART_DELETION_UNSUPPORTED_BY_SPEC")})}}}return e}isComplexScenario(e){let r=e.split("."),n=r[r.length-1]||"";return n.startsWith("SelectionPresentationVariant")||n.startsWith("PresentationVariant#")}};var xS=class extends Jt{actions=["Delete"];sortableItem="Enabled";isViewNode=!0;sortableCollection="fields";getRawDisplayName(){let e=super.getRawDisplayName();if(!e){let r=this.getTechnicalName();if(r)return r}return e}getTechnicalName(){return xD(this.path)}};var kK=class extends Jt{sortableList=!0;childClass=xS;allowedAnnotationCreationForms=["NativeField","NativeContactField","NativeConnectedFields"];sortableCollection="fields";i18nKey="FIELDS";updateAnnotationData(e){super.updateAnnotationData(e),this.path[0]==="header"&&this.allowedAnnotationCreationForms.splice(this.allowedAnnotationCreationForms.indexOf("NativeConnectedFields"))}};var $K=class extends xS{sortableList=!0;childClass=xS};var DD=class extends Jt{actions=["Delete"];sortableItem="Enabled";isViewNode=!0;getRawDisplayName(){let e=super.getRawDisplayName();if(!e){let r=this.getTechnicalName();if(r)return r}return e}getTechnicalName(){let e=this.path[this.path.length-1];if(e){let n=e.toString().split("::"),i=n[n.length-1];if(i)return i}}markAsCustomFilterField(){this.custom=!0,this.actions=["OpenSource"],this.isMacrosNode()||this.actions.push("Delete"),this.sortableItem="Enabled",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_FILTER_FIELD"),this.i18nKey=this.parent?.i18nKey,this.isMacrosNode()&&PD(this);let e=this.properties.anchor;e?.value&&((e.schema.oneOf||[]).some(n=>n.const===e.value)||ov(this,!1,Et.t("PAGE_EDITOR_CUSTOM_EXTENSION_NO_ANCHOR")))}addProperty(e,r){let n=super.addProperty(e,r);return e==="property"&&(n.disabled=!0),n}};var MK=class extends Jt{sortableList=!0;allowedAnnotationCreationForms=["NativeFilterFields"];childClass=DD;i18nKey="FILTER_FIELDS";constructor(e,r){super(e,r);let n=r?.additionalProperties;typeof n=="object"&&n.$ref&&!this.isMacrosNode()&&(this.schemaCreationForms=[{name:"CustomFilterField",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_FILTER_FIELDS_TITLE",disabled:!1}])}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.formSchema=this.additionalProperties?.aggregations.selectionFields;let o=e||{};for(let s in o){let c=this.aggregations[s];c?.schema&&!c.schema.annotationPath&&c.markAsCustomFilterField()}}};var _wt=require("node:path");var Twt=Tt(kd()),sv=class extends Jt{filePath;constructor(e,r){super(e,r),this.path=["macros"],this.isViewNode=!0,this.virtual=!0,this.allowedAnnotationCreationForms=[];let n=this.getCreationForms();this.annotationCreationForms=n.internal,this.schemaCreationForms=n.external;let i=this.schema?.metadata?.filePath;i&&this.setFilePath(i)}getCreationForms(){return{internal:[{name:"MacrosChart",kind:CD,disabled:!1,title:"ADD_BUILDING_BLOCK_CHART"},{name:"MacrosFilterBar",kind:CD,disabled:!1,title:"ADD_BUILDING_BLOCK_FILTERBAR"},{name:"MacrosTable",kind:CD,disabled:!1,title:"ADD_BUILDING_BLOCK_TABLE"}],external:[]}}getDisplayName(){return Et.t("PAGE_EDITOR_OUTLINE_NODE_BUILDING_BLOCK")}getNativeNodeCreationForms(){return this.annotationNodeId?this.annotationCreationForms:[]}setFilePath(e){this.filePath=(0,_wt.join)(Twt.DirName.Webapp,e)}updateAnnotationData(e){if(super.updateAnnotationData(e),e?.dialogsContext?.analyticalChartSupport!==void 0){let r=this.annotationCreationForms.find(n=>n.name==="MacrosChart");r&&(r.disabled=!e.dialogsContext.analyticalChartSupport.creationEnabled,r.disabled&&(r.tooltip=e.dialogsContext.analyticalChartSupport.creationTooltip))}}};var Dwt=require("node:path"),ND=Tt(mc());var wm=class extends Jt{actions=["Delete"];title;id;position;data;useDescriptionAsId;isViewNode=!0;sortableCollection="sections";constructor(e,r){super(e,r),this.sortableItem="Enabled"}setTitle(e){this.title=e}setId(e){this.id=e}getRawDisplayName(){return this.title||this.getSectionId()||super.getRawDisplayName()}getSectionId(e=!0){if(this.schema){if(this.schema.title?.startsWith(lAe)){let r=this.schema.title.split(lAe);return r.length>1?r[r.length-1]:r[0]}else if(e&&this.useDescriptionAsId&&this.schema.description)return this.schema.description}if(this.data&&"id"in this.data)return this.data.id}markAsReplaced(e){this.inactive=!0,this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_SECTION_REPLACED_WITH",{section:e})}markAsCustomSection(e,r,n){this.custom=!0,this.actions=["Delete",n||"OpenSource"],this.sortableItem="Enabled",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_SECTION"),this.data=e,this.i18nKey=r}getTechnicalName(){return this.getSectionId()}getFormattedName(){let e=this.name,r=`${swt}.`;return e?.includes(r)&&(e=e.replace(r,"")),e}};var Cf=Tt(mc());var n2="custom",wD=class extends Jt{customSections=[];sections=[];sortingApproach="Normal";allowedAnnotationCreationForms=void 0;sortableCollection="sections";constructor(e,r){super(e,r),this.childClass=wm,r?.properties?.custom&&(this.schemaCreationForms=[{name:"CustomSection",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE",disabled:!1}]),this.sortableList=!0,this.i18nKey="SECTIONS"}updatePropertiesValues(e,r,n,i,a,o){if(super.updatePropertiesValues(e,r,n,i,a,o),this.formSchema=this.aggregations[n2],this.sortingApproach=this.getSortingApproach(),delete this.aggregations[n2],this.correctSectionData(),this.formSchema&&(this.customSections=e&&n2 in e?e[n2]:[],this.customSections.length)){this.sections=Object.keys(this.aggregations);let s=[...this.sections];for(let p in s){let d=this.aggregations[s[p]];this.traverseCustomSections(d.getSectionId()||s[p],this.customSectionFactory.bind(this,r,n,i,o))}let c=this.customSections.filter(p=>{for(let d in this.aggregations)if(this.aggregations[d].data===p)return!1;return!0});for(let p of c)this.customSectionFactory(r,n,i,o,p);let u=this.aggregations;this.aggregations={};let l=0;for(let p of this.sections)this.aggregations[p]=u[p],this.aggregations[p].order=l,l++}}onPropertiesUpdated(){this.customSections.length&&!this.isV4()&&vwt(this,"SECTION_UNDELETABLE_LAST_NATIVE_NODE")}traverseCustomSections(e,r){let n=this.customSections.filter(a=>this.isSectionMatchesRelatedFacet(a.relatedFacet,e)),i=this.sortingApproach==="WithIds";for(let a of n)r(a),i&&"id"in a&&this.traverseCustomSections(a.id,r)}customSectionFactory(e,r,n,i,a){if(!this.formSchema)return;let o=this.customSections.indexOf(a),s=this.formSchema.getCopy(wm);if(s.markAsCustomSection(a,this.i18nKey),i){let p=a,{fragmentName:d}=p,f=i?.definitions[`CustomExtensionFragment<${d}>`];if(f&&s.aggregations.controls){let h=new sv(void 0,f);s.addAggregation("controls",h,s.path,void 0,!0),i.parse(s.aggregations.controls,f,void 0,void 0,n,{filePath:f.metadata?.filePath})}}s.updatePropertiesValues(a,e,r,n,i?.annotations),s.setTitle(a.title),s.position=a.relativePosition;let c=this.storeSection(a);this.addAggregation(c,s,this.path.concat([n2,o]));for(let p of yAe){let d=s.properties[p];d&&(d.schema=DK(s,d.schema))}let u=this.formSchema.properties.relatedFacet?.schema.oneOf?this.formSchema.properties.relatedFacet?.schema.oneOf:[],l=this.isV4()&&!a.relatedFacet?!0:u.some(p=>p.const===a.relatedFacet);ov(s,l,Et.t("PAGE_EDITOR_CUSTOM_SECTION_NO_FACET"))}correctSectionData(){let e=this.formSchema?.properties.relatedFacet?.schema.oneOf?this.formSchema.properties.relatedFacet.schema.oneOf:[];for(let r in this.aggregations){let n=this.aggregations[r];if(n.custom)continue;this.isV4()&&(n.useDescriptionAsId=!0),n.description&&n.setTitle(n.description);let i=n.getSectionId()||r,a=e.find(o=>this.isSectionMatchesRelatedFacet(i,o.const));a?.description&&(n.setTitle(a.description),n.setId(a.const))}}isSectionMatchesRelatedFacet(e="",r=""){return e.replace(/@/g,"")===r.replace(/@/g,"")}findSectionInsertPosition(e){let{relativePosition:r,relatedFacet:n}=e,i=this.checkRelatedPosition(r,Cf.v2.SectionPosition.AfterFacet,Cf.v2.SectionPosition.ReplaceFacet),a=this.findReferenceSection(n);if(!a)return this.sections.length;let o=this.checkRelatedPosition(r,Cf.v2.SectionPosition.ReplaceFacet),s=this.checkRelatedPosition(r,Cf.v2.SectionPosition.BeforeFacet),c=o?[Cf.v2.SectionPosition.ReplaceFacet]:[Cf.v2.SectionPosition.AfterFacet,Cf.v2.SectionPosition.ReplaceFacet],u=a.index;if(i&&this.sortingApproach==="Normal")for(let l=u+1;l<this.sections.length;l++){let p=this.aggregations[this.sections[l]];if(p?.custom&&p.position&&this.checkRelatedPosition(p.position,...c))u++;else break}return u+(s?0:1)}findReferenceSection(e){for(let r=0;r<this.sections.length;r++){let n=this.sections[r],i=this.aggregations[n],a=i?.getSectionId?.()??n;if(a&&this.isSectionMatchesRelatedFacet(a,e))return{index:r,aggregation:i}}}storeSection(e){let r=this.findSectionInsertPosition(e),n=this.getFreeSectionId("id"in e&&typeof e.id=="string"?e.id:e.title);this.sections.splice(r,0,n);let i=this.findReferenceSection(e.relatedFacet);return i?.aggregation&&this.checkRelatedPosition(e.relativePosition,Cf.v2.SectionPosition.ReplaceFacet)&&i.aggregation.markAsReplaced(e.title),n}getFreeSectionId(e){let r=1,n=e??"missingId";e=n;let i=Object.keys(this.aggregations).filter(o=>this.sections.indexOf(o)===-1),a=[...this.sections,...i];for(;a.includes(e);)e=n+r,r++;return e}checkRelatedPosition(e="",...r){let n=new Map([[Cf.v2.SectionPosition.AfterFacet,"after"],[Cf.v2.SectionPosition.BeforeFacet,"before"],[Cf.v2.SectionPosition.ReplaceFacet,"replace"]]);e=e.toLowerCase();for(let i of r){let a=n.get(i);if(a&&e.includes(a))return!0}return!1}getSortingApproach(){return this.isV4()?"WithIds":"Normal"}isV4(){return!!this.formSchema?.properties.id}getNativeNodeCreationForms(e){if(!e)return[];let r=super.getNativeNodeCreationForms(e),n=r.find(i=>i.name==="AnalyticalChart");return n&&!n.disabled&&(n.disabled=!e.dialogsContext?.analyticalChartSupport?.creationEnabled,e.dialogsContext?.analyticalChartSupport?.creationTooltip&&(n.disabledTitle=e.dialogsContext.analyticalChartSupport.creationTooltip)),r}};var Owt=Tt(mc()),PS=class extends Jt{title;originalIndex;isViewNode=!0;actions=["Delete"];sortableItem="Enabled";criticality;setTitle(e){this.title=e}getRawDisplayName(){return this.title||super.getRawDisplayName()}validateColumnPositioning(){let e=this.value&&typeof this.value=="object"?this.value:{},r=this.aggregations.position?.schema?.properties?.anchor?.enum,n=this.schema?.properties?.anchor?.oneOf,i=!1;if(this.isMacrosNode()){PD(this,e);let a=n??[],o=AS(e,["anchor"]);i=o?a.some(s=>s.const===o):!0}else{let a=r??[],o=AS(e,["position","anchor"]);i=o?a.includes(o):!0}ov(this,i,Et.t("PAGE_EDITOR_CUSTOM_EXTENSION_NO_ANCHOR"))}markAsCustomColumn(e){let{pageType:r,originalIndex:n,columnExtension:i,isExtensionTypeSupported:a,i18nKey:o,tableExtension:s="ResponsiveTableColumnsExtension",isV4:c=!1,tabkey:u}=e;this.custom=!0,this.actions=["OpenSource"],this.isMacrosNode()||this.actions.push("Delete"),this.sortableItem=!a||s===i?"Enabled":"Excluded";let l=i??"Unknown";u&&r===Owt.PageType.ListReport?this.additionalText=a?Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_WITH_EXTENSION_TAB",{tabkey:u,extension:Et.t(`PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_${l}`)}):Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_TAB",{tabkey:u}):this.additionalText=a?Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_WITH_EXTENSION",{extension:Et.t(`PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_${l}`)}):Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN"),this.originalIndex=n,this.i18nKey=o,a&&s!==l&&(this.state=1,this.messages=[{text:Et.t("PAGE_EDITOR_CUSTOM_COLUMN_UNUSED_COLUMN",{tableType:owt.get(s)}),type:"info"}],this.inactive=!0),c&&this.validateColumnPositioning()}getTechnicalName(){return xD(this.path)}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.updateMoveProperties()}updateMoveProperties(){(this.isActionColumn()||this.isNavigationColumn())&&(this.sortableCollection=!this.criticality||this.criticality==="None"?"actions":void 0,this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_ACTION_COLUMN"))}isActionColumn(){return!!this.name?.startsWith(`${AK}${cAe}`)}isNavigationColumn(){return!!this.name?.startsWith(`${CK}${cAe}`)}};var h_=Tt(mc());var Awt=Tt(mc()),Swt=t=>!t.type||t.type===Awt.ArtifactType.Annotation,FK=t=>{let e=[],r=t.locations?[...t.locations]:[];for(let n=r.length-1;n>=0;n--){let i=r[n];Swt(i)&&(e.push(i),r.splice(n,1))}if(t.parent&&e.length){let n=t.parent.locations||[];t.parent.locations=n.filter(i=>!Swt(i)),t.parent.locations.unshift(...e)}t.locations=r};var i2="custom",zbn=new Map([[h_.PageType.ObjectPage,"ResponsiveTableColumnsExtension"],[h_.PageType.ListReport,"ResponsiveTableColumnsExtension"],[h_.PageType.AnalyticalListPage,"AnalyticalTableColumnsExtension"]]),jK=class extends Jt{customColumns=[];columnKeys=[];tableColumnExtensionType;allowedAnnotationCreationForms=["Basic","Rating","Chart","Progress","NativeAction","Contact","NativeNavigation"];isV4;sectionId;sortableCollection="actions";constructor(e,r){if(super(e,r),this.childClass=PS,r?.properties){let n;r.properties?.custom?n="CustomColumn":typeof r.additionalProperties=="object"&&r.additionalProperties.$ref&&r.additionalProperties.$ref.indexOf("TableCustomColumn")>-1?(n="CustomColumnV4",this.isV4=!0):this.isMacrosNode()&&(this.isV4=!0),n&&(this.schemaCreationForms=[{name:n,kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_COLUMNS_TITLE",disabled:!1}])}this.sortableList=!0,this.i18nKey="COLUMNS"}groupCustomColumnsByExtension(){let e=new Map,r=[...this.customColumns].sort((n,i)=>{let a=n.columnIndex??0,o=i.columnIndex??0;return a===o?0:a>o?1:-1});for(let n of r){let i=e.get(n.extensionType);i||(i=[],e.set(n.extensionType,i)),i.push(n)}return e}ensureColumnOrder(){let e=this.getAggregationKeys();for(let r=0;r<e.length;r++){let n=this.aggregations[e[r]];n&&(n.order=r)}}updatePropertiesFromCustomAggregation(e,r,n,i){let a=this.formSchema;this.customColumns=e&&i2 in e?e[i2]:[],n===h_.PageTypeV2.ObjectPage&&(this.sectionId=this.parent?.parent?.schema?.keys?.reduce(o=>o.name==="ID").value),this.customColumns.length&&(this.ensureColumnOrder(),this.columnKeys=Object.keys(this.aggregations),this.groupCustomColumnsByExtension().forEach(s=>{for(let c in s){let u=a?.getCopy(PS),l=s[c],p=this.customColumns.indexOf(l);u.markAsCustomColumn({pageType:n,originalIndex:p,columnExtension:l.extensionType,isExtensionTypeSupported:this.isExtensionTypeSupported(),i18nKey:this.i18nKey,tableExtension:this.tableColumnExtensionType,isV4:this.isV4,tabkey:l.tabKey}),u.updatePropertiesValues(l,r,n,i),u.setTitle(l.text);let d=this.getFreeId(l.id||l.columnKey||"customColumn",this.columnKeys);this.columnKeys.push(d);let f=this.doesColumnExtensionMatchTableType(l)?l.columnIndex:this.getMaxColumnIndex(this.customColumns)+1;this.addAggregation(d,u,this.path.concat([i2,p]),f)}}))}updatePropertiesValues(e,r,n,i,a){if(super.updatePropertiesValues(e,r,n,i,a),this.resolveTableColumnExtensionType(r,n,i),!this.isV4)this.formSchema=this.aggregations[i2],delete this.aggregations[i2],this.updatePropertiesFromCustomAggregation(e,r,n,i);else{this.formSchema=this.additionalProperties?.aggregations.columns;let o=e||{};for(let s in o){let c=this.aggregations[s];c.schema&&!c.schema.annotationPath&&(c.originalIndex=c.schema.propertyIndex,c.markAsCustomColumn({pageType:n,originalIndex:c.schema.propertyIndex,columnExtension:this.tableColumnExtensionType,isExtensionTypeSupported:this.isExtensionTypeSupported(),i18nKey:this.i18nKey,tableExtension:this.tableColumnExtensionType,isV4:this.isV4,tabkey:c.properties.tabkey?.value}))}}}getFreeId(e,r){let n=1,i=e;for(;r.includes(e);)e=i+n,n++;return e}resolveTableColumnExtensionType(e,r,n){let i=n.splice(0,n.length-1);i.push("type");let a=AS(e,i);this.tableColumnExtensionType=typeof a=="string"&&a in h_.v2.TableTypeV2?uAe.get(a):zbn.get(r)}doesColumnExtensionMatchTableType(e){return!this.isExtensionTypeSupported()||e.extensionType===this.tableColumnExtensionType}isExtensionTypeSupported(){return!!this.formSchema?.properties.extensionType}getMaxColumnIndex(e){let r=this.getMaxOrder();for(let n of e)n.columnIndex!==void 0&&r<n.columnIndex&&(r=n.columnIndex);return r}updateLocations(e,r){super.updateLocations(e,r),FK(this)}};var VK=class extends Jt{getTechnicalName(){return(this.parent?xD(this.parent.path,!0):void 0)||super.getTechnicalName()}};var UK=class extends Jt{updateLocations(e,r){super.updateLocations(e,r),FK(this)}};var qK=class extends Jt{sortableCollection="visualFilters";actions=["Delete"];isViewNode=!0};var BK=class extends Jt{sortableList=!0;childClass=qK;i18nKey="VISUAL_FILTERS"};var m_=class extends wD{constructor(e,r){super(e,r);let n=r?.additionalProperties;typeof n=="object"&&n.$ref&&(this.schemaCreationForms=[{name:"CustomSection",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE",disabled:!1}])}updatePropertiesValues(e,r,n,i,a,o){super.updatePropertiesValues(e,r,n,i,a,o),this.formSchema=this.additionalProperties?.aggregations?.sections;let s=e||{};this.removeObsoleteAggregations();for(let u in s){let l=this.aggregations[u];l?.schema&&!l.schema.annotationPath&&(l.markAsCustomSection(),o&&this.parseBuildingBlocks({parser:o,page:r,pageType:n},l,u,s,i))}if(this.isSectionsMerged())for(let u in this.aggregations)this.aggregations[u].custom&&(this.aggregations[u].sortableItem="Excluded")}removeObsoleteAggregations(){let e=this.schema?.properties||{};for(let r in this.aggregations)r in e||delete this.aggregations[r]}parseBuildingBlocks(e,r,n,i,a){let{parser:o,page:s,pageType:c}=e,u=i[n],{fragmentName:l}=u,p=o?.definitions[`CustomExtensionFragment<${l}>`];if(p&&r.aggregations.controls){let d=new sv(void 0,p);r.addAggregation("controls",d,a.concat(r.path[r.path.length-1],"controls"),0,!0),o.parse(d,p,void 0,void 0,d.path,{filePath:p.metadata?.filePath});let f=AS(r.value||{},["controls"]);f&&typeof f=="object"&&d.updatePropertiesValues(f,s,c,a,o?.annotations)}}isSectionsMerged(){return!1}};var HK=class extends m_{allowedAnnotationCreationForms=["NativeSection","DataPointSection","ProgressSection","RatingSection","ChartSection"];constructor(e,r){super(e,r);let n=r?.additionalProperties;typeof n=="object"&&n.$ref&&(this.schemaCreationForms=[{name:"CustomHeaderSection",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE",disabled:!1}])}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.formSchema=this.additionalProperties?.aggregations?.sections;let o=e||{};for(let s in o){let c=this.aggregations[s];if(c?.schema&&!c.schema.annotationPath){let u=c.properties.templateEdit?.value,l=c.properties.fragmentName?.value,p;typeof l=="string"&&typeof u=="string"&&(p={type:"OpenSource",subActions:[{id:l,text:Et.t("CUSTOM_HEADER_SECTION_TEMPLATE")},{id:u,text:Et.t("CUSTOM_HEADER_SECTION_TEMPLATE_EDIT")}]}),c.markAsCustomSection(void 0,void 0,p)}}}};var GK=class extends m_{constructor(e,r){super(e,r);let n=r?.additionalProperties;typeof n=="object"&&n.$ref&&(this.schemaCreationForms=[{name:"CustomSubSection",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE",disabled:!1}])}updatePropertiesValues(e,r,n,i,a,o){super.updatePropertiesValues(e,r,n,i,a,o),this.formSchema=this.additionalProperties?.aggregations?.subsections}isSectionsMerged(){let e=0;for(let r in this.aggregations){let n=this.aggregations[r];if("subsections"in n.aggregations)return!1;n.custom||e++}return e>0}};var DS=class extends Jt{title;actions=[];sortableItem="Enabled";sortableCollection="views";constructor(e,r){super(e,r),r?.key&&!r.annotationPath&&!r.properties?.annotationPath&&(r.annotationPath=`${t2}${r.key})`)}getRawDisplayName(){return this.title||super.getRawDisplayName()}markAsCustomView(){this.custom=!0,this.actions=["Delete","OpenSource"],this.sortableItem="Enabled",this.additionalText=Et.t("PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_VIEW"),this.i18nKey=this.parent?.i18nKey,this.properties.label?.value&&(this.title=this.properties.label.value)}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.isTableView()?this.icon="Table":this.isChartView()?this.icon="Chart":this.icon="Sections",this.isAnnotationView()&&!this.schema?.annotationPath&&this.properties.annotationPath&&(this.properties.annotationPath.messages=[{type:"warning",text:Et.t("PAGE_EDITOR_PROPERTIES_VIEW_NO_ANNOTATION_PATH")}])}isTableView(){return"columns"in this.aggregations}isChartView(){return!("columns"in this.aggregations)&&"toolBar"in this.aggregations}isAnnotationView(){return!this.custom&&"annotationPath"in this.properties||!this.custom&&this.schema?.annotationPath&&!this.schema?.annotationPath.startsWith(t2)}};var wS=class extends Jt{sortableList=!0;childClass=DS;allowedAnnotationCreationForms=["TableView","AnalyticalChartView","CustomViewV4"];sortableCollection="views";sortableConfigOnly=!0;i18nKey="VIEWS";updateAnnotationData(e){if(super.updateAnnotationData(e),e){this.toggleChartForm(this.annotationCreationForms,e);for(let r in this.aggregations){let n=this.aggregations[r],i=this.getViewDeleteAction(n,e),a=n.actions||[];a.push(i),n.actions=a}}}updatePropertiesValues(e,r,n,i,a){super.updatePropertiesValues(e,r,n,i,a),this.formSchema=this.additionalProperties?.aggregations.views,this.formSchema?.properties?.template&&(this.schemaCreationForms=[{name:"CustomViewV4",kind:ho,title:"PAGE_EDITOR_OUTLINE_ADD_CUSTOM_VIEW_TITLE",disabled:!1}]);let o=e||{};if(Object.keys(o).length!==0)for(let s in o){let c=this.aggregations[s];c?.schema&&!c?.schema.properties?.annotationPath&&(!c.schema.annotationPath||c.schema.annotationPath.startsWith(t2))&&c.markAsCustomView()}}getViewDeleteAction(e,r){let n=e.annotationNodeId,i=!0,a=this.getAnnotationViewCount();return n?i=SS(r.dialogsContext?.suppressTableViewDeletionNodeId||[],n):(a>1||a===1&&e.custom)&&(i=!1),{type:"Delete",disabled:i,title:Et.t(i?"TABLE_VIEW_DELETE_DISABLED_TOOLTIP":"PAGE_EDITOR_OUTLINE_DELETE_TOOLTIP")}}toggleChartForm(e,r){let n=e.find(i=>i.name==="AnalyticalChartView");n&&r.dialogsContext?.analyticalChartSupport&&(r.dialogsContext.analyticalChartSupport.addToMultiViewEnabled?(n.disabled=!1,delete n.disabledTitle):(n.disabled=!0,n.disabledTitle=r.dialogsContext.analyticalChartSupport.addToMultiViewTooltip))}getAnnotationViewCount(){let e=0;for(let r in this.aggregations){let n=this.aggregations[r];n instanceof DS&&n.isAnnotationView()&&e++}return e}};var Kbn="array",Cwt="object",vAe="sap.fe.macros.Table",xwt=[["table","quickVariantSelection","variants"],["table","quickVariantSelectionX","variants"]],bAe=(t,e,r)=>{let n=r,i=t.split("/").length-1,a=0;for(;a<i;)n=n?.parent,a++;return e.endsWith(`table/${t}`)||n instanceof DS&&e.endsWith(`/${t}`)},Ybn=(t,e,r)=>!!r?.additionalProperties?.$ref?.includes("CustomSectionActionOP")&&!!e?.name&&t.endsWith(`${e.name}/actions`),EAe=(t,e)=>e?.schema?.metadata?.controlName===t,Wbn=(t,e)=>e?.metadata?.controlName===t,Pwt=(t,e)=>{let r=e?.additionalProperties;return e?.metadata?.type==="Aggregation"&&typeof r=="object"&&r.$ref===`#/definitions/${t}`},Xbn=[{aggregation:m_,fn:(t,e,r)=>{let i=r?.additionalProperties?.$ref?.includes("ObjectPageCustomSectionFragment");return t==="sections"&&!!i}},{aggregation:wD,fn:t=>t==="sections"},{aggregation:jK,fn:(t,e,r)=>bAe("columns",t,e)||Pwt("sap.fe.macros.table.Column",r)&&EAe(vAe,e)},{aggregation:UK,fn:(t,e)=>bAe("toolBar",t,e)},{aggregation:kK,fn:t=>t.endsWith("form/fields")},{aggregation:IK,fn:t=>t.endsWith("actions/RelatedApps/additionalSemanticObjects")},{aggregation:$K,fn:(t,e,r)=>r?.dataType==="ConnectedFields"},{aggregation:wK,fn:(t,e,r)=>Ybn(t,e,r)||["form/actions","header/actions","footer/actions"].some(n=>t.endsWith(n))||bAe("toolBar/actions",t,e)||Pwt("sap.fe.macros.table.Action",r)&&EAe(vAe,e)},{aggregation:MK,fn:(t,e)=>t.endsWith("filterBar/selectionFields")||t.endsWith("/filterFields")&&EAe("sap.fe.macros.FilterBar",e)},{aggregation:BK,fn:t=>t.endsWith("filterBar/visualFilters")},{aggregation:VK,fn:(t,e,r)=>t==="table"||t.endsWith("/table")&&e instanceof wm||Wbn(vAe,r)},{aggregation:HK,fn:t=>t.endsWith("header/sections")},{aggregation:d_,fn:t=>t===""},{aggregation:LK,fn:t=>t==="chart"},{aggregation:wS,fn:t=>t.endsWith("table/views")},{aggregation:GK,fn:(t,e)=>t.endsWith("/subsections")&&e instanceof wm}],Jbn=["annotationPath"],zK=class{name;pageType;root=this.prepareAggregation();data;originalData;definitions={};excludeProperties=["$schema"];schema;validator=new RK;pendingNodes=[];constructor(e,r,n,i,a){this.name=e,this.pageType=r,this.data=n,this.originalData={page:structuredClone(this.data),annotations:a,schema:i},this.schema=JSON.parse(i),this.init(a)}init(e){if(this.schema.definitions)for(let i in this.schema.definitions)this.definitions[`#/definitions/${i}`]=this.schema.definitions[i];let r=JSON.parse(this.originalData.schema);this.root=this.prepareAggregation(void 0,{properties:r.properties}),this.parseSchema(this.root,r,{subnodes:e.nodes},void 0,[],{filePath:this.data.$filePath}),this.readAdvancedPropertiesData(this.root,this.data);let n={definitions:this.schema.definitions,parse:this.parseSchema.bind(this),annotations:e};this.root.updatePropertiesValues(this.data,this.data,this.pageType,[],e,n),this.validator.validate(this.root,this.data),this.updateViewNodes(this.root),this.pendingNodes=[],this.afterInit(e)}updatePropertyFromSchema(e,r,n){if(!(e in r.properties))r.properties[e]=r.addProperty(e,n),r.properties[e].freeText=this.isFreeText(n);else if(n.enum){let i=r.properties[e].schema.enum;i=i?i.concat(n.enum):n.enum,r.properties[e].schema.enum=i?i.filter((a,o)=>i&&i.indexOf(a)===o):[]}}getContextForMacrosNode(e,r){for(let n in r){let i=r[n],a="subnodes"in i?i.subnodes:[];for(let o in a)if(a[o].macroNodeId===e)return i}}schemaParsers=[e=>(e.currentNode.const&&!e.currentNode.enum&&(e.currentNode.enum=[e.currentNode.const]),!0),e=>{let{currentNode:r}=e;return!r.hidden},e=>{let{currentNode:r,name:n}=e;if(n===void 0)return!0;if(this.isAggregation(r)){e.path=e.path.concat([e.aggregation.type==="Array"?Number.parseInt(n,10):n]);let i=r.displayName||n,a=r.type===Cwt?"Object":"Array";if(e.aggregation=e.aggregation.addAggregation(i,e.aggregation.aggregations[i]||this.prepareAggregation(e.path,r,e.aggregation,a),e.path),e.aggregation.type==="Array")return e.aggregation.schema=r,this.updateFormSchema(e.aggregation),this.copySchemaProperties(e.aggregation,r,n),!1}else this.isProperty(r)&&this.updatePropertyFromSchema(n,e.aggregation,r);return!0},e=>{let{aggregation:r,currentNode:n}=e,i=e.currentAnnotationNode;if(r instanceof sv&&(i=this.originalData.annotations.nodes.find(a=>"nodeType"in a&&a.nodeType==="macros"),r.annotationNodeId=i?.nodeId),n.metadata?.internalId&&!i){let a=this.originalData.annotations.nodes;a=a.filter(o=>"nodeType"in o&&o.nodeType==="macros"),i=e.currentAnnotationNode=this.getContextForMacrosNode(n.metadata.internalId,a)}if(!n.$ref&&n.annotationPath){let a=[];i&&!f_(i)&&(a=i.subnodes);let o=mwt(n.annotationPath,this.originalData.annotations.nodes,a,i?.annotationPath,r.order);o&&(e.currentAnnotationNode=o,r.annotationNodeId=o.nodeId)}return!0},e=>{for(let r of Array.from(this.schemaReferenceParsers))if(r[1](e))break;return!0},e=>{let{aggregation:r,currentNode:n,name:i}=e;return this.copySchemaProperties(r,n,i),!0},e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,name:a,path:o,context:s}=e;return typeof n.additionalProperties=="object"&&(r.additionalProperties=this.prepareAggregation(),this.parseSchema(r.additionalProperties,n.additionalProperties,i,a,o,s),this.isSchemaAtomic(n.additionalProperties)&&this.updateFormSchema(r,a)),!0},e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,name:a,path:o,context:s}=e;return typeof n.patternProperties=="object"&&(r.pattern=Object.keys(n.patternProperties)[0],n.additionalProperties=n.patternProperties[r.pattern],r.additionalProperties=this.prepareAggregation(),this.parseSchema(r.additionalProperties,n.patternProperties[r.pattern],i,a,o,s),this.updateFormSchema(r,a)),!0},e=>{let{aggregation:r,currentNode:n}=e;if(n.required)for(let i of n.required){let a=r.properties[i];a&&(a.required=!0)}return!0},e=>{let{aggregation:r,currentNode:n,name:i}=e;return n.displayName&&i&&n.type==="object"&&r.addUnionName(n.displayName,i),!0},e=>{let{name:r="",aggregation:n,currentNode:i,context:a}=e,{metadata:o}=i,s=n.properties[r];if(a.filePath&&o){let{position:c}=o,u=[];c&&u.push({fileUri:(0,Dwt.join)(ND.DirName.Webapp,a.filePath),range:{start:{line:c.startLine-1,character:c.startColumn-1},end:{line:c.endLine-1,character:c.endColumn}},relative:!0,type:ND.ArtifactType.XMLProperty}),s?s.locations=u:n.name===r&&(n.locations=u)}return!0},e=>{let{path:r,name:n="",aggregation:i}=e;return r&&xwt.some(a=>hAe(r,a))&&this.updateFormSchema(i,n),!0}];schemaReferenceParsers=new Map([["$ref",e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,name:a,path:o,context:s}=e;if(!n.$ref)return!1;let c=this.definitions[n.$ref]?{...this.definitions[n.$ref]}:{};for(let u of Object.keys(n)){let l=Jbn.includes(u);u!=="$ref"&&!(l&&c[u])&&(c[u]=n[u])}return this.parseSchema(r,c,i,a,o,s),!0}],["anyOf",e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,name:a,path:o,context:s}=e;if(!n.anyOf)return!1;for(let c of n.anyOf)this.parseSchema(r,c,i,a,o,s);return(Object.keys(n.anyOf).length>1||Array.isArray(n.anyOf)&&n.anyOf.length>1)&&this.createAnyOfPropertiesVariations(n.anyOf,e),!0}],["properties",e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,path:a,context:o}=e;if(!n.properties)return!1;let s=Object.keys(n.properties).filter(l=>!this.excludeProperties.includes(l)),c=n.properties,u=s.some(l=>n.properties&&n.properties[l]?.propertyIndex!==void 0);c&&s.length&&u&&s.sort(this.propertySorter.bind(this,c));for(let l of s)this.parseSchema(r,n.properties[l],i,l,a,o);return!0}],["items",e=>{let{aggregation:r,currentNode:n,currentAnnotationNode:i,path:a,context:o}=e;if(!n.items)return!1;if(Array.isArray(n.items))for(let s=0;s<n.items.length;s++)this.parseSchema(r,n.items[s],i,s.toString(),a,o);else this.parseSchema(r,n.items,i,void 0,a,o);return!0}]]);createAnyOfPropertiesVariations(e,r){let{aggregation:n,currentAnnotationNode:i,name:a,path:o,context:s}=r;for(let c of e){let u=this.prepareAggregation();this.parseSchema(u,c,i,a,o,s);let l=a;if(a&&!u.aggregations[a]){let d=Object.keys(u.aggregations);l=d.length>0?d[0]:a}let p=n;l&&(p=n.aggregations[l],u=u.aggregations[l]),u&&p&&p.variants.push({aggregations:u.aggregations,properties:u.properties})}a&&n.properties[a]&&(n.properties[a].freeText=this.isFreeText(e))}parseSchema(e,r,n,i,a,o){let s={aggregation:e,currentNode:r,currentAnnotationNode:n,name:i,path:a,context:o};for(let c of this.schemaParsers)if(!c.call(this,s))break}copySchemaProperties(e,r,n){if(n)if(e.properties[n])this.storeInnerProperties(e.properties[n],["pattern","description","i18nClassification","artifactType","minimum","displayName","messages"],r);else{let i=e.aggregations[n]||e;this.storeInnerProperties(i,["description","isViewNode","artifactType","messages"],r)}}isProperty(e){return!e.$ref&&e.type!=="object"&&e.type!=="array"&&!e.anyOf}isAggregation(e){return(e.type===Cwt||e.type===Kbn)&&!e.$ref}handleAdditionalProperties(e,r){let n=[...Object.keys(e.properties),...Object.keys(e.aggregations)];for(let i of Object.keys(r))if(!n.includes(i)&&e.additionalProperties){let a=e.schema?e.schema.additionalProperties||e.schema.additionalItems:void 0;if(typeof a=="object"){this.parseSchema(e,a,void 0,i,e.path,{});let o=e.aggregations[i];o?.isViewNode&&o.description&&delete o.description}}}readAdvancedPropertiesData(e,r){if(this.handleAdditionalProperties(e,r),e&&e.type==="Array"&&e.schema){let n=e.schema,i=this.getSchemaArrayItem(n);if(i&&Array.isArray(r))for(let a=0;a<r.length;a++)this.parseSchema(e,i,void 0,a.toString(),e.path,{})}for(let n in e.aggregations){let i=e.aggregations[n].union?.originalNames||[n];for(let a of i)typeof r=="object"&&a in r&&this.readAdvancedPropertiesData(e.aggregations[n],r[a])}}readPropertiesData(e,r){let n=Object.keys(e.properties);for(let i in r)n.includes(i)&&(e.properties[i].value=r[i]);for(let i in e.aggregations)i in r&&this.readPropertiesData(e.aggregations[i],r[i])}prepareAggregation(e,r,n,i="Object"){let a=(e||[]).join("/");for(let s of Xbn)if(s.fn(a,n,r))return new s.aggregation(void 0,r);let o;if(n?.childClass)o=new n.childClass(void 0,r);else{let s=i==="Object"?Jt:r2;o=new s(void 0,r)}return e&&xwt.some(s=>hAe(e,s))&&(o.isTable=!0),o}isFreeText(e){let r=n=>n.type==="string"&&!n.enum;return Array.isArray(e)?e.some(r):r(e)}storeInnerProperties(e,r,n){for(let i of r)if(n[i]!==void 0||i==="i18nClassification"&&i in n){if(!this.isCorrectSchemaProperty(i,n[i])){kt.error(Et.t("SCHEMA_PARSING_ERROR_UNEXPECTED_VALUE",{name:i,value:JSON.stringify(n[i])}));return}e[i]=n[i]}}getSchemaArrayItem(e){let r=Array.isArray(e.items)?e.additionalItems:e.items;return typeof r=="object"?r:void 0}updateArrayFormSchema(e){let r=this.getSchemaArrayItem(e.schema||{});if(typeof r=="object"){let n=this.prepareAggregation();e.isAtomic=!!r.type,this.parseSchema(n,r,void 0,e.isAtomic?"":void 0,e.path,{}),Object.keys(n.properties).length&&(e.formSchema=n)}(!e.formSchema||!Object.keys(e.formSchema.properties).length)&&(e.schemaCreationForms=[])}updateFormSchema(e,r){if(e instanceof r2)this.updateArrayFormSchema(e);else if(r&&e.additionalProperties?.aggregations[r]){let n=this.prepareAggregation();this.parseSchema(n,e.additionalProperties.aggregations[r].schema||{},void 0,void 0,e.path,{}),Object.keys(n.properties).length&&(e.formSchema=n)}else if(typeof e.schema?.additionalProperties=="object"&&this.isSchemaAtomic(e.schema?.additionalProperties)){e.isAtomic=!0,e.isTable=!0;let n=this.prepareAggregation();this.parseSchema(n,e.schema.additionalProperties,void 0,"",e.path,{}),Object.keys(n.properties).length&&(e.formSchema=n)}}updateViewNodes(e){for(let r in e.aggregations){let n=e.aggregations[r];this.updateViewNodes(n)&&!e.isViewNode&&(e.isViewNode=!0)}return e.isViewNode||!1}isCorrectSchemaProperty(e,r){let n=!0;switch(e){case"description":case"pattern":case"i18nClassification":{n=r===void 0||typeof r=="string";break}case"isViewNode":{n=r===void 0||typeof r=="boolean";break}}return n}propertySorter(e,r,n){let i=e[r].propertyIndex!==void 0?e[r].propertyIndex:0,a=e[n].propertyIndex!==void 0?e[n].propertyIndex:0;return i===a?0:i>a?1:-1}afterInit(e){if(this.pageType===ND.PageType.FPMCustomPage){let r=new sv(void 0,void 0);typeof this.data.$filePath=="string"&&(r.setFilePath(this.data.$filePath),r.annotationNodeId=e.nodes[0]?.nodeId),r.aggregations=this.root.aggregations,this.root.aggregations={macros:r}}}isSchemaAtomic(e){let r=["string","number","boolean"];return typeof e=="object"&&typeof e.type=="string"&&r.includes(e.type)}};var Nwt=Tt(mc());var Qbn="True",Zbn="False",eEn=[CK,awt];function tEn(t){return`outline-node${t.replace(/\//g,"-")}`}function Iwt(t,e,r,n){return{schemaPath:n,artifactType:r.artifactType,description:r.description??"",name:t,displayName:e,type:"string",value:r.value,schema:r.schema??{}}}var wwt=t=>!Number.isNaN(t)&&!Number.isNaN(t-0),Rwt=t=>{let e=[];e.push({key:"",text:""});for(let r of t){let n=r;typeof r=="boolean"?(n=r?Qbn:Zbn,e.push({key:r,text:n})):typeof r=="string"?wwt(parseFloat(r))?e.push({key:parseFloat(r),text:r?.toString()}):e.push({key:r,text:r}):typeof r=="number"&&wwt(r)&&e.push({key:r,text:r?.toString()})}return e};function rEn(t,e){if(e.enum||e.oneOf){let r=[];e.enum?r=Rwt(e.enum):e.oneOf&&(r=e.oneOf.map(n=>{let i=n.const;return{key:n.const,text:i}}),r.unshift({key:"",text:"",reset:!0})),t.options=r}}function nEn(t,e,r,n){let i=r.schema.type,a=Iwt(t,e,r,n);switch(i){case"string":a.type="string",rEn(a,r.schema);break;case"number":{a.type="number";break}case"boolean":{a.type="boolean",a.options=[{key:void 0,text:""},{key:!0,text:"True"},{key:!1,text:"False"}];break}default:{r.schema.enum?Rwt(r.schema.enum):kt.warn(`Unhandled property: ${JSON.stringify(r)}`);break}}return a}function Lwt(t,e=[]){let r=[],n=Object.keys(t.properties);n.length&&n.forEach(i=>{let a=t.properties[i],o=t.path.concat(i),s=nEn(i,a.name,a,o);s&&r.push(s)});for(let i in t.aggregations){let a=t.aggregations[i];if(a.isViewNode)continue;let o=Iwt(i,a.name??i,a,a.path);o.type="object";let s=Lwt(a,[...e,t]);s.length&&(o.properties=s),r.push(o)}return r}function kwt(t,e){let{text:r,level:n,model:i}=e,{path:a}=e,o=[],s=t.getAggregationKeys(!0),c=tEn(t===i.root?"root-node":`${a}-node`);t.virtual&&i.pageType===Nwt.PageTypeV4.FPMCustomPage&&(a="");for(let l of s){let p=a+"/"+l,d=t.aggregations[l],f=d.getDisplayName(),h=kwt(d,{...e,level:n+1,path:p,text:f});o.push(h)}let u=t.annotationNodeId;return!u&&(t instanceof d_||t instanceof wS)&&(u=[]),{id:c,path:t.path.map(l=>l),children:o,text:r,additionalText:t.additionalText,moveProps:iEn(i,t),title:t.getTechnicalName(),properties:Lwt(t),annotationNodeId:u,type:oEn(t),value:t.value,schema:t.schema??{}}}function iEn(t,e){if(t.root!==e){let n={movable:e.sortableItem==="Enabled"&&!0,allowedParents:aEn(t.root,e),allowedChildTypes:e.sortableList&&e.sortableCollection?[e.sortableCollection]:void 0,type:e.sortableCollection};return e.sortableItem==="Excluded"&&(n.dropRestricted=!0),n}}function aEn(t,e){let r;if(e.custom){let n=e.parent?.getAllowedDropRange(e);r=[],e.parent&&n&&r.push({path:e.parent.path,allowedRanges:n})}else if(e.dropUINodes){let n=t.findAllowedDropAggregations(e);eEn.some(i=>e.name?.startsWith(i))&&(n=n.filter(i=>!SS(i.path,["footer","actions"]))),r=n.map(i=>({path:i.path,allowedRanges:i.range}))}return r}function oEn(t){let e;return t.custom?t instanceof CS?e="customAction":t instanceof PS?e="customColumn":t instanceof DD?e="customFilterField":t instanceof wm&&(e="customSection"):t.path.length===0?e="rootNode":t instanceof wS&&(e="views"),e}function _Ae(t,e,r,n){let i=new zK("Root",r,e,t,n??{dynamicNodes:{},nodes:[]}),a=kwt(i.root,{level:0,path:"",text:i.name,model:i});return a.root=!0,a.schema=i.schema,a}function KK(t,e){for(let r of t){if(SS(r.path,e))return{node:r};for(let i of r.properties){if(SS(i.schemaPath,e))return{property:i};let a=$wt(i,e);if(a)return{node:r,property:a}}let n=r.children?KK(r.children,e):void 0;if(n)return n}}function $wt(t,e){if(t.properties)for(let r of t.properties){if(SS(r.schemaPath,e))return r;let n=$wt(r,e);if(n)return n}}var Gd=Tt(mc()),xf=require("node:path"),xAe=Tt(kd());var Hd=Tt(kd()),TAe=Tt(mc()),OAe=require("node:fs"),a2=require("node:fs/promises"),SAe=require("node:path");function Mwt(t){let e=t.getAppId(),r=t.project,n;if(e===void 0){let i=Object.keys(r.apps);n=r.apps[i[0]].mainService}else{let i=r.apps[e];if(!i)throw new Error("ERROR_INVALID_APP_ID");n=i.mainService}return n??"mainService"}async function ID(t){let e=Mwt(t);return(t.projectType==="CAPJava"||t.projectType==="CAPNodejs")&&(e=await(0,Hd.getCapServiceName)(t.project.root,t.app?.services?.[e].uri??"")),e}async function Fwt(t){let e=[],r=Mwt(t),n=t.app?.services?.[r];if(!n)return[];if(n.uri&&(t.projectType==="CAPJava"||t.projectType==="CAPNodejs")){let i=n?.uri??"";if(i){let a=await(0,Hd.readCapServiceMetadataEdmx)(t.root,i);e.push({fileContent:a,dataSourceUri:i})}}else{if(n.local){let a=await(0,a2.readFile)(n.local);e.push({dataSourceUri:n.local,fileContent:a.toString()})}let{annotations:i=[]}=n;for(let a of i)if(a.local){let o=await(0,a2.readFile)(a.local);e.push({dataSourceUri:a.local,fileContent:o.toString()})}}return e}async function o2(t){let e=await(0,Hd.getWebappPath)(t.app.appRoot),r=(0,SAe.join)(e,Hd.FileName.Manifest);if(!(0,OAe.existsSync)(r))return;let n=await(0,a2.readFile)(r);return JSON.parse(n.toString())}async function AAe(t){let e=await o2(t),r=e?(0,Hd.getMinimumUI5Version)(e):void 0;return r!==void 0&&Number.isNaN(parseFloat(r))&&(r="latest"),r??"latest"}async function jwt(t){let e,r=(0,SAe.join)(t,Hd.FileName.Package);if((0,OAe.existsSync)(r)){let n=await(0,a2.readFile)(r);try{e=JSON.parse(n.toString())}catch(i){kt.error(String(i))}}return e?.sapuxLayer==="VENDOR"?TAe.FlexChangeLayer.Vendor:TAe.FlexChangeLayer.Customer}var NS=require("node:path"),CAe=require("node:fs"),YK=require("node:fs/promises"),Uwt=Tt(XH()),qwt=Tt(VG());function sEn(t){return t??(0,qwt.create)((0,Uwt.create)())}function Bwt(t,e,r){let n={},i=fEn(e),a=uEn(r);if(a)for(;a.length>0;){let o=a.pop();dEn(i,o)||o.content.newValue!==null&&(n[(0,NS.join)(t,`${o.fileName}.change`)]=o)}return pEn(t,i,n),n}async function Hwt(t,e,r){r=sEn(r),await cEn(t,e,r),Object.keys(e).length>0&&!(0,CAe.existsSync)((0,NS.join)(t))&&await(0,YK.mkdir)(t);for(let n in e){let i="";(0,CAe.existsSync)(n)&&(i=await r.read(n));let a=JSON.stringify(e[n],void 0,4);a!==i&&await r.write(n,a)}return r}async function cEn(t,e,r){let n=Object.keys(e);try{let i=await(0,YK.readdir)(t);i=i.map(o=>(0,NS.join)(t,o));let a=i.filter(o=>!n.includes(o));for(let o of a)try{await r.delete(o)}catch(s){kt.error(`Failed to delete deprecated file "${o}": ${s}`);continue}}catch(i){kt.error(`Error while removing deprecated flex change files: ${i}`);return}}function uEn(t=[]){let e=[];for(let r of t){let n=Gwt(r);n&&e.push(n)}return e}function Gwt(t){try{return JSON.parse(t)}catch(e){kt.error(`Error while prsing flex change file: ${e}`)}}function Vwt(t,e){return(t.changeType==="propertyChange"||t.changeType==="propertyBindingChange")&&t.changeType===e.changeType&&t.content?.property===e.content?.property&&t.selector?.id===e.selector?.id}function lEn(t,e){for(let r=t.length-1;r>=0;r--){let n=t[r].change;e.selector.id===n.selector.id&&e.content.property===n.content.property&&t.splice(r,1)}}function pEn(t,e,r){if(e)for(let n of e)r[(0,NS.join)(t,`${n.filename}`)]=n.change}function fEn(t){let e=[];for(let r in t){let n=Gwt(t[r]);n&&e.push({filename:r,change:n})}return e}function dEn(t,e){let r=t?.filter(n=>Vwt(e,n.change));if(r&&r.length>0)if(r.length===1){let n=r[0].change;if(n.content.newValue!==void 0&&e.content.newValue!==void 0&&n.content.newValue===e.content.newValue||n.content.newBinding!==void 0&&e.content.newBinding!==void 0&&n.content.newBinding===e.content.newBinding)return!0;e.fileName=(0,NS.parse)(r[0]?.filename).name;let i=t.findIndex(a=>Vwt(e,a.change));t.splice(i,1)}else lEn(t,e);return!1}var $o=class{appAccess;constructor(e){this.appAccess=e}async getSpecification(){return this.appAccess.getSpecification()}getAppId(e){return e["sap.app"]?.id??""}async getVirtualFiles(){let e=await o2(this.appAccess);if(!e)return[];let r=await this.getSpecification(),n=await Fwt(this.appAccess),i=await(0,xAe.readFlexChanges)(this.appAccess.app.changes);return r.importProject({manifest:e,annotations:n,flex:Object.values(i)})}async readApp(e){e??=await this.getVirtualFiles();let r=e.find(o=>o.dataSourceUri===Gd.FileName.App),n=JSON.parse(r?.fileContent??"{}"),i=(0,xf.join)(".schemas",(0,xf.basename)((0,xf.join)(n?.$schema??""))),a=e.find(o=>(0,xf.join)(o.dataSourceUri)===i);if(a){let o=JSON.parse(a.fileContent);o.properties?.settings&&(o.properties.settings.isViewNode=!0),a.fileContent=JSON.stringify(o)}return{config:n,schema:a?.fileContent??"{}"}}async readPageData(e){try{let r=await this.getVirtualFiles(),n=(0,xf.join)(Gd.DirName.Pages,`${e}.json`),i=r.find(c=>(0,xf.join)(c.dataSourceUri)===n),a=i?.fileContent?JSON.parse(i.fileContent):void 0,o=(0,xf.join)(".schemas",(0,xf.basename)((0,xf.join)(a?.$schema??""))),s=r.find(c=>(0,xf.join)(c.dataSourceUri)===o);if(a&&s){let u=(await this.readApp(r)).config.pages?.[e];if(u){let l=u.pageType;return{pageId:e,pageType:l??Gd.PageTypeV4.ListReport,config:a,page:u,schema:s.fileContent,entitySet:u.entitySet,entityType:"entityType"in u&&typeof u.entityType=="string"?u.entityType:void 0,contextPath:u.contextPath}}}}catch(r){kt.error(String(r))}}async writePage(e){let r=await o2(this.appAccess);if(!r)return;let n=await this.getSpecification(),a={[e.pageType===Gd.PageTypeV4.ObjectPage?Gd.SchemaType.ObjectPage:Gd.SchemaType.ListReport]:{appId:this.getAppId(r),jsonSchema:JSON.parse(e.schema),manifest:r,page:{...e.page,name:e.pageId,config:e.config}}},o=await this.getExportConfigParameters(r,a),s=n.exportConfig(o);s.manifestChangeIndicator==="Updated"&&await this.appAccess.updateManifestJSON(s.manifest);let c=this.appAccess.app.changes,u=await(0,xAe.readFlexChanges)(this.appAccess.app.changes),l=Bwt(c,u,s.flexChanges),p=await Hwt(c,l);return await p.commit(()=>{}),s.flexChanges=Object.keys(p.dump()),s}async writeApp(e){let{config:r,schema:n}=e,i=await o2(this.appAccess);if(!i)return;let a=await this.getSpecification(),o={[Gd.SchemaType.Application]:{application:r,manifest:i,jsonSchema:JSON.parse(n)}},s=await this.getExportConfigParameters(i,o),c=a.exportConfig(s);return await this.appAccess.updateManifestJSON(c.manifest),c}async writeFPM(e){e.data&&(e.data.minUI5Version=await AAe(this.appAccess));let n=await(await this.getSpecification()).generateCustomExtension(e);return await n?.commit(()=>{}),n?Object.keys(n.dump()):[]}async getExportConfigParameters(e,r){let i=e["sap.app"]?.dataSources?.mainService?.settings?.odataVersion==="2.0"?{v2:r}:{v4:r};return i.ui5Version=await AAe(this.appAccess),i.layer=await jwt(this.appAccess.root),i}};function PAe(t,e,r,n=!1){hEn(t,e,r!==void 0,(i,a)=>{if(typeof i!="object"||i===null)return;let o=i;r!==void 0?n&&Array.isArray(o[a])?o[a].push(r):o[a]=n?[r]:r:Array.isArray(o)?o.splice(typeof a=="string"?Number.parseInt(a,10):a,1):delete o[a]})}function hEn(t,e,r,n){let i=t;for(let a=0;a<e.length;a++)if(e[a]!==void 0){if(a===e.length-1&&n(i,e[a]),i[e[a]]===void 0&&r){let o=e[a+1]!==void 0&&typeof e[a+1]=="number";i[e[a]]=o?[]:{}}if(i=i[e[a]],!i)break}}var cv=class{constructor(e,r){this.appAccess=e;this.pageId=r;this.ftfsIO=new $o(e)}ftfsIO;async getPageTree(e){let r={children:[],path:[],properties:[],text:"",schema:{}};if(this.pageId){let n=await this.ftfsIO.readPageData(this.pageId);n&&(r=_Ae(n.schema,n.config,n.pageType,e))}else{let n=await this.ftfsIO.readApp();n&&(r=_Ae(n.schema,n.config,zwt.PageTypeV4.ListReport))}return r}async changeProperty(e,r){if(this.pageId){let n=await this.ftfsIO.readPageData(this.pageId);if(n)return PAe(n.config,e,r),this.ftfsIO.writePage(n)}else{let n=await this.ftfsIO.readApp();return PAe(n.config,e,r),this.ftfsIO.writeApp(n)}}async getApplication(){return this.ftfsIO.readApp()}async updateApplication(e){await this.ftfsIO.writeApp(e)}};var dl=Tt(mc());var pVt=require("node:path");var cVt=Tt(kjt()),uVt=Tt(kd()),lVt=Tt(sVt()),SX=class{constructor(e){this.options=e}metadataService;annotationService;nodes=[];nodesMap=new Map;namespace="";async loadMetadata(e=!1){if(!e&&this.metadataService)return;let{project:r,serviceName:n,appName:i}=this.options,a=await(0,uVt.getProject)(r.root);this.annotationService=await cVt.FioriAnnotationService.createService(a,n,i),await this.annotationService.sync(),this.metadataService=this.annotationService.getMetadataService(),this.namespace=[...this.metadataService.getNamespaces()][0],this.metadataService.visitMetadataElements(this.visitMdElement.bind(this))}visitMdElement(e){let{path:r,name:n}=e,i=this.metadataService?.getEdmTargetKinds(r)[0]||"",a={path:r,name:n,mdElement:e,kind:i};this.nodes?.push(a),this.nodesMap.set(r,a)}async getNamespace(){return await this.loadMetadata(),this.namespace}async getAllowedEntities(e=!1){if(await this.loadMetadata(e),!this.annotationService)return[];let r=[],n=this.annotationService.getSchema(),i=(0,lVt.convert)(n);for(let a of i.entitySets)r.push({entitySet:a.name,entityType:a.entityType.name,navigations:a.entityType.navigationProperties.filter(o=>o.isCollection).map(o=>{let s=o.targetType,c=i.entitySets.find(u=>u.entityTypeName===s.name);return{name:o.name,fullyQualifiedName:o.fullyQualifiedName,entitySet:c?.name??s.name}})});return r}async getAllowedNavigations(e,r,n=!1){return(await this.getAllowedEntities(n)).find(a=>a.entitySet===e||a.entityType===r)?.navigations??[]}};var HDe=new Map;function e$n(t){return(0,pVt.join)(t.project.root,t.appName,t.serviceName)}async function GDe(t){let e=e$n(t);HDe.has(e)||HDe.set(e,new SX(t));let r=HDe.get(e);if(!r)throw new Error(`No service: '${e}'`);return r}var Uf=Tt(mc()),t$n=new Map([[Uf.PageTypeV4.ListReport,"List"],[Uf.PageTypeV4.ObjectPage,Uf.PageTypeV4.ObjectPage],[Uf.PageTypeV4.CustomPage,"Page"],[Uf.PageTypeV4.FPMCustomPage,"Page"],[Uf.PageTypeV4.AnalyticalListPage,"ALP"]]);function r$n(t,e,r){let n="",i=[];if(t.pageType===Uf.PageTypeV4.CustomPage||t.pageType===Uf.PageTypeV4.FPMCustomPage){let o=(t.viewName??"").split(".");n=o[o.length-1]}else n=t.contextPath?t.contextPath.slice(1).replace(/\//g,"_"):t.entitySet;return i=[n],e&&r&&(!t.contextPath||t.contextPath.indexOf(r)===-1)&&i.push(r),i[i.length-1]+=t$n.get(t.pageType),i}function n$n(t){let e=[];return e.push(t.pageType),t.entitySet&&e.push(t.entitySet),e}function zDe(t,e,r,n,i){let a=[];n===Uf.FioriElementsVersion.v2?a=n$n(t):a=r$n(t,e,i);let o=a.join("_"),s=r.map(u=>u.pageId),c=0;for(;s.indexOf(o)>-1;)o+=c.toString(),c++;return o}function Ij(t){return t.config.target?.fioriElements??Uf.FioriElementsVersion.v4}var dVt=Tt(kd()),hVt=require("node:path");var fVt="1.136.7",gA="generate-fiori-ui-application-cap",U_="add-page",$v="delete-page",AX="create-controller-extension",CX=/^[A-Za-z][A-Za-z0-9_-]*$/;var q_=class{serviceName;appData;appId;applicationAccess;params;version;constructor({params:e,applicationAccess:r,appId:n,serviceName:i,appData:a}){this.params=e,this.serviceName=i,this.appData=a,this.appId=n,this.applicationAccess=r,this.version=Ij(a)}getAllowedNavigationsOutput(e){return e.map(r=>r.name).join(", ")}getMissingNavigationMessage(e,r,n){let i="";switch(e){case 1:{i="page does not have valid navigation for add";break}case 2:{i=`provided 'navigation' was not found. ${n} has following navigations available: ${this.getAllowedNavigationsOutput(r)}`;break}case 3:{i="provide 'entitySet' for very first page";break}case 4:{i=`provided 'entitySet' was not found. Following entitySets available: ${this.getAllowedNavigationsOutput(r)}`;break}}return i}calculateContextPath(e,r,n){let i;return!e||e.pageType===dl.PageTypeV4.ListReport?i=`/${n}`:e.contextPath?i=r&&e.routePattern!==":?query:"?`${e.contextPath}/${r}`:`/${n}`:e.entitySet&&(i=this.calculateContextPathBasedOnEntitySet(e,r)),i}calculateContextPathBasedOnEntitySet(e,r){let n,a=e.routePattern?.replace(":?query:","").replace(/\({[^}]*}\)/g,"");return a?n=r&&r!==""?`/${a}/${r}`:`/${a}`:n=r&&r!==""?`/${e.entitySet}/${r}`:`/${e.entitySet}`,n}createErrorResponse(e){return{functionalityId:U_,status:"Failed",message:e,parameters:[],appPath:this.params.appPath,changes:[],timestamp:new Date().toISOString()}}async validatePageCreationInput(e,r,n){if(r.length&&!e.parent)return this.createErrorResponse('Provide "parentPage" for page creation');if(e.pageType===dl.PageTypeV4.CustomPage){let i=this.validateCustomPageViewName(n);if(i)return i}return null}validateCustomPageViewName(e){let r=".view.xml",n=e?.endsWith(r)?e.slice(0,-r.length):e;return n?/^[a-z][a-z0-9_-]*$/i.exec(n)?null:this.createErrorResponse("'viewName' must not contain spaces, must start with an upper-case letter, and may contain letters, digits, and underscores."):this.createErrorResponse('Provide "viewName" for CustomPage')}async validateNavigationInput(e,r,n,i=[]){if(i.length&&!e)return this.createErrorResponse('provided "parentPage" was not found');let a=await this.getAllowedNavigations(e);if(e&&!a.length){let s=this.getMissingNavigationMessage(1,a);return this.createErrorResponse(s)}let o=this.findTargetNavigation(a,r,n);if(e&&!o){let s=this.getMissingNavigationMessage(2,a,e.pageId);return this.createErrorResponse(s)}if(!e&&!n){let s=this.getMissingNavigationMessage(3,a);return this.createErrorResponse(s)}if(!e&&!o){let s=this.getMissingNavigationMessage(4,a);return this.createErrorResponse(s)}return null}findTargetNavigation(e,r,n){return e.find(i=>{let a=i.name.toLocaleLowerCase();return a===r?.toLocaleLowerCase()||a===n?.toLocaleLowerCase()})}async generatePageV4(e,r,n,i,a,o){let s=r?{sourceEntity:r.entitySet,sourcePage:r.pageId,navEntity:n?.name,navKey:!0}:void 0,c=this.calculateContextPath(r,n?.name,n?.entitySet??o),u=zDe({entitySet:n?.entitySet??o??"",pageId:"",pageType:e.pageType,contextPath:c,viewName:a},r?.pageId,i,this.version,n?.name),l={id:u,entity:n?.entitySet??o??"",navigation:s,contextPath:c,name:e.pageType===dl.PageTypeV4.CustomPage?a:void 0},p=await this.writeFPM(e.pageType,l,a);return{pageID:u,changes:p}}async generatePageV2(e,r,n,i,a,o){let s=this.appData.config;s.pages||(s.pages={});let c=zDe({entitySet:n?.entitySet??o??"",pageId:"",pageType:e.pageType,contextPath:"",viewName:a},r?.pageId,i,this.version,n?.name);s.pages[c]={pageType:e.pageType,entitySet:n?.entitySet??o,navigationProperty:n?.name,navigation:{}};let u=r?s.pages[r.pageId]:void 0;if(u){u.navigation||(u.navigation={});let p=u.entitySet??"";u.navigation[c]=n?.name?`${p}.${n.name}`:p}return await new $o(this.applicationAccess).writeApp(this.appData),{pageID:c,changes:[this.applicationAccess.app.manifest]}}async writeFPM(e,r,n){let i=new $o(this.applicationAccess),a=dl.CustomExtensionType.ListReport;e===dl.PageTypeV4.ObjectPage&&(a=dl.CustomExtensionType.ObjectPage),e===dl.PageTypeV4.CustomPage&&n&&(a=dl.CustomExtensionType.CustomPage);let o=qz(dVt.DirName.View);return i.writeFPM({customExtension:a,basePath:(0,hVt.join)(this.applicationAccess.project.root,this.appId),data:{...r,folder:o}})}deleteNavigationLinks(e,r){if(e){for(let n in e)if(this.findPageByNavigation(e,n)===r){delete e[n];break}}}findPageByNavigation(e,r){let n=e?.[r];return typeof n=="string"?r:n?.route}deletePageRecursively(e,r){if(!r)return;let{pages:n}=e,i=e.settings??{};if(n?.[r]){let a=n?.[r];delete n[r];let o=`${a.pageType}#${r}`;if(i.controllerExtensions?.[o]&&delete i.controllerExtensions[o],a.navigation)for(let s in a.navigation){let c=this.findPageByNavigation(a.navigation,s);this.deletePageRecursively(e,c)}}}getPages(){let{config:e}=this.appData,{pages:r={}}=e,n=[];for(let i in r){let a=r[i];n.push({pageId:i,pageType:a.pageType??dl.PageTypeV4.ListReport,entitySet:a.entitySet??"",contextPath:a.contextPath,routePattern:"routePattern"in a&&typeof a.routePattern=="string"?a.routePattern:void 0})}return n}async getAllowedNavigations(e,r=!1){return!e||e?.pageType==="ListReport"?this.getRootPageNavigationOptions(r):(await(await GDe({appName:this.appId,project:this.applicationAccess.project,serviceName:this.serviceName})).getAllowedNavigations(e?.entitySet,e?.entitySet,r)).map(i=>({...i,isNavigation:!0}))}async getRootPageNavigationOptions(e=!1){return(await(await GDe({appName:this.appId,project:this.applicationAccess.project,serviceName:this.serviceName})).getAllowedEntities(e)).map(i=>({entitySet:i.entitySet,name:i.entitySet}))}async getCreationNavigationOptions(){let e={navigations:{}},r=this.getPages();if(r.length){let n=!0;for(let i of r)e.navigations[i.pageId]=await this.getAllowedNavigations(i,n),n=!1}else e.entities=await this.getAllowedNavigations();return e}async createPage(e){let{parent:r,navigation:n,pageType:i,entitySet:a}=e,o=e.pageType===dl.PageTypeV4.CustomPage?e.viewName:void 0,s=this.getPages(),c=await this.validatePageCreationInput(e,s,o);if(c)return c;let u=s.find(v=>v.pageId===r),l=await this.validateNavigationInput(u,n,a,s);if(l)return l;let p=await this.getAllowedNavigations(u),d=this.findTargetNavigation(p,n,a),f=this.version===dl.FioriElementsVersion.v2?this.generatePageV2:this.generatePageV4,{pageID:h,changes:m}=await f.call(this,e,u,d,s,o,a);return{functionalityId:U_,status:m.length?"success":"skipped",message:m.length?`Page with id '${h}' of type '${i}' was created successfully in application '${this.appId}'`:`No changes were made for '${i}'`,parameters:[],appPath:this.params.appPath,changes:m,timestamp:new Date().toISOString()}}async deletePage(e){let{pageId:r}=e,n=structuredClone(this.appData),{config:i}=n,a=!1,{pages:o={}}=i;if(o?.[r]){for(let s in o)o[s].navigation&&this.deleteNavigationLinks(o[s].navigation,r);this.deletePageRecursively(i,r),a=!0}return Object.keys(o).length===0&&delete i.home,a?(await new $o(this.applicationAccess).writeApp(n),{functionalityId:$v,status:"success",message:`Page with id '${r}' was deleted successfully in application '${this.appId}'`,parameters:[],appPath:this.params.appPath,changes:[],timestamp:new Date().toISOString()}):{functionalityId:$v,status:"unchanged",message:`Page with id '${r}' was not found in application '${this.appId}'`,parameters:[],appPath:this.params.appPath,changes:[],timestamp:new Date().toISOString()}}};var qf=Tt(mc());var mVt=qc([qf.PageTypeV4.ListReport,qf.PageTypeV4.ObjectPage,qf.PageTypeV4.CustomPage]),gVt=qc([qf.PageTypeV4.ObjectPage]),i$n=(t,e)=>{let r=e===qf.FioriElementsVersion.v2?gVt:mVt;return Xn({pageType:r.describe("Type of page to be created. First try to extract page type from user input, if not possible suggest content defined in options."),entitySet:qc(t.map(n=>n.name)).describe("Entity set for the new page. First try to extract entity from user input, if not possible suggest content defined in options.")})},a$n=(t,e,r)=>{let n=r===qf.FioriElementsVersion.v2?gVt:mVt,i={parentPage:gx(t).describe("Parent page is id/name of parent page. First try to extract parent page from user input, if not possible suggest content defined in options"),pageNavigation:qc(e.map(o=>o.name)),pageType:n.describe("Type of page to be created. First try to extract page type from user input, if not possible suggest content defined in options.")};r===qf.FioriElementsVersion.v4&&(i.pageViewName=qt().regex(CX).optional().describe('Required if pageType is "CustomPage". Name of custom view file. First try to extract view name from user input that satisfies the pattern, if not possible ask user to provide view name'));let a=Xn(i);return r===qf.FioriElementsVersion.v4&&(a=a.refine(o=>!(o.pageType===qf.PageTypeV4.CustomPage&&!o.pageViewName),{path:["pageViewName"],message:"A pageViewName must be provided when using PageTypeV4.CustomPage"})),a};function xX(t,e=[],r=qf.FioriElementsVersion.v4){let n=Object.keys(t);return n.length?Rh(n.map(i=>a$n(i,t[i],r))):i$n(e,r)}function PX(t=[]){let e=t.map(r=>r.pageId);return Xn({pageId:qc(e).describe("Page id to be deleted. First try to extract page id from user input, if not possible suggest content defined in options")})}var yVt=Tt(mc());var Rj={functionalityId:U_,name:"Add new page to application by updating manifest.json",description:"Create new fiori elements page like ListReport, ObjectPage, CustomPage",parameters:Ta(xX({}))};async function o$n(t){let{appPath:e}=t,r=await eu(e);if(!r?.applicationAccess)return{...Rj,parameters:{},name:"Invalid Project Root or Application Path",description:`To add a new page, provide a valid project root or application path. "${e}" is not valid`};let{appId:n,applicationAccess:i}=r,o=await new $o(i).readApp(),s=await ID(i),u=await new q_({params:t,applicationAccess:i,serviceName:s,appId:n,appData:o}).getCreationNavigationOptions();return{...Rj,parameters:Ta(xX(u.navigations,u.entities,Ij(o)))}}async function s$n(t){let{appPath:e,parameters:r}=t,n=await eu(e);if(!n?.applicationAccess)return{functionalityId:U_,status:"Failed",message:`Project root not found for app path: ${e}`,parameters:[],appPath:e,changes:[],timestamp:new Date().toISOString()};let{appId:i,applicationAccess:a}=n,s=await new $o(a).readApp(),c=await ID(a),u=new q_({params:t,applicationAccess:a,serviceName:c,appId:i,appData:s}),l=await u.getCreationNavigationOptions(),p=xX(l.navigations,l.entities,Ij(s)),d=sm(p,r),f=d.pageType??yVt.PageTypeV4.ObjectPage,h="parentPage"in d?d.parentPage:void 0,m="entitySet"in d?d.entitySet?.toString():void 0,v="pageNavigation"in d?d.pageNavigation.toString():void 0,_="pageViewName"in d&&d.pageViewName&&typeof d.pageViewName=="string"?d.pageViewName:"";return u.createPage({pageType:f,parent:h,navigation:v,entitySet:m,viewName:_})}var KDe={getFunctionalityDetails:o$n,executeFunctionality:s$n};var DX={functionalityId:$v,name:"Delete page from application by updating manifest.json",description:"Remove existing fiori elements page from the application",parameters:Ta(PX())};async function c$n(t){let{appPath:e}=t,r=await eu(e);if(!r?.applicationAccess)return{functionalityId:$v,name:"Invalid Project Root or Application Path",description:`To delete a page, provide a valid project root or application path. "${e}" is not valid`,parameters:{}};let{appId:n,applicationAccess:i}=r,o=await new $o(i).readApp(),s=await ID(i),c=new q_({params:t,applicationAccess:i,serviceName:s,appId:n,appData:o});return{...DX,parameters:Ta(PX(c.getPages()))}}async function u$n(t){let{appPath:e,parameters:r}=t,n=await eu(e);if(!n?.applicationAccess)return{functionalityId:$v,status:"Failed",message:`Project root not found for app path: ${e}`,parameters:[],appPath:e,changes:[],timestamp:new Date().toISOString()};let{appId:i,applicationAccess:a}=n,s=await new $o(a).readApp(),c=await ID(a),u=new q_({params:t,applicationAccess:a,serviceName:c,appId:i,appData:s}),l=PX(u.getPages()),p=sm(l,r);return u.deletePage({pageId:p.pageId})}var YDe={getFunctionalityDetails:c$n,executeFunctionality:u$n};var NX=Tt(mc());var vVt=require("node:path");var wX=Xn({pageType:qc(["ListReport","ObjectPage"]).describe("Type of page").default("ListReport"),controllerName:qt().regex(CX).describe("Name of new controller extension file")});async function WDe(t){let e=[];if(t){let r=await t.readApp();e=Object.keys(r.config.pages??{})}return e.length>0?wX.extend({pageId:qc(e).optional().describe("If controller extension should be assigned for specific page, then pageId should be provided")}):wX}var XDe={functionalityId:AX,name:"Add new controller extension by creating javascript or typescript file and updates manifest.json with entry",description:"Add new controller extension by creating javascript or typescript file and updates manifest.json with entry. Controller extensions allow users to extensiate default behaviour with custom controllers code.",parameters:Ta(wX)};async function l$n(t){let e=await eu(t.appPath);if(!e?.applicationAccess)throw new Error("Invalid Project Root or Application Path");let r=new $o(e.applicationAccess);return{...XDe,parameters:Ta(await WDe(r))}}async function p$n(t){let{parameters:e,appPath:r}=t,n=await eu(r),i=[];if(n?.applicationAccess){let{appId:a,root:o}=n,s=new $o(n.applicationAccess),c=await WDe(s),u=sm(c,e),{pageId:l,controllerName:p,pageType:d}=u,f=await f$n(s,d,l);if(f&&typeof f=="string"){let h={pageId:typeof l=="string"?l:void 0,pageType:f};i=await s.writeFPM({customExtension:NX.CustomExtensionType.ControllerExtension,basePath:(0,vVt.join)(o,a),data:{extension:h,folder:qz(NX.DirName.Controller),name:p}})}}return{functionalityId:t.functionalityId,status:i.length?"success":"skipped",message:i.length?"Controller extension is created":"Controller extension is not created",parameters:e,appPath:r,changes:i,timestamp:new Date().toISOString()}}async function f$n(t,e,r){if(r&&typeof r=="string"&&(e=(await t.readApp()).config.pages?.[r]?.pageType),e&&typeof e=="string")return e}var bVt={getFunctionalityDetails:l$n,executeFunctionality:p$n};var Fw=require("node:fs"),Lj=require("node:path");var yA={version:"0.2",telemetryData:{generationSourceName:AR.name,generationSourceVersion:AR.version},project:{sapux:!0}},IX=gx(["FE_FPM","FE_LROP","FE_OVP","FE_ALP","FE_FEOP","FE_WORKLIST","FF_SIMPLE"]).describe("SAP Fiori Elements floor plan type."),RX=Xn({name:qt().describe("Must be lowercase with dashes, e.g., 'sales-order-management'.").regex(/^[a-z0-9-]+$/),title:ay(qt()),description:qt(),targetFolder:qt().describe("Absolute path to the project folder (projectPath)."),ui5Version:qt().default(fVt)}),EVt=Xn({servicePath:qt().describe("The odata endpoint. If the parameter is not provided, the agent should ask the user for it.").meta({examples:["odata/v4/<servicename>/","odata/v4/MyRiskService/","odata/v4/MyOdataV4Service/","odata/v4/<relative '@path' annotation from service cds file>/","<absolute '@path' annotation from service cds file>/","myAbsolutePathFromServiceCdsFile/"]}),host:Mse().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:ay(qt().describe("The client to be used for the OData service.")),metadataFilePath:ay(qt().describe("Path to a local metadata.xml file."))}),_Vt=Xn({capService:Xn({projectPath:qt(),serviceName:qt(),serviceCdsPath:qt().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:ay(gx(["Node.js","Java"]))})}),LX=Xn({mainEntity:Xn({entityName:qt().describe("The name of the main entity. EntitySet Name attribute in OData Metadata.").meta({examples:["'SalesOrder'","'PurchaseOrderHeader'","'MyEntity'"]})}),generateFormAnnotations:AT().describe("Whether to generate form annotations for the main entity if none exist.").default(!0),generateLROPAnnotations:AT().describe("Whether to generate LROP annotations for the main entity if none exist.").default(!0)});var JDe=yx.object({entityConfig:LX,floorplan:IX,project:RX,service:EVt}).describe(`The configuration that will be used for the Application UI generation.
|
|
1604
1604
|
The configuration **MUST** be a valid JSON object corresponding to the inputSchema of the functionality.`),TVt=Ta(JDe);var QDe=yx.object({entityConfig:LX,floorplan:IX,project:RX,service:_Vt}).describe(`The configuration that will be used for the Application UI generation.
|
|
1605
1605
|
The configuration **MUST** be a valid JSON object corresponding to the inputSchema of the functionality.`),OVt=Ta(QDe);async function SVt(t){let e=sm(QDe,t?.parameters),r={...yA,...e,project:{...yA.project,...e.project}};r.project.sapux=r.floorplan!=="FF_SIMPLE";let n=r?.project?.targetFolder??t.appPath;if(!n||typeof n!="string")throw new Error("Please provide a valid path to the CAP project folder.");r?.service.capService.serviceCdsPath&&(r.service.capService.serviceCdsPath=r?.service.capService.serviceCdsPath?.startsWith("/")?r?.service.capService.serviceCdsPath:`/${r?.service.capService.serviceCdsPath}`);let i=r?.project.name??"default",a=(0,Lj.join)(n,"app",i),o=n,s=`${i}-generator-config.json`,c=(0,Lj.join)(o,s);await nK();try{let u=JSON.stringify(r,null,4);await Fw.promises.mkdir((0,Lj.dirname)(c),{recursive:!0}),await Fw.promises.writeFile(c,u,{encoding:"utf8"});let l=`npx -y yo@4 @sap/fiori:headless ${s} --force --skipInstall`.trim(),{stdout:p,stderr:d}=await iK(l,{cwd:o});kt.info(p),d&&kt.error(d)}catch(u){return kt.error(`Error generating application: ${u}`),{functionalityId:gA,status:"Error",message:"Error generating application: "+u.message,parameters:t.parameters,appPath:a,changes:[],timestamp:new Date().toISOString()}}finally{(0,Fw.existsSync)(c)&&await Fw.promises.unlink(c)}return{functionalityId:gA,status:"Success",message:`Generation completed successfully: ${a}. You must run \`npm install\` in ${o} before trying to run the application.`,parameters:t.parameters,appPath:a,changes:[],timestamp:new Date().toISOString()}}var kX={functionalityId:gA,name:"Generate SAP Fiori UI Application",description:`Creates (generates) a new SAP Fiori UI application within an existing CAP project.
|
|
1606
1606
|
To populate parameters, you **MUST** use the ***CDS MCP*** to search the model for service definitions, entities, associations, and UI annotations.
|
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": "0.4.
|
|
4
|
+
"version": "0.4.6",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"SAP Fiori tools",
|
|
7
7
|
"SAP Fiori elements",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"@sap-ux/axios-extension": "1.24.3",
|
|
49
49
|
"@sap-ux/project-access": "1.32.11",
|
|
50
50
|
"@sap-ux/fiori-annotation-api": "0.7.16",
|
|
51
|
-
"@sap-ux/fiori-docs-embeddings": "0.4.4",
|
|
52
51
|
"@sap-ux/i18n": "0.3.5",
|
|
53
|
-
"@sap-ux/
|
|
52
|
+
"@sap-ux/fiori-docs-embeddings": "0.4.5",
|
|
54
53
|
"@sap-ux/odata-annotation-core-types": "0.5.1",
|
|
55
|
-
"@sap-ux/
|
|
54
|
+
"@sap-ux/logger": "0.7.1",
|
|
56
55
|
"@sap-ux/odata-entity-model": "0.3.2",
|
|
56
|
+
"@sap-ux/text-document-utils": "0.3.2",
|
|
57
|
+
"@sap-ux/feature-toggle": "0.3.4",
|
|
57
58
|
"@sap-ux/btp-utils": "1.1.5",
|
|
58
|
-
"@sap-ux/telemetry": "0.6.41",
|
|
59
59
|
"@sap-ux/nodejs-utils": "0.2.8",
|
|
60
|
-
"@sap-ux/
|
|
60
|
+
"@sap-ux/telemetry": "0.6.41"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@sap-ux/fiori-docs-embeddings": "*",
|