@sap-ux/fiori-mcp-server 0.6.39 → 0.6.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1441,7 +1441,7 @@ cfg: { // Application Insights Configuration\r
1441
1441
  ${Hfi.sanitize(Object.assign(Object.assign({},this),{request:this.request,response:this.response}))}`}};Rq.RestError=GI;GI.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR";GI.PARSE_ERROR="PARSE_ERROR";function zfi(e){return e instanceof GI?!0:(0,qfi.isError)(e)&&e.name==="RestError"}});var f2e=v(HI=>{"use strict";Object.defineProperty(HI,"__esModule",{value:!0});HI.tracingPolicyName=void 0;HI.tracingPolicy=Qfi;var Yfi=Qnr(),Kfi=Mb(),Wfi=zFe(),Vne=rC(),Lq=Fg(),Xfi=Une(),Jfi=bne();HI.tracingPolicyName="tracingPolicy";function Qfi(e={}){let t=(0,Wfi.getUserAgentValue)(e.userAgentPrefix),r=new Jfi.Sanitizer({additionalAllowedQueryParameters:e.additionalAllowedQueryParameters}),n=Zfi();return{name:HI.tracingPolicyName,async sendRequest(i,a){var o,s;if(!n||!(!((o=i.tracingOptions)===null||o===void 0)&&o.tracingContext))return a(i);let c=await t,u={"http.url":r.sanitizeUrl(i.url),"http.method":i.method,"http.user_agent":c,requestId:i.requestId};c&&(u["http.user_agent"]=c);let{span:l,tracingContext:p}=(s=edi(n,i,u))!==null&&s!==void 0?s:{};if(!l||!p)return a(i);try{let f=await n.withContext(p,a,i);return rdi(l,f),f}catch(f){throw tdi(l,f),f}}}}function Zfi(){try{return(0,Yfi.createTracingClient)({namespace:"",packageName:"@azure/core-rest-pipeline",packageVersion:Kfi.SDK_VERSION})}catch(e){Vne.logger.warning(`Error when creating the TracingClient: ${(0,Lq.getErrorMessage)(e)}`);return}}function edi(e,t,r){try{let{span:n,updatedOptions:i}=e.startSpan(`HTTP ${t.method}`,{tracingOptions:t.tracingOptions},{spanKind:"client",spanAttributes:r});if(!n.isRecording()){n.end();return}let a=e.createRequestHeaders(i.tracingOptions.tracingContext);for(let[o,s]of Object.entries(a))t.headers.set(o,s);return{span:n,tracingContext:i.tracingOptions.tracingContext}}catch(n){Vne.logger.warning(`Skipping creating a tracing span due to an error: ${(0,Lq.getErrorMessage)(n)}`);return}}function tdi(e,t){try{e.setStatus({status:"error",error:(0,Lq.isError)(t)?t:void 0}),(0,Xfi.isRestError)(t)&&t.statusCode&&e.setAttribute("http.status_code",t.statusCode),e.end()}catch(r){Vne.logger.warning(`Skipping tracing span processing due to an error: ${(0,Lq.getErrorMessage)(r)}`)}}function rdi(e,t){try{e.setAttribute("http.status_code",t.status);let r=t.headers.get("x-ms-request-id");r&&e.setAttribute("serviceRequestId",r),e.setStatus({status:"success"}),e.end()}catch(r){Vne.logger.warning(`Skipping tracing span processing due to an error: ${(0,Lq.getErrorMessage)(r)}`)}}});var rir=v(d2e=>{"use strict";Object.defineProperty(d2e,"__esModule",{value:!0});d2e.createPipelineFromOptions=hdi;var ndi=qFe(),idi=OFe(),adi=BFe(),odi=YFe(),eir=JFe(),sdi=QFe(),cdi=t2e(),udi=i2e(),tir=Fg(),ldi=a2e(),pdi=o2e(),fdi=s2e(),ddi=f2e();function hdi(e){var t;let r=(0,idi.createEmptyPipeline)();return tir.isNodeLike&&(e.tlsOptions&&r.addPolicy((0,fdi.tlsPolicy)(e.tlsOptions)),r.addPolicy((0,ldi.proxyPolicy)(e.proxyOptions)),r.addPolicy((0,sdi.decompressResponsePolicy)())),r.addPolicy((0,udi.formDataPolicy)(),{beforePolicies:[eir.multipartPolicyName]}),r.addPolicy((0,odi.userAgentPolicy)(e.userAgentOptions)),r.addPolicy((0,pdi.setClientRequestIdPolicy)((t=e.telemetryOptions)===null||t===void 0?void 0:t.clientRequestIdHeaderName)),r.addPolicy((0,eir.multipartPolicy)(),{afterPhase:"Deserialize"}),r.addPolicy((0,cdi.defaultRetryPolicy)(e.retryOptions),{phase:"Retry"}),r.addPolicy((0,ddi.tracingPolicy)(Object.assign(Object.assign({},e.userAgentOptions),e.loggingOptions)),{afterPhase:"Retry"}),tir.isNodeLike&&r.addPolicy((0,adi.redirectPolicy)(e.redirectOptions),{afterPhase:"Retry"}),r.addPolicy((0,ndi.logPolicy)(e.loggingOptions),{afterPhase:"Sign"}),r}});var cir=v(qne=>{"use strict";Object.defineProperty(qne,"__esModule",{value:!0});qne.getBodyLength=sir;qne.createNodeHttpClient=Tdi;var y2e=(hb(),nn(db)),h2e=y2e.__importStar(require("node:http")),m2e=y2e.__importStar(require("node:https")),nir=y2e.__importStar(require("node:zlib")),mdi=require("node:stream"),iir=Pq(),gdi=Iq(),kq=Une(),Mq=rC(),ydi={};function $q(e){return e&&typeof e.pipe=="function"}function air(e){return new Promise(t=>{e.on("close",t),e.on("end",t),e.on("error",t)})}function oir(e){return e&&typeof e.byteLength=="number"}var jne=class extends mdi.Transform{_transform(t,r,n){this.push(t),this.loadedBytes+=t.length;try{this.progressCallback({loadedBytes:this.loadedBytes}),n()}catch(i){n(i)}}constructor(t){super(),this.loadedBytes=0,this.progressCallback=t}},g2e=class{constructor(){this.cachedHttpsAgents=new WeakMap}async sendRequest(t){var r,n,i;let a=new AbortController,o;if(t.abortSignal){if(t.abortSignal.aborted)throw new iir.AbortError("The operation was aborted.");o=p=>{p.type==="abort"&&a.abort()},t.abortSignal.addEventListener("abort",o)}t.timeout>0&&setTimeout(()=>{a.abort()},t.timeout);let s=t.headers.get("Accept-Encoding"),c=s?.includes("gzip")||s?.includes("deflate"),u=typeof t.body=="function"?t.body():t.body;if(u&&!t.headers.has("Content-Length")){let p=sir(u);p!==null&&t.headers.set("Content-Length",p)}let l;try{if(u&&t.onUploadProgress){let _=t.onUploadProgress,T=new jne(_);T.on("error",O=>{Mq.logger.error("Error in upload progress",O)}),$q(u)?u.pipe(T):T.end(u),u=T}let p=await this.makeRequest(t,a,u),f=vdi(p),d={status:(r=p.statusCode)!==null&&r!==void 0?r:0,headers:f,request:t};if(t.method==="HEAD")return p.resume(),d;l=c?_di(p,f):p;let m=t.onDownloadProgress;if(m){let _=new jne(m);_.on("error",T=>{Mq.logger.error("Error in download progress",T)}),l.pipe(_),l=_}return!((n=t.streamResponseStatusCodes)===null||n===void 0)&&n.has(Number.POSITIVE_INFINITY)||!((i=t.streamResponseStatusCodes)===null||i===void 0)&&i.has(d.status)?d.readableStreamBody=l:d.bodyAsText=await Edi(l),d}finally{if(t.abortSignal&&o){let p=Promise.resolve();$q(u)&&(p=air(u));let f=Promise.resolve();$q(l)&&(f=air(l)),Promise.all([p,f]).then(()=>{var h;o&&((h=t.abortSignal)===null||h===void 0||h.removeEventListener("abort",o))}).catch(h=>{Mq.logger.warning("Error when cleaning up abortListener on httpRequest",h)})}}}makeRequest(t,r,n){var i;let a=new URL(t.url),o=a.protocol!=="https:";if(o&&!t.allowInsecureConnection)throw new Error(`Cannot connect to ${t.url} while allowInsecureConnection is false.`);let c={agent:(i=t.agent)!==null&&i!==void 0?i:this.getOrCreateAgent(t,o),hostname:a.hostname,path:`${a.pathname}${a.search}`,port:a.port,method:t.method,headers:t.headers.toJSON({preserveCase:!0})};return new Promise((u,l)=>{let p=o?h2e.request(c,u):m2e.request(c,u);p.once("error",f=>{var h;l(new kq.RestError(f.message,{code:(h=f.code)!==null&&h!==void 0?h:kq.RestError.REQUEST_SEND_ERROR,request:t}))}),r.signal.addEventListener("abort",()=>{let f=new iir.AbortError("The operation was aborted.");p.destroy(f),l(f)}),n&&$q(n)?n.pipe(p):n?typeof n=="string"||Buffer.isBuffer(n)?p.end(n):oir(n)?p.end(ArrayBuffer.isView(n)?Buffer.from(n.buffer):Buffer.from(n)):(Mq.logger.error("Unrecognized body type",n),l(new kq.RestError("Unrecognized body type"))):p.end()})}getOrCreateAgent(t,r){var n;let i=t.disableKeepAlive;if(r)return i?h2e.globalAgent:(this.cachedHttpAgent||(this.cachedHttpAgent=new h2e.Agent({keepAlive:!0})),this.cachedHttpAgent);{if(i&&!t.tlsSettings)return m2e.globalAgent;let a=(n=t.tlsSettings)!==null&&n!==void 0?n:ydi,o=this.cachedHttpsAgents.get(a);return o&&o.options.keepAlive===!i||(Mq.logger.info("No cached TLS Agent exist, creating a new Agent"),o=new m2e.Agent(Object.assign({keepAlive:!i},a)),this.cachedHttpsAgents.set(a,o)),o}}};function vdi(e){let t=(0,gdi.createHttpHeaders)();for(let r of Object.keys(e.headers)){let n=e.headers[r];Array.isArray(n)?n.length>0&&t.set(r,n[0]):n&&t.set(r,n)}return t}function _di(e,t){let r=t.get("Content-Encoding");if(r==="gzip"){let n=nir.createGunzip();return e.pipe(n),n}else if(r==="deflate"){let n=nir.createInflate();return e.pipe(n),n}return e}function Edi(e){return new Promise((t,r)=>{let n=[];e.on("data",i=>{Buffer.isBuffer(i)?n.push(i):n.push(Buffer.from(i))}),e.on("end",()=>{t(Buffer.concat(n).toString("utf8"))}),e.on("error",i=>{i&&i?.name==="AbortError"?r(i):r(new kq.RestError(`Error reading response as text: ${i.message}`,{code:kq.RestError.PARSE_ERROR}))})})}function sir(e){return e?Buffer.isBuffer(e)?e.length:$q(e)?null:oir(e)?e.byteLength:typeof e=="string"?Buffer.from(e).length:null:0}function Tdi(){return new g2e}});var uir=v(v2e=>{"use strict";Object.defineProperty(v2e,"__esModule",{value:!0});v2e.createDefaultHttpClient=Sdi;var bdi=cir();function Sdi(){return(0,bdi.createNodeHttpClient)()}});var lir=v(E2e=>{"use strict";Object.defineProperty(E2e,"__esModule",{value:!0});E2e.createPipelineRequest=Cdi;var Odi=Iq(),Adi=Fg(),_2e=class{constructor(t){var r,n,i,a,o,s,c;this.url=t.url,this.body=t.body,this.headers=(r=t.headers)!==null&&r!==void 0?r:(0,Odi.createHttpHeaders)(),this.method=(n=t.method)!==null&&n!==void 0?n:"GET",this.timeout=(i=t.timeout)!==null&&i!==void 0?i:0,this.multipartBody=t.multipartBody,this.formData=t.formData,this.disableKeepAlive=(a=t.disableKeepAlive)!==null&&a!==void 0?a:!1,this.proxySettings=t.proxySettings,this.streamResponseStatusCodes=t.streamResponseStatusCodes,this.withCredentials=(o=t.withCredentials)!==null&&o!==void 0?o:!1,this.abortSignal=t.abortSignal,this.tracingOptions=t.tracingOptions,this.onUploadProgress=t.onUploadProgress,this.onDownloadProgress=t.onDownloadProgress,this.requestId=t.requestId||(0,Adi.randomUUID)(),this.allowInsecureConnection=(s=t.allowInsecureConnection)!==null&&s!==void 0?s:!1,this.enableBrowserStreams=(c=t.enableBrowserStreams)!==null&&c!==void 0?c:!1}};function Cdi(e){return new _2e(e)}});var pir=v(Fq=>{"use strict";Object.defineProperty(Fq,"__esModule",{value:!0});Fq.exponentialRetryPolicyName=void 0;Fq.exponentialRetryPolicy=Ndi;var xdi=wne(),Pdi=kI(),Ddi=Mb();Fq.exponentialRetryPolicyName="exponentialRetryPolicy";function Ndi(e={}){var t;return(0,Pdi.retryPolicy)([(0,xdi.exponentialRetryStrategy)(Object.assign(Object.assign({},e),{ignoreSystemErrors:!0}))],{maxRetries:(t=e.maxRetries)!==null&&t!==void 0?t:Ddi.DEFAULT_RETRY_POLICY_COUNT})}});var fir=v(zI=>{"use strict";Object.defineProperty(zI,"__esModule",{value:!0});zI.systemErrorRetryPolicyName=void 0;zI.systemErrorRetryPolicy=Ldi;var wdi=wne(),Idi=kI(),Rdi=Mb();zI.systemErrorRetryPolicyName="systemErrorRetryPolicy";function Ldi(e={}){var t;return{name:zI.systemErrorRetryPolicyName,sendRequest:(0,Idi.retryPolicy)([(0,wdi.exponentialRetryStrategy)(Object.assign(Object.assign({},e),{ignoreHttpStatusCodes:!0}))],{maxRetries:(t=e.maxRetries)!==null&&t!==void 0?t:Rdi.DEFAULT_RETRY_POLICY_COUNT}).sendRequest}}});var dir=v(YI=>{"use strict";Object.defineProperty(YI,"__esModule",{value:!0});YI.throttlingRetryPolicyName=void 0;YI.throttlingRetryPolicy=Fdi;var Mdi=Nne(),$di=kI(),kdi=Mb();YI.throttlingRetryPolicyName="throttlingRetryPolicy";function Fdi(e={}){var t;return{name:YI.throttlingRetryPolicyName,sendRequest:(0,$di.retryPolicy)([(0,Mdi.throttlingRetryStrategy)()],{maxRetries:(t=e.maxRetries)!==null&&t!==void 0?t:kdi.DEFAULT_RETRY_POLICY_COUNT}).sendRequest}}});var T2e=v(KI=>{"use strict";Object.defineProperty(KI,"__esModule",{value:!0});KI.DEFAULT_CYCLER_OPTIONS=void 0;KI.createTokenCycler=jdi;var Udi=Pne();KI.DEFAULT_CYCLER_OPTIONS={forcedRefreshWindowInMs:1e3,retryIntervalInMs:3e3,refreshWindowInMs:1e3*60*2};async function Vdi(e,t,r){async function n(){if(Date.now()<r)try{return await e()}catch{return null}else{let a=await e();if(a===null)throw new Error("Failed to refresh access token.");return a}}let i=await n();for(;i===null;)await(0,Udi.delay)(t),i=await n();return i}function jdi(e,t){let r=null,n=null,i,a=Object.assign(Object.assign({},KI.DEFAULT_CYCLER_OPTIONS),t),o={get isRefreshing(){return r!==null},get shouldRefresh(){var c;return!o.isRefreshing&&((c=n?.expiresOnTimestamp)!==null&&c!==void 0?c:0)-a.refreshWindowInMs<Date.now()},get mustRefresh(){return n===null||n.expiresOnTimestamp-a.forcedRefreshWindowInMs<Date.now()}};function s(c,u){var l;return o.isRefreshing||(r=Vdi(()=>e.getToken(c,u),a.retryIntervalInMs,(l=n?.expiresOnTimestamp)!==null&&l!==void 0?l:Date.now()).then(f=>(r=null,n=f,i=u.tenantId,n)).catch(f=>{throw r=null,n=null,i=void 0,f})),r}return async(c,u)=>{let l=!!u.claims,p=i!==u.tenantId;return l&&(n=null),p||l||o.mustRefresh?s(c,u):(o.shouldRefresh&&s(c,u),n)}}});var hir=v(WI=>{"use strict";Object.defineProperty(WI,"__esModule",{value:!0});WI.bearerTokenAuthenticationPolicyName=void 0;WI.bearerTokenAuthenticationPolicy=zdi;var qdi=T2e(),Bdi=rC();WI.bearerTokenAuthenticationPolicyName="bearerTokenAuthenticationPolicy";async function Gdi(e){let{scopes:t,getAccessToken:r,request:n}=e,i={abortSignal:n.abortSignal,tracingOptions:n.tracingOptions},a=await r(t,i);a&&e.request.headers.set("Authorization",`Bearer ${a.token}`)}function Hdi(e){let t=e.headers.get("WWW-Authenticate");if(e.status===401&&t)return t}function zdi(e){var t;let{credential:r,scopes:n,challengeCallbacks:i}=e,a=e.logger||Bdi.logger,o=Object.assign({authorizeRequest:(t=i?.authorizeRequest)!==null&&t!==void 0?t:Gdi,authorizeRequestOnChallenge:i?.authorizeRequestOnChallenge},i),s=r?(0,qdi.createTokenCycler)(r):()=>Promise.resolve(null);return{name:WI.bearerTokenAuthenticationPolicyName,async sendRequest(c,u){if(!c.url.toLowerCase().startsWith("https://"))throw new Error("Bearer token authentication is not permitted for non-TLS protected (non-https) URLs.");await o.authorizeRequest({scopes:Array.isArray(n)?n:[n],request:c,getAccessToken:s,logger:a});let l,p;try{l=await u(c)}catch(f){p=f,l=f.response}if(o.authorizeRequestOnChallenge&&l?.status===401&&Hdi(l)&&await o.authorizeRequestOnChallenge({scopes:Array.isArray(n)?n:[n],request:c,response:l,getAccessToken:s,logger:a}))return u(c);if(p)throw p;return l}}}});var mir=v(XI=>{"use strict";Object.defineProperty(XI,"__esModule",{value:!0});XI.ndJsonPolicyName=void 0;XI.ndJsonPolicy=Ydi;XI.ndJsonPolicyName="ndJsonPolicy";function Ydi(){return{name:XI.ndJsonPolicyName,async sendRequest(e,t){if(typeof e.body=="string"&&e.body.startsWith("[")){let r=JSON.parse(e.body);Array.isArray(r)&&(e.body=r.map(n=>JSON.stringify(n)+`
1442
1442
  `).join(""))}return t(e)}}}});var yir=v(aC=>{"use strict";Object.defineProperty(aC,"__esModule",{value:!0});aC.auxiliaryAuthenticationHeaderPolicyName=void 0;aC.auxiliaryAuthenticationHeaderPolicy=Jdi;var Kdi=T2e(),Wdi=rC();aC.auxiliaryAuthenticationHeaderPolicyName="auxiliaryAuthenticationHeaderPolicy";var gir="x-ms-authorization-auxiliary";async function Xdi(e){var t,r;let{scopes:n,getAccessToken:i,request:a}=e,o={abortSignal:a.abortSignal,tracingOptions:a.tracingOptions};return(r=(t=await i(n,o))===null||t===void 0?void 0:t.token)!==null&&r!==void 0?r:""}function Jdi(e){let{credentials:t,scopes:r}=e,n=e.logger||Wdi.logger,i=new WeakMap;return{name:aC.auxiliaryAuthenticationHeaderPolicyName,async sendRequest(a,o){if(!a.url.toLowerCase().startsWith("https://"))throw new Error("Bearer token authentication for auxiliary header is not permitted for non-TLS protected (non-https) URLs.");if(!t||t.length===0)return n.info(`${aC.auxiliaryAuthenticationHeaderPolicyName} header will not be set due to empty credentials.`),o(a);let s=[];for(let u of t){let l=i.get(u);l||(l=(0,Kdi.createTokenCycler)(u),i.set(u,l)),s.push(Xdi({scopes:Array.isArray(r)?r:[r],request:a,getAccessToken:l,logger:n}))}let c=(await Promise.all(s)).filter(u=>!!u);return c.length===0?(n.warning(`None of the auxiliary tokens are valid. ${gir} header will not be set.`),o(a)):(a.headers.set(gir,c.map(u=>`Bearer ${u}`).join(", ")),o(a))}}}});var Mir=v(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.createFileFromStream=je.createFile=je.auxiliaryAuthenticationHeaderPolicyName=je.auxiliaryAuthenticationHeaderPolicy=je.ndJsonPolicyName=je.ndJsonPolicy=je.bearerTokenAuthenticationPolicyName=je.bearerTokenAuthenticationPolicy=je.formDataPolicyName=je.formDataPolicy=je.tlsPolicyName=je.tlsPolicy=je.userAgentPolicyName=je.userAgentPolicy=je.defaultRetryPolicy=je.tracingPolicyName=je.tracingPolicy=je.retryPolicy=je.throttlingRetryPolicyName=je.throttlingRetryPolicy=je.systemErrorRetryPolicyName=je.systemErrorRetryPolicy=je.redirectPolicyName=je.redirectPolicy=je.getDefaultProxySettings=je.proxyPolicyName=je.proxyPolicy=je.multipartPolicyName=je.multipartPolicy=je.logPolicyName=je.logPolicy=je.setClientRequestIdPolicyName=je.setClientRequestIdPolicy=je.exponentialRetryPolicyName=je.exponentialRetryPolicy=je.decompressResponsePolicyName=je.decompressResponsePolicy=je.isRestError=je.RestError=je.createPipelineRequest=je.createHttpHeaders=je.createDefaultHttpClient=je.createPipelineFromOptions=je.createEmptyPipeline=void 0;var Qdi=OFe();Object.defineProperty(je,"createEmptyPipeline",{enumerable:!0,get:function(){return Qdi.createEmptyPipeline}});var Zdi=rir();Object.defineProperty(je,"createPipelineFromOptions",{enumerable:!0,get:function(){return Zdi.createPipelineFromOptions}});var ehi=uir();Object.defineProperty(je,"createDefaultHttpClient",{enumerable:!0,get:function(){return ehi.createDefaultHttpClient}});var thi=Iq();Object.defineProperty(je,"createHttpHeaders",{enumerable:!0,get:function(){return thi.createHttpHeaders}});var rhi=lir();Object.defineProperty(je,"createPipelineRequest",{enumerable:!0,get:function(){return rhi.createPipelineRequest}});var vir=Une();Object.defineProperty(je,"RestError",{enumerable:!0,get:function(){return vir.RestError}});Object.defineProperty(je,"isRestError",{enumerable:!0,get:function(){return vir.isRestError}});var _ir=QFe();Object.defineProperty(je,"decompressResponsePolicy",{enumerable:!0,get:function(){return _ir.decompressResponsePolicy}});Object.defineProperty(je,"decompressResponsePolicyName",{enumerable:!0,get:function(){return _ir.decompressResponsePolicyName}});var Eir=pir();Object.defineProperty(je,"exponentialRetryPolicy",{enumerable:!0,get:function(){return Eir.exponentialRetryPolicy}});Object.defineProperty(je,"exponentialRetryPolicyName",{enumerable:!0,get:function(){return Eir.exponentialRetryPolicyName}});var Tir=o2e();Object.defineProperty(je,"setClientRequestIdPolicy",{enumerable:!0,get:function(){return Tir.setClientRequestIdPolicy}});Object.defineProperty(je,"setClientRequestIdPolicyName",{enumerable:!0,get:function(){return Tir.setClientRequestIdPolicyName}});var bir=qFe();Object.defineProperty(je,"logPolicy",{enumerable:!0,get:function(){return bir.logPolicy}});Object.defineProperty(je,"logPolicyName",{enumerable:!0,get:function(){return bir.logPolicyName}});var Sir=JFe();Object.defineProperty(je,"multipartPolicy",{enumerable:!0,get:function(){return Sir.multipartPolicy}});Object.defineProperty(je,"multipartPolicyName",{enumerable:!0,get:function(){return Sir.multipartPolicyName}});var b2e=a2e();Object.defineProperty(je,"proxyPolicy",{enumerable:!0,get:function(){return b2e.proxyPolicy}});Object.defineProperty(je,"proxyPolicyName",{enumerable:!0,get:function(){return b2e.proxyPolicyName}});Object.defineProperty(je,"getDefaultProxySettings",{enumerable:!0,get:function(){return b2e.getDefaultProxySettings}});var Oir=BFe();Object.defineProperty(je,"redirectPolicy",{enumerable:!0,get:function(){return Oir.redirectPolicy}});Object.defineProperty(je,"redirectPolicyName",{enumerable:!0,get:function(){return Oir.redirectPolicyName}});var Air=fir();Object.defineProperty(je,"systemErrorRetryPolicy",{enumerable:!0,get:function(){return Air.systemErrorRetryPolicy}});Object.defineProperty(je,"systemErrorRetryPolicyName",{enumerable:!0,get:function(){return Air.systemErrorRetryPolicyName}});var Cir=dir();Object.defineProperty(je,"throttlingRetryPolicy",{enumerable:!0,get:function(){return Cir.throttlingRetryPolicy}});Object.defineProperty(je,"throttlingRetryPolicyName",{enumerable:!0,get:function(){return Cir.throttlingRetryPolicyName}});var nhi=kI();Object.defineProperty(je,"retryPolicy",{enumerable:!0,get:function(){return nhi.retryPolicy}});var xir=f2e();Object.defineProperty(je,"tracingPolicy",{enumerable:!0,get:function(){return xir.tracingPolicy}});Object.defineProperty(je,"tracingPolicyName",{enumerable:!0,get:function(){return xir.tracingPolicyName}});var ihi=t2e();Object.defineProperty(je,"defaultRetryPolicy",{enumerable:!0,get:function(){return ihi.defaultRetryPolicy}});var Pir=YFe();Object.defineProperty(je,"userAgentPolicy",{enumerable:!0,get:function(){return Pir.userAgentPolicy}});Object.defineProperty(je,"userAgentPolicyName",{enumerable:!0,get:function(){return Pir.userAgentPolicyName}});var Dir=s2e();Object.defineProperty(je,"tlsPolicy",{enumerable:!0,get:function(){return Dir.tlsPolicy}});Object.defineProperty(je,"tlsPolicyName",{enumerable:!0,get:function(){return Dir.tlsPolicyName}});var Nir=i2e();Object.defineProperty(je,"formDataPolicy",{enumerable:!0,get:function(){return Nir.formDataPolicy}});Object.defineProperty(je,"formDataPolicyName",{enumerable:!0,get:function(){return Nir.formDataPolicyName}});var wir=hir();Object.defineProperty(je,"bearerTokenAuthenticationPolicy",{enumerable:!0,get:function(){return wir.bearerTokenAuthenticationPolicy}});Object.defineProperty(je,"bearerTokenAuthenticationPolicyName",{enumerable:!0,get:function(){return wir.bearerTokenAuthenticationPolicyName}});var Iir=mir();Object.defineProperty(je,"ndJsonPolicy",{enumerable:!0,get:function(){return Iir.ndJsonPolicy}});Object.defineProperty(je,"ndJsonPolicyName",{enumerable:!0,get:function(){return Iir.ndJsonPolicyName}});var Rir=yir();Object.defineProperty(je,"auxiliaryAuthenticationHeaderPolicy",{enumerable:!0,get:function(){return Rir.auxiliaryAuthenticationHeaderPolicy}});Object.defineProperty(je,"auxiliaryAuthenticationHeaderPolicyName",{enumerable:!0,get:function(){return Rir.auxiliaryAuthenticationHeaderPolicyName}});var Lir=KFe();Object.defineProperty(je,"createFile",{enumerable:!0,get:function(){return Lir.createFile}});Object.defineProperty(je,"createFileFromStream",{enumerable:!0,get:function(){return Lir.createFileFromStream}})});var kir=v((Vq,$ir)=>{"use strict";var ahi=Vq&&Vq.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(p){o(p)}}function c(l){try{u(n.throw(l))}catch(p){o(p)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},ohi=Vq&&Vq.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(l){u=[6,l],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},shi=Ci(),chi="https://monitor.azure.com//.default",Uq;try{Uq=Mir()}catch{shi.warn("Cannot load @azure/core-auth package. This package is required for AAD token authentication. It's likely that your node.js version is not supported by the JS Azure SDK.")}function uhi(e){return null}var lhi=(function(){function e(t,r){if(Uq){var n=r?[r]:[chi];this._azureTokenPolicy=Uq.bearerTokenAuthenticationPolicy({credential:t,scopes:n})}}return e.prototype.addAuthorizationHeader=function(t){return ahi(this,void 0,void 0,function(){var r,n;return ohi(this,function(i){switch(i.label){case 0:return Uq?(r="authorization",n=Uq.createPipelineRequest({url:"https://"}),[4,this._azureTokenPolicy.sendRequest(n,uhi)]):[3,2];case 1:i.sent(),t.headers[r]=n.headers.get(r),i.label=2;case 2:return[2]}})})},e})();$ir.exports=lhi});var Uir=v((tda,Fir)=>{"use strict";var phi=Ci(),fhi=Js(),dhi=(function(){function e(t,r,n,i){this._buffer=[],this._lastSend=0,this._isDisabled=t,this._getBatchSize=r,this._getBatchIntervalMs=n,this._sender=i}return e.prototype.setUseDiskRetryCaching=function(t,r,n){this._sender.setDiskRetryMode(t,r,n)},e.prototype.send=function(t){var r=this;if(!this._isDisabled()){if(!t){phi.warn("Cannot send null/undefined telemetry");return}if(this._buffer.push(t),this._buffer.length>=this._getBatchSize()){this.triggerSend(!1);return}!this._timeoutHandle&&this._buffer.length>0&&(this._timeoutHandle=setTimeout(function(){r._timeoutHandle=null,r.triggerSend(!1)},this._getBatchIntervalMs()))}},e.prototype.triggerSend=function(t,r){var n=this._buffer.length<1;n||(t||fhi.isNodeExit?(this._sender.saveOnCrash(this._buffer),typeof r=="function"&&r("data saved on crash")):this._sender.send(this._buffer,r)),this._lastSend=+new Date,this._buffer=[],clearTimeout(this._timeoutHandle),this._timeoutHandle=null,n&&typeof r=="function"&&r("no data to send")},e})();Fir.exports=dhi});var Vir=v(S2e=>{"use strict";Object.defineProperty(S2e,"__esModule",{value:!0});S2e.azureRoleEnvironmentTelemetryProcessor=hhi;function hhi(e,t){}});var Bir=v(Bne=>{"use strict";Object.defineProperty(Bne,"__esModule",{value:!0});Bne.samplingTelemetryProcessor=mhi;Bne.getSamplingHashCode=qir;var jir=Xc();function mhi(e,t){var r=e.sampleRate,n=!1;return r==null||r>=100||e.data&&jir.TelemetryType.Metric===jir.baseTypeToTelemetryType(e.data.baseType)?!0:(t.correlationContext&&t.correlationContext.operation?n=qir(t.correlationContext.operation.id)<r:n=Math.random()*100<r,n)}function qir(e){var t=-2147483648,r=2147483647,n=5381;if(!e)return 0;for(;e.length<8;)e=e+e;for(var i=0;i<e.length;i++)n=((n<<5)+n|0)+e.charCodeAt(i)|0;return n=n<=t?r:Math.abs(n),n/r*100}});var Gir=v(y_=>{"use strict";var ghi=y_&&y_.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),yhi=y_&&y_.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),vhi=y_&&y_.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ghi(t,e,r);return yhi(t,e),t};Object.defineProperty(y_,"__esModule",{value:!0});y_.performanceMetricsTelemetryProcessor=_hi;var O2e=ene(),A2e=vhi(Xc());function _hi(e,t){switch(t&&t.addDocument(e),e.data.baseType){case A2e.TelemetryTypeString.Exception:O2e.countException();break;case A2e.TelemetryTypeString.Request:var r=e.data.baseData;O2e.countRequest(r.duration,r.success);break;case A2e.TelemetryTypeString.Dependency:var n=e.data.baseData;O2e.countDependency(n.duration,n.success);break}return!0}});var Hir=v(Rh=>{"use strict";var Ug=Rh&&Rh.__assign||function(){return Ug=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Ug.apply(this,arguments)},Ehi=Rh&&Rh.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Thi=Rh&&Rh.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),bhi=Rh&&Rh.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ehi(t,e,r);return Thi(t,e),t};Object.defineProperty(Rh,"__esModule",{value:!0});Rh.preAggregatedMetricsTelemetryProcessor=Ohi;var Shi=Xc(),jq=eFe(),Gne=bhi(Xc());function Ohi(e,t){if(jq.isEnabled())switch(e.data.baseType){case Gne.TelemetryTypeString.Exception:var r=e.data.baseData;r.properties=Ug(Ug({},r.properties),{"_MS.ProcessedByMetricExtractors":"(Name:'Exceptions', Ver:'1.1')"});var n={cloudRoleInstance:e.tags[t.keys.cloudRoleInstance],cloudRoleName:e.tags[t.keys.cloudRole]};jq.countException(n);break;case Gne.TelemetryTypeString.Trace:var i=e.data.baseData;i.properties=Ug(Ug({},i.properties),{"_MS.ProcessedByMetricExtractors":"(Name:'Traces', Ver:'1.1')"});var a={cloudRoleInstance:e.tags[t.keys.cloudRoleInstance],cloudRoleName:e.tags[t.keys.cloudRole],traceSeverityLevel:Shi.SeverityLevel[i.severity]};jq.countTrace(a);break;case Gne.TelemetryTypeString.Request:var o=e.data.baseData;o.properties=Ug(Ug({},o.properties),{"_MS.ProcessedByMetricExtractors":"(Name:'Requests', Ver:'1.1')"});var s={cloudRoleInstance:e.tags[t.keys.cloudRoleInstance],cloudRoleName:e.tags[t.keys.cloudRole],operationSynthetic:e.tags[t.keys.operationSyntheticSource],requestSuccess:o.success,requestResultCode:o.responseCode};jq.countRequest(o.duration,s);break;case Gne.TelemetryTypeString.Dependency:var c=e.data.baseData;c.properties=Ug(Ug({},c.properties),{"_MS.ProcessedByMetricExtractors":"(Name:'Dependencies', Ver:'1.1')"});var u={cloudRoleInstance:e.tags[t.keys.cloudRoleInstance],cloudRoleName:e.tags[t.keys.cloudRole],operationSynthetic:e.tags[t.keys.operationSyntheticSource],dependencySuccess:c.success,dependencyType:c.type,dependencyTarget:c.target,dependencyResultCode:c.resultCode};jq.countDependency(c.duration,u);break}return!0}});var zir=v(Vg=>{"use strict";var Ahi=Vg&&Vg.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Hne=Vg&&Vg.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Ahi(t,e,r)};Object.defineProperty(Vg,"__esModule",{value:!0});Hne(Vir(),Vg);Hne(Bir(),Vg);Hne(Gir(),Vg);Hne(Hir(),Vg)});var C2e=v((sda,Wir)=>{"use strict";var Wt=Xc(),Gl=Js(),Yir=xb(),Chi=Ci(),xhi=(function(){function e(){}return e.createEnvelope=function(t,r,n,i,a){var o=null;switch(r){case Wt.TelemetryType.Trace:o=e.createTraceData(t);break;case Wt.TelemetryType.Dependency:o=e.createDependencyData(t);break;case Wt.TelemetryType.Event:o=e.createEventData(t);break;case Wt.TelemetryType.Exception:o=e.createExceptionData(t);break;case Wt.TelemetryType.Request:o=e.createRequestData(t);break;case Wt.TelemetryType.Metric:o=e.createMetricData(t);break;case Wt.TelemetryType.Availability:o=e.createAvailabilityData(t);break;case Wt.TelemetryType.PageView:o=e.createPageViewData(t);break}if(o&&o.baseData&&Wt.domainSupportsProperties(o.baseData)){if(n)if(!o.baseData.properties)o.baseData.properties=n;else for(var s in n)o.baseData.properties[s]||(o.baseData.properties[s]=n[s]);e.addAzureFunctionsCorrelationProperties(o.baseData.properties),o.baseData.properties&&(o.baseData.properties=Gl.validateStringMap(o.baseData.properties))}var c=a&&a.instrumentationKey||"",u=new Wt.Envelope;return u.data=o,u.iKey=c,u.name="Microsoft.ApplicationInsights."+c.replace(/-/g,"")+"."+o.baseType.substr(0,o.baseType.length-4),u.tags=this.getTags(i,t.tagOverrides),u.time=new Date().toISOString(),u.ver=1,u.sampleRate=a?a.samplingPercentage:100,r===Wt.TelemetryType.Metric&&(u.sampleRate=100),u},e.addAzureFunctionsCorrelationProperties=function(t){var r=Yir.CorrelationContextManager.getCurrentContext();if(r&&r.customProperties&&r.customProperties.getProperty instanceof Function){t=t||{};var n=r.customProperties.getProperty("InvocationId");n&&(t.InvocationId=n),n=r.customProperties.getProperty("ProcessId"),n&&(t.ProcessId=n),n=r.customProperties.getProperty("LogLevel"),n&&(t.LogLevel=n),n=r.customProperties.getProperty("Category"),n&&(t.Category=n),n=r.customProperties.getProperty("HostInstanceId"),n&&(t.HostInstanceId=n),n=r.customProperties.getProperty("AzFuncLiveLogsSessionId"),n&&(t.AzFuncLiveLogsSessionId=n)}},e.truncateProperties=function(t){if(t.properties)try{for(var r={},n=Object.keys(t.properties),i=Object.values(t.properties),a=0;a<n.length;a++)n[a].length<=150&&(Gl.isDate(i[a])||(i[a]==null&&(i[a]=""),typeof i[a]=="object"&&(i[a]=Gl.stringify(i[a])),r[n[a]]=String(i[a]).substring(0,8192)),r[n[a]]=i[a]);return r}catch(o){Chi.warn("Failed to properly truncate telemetry properties: ",o)}},e.createTraceData=function(t){var r,n=new Wt.MessageData;n.message=(r=t.message)===null||r===void 0?void 0:r.substring(0,32768),n.properties=this.truncateProperties(t),isNaN(t.severity)?n.severityLevel=Wt.SeverityLevel.Information:n.severityLevel=t.severity;var i=new Wt.Data;return i.baseType=Wt.telemetryTypeToBaseType(Wt.TelemetryType.Trace),i.baseData=n,i},e.createDependencyData=function(t){var r,n,i,a=new Wt.RemoteDependencyData;a.name=(r=t.name)===null||r===void 0?void 0:r.substring(0,1024),a.data=(n=t.data)===null||n===void 0?void 0:n.substring(0,8192),a.target=(i=t.target)===null||i===void 0?void 0:i.substring(0,1024),a.duration=Gl.msToTimeSpan(t.duration),a.success=t.success,a.type=t.dependencyTypeName,a.properties=this.truncateProperties(t),a.resultCode=t.resultCode?t.resultCode.toString():"0",t.id?a.id=t.id:a.id=Gl.w3cTraceId();var o=new Wt.Data;return o.baseType=Wt.telemetryTypeToBaseType(Wt.TelemetryType.Dependency),o.baseData=a,o},e.createEventData=function(t){var r,n=new Wt.EventData;n.name=(r=t.name)===null||r===void 0?void 0:r.substring(0,512),n.properties=this.truncateProperties(t),n.measurements=t.measurements;var i=new Wt.Data;return i.baseType=Wt.telemetryTypeToBaseType(Wt.TelemetryType.Event),i.baseData=n,i},e.createExceptionData=function(t){var r,n,i=new Wt.ExceptionData;i.properties=this.truncateProperties(t),isNaN(t.severity)?i.severityLevel=Wt.SeverityLevel.Error:i.severityLevel=t.severity,i.measurements=t.measurements,i.exceptions=[];var a=t.exception.stack,o=new Wt.ExceptionDetails;o.message=(r=t.exception.message)===null||r===void 0?void 0:r.substring(0,32768),o.typeName=(n=t.exception.name)===null||n===void 0?void 0:n.substring(0,1024),o.parsedStack=this.parseStack(a),o.hasFullStack=Gl.isArray(o.parsedStack)&&o.parsedStack.length>0,i.exceptions.push(o);var s=new Wt.Data;return s.baseType=Wt.telemetryTypeToBaseType(Wt.TelemetryType.Exception),s.baseData=i,s},e.createRequestData=function(t){var r,n,i,a,o=new Wt.RequestData;t.id?o.id=t.id:o.id=Gl.w3cTraceId(),o.name=(r=t.name)===null||r===void 0?void 0:r.substring(0,1024),o.url=(n=t.url)===null||n===void 0?void 0:n.substring(0,2048),o.source=(i=t.source)===null||i===void 0?void 0:i.substring(0,1024),o.duration=Gl.msToTimeSpan(t.duration),o.responseCode=(a=t.resultCode?t.resultCode.toString():"0")===null||a===void 0?void 0:a.substring(0,1024),o.success=t.success,o.properties=this.truncateProperties(t),o.measurements=t.measurements;var s=new Wt.Data;return s.baseType=Wt.telemetryTypeToBaseType(Wt.TelemetryType.Request),s.baseData=o,s},e.createMetricData=function(t){var r,n=new Wt.MetricData;n.metrics=[];var i=new Wt.DataPoint;i.count=isNaN(t.count)?1:t.count,i.kind=Wt.DataPointType.Aggregation,i.max=isNaN(t.max)?t.value:t.max,i.min=isNaN(t.min)?t.value:t.min,i.name=(r=t.name)===null||r===void 0?void 0:r.substring(0,1024),i.stdDev=isNaN(t.stdDev)?0:t.stdDev,i.value=t.value,i.ns=t.namespace,n.metrics.push(i),n.properties=this.truncateProperties(t);var a=new Wt.Data;return a.baseType=Wt.telemetryTypeToBaseType(Wt.TelemetryType.Metric),a.baseData=n,a},e.createAvailabilityData=function(t){var r,n,i=new Wt.AvailabilityData;t.id?i.id=t.id:i.id=Gl.w3cTraceId(),i.name=(r=t.name)===null||r===void 0?void 0:r.substring(0,1024),i.duration=Gl.msToTimeSpan(t.duration),i.success=t.success,i.runLocation=t.runLocation,i.message=(n=t.message)===null||n===void 0?void 0:n.substring(0,8192),i.measurements=t.measurements,i.properties=this.truncateProperties(t);var a=new Wt.Data;return a.baseType=Wt.telemetryTypeToBaseType(Wt.TelemetryType.Availability),a.baseData=i,a},e.createPageViewData=function(t){var r,n,i=new Wt.PageViewData;i.name=(r=t.name)===null||r===void 0?void 0:r.substring(0,1024),i.duration=Gl.msToTimeSpan(t.duration),i.url=(n=t.url)===null||n===void 0?void 0:n.substring(0,2048),i.measurements=t.measurements,i.properties=this.truncateProperties(t);var a=new Wt.Data;return a.baseType=Wt.telemetryTypeToBaseType(Wt.TelemetryType.PageView),a.baseData=i,a},e.getTags=function(t,r){var n=Yir.CorrelationContextManager.getCurrentContext(),i={};if(t&&t.tags)for(var a in t.tags)i[a]=t.tags[a];if(r)for(var a in r)i[a]=r[a];return n&&(i[t.keys.operationId]=i[t.keys.operationId]||n.operation.id,i[t.keys.operationName]=i[t.keys.operationName]||n.operation.name,i[t.keys.operationParentId]=i[t.keys.operationParentId]||n.operation.parentId),i},e.parseStack=function(t){var r=void 0;if(typeof t=="string"){var n=t.split(`
1443
1443
  `);r=[];for(var i=0,a=0,o=0;o<=n.length;o++){var s=n[o];if(Kir.regex.test(s)){var c=new Kir(n[o],i++);a+=c.sizeInBytes,r.push(c)}}var u=32*1024;if(a>u)for(var l=0,p=r.length-1,f=0,h=l,d=p;l<p;){var m=r[l].sizeInBytes,_=r[p].sizeInBytes;if(f+=m+_,f>u){var T=d-h+1;r.splice(h,T);break}h=l,d=p,l++,p--}}return r},e})(),Kir=(function(){function e(t,r){this.sizeInBytes=0,this.level=r,this.method="<no_method>",this.assembly=Gl.trim(t);var n=t.match(e.regex);n&&n.length>=5&&(this.method=Gl.trim(n[2])||this.method,this.fileName=Gl.trim(n[4])||"<no_filename>",this.line=parseInt(n[5])||0),this.sizeInBytes+=this.method.length,this.sizeInBytes+=this.fileName.length,this.sizeInBytes+=this.assembly.length,this.sizeInBytes+=e.baseSize,this.sizeInBytes+=this.level.toString().length,this.sizeInBytes+=this.line.toString().length}return e.regex=/^(\s+at)?(.*?)(\@|\s\(|\s)([^\(\n]+):(\d+):(\d+)(\)?)$/,e.baseSize=58,e})();Wir.exports=xhi});var Xir=v($b=>{"use strict";var Phi=$b&&$b.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(p){o(p)}}function c(l){try{u(n.throw(l))}catch(p){o(p)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},Dhi=$b&&$b.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(l){u=[6,l],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty($b,"__esModule",{value:!0});$b.FileAccessControl=void 0;var Nhi=require("fs"),whi=require("os"),JI=require("child_process"),Ihi=Ci(),Rhi=(function(){function e(){}return e.checkFileProtection=function(){if(!e.OS_PROVIDES_FILE_PROTECTION&&!e.OS_FILE_PROTECTION_CHECKED)if(e.OS_FILE_PROTECTION_CHECKED=!0,e.USE_ICACLS){try{e.OS_PROVIDES_FILE_PROTECTION=Nhi.existsSync(e.ICACLS_PATH)}catch{}e.OS_PROVIDES_FILE_PROTECTION||Ihi.warn(e.TAG,"Could not find ICACLS in expected location! This is necessary to use disk retry mode on Windows.")}else e.OS_PROVIDES_FILE_PROTECTION=!0},e.applyACLRules=function(t){return Phi(this,void 0,void 0,function(){var r,n;return Dhi(this,function(i){switch(i.label){case 0:if(!e.USE_ICACLS)return[3,7];if(e.ACLED_DIRECTORIES[t]!==void 0)return[3,6];e.ACLED_DIRECTORIES[t]=!1,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._getACLIdentity()];case 2:return r=i.sent(),[4,this._runICACLS(this._getACLArguments(t,r))];case 3:return i.sent(),e.ACLED_DIRECTORIES[t]=!0,[3,5];case 4:throw n=i.sent(),e.ACLED_DIRECTORIES[t]=!1,n;case 5:return[3,7];case 6:if(!e.ACLED_DIRECTORIES[t])throw new Error("Setting ACL restrictions did not succeed (cached result)");i.label=7;case 7:return[2]}})})},e.applyACLRulesSync=function(t){if(e.USE_ICACLS){if(e.ACLED_DIRECTORIES[t]===void 0){this._runICACLSSync(this._getACLArguments(t,this._getACLIdentitySync())),e.ACLED_DIRECTORIES[t]=!0;return}else if(!e.ACLED_DIRECTORIES[t])throw new Error("Setting ACL restrictions did not succeed (cached result)")}},e._runICACLS=function(t){return new Promise(function(r,n){var i=JI.spawn(e.ICACLS_PATH,t,{windowsHide:!0});i.on("error",function(a){return n(a)}),i.on("close",function(a,o){a===0?r():n(new Error("Setting ACL restrictions did not succeed (ICACLS returned code ".concat(a,")")))})})},e._runICACLSSync=function(t){if(JI.spawnSync){var r=JI.spawnSync(e.ICACLS_PATH,t,{windowsHide:!0});if(r.error)throw r.error;if(r.status!==0)throw new Error("Setting ACL restrictions did not succeed (ICACLS returned code ".concat(r.status,")"))}else throw new Error("Could not synchronously call ICACLS under current version of Node.js")},e._getACLIdentity=function(){return new Promise(function(t,r){e.ACL_IDENTITY&&t(e.ACL_IDENTITY);var n=JI.spawn(e.POWERSHELL_PATH,["-Command","[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),i="";n.stdout.on("data",function(a){return i+=a}),n.on("error",function(a){return r(a)}),n.on("close",function(a,o){e.ACL_IDENTITY=i&&i.trim(),a===0?t(e.ACL_IDENTITY):r(new Error("Getting ACL identity did not succeed (PS returned code ".concat(a,")")))})})},e._getACLIdentitySync=function(){if(e.ACL_IDENTITY)return e.ACL_IDENTITY;if(JI.spawnSync){var t=JI.spawnSync(e.POWERSHELL_PATH,["-Command","[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]});if(t.error)throw t.error;if(t.status!==0)throw new Error("Getting ACL identity did not succeed (PS returned code ".concat(t.status,")"));return e.ACL_IDENTITY=t.stdout&&t.stdout.toString().trim(),e.ACL_IDENTITY}else throw new Error("Could not synchronously get ACL identity under current version of Node.js")},e._getACLArguments=function(t,r){return[t,"/grant","*S-1-5-32-544:(OI)(CI)F","/grant","".concat(r,":(OI)(CI)F"),"/inheritance:r"]},e.TAG="FileAccessControl",e.ICACLS_PATH="".concat(process.env.systemdrive,"/windows/system32/icacls.exe"),e.POWERSHELL_PATH="".concat(process.env.systemdrive,"/windows/system32/windowspowershell/v1.0/powershell.exe"),e.ACLED_DIRECTORIES={},e.ACL_IDENTITY=null,e.OS_FILE_PROTECTION_CHECKED=!1,e.OS_PROVIDES_FILE_PROTECTION=!1,e.USE_ICACLS=whi.type()==="Windows_NT",e})();$b.FileAccessControl=Rhi});var D2e=v((Bq,Jir)=>{"use strict";var zne=Bq&&Bq.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(p){o(p)}}function c(l){try{u(n.throw(l))}catch(p){o(p)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},Yne=Bq&&Bq.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(l){u=[6,l],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},x2e=require("fs"),Lhi=require("os"),oC=require("path"),Mhi=require("zlib"),kb=na(),$hi=PI(),v_=PLe(),Hl=Js(),khi=require("url"),P2e=Ci(),qq=Xir(),Fhi=439,Uhi=402,Vhi=[200,206,402,408,429,439,500],jhi="Invalid instrumentation key",qhi=(function(){function e(t,r,n,i,a,o,s){this._redirectedHost=null,this._config=t,this._onSuccess=n,this._onError=i,this._statsbeat=a,this._enableDiskRetryMode=!1,this._resendInterval=e.WAIT_BETWEEN_RESEND,this._maxBytesOnDisk=e.MAX_BYTES_ON_DISK,this._numConsecutiveFailures=0,this._numConsecutiveRedirects=0,this._resendTimer=null,this._getAuthorizationHandler=r,this._fileCleanupTimer=null,this._tempDir=oC.join(Lhi.tmpdir(),e.TEMPDIR_PREFIX+this._config.instrumentationKey),this._isStatsbeatSender=o||!1,this._shutdownStatsbeat=s,this._failedToIngestCounter=0,this._statsbeatHasReachedIngestionAtLeastOnce=!1}return e.prototype.setDiskRetryMode=function(t,r,n){var i=this;t&&qq.FileAccessControl.checkFileProtection(),this._enableDiskRetryMode=qq.FileAccessControl.OS_PROVIDES_FILE_PROTECTION&&t,typeof r=="number"&&r>=0&&(this._resendInterval=Math.floor(r)),typeof n=="number"&&n>=0&&(this._maxBytesOnDisk=Math.floor(n)),t&&!qq.FileAccessControl.OS_PROVIDES_FILE_PROTECTION&&(this._enableDiskRetryMode=!1,this._logWarn("Ignoring request to enable disk retry mode. Sufficient file protection capabilities were not detected.")),this._enableDiskRetryMode?(this._statsbeat&&this._statsbeat.addFeature(kb.StatsbeatFeature.DISK_RETRY),this._fileCleanupTimer||(this._fileCleanupTimer=setTimeout(function(){i._fileCleanupTask()},e.CLEANUP_TIMEOUT),this._fileCleanupTimer.unref())):(this._statsbeat&&this._statsbeat.removeFeature(kb.StatsbeatFeature.DISK_RETRY),this._fileCleanupTimer&&clearTimeout(this._fileCleanupTimer))},e.prototype.send=function(t,r){return zne(this,void 0,void 0,function(){var n,i,a,o,s,c,u,l,p=this;return Yne(this,function(f){switch(f.label){case 0:if(!(t&&t.length>0))return[3,5];if(n=this._redirectedHost||this._config.endpointUrl,i=new khi.URL(n).hostname,a={method:"POST",withCredentials:!1,headers:{"Content-Type":"application/x-json-stream"}},o=this._getAuthorizationHandler?this._getAuthorizationHandler(this._config):null,!o)return[3,4];this._statsbeat&&this._statsbeat.addFeature(kb.StatsbeatFeature.AAD_HANDLING),f.label=1;case 1:return f.trys.push([1,3,,4]),[4,o.addAuthorizationHeader(a)];case 2:return f.sent(),[3,4];case 3:return s=f.sent(),c="Failed to get AAD bearer token for the Application.",this._enableDiskRetryMode&&(c+="This batch of telemetry items will be retried. ",this._storeToDisk(t)),c+="Error:"+s.toString(),this._logWarn(c),typeof r=="function"&&r(c),[2];case 4:if(u="",t.forEach(function(h){var d=Hl.stringify(h);typeof d=="string"&&(u+=d+`
1444
- `)}),u.length>0&&(u=u.substring(0,u.length-1)),u.length===0)return typeof r=="function"&&r("Empty batch of telemetry items. Nothing to send."),[2];l=Buffer.from?Buffer.from(u):new Buffer(u),Mhi.gzip(l,function(h,d){var m=d;h?(p._logWarn(Hl.dumpObj(h)),m=l,a.headers["Content-Length"]=l.length.toString()):(a.headers["Content-Encoding"]="gzip",a.headers["Content-Length"]=d.length.toString()),p._logInfo(Hl.dumpObj(a)),a[$hi.disableCollectionRequestOption]=!0;var _=+new Date,T=function(A){A.setEncoding("utf-8");var C="";A.on("data",function(P){C+=P}),A.on("end",function(){var P,N=+new Date,F=N-_;if(p._numConsecutiveFailures=0,C.includes(jhi)&&A.statusCode===400&&(P2e.warn("Instrumentation key was invalid, please check the iKey"),(P=p._shutdownStatsbeat)===null||P===void 0||P.call(p)),p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&(Vhi.includes(A.statusCode)?p._statsbeatHasReachedIngestionAtLeastOnce=!0:p._statsbeatFailedToIngest()),p._statsbeat&&(A.statusCode==Uhi||A.statusCode==Fhi?p._statsbeat.countThrottle(kb.StatsbeatNetworkCategory.Breeze,i,A.statusCode):p._statsbeat.countRequest(kb.StatsbeatNetworkCategory.Breeze,i,F,A.statusCode===200,A.statusCode)),p._enableDiskRetryMode){if(A.statusCode===200)p._resendTimer||(p._resendTimer=setTimeout(function(){p._resendTimer=null,p._sendFirstFileOnDisk()},p._resendInterval),p._resendTimer.unref());else if(p._isRetriable(A.statusCode))try{p._statsbeat&&p._statsbeat.countRetry(kb.StatsbeatNetworkCategory.Breeze,i,A.statusCode);var L=JSON.parse(C),B=[];L.errors&&(L.errors.forEach(function(Q){(Q.statusCode==429||Q.statusCode==500||Q.statusCode==503)&&B.push(t[Q.index])}),B.length>0&&p._storeToDisk(B))}catch{p._storeToDisk(t)}}if(A.statusCode===307||A.statusCode===308)if(p._numConsecutiveRedirects++,p._numConsecutiveRedirects<10){var J=A.headers.location?A.headers.location.toString():null;J&&(p._redirectedHost=J,p.send(t,r))}else{var j={name:"Circular Redirect",message:"Error sending telemetry because of circular redirects."};p._statsbeat&&p._statsbeat.countException(kb.StatsbeatNetworkCategory.Breeze,i,j),typeof r=="function"&&r("Error sending telemetry because of circular redirects.")}else p._numConsecutiveRedirects=0,typeof r=="function"&&r(C),p._logInfo(C),typeof p._onSuccess=="function"&&p._onSuccess(C)})},O=Hl.makeRequest(p._config,n,a,T);O.setTimeout(e.HTTP_TIMEOUT,function(){p._requestTimedOut=!0,O.abort()}),O.on("error",function(A){if(p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&p._statsbeatFailedToIngest(),p._numConsecutiveFailures++,p._statsbeat&&p._statsbeat.countException(kb.StatsbeatNetworkCategory.Breeze,i,A),!p._enableDiskRetryMode||p._numConsecutiveFailures>0&&p._numConsecutiveFailures%e.MAX_CONNECTION_FAILURES_BEFORE_WARN===0){var C="Ingestion endpoint could not be reached. This batch of telemetry items has been lost. Use Disk Retry Caching to enable resending of failed telemetry. Error:";p._enableDiskRetryMode&&(C="Ingestion endpoint could not be reached ".concat(p._numConsecutiveFailures," consecutive times. There may be resulting telemetry loss. Most recent error:")),p._logWarn(C,Hl.dumpObj(A))}else{var C="Transient failure to reach ingestion endpoint. This batch of telemetry items will be retried. Error:";p._logInfo(C,Hl.dumpObj(A))}p._onErrorHelper(A),typeof r=="function"&&(A?(p._requestTimedOut&&(A.name="telemetry timeout",A.message="telemetry request timed out"),r(Hl.dumpObj(A))):r("Error sending telemetry")),p._enableDiskRetryMode&&p._storeToDisk(t)}),O.write(m),O.end()}),f.label=5;case 5:return[2]}})})},e.prototype.saveOnCrash=function(t){this._enableDiskRetryMode&&this._storeToDiskSync(Hl.stringify(t))},e.prototype._isRetriable=function(t){return t===206||t===401||t===403||t===408||t===429||t===500||t===502||t===503||t===504},e.prototype._logInfo=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this._isStatsbeatSender||P2e.info(e.TAG,t,r)},e.prototype._logWarn=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this._isStatsbeatSender||P2e.warn(e.TAG,t,r)},e.prototype._statsbeatFailedToIngest=function(){this._shutdownStatsbeat&&(this._failedToIngestCounter++,this._failedToIngestCounter>=3&&this._shutdownStatsbeat())},e.prototype._storeToDisk=function(t){return zne(this,void 0,void 0,function(){var r,n,i,a,o,s,c;return Yne(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),this._logInfo("Checking existence of data storage directory: "+this._tempDir),[4,v_.confirmDirExists(this._tempDir)];case 1:return u.sent(),[3,3];case 2:return r=u.sent(),this._logWarn("Failed to create folder to put telemetry: "+Hl.dumpObj(r)),this._onErrorHelper(r),[2];case 3:return u.trys.push([3,5,,6]),[4,qq.FileAccessControl.applyACLRules(this._tempDir)];case 4:return u.sent(),[3,6];case 5:return n=u.sent(),this._logWarn("Failed to apply file access control to folder: "+Hl.dumpObj(n)),this._onErrorHelper(n),[2];case 6:return u.trys.push([6,8,,9]),[4,v_.getShallowDirectorySize(this._tempDir)];case 7:return i=u.sent(),i>this._maxBytesOnDisk?(this._logWarn("Not saving data due to max size limit being met. Directory size in bytes is: "+i),[2]):[3,9];case 8:return a=u.sent(),this._logWarn("Failed to read directory for retriable telemetry: "+Hl.dumpObj(a)),this._onErrorHelper(a),[2];case 9:return u.trys.push([9,11,,12]),o="".concat(new Date().getTime(),".ai.json"),s=oC.join(this._tempDir,o),this._logInfo("saving data to disk at: "+s),[4,v_.writeFileAsync(s,Hl.stringify(t),{mode:384})];case 10:return u.sent(),[3,12];case 11:return c=u.sent(),this._logWarn("Failed to persist telemetry to disk: "+Hl.dumpObj(c)),this._onErrorHelper(c),[2];case 12:return[2]}})})},e.prototype._storeToDiskSync=function(t){try{this._logInfo("Checking existence of data storage directory: "+this._tempDir),x2e.existsSync(this._tempDir)||x2e.mkdirSync(this._tempDir),qq.FileAccessControl.applyACLRulesSync(this._tempDir);var r=v_.getShallowDirectorySizeSync(this._tempDir);if(r>this._maxBytesOnDisk){this._logInfo("Not saving data due to max size limit being met. Directory size in bytes is: "+r);return}var n="".concat(new Date().getTime(),".ai.json"),i=oC.join(this._tempDir,n);this._logInfo("saving data before crash to disk at: "+i),x2e.writeFileSync(i,t,{mode:384})}catch(a){this._logWarn("Error while saving data to disk: "+Hl.dumpObj(a)),this._onErrorHelper(a)}},e.prototype._sendFirstFileOnDisk=function(){return zne(this,void 0,void 0,function(){var t,r,n,i,a,o;return Yne(this,function(s){switch(s.label){case 0:return s.trys.push([0,6,,7]),[4,v_.readdirAsync(this._tempDir)];case 1:return t=s.sent(),t=t.filter(function(c){return oC.basename(c).indexOf(".ai.json")>-1}),t.length>0?(r=t[0],n=oC.join(this._tempDir,r),[4,v_.readFileAsync(n)]):[3,5];case 2:return i=s.sent(),[4,v_.unlinkAsync(n)];case 3:return s.sent(),a=JSON.parse(i.toString()),[4,this.send(a)];case 4:s.sent(),s.label=5;case 5:return[3,7];case 6:return o=s.sent(),this._onErrorHelper(o),[3,7];case 7:return[2]}})})},e.prototype._onErrorHelper=function(t){typeof this._onError=="function"&&this._onError(t)},e.prototype._fileCleanupTask=function(){return zne(this,void 0,void 0,function(){var t,r,n,i,a,o,s=this;return Yne(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),[4,v_.readdirAsync(this._tempDir)];case 1:if(t=c.sent(),t=t.filter(function(u){return oC.basename(u).indexOf(".ai.json")>-1}),!(t.length>0))return[3,5];r=0,c.label=2;case 2:return r<t.length?(n=new Date(parseInt(t[r].split(".ai.json")[0])),i=new Date(+new Date-e.FILE_RETEMPTION_PERIOD)>n,i?(a=oC.join(this._tempDir,t[r]),[4,v_.unlinkAsync(a).catch(function(u){s._onErrorHelper(u)})]):[3,4]):[3,5];case 3:c.sent(),c.label=4;case 4:return r++,[3,2];case 5:return[3,7];case 6:return o=c.sent(),o.code!="ENOENT"&&this._onErrorHelper(o),[3,7];case 7:return[2]}})})},e.TAG="Sender",e.WAIT_BETWEEN_RESEND=60*1e3,e.MAX_BYTES_ON_DISK=50*1024*1024,e.MAX_CONNECTION_FAILURES_BEFORE_WARN=5,e.CLEANUP_TIMEOUT=3600*1e3,e.FILE_RETEMPTION_PERIOD=10080*60*1e3,e.TEMPDIR_PREFIX="appInsights-node",e.HTTP_TIMEOUT=2e4,e})();Jir.exports=qhi});var Zir=v(Kne=>{"use strict";Object.defineProperty(Kne,"__esModule",{value:!0});Kne.AzureVirtualMachine=void 0;var Qir=Ci(),Bhi=Js(),Ghi=PI(),Hhi="http://169.254.169.254/metadata/instance/compute",zhi="api-version=2017-12-01",Yhi="format=json",Khi="UNREACH",Whi=(function(){function e(){}return e.getAzureComputeMetadata=function(t,r){var n,i=this,a={},o="".concat(Hhi,"?").concat(zhi,"&").concat(Yhi),s=(n={method:"GET"},n[Ghi.disableCollectionRequestOption]=!0,n.headers={Metadata:"True"},n),c=Bhi.makeRequest(t,o,s,function(u){if(u.statusCode===200){a.isVM=!0;var l="";u.on("data",function(p){l+=p}),u.on("end",function(){try{var p=JSON.parse(l);a.id=p.vmId||"",a.subscriptionId=p.subscriptionId||"",a.osType=p.osType||""}catch(f){Qir.info(e.TAG,f)}r(a)})}else r(a)},!1,!1);c&&(setTimeout(function(){i._requestTimedOut=!0,c.abort()},e.HTTP_TIMEOUT),c.on("error",function(u){i._requestTimedOut&&u&&(u.name="telemetry timeout",u.message="telemetry request timed out"),u&&u.message&&u.message.indexOf(Khi)>-1?a.isVM=!1:Qir.info(e.TAG,u),r(a)}),c.end())},e.HTTP_TIMEOUT=2500,e.TAG="AzureVirtualMachine",e})();Kne.AzureVirtualMachine=Whi});var ear=v(Wne=>{"use strict";Object.defineProperty(Wne,"__esModule",{value:!0});Wne.NetworkStatsbeat=void 0;var Xhi=(function(){function e(t,r){this.endpoint=t,this.host=r,this.totalRequestCount=0,this.totalSuccesfulRequestCount=0,this.totalFailedRequestCount=[],this.retryCount=[],this.exceptionCount=[],this.throttleCount=[],this.intervalRequestExecutionTime=0,this.lastIntervalRequestExecutionTime=0,this.lastTime=+new Date,this.lastRequestCount=0}return e})();Wne.NetworkStatsbeat=Xhi});var aar=v((sC,iar)=>{"use strict";var jg=sC&&sC.__assign||function(){return jg=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},jg.apply(this,arguments)},N2e=sC&&sC.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(p){o(p)}}function c(l){try{u(n.throw(l))}catch(p){o(p)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},w2e=sC&&sC.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(l){u=[6,l],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Jhi=require("os"),Qhi=C2e(),tar=Ci(),Zhi=D2e(),aa=na(),emi=Xc(),tmi=Zir(),rmi=TFe(),rar=TI(),nmi=ear(),nar=Js(),imi="node",ami=(function(){function e(t,r){this._attach=aa.StatsbeatAttach.sdk,this._feature=aa.StatsbeatFeature.NONE,this._instrumentation=aa.StatsbeatInstrumentation.NONE,this._isInitialized=!1,this._statbeatMetrics=[],this._networkStatsbeatCollection=[],this._config=t,this._context=r||new rar,this._longHandleTimeout=null;var n=this._getConnectionString(t);this._statsbeatConfig=new rmi(n),this._statsbeatConfig.samplingPercentage=100,this._sender=new Zhi(this._statsbeatConfig,null,null,null,null,!0,this._shutdownStatsbeat.bind(this))}return e.prototype.enable=function(t){var r=this;this._isEnabled=t,this._isEnabled&&!this._isInitialized&&(this._getCustomProperties(),this._isInitialized=!0),t?(this._handle||(this._handle=setInterval(function(){r.trackShortIntervalStatsbeats()},e.STATS_COLLECTION_SHORT_INTERVAL),this._handle.unref()),this._longHandle||(this._longHandleTimeout=setTimeout(function(){r.isEnabled()&&r.trackLongIntervalStatsbeats()},e.STATS_COLLECTION_INITIAL_DELAY),this._longHandleTimeout.unref(),this._longHandle=setInterval(function(){r.trackLongIntervalStatsbeats()},e.STATS_COLLECTION_LONG_INTERVAL),this._longHandle.unref())):(this._handle&&(clearInterval(this._handle),this._handle=null),this._longHandle&&(clearInterval(this._longHandle),this._longHandle=null),this._longHandleTimeout&&(clearTimeout(this._longHandleTimeout),this._longHandleTimeout=null))},e.prototype.isInitialized=function(){return this._isInitialized},e.prototype.isEnabled=function(){return this._isEnabled},e.prototype.setCodelessAttach=function(){this._attach=aa.StatsbeatAttach.codeless},e.prototype.addFeature=function(t){this._feature|=t},e.prototype.removeFeature=function(t){this._feature&=~t},e.prototype.addInstrumentation=function(t){this._instrumentation|=t},e.prototype.removeInstrumentation=function(t){this._instrumentation&=~t},e.prototype.countRequest=function(t,r,n,i,a){if(this.isEnabled()){var o=this._getNetworkStatsbeatCounter(t,r);if(o.totalRequestCount++,o.intervalRequestExecutionTime+=n,i===!1){if(!a)return;var s=o.totalFailedRequestCount.find(function(c){return a===c.statusCode});s?s.count++:o.totalFailedRequestCount.push({statusCode:a,count:1})}else o.totalSuccesfulRequestCount++}},e.prototype.countException=function(t,r,n){if(this.isEnabled()){var i=this._getNetworkStatsbeatCounter(t,r),a=i.exceptionCount.find(function(o){return n.name===o.exceptionType});a?a.count++:i.exceptionCount.push({exceptionType:n.name,count:1})}},e.prototype.countThrottle=function(t,r,n){if(this.isEnabled()){var i=this._getNetworkStatsbeatCounter(t,r),a=i.throttleCount.find(function(o){return n===o.statusCode});a?a.count++:i.throttleCount.push({statusCode:n,count:1})}},e.prototype.countRetry=function(t,r,n){if(this.isEnabled()){var i=this._getNetworkStatsbeatCounter(t,r),a=i.retryCount.find(function(o){return n===o.statusCode});a?a.count++:i.retryCount.push({statusCode:n,count:1})}},e.prototype.trackShortIntervalStatsbeats=function(){return N2e(this,void 0,void 0,function(){var t,r;return w2e(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this._getResourceProvider()];case 1:return n.sent(),t={os:this._os,rp:this._resourceProvider,cikey:this._cikey,runtimeVersion:this._runtimeVersion,language:this._language,version:this._sdkVersion,attach:this._attach},this._trackRequestDuration(t),this._trackRequestsCount(t),[4,this._sendStatsbeats()];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),tar.info(e.TAG,"Failed to send Statsbeat metrics: "+nar.dumpObj(r)),[3,4];case 4:return[2]}})})},e.prototype.trackLongIntervalStatsbeats=function(){return N2e(this,void 0,void 0,function(){var t,r,n,i,a;return w2e(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this._getResourceProvider()];case 1:return o.sent(),t={os:this._os,rp:this._resourceProvider,cikey:this._cikey,runtimeVersion:this._runtimeVersion,language:this._language,version:this._sdkVersion,attach:this._attach},r=Object.assign({rpId:this._resourceIdentifier},t),this._statbeatMetrics.push({name:aa.StatsbeatCounter.ATTACH,value:1,properties:r}),this._instrumentation!=aa.StatsbeatInstrumentation.NONE&&(n=Object.assign({feature:this._instrumentation,type:aa.StatsbeatFeatureType.Instrumentation},t),this._statbeatMetrics.push({name:aa.StatsbeatCounter.FEATURE,value:1,properties:n})),this._feature!=aa.StatsbeatFeature.NONE&&(i=Object.assign({feature:this._feature,type:aa.StatsbeatFeatureType.Feature},t),this._statbeatMetrics.push({name:aa.StatsbeatCounter.FEATURE,value:1,properties:i})),[4,this._sendStatsbeats()];case 2:return o.sent(),[3,4];case 3:return a=o.sent(),tar.info(e.TAG,"Failed to send Statsbeat metrics: "+nar.dumpObj(a)),[3,4];case 4:return[2]}})})},e.prototype._getNetworkStatsbeatCounter=function(t,r){for(var n=this._getShortHost(r),i=0;i<this._networkStatsbeatCollection.length;i++)if(t===this._networkStatsbeatCollection[i].endpoint&&n===this._networkStatsbeatCollection[i].host)return this._networkStatsbeatCollection[i];var a=new nmi.NetworkStatsbeat(t,n);return this._networkStatsbeatCollection.push(a),a},e.prototype._trackRequestDuration=function(t){for(var r=0;r<this._networkStatsbeatCollection.length;r++){var n=this._networkStatsbeatCollection[r];n.time=+new Date;var i=n.totalRequestCount-n.lastRequestCount||0,a=n.intervalRequestExecutionTime-n.lastIntervalRequestExecutionTime,o=a>0&&a/i||0;if(n.lastIntervalRequestExecutionTime=n.intervalRequestExecutionTime,i>0){var s=Object.assign({endpoint:this._networkStatsbeatCollection[r].endpoint,host:this._networkStatsbeatCollection[r].host},t);this._statbeatMetrics.push({name:aa.StatsbeatCounter.REQUEST_DURATION,value:o,properties:s})}n.lastRequestCount=n.totalRequestCount,n.lastTime=n.time}},e.prototype._getShortHost=function(t){var r=t;try{var n=new RegExp(/^https?:\/\/(?:www\.)?([^\/.-]+)/),i=n.exec(t);i!=null&&i.length>1&&(r=i[1]),r=r.replace(".in.applicationinsights.azure.com","")}catch{}return r},e.prototype._trackRequestsCount=function(t){for(var r=this,n=function(s){a=i._networkStatsbeatCollection[s];var c=Object.assign({endpoint:a.endpoint,host:a.host},t);a.totalSuccesfulRequestCount>0&&(i._statbeatMetrics.push({name:aa.StatsbeatCounter.REQUEST_SUCCESS,value:a.totalSuccesfulRequestCount,properties:c}),a.totalSuccesfulRequestCount=0),a.totalFailedRequestCount.length>0&&(a.totalFailedRequestCount.forEach(function(u){c=Object.assign(jg(jg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:aa.StatsbeatCounter.REQUEST_FAILURE,value:u.count,properties:c})}),a.totalFailedRequestCount=[]),a.retryCount.length>0&&(a.retryCount.forEach(function(u){c=Object.assign(jg(jg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:aa.StatsbeatCounter.RETRY_COUNT,value:u.count,properties:c})}),a.retryCount=[]),a.throttleCount.length>0&&(a.throttleCount.forEach(function(u){c=Object.assign(jg(jg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:aa.StatsbeatCounter.THROTTLE_COUNT,value:u.count,properties:c})}),a.throttleCount=[]),a.exceptionCount.length>0&&(a.exceptionCount.forEach(function(u){c=Object.assign(jg(jg({},c),{exceptionType:u.exceptionType})),r._statbeatMetrics.push({name:aa.StatsbeatCounter.EXCEPTION_COUNT,value:u.count,properties:c})}),a.exceptionCount=[])},i=this,a,o=0;o<this._networkStatsbeatCollection.length;o++)n(o)},e.prototype._sendStatsbeats=function(){return N2e(this,void 0,void 0,function(){var t,r,n,i;return w2e(this,function(a){switch(a.label){case 0:if(!(this._statbeatMetrics.length>0))return[3,2];for(t=[],r=0;r<this._statbeatMetrics.length;r++)n={name:this._statbeatMetrics[r].name,value:this._statbeatMetrics[r].value,properties:this._statbeatMetrics[r].properties},i=Qhi.createEnvelope(n,emi.TelemetryType.Metric,null,this._context,this._statsbeatConfig),i.name=aa.StatsbeatTelemetryName,t.push(i);return this._statbeatMetrics=[],[4,this._sender.send(t)];case 1:a.sent(),a.label=2;case 2:return[2]}})})},e.prototype._getCustomProperties=function(){this._language=imi,this._cikey=this._config.instrumentationKey,this._sdkVersion=rar.sdkVersion,this._os=Jhi.type(),this._runtimeVersion=process.version},e.prototype._getResourceProvider=function(){var t=this;return new Promise(function(r,n){var i=!1;t._resourceProvider=aa.StatsbeatResourceProvider.unknown,t._resourceIdentifier=aa.StatsbeatResourceProvider.unknown,process.env.AKS_ARM_NAMESPACE_ID?(t._resourceProvider=aa.StatsbeatResourceProvider.aks,t._resourceIdentifier=process.env.AKS_ARM_NAMESPACE_ID):process.env.WEBSITE_SITE_NAME?(t._resourceProvider=aa.StatsbeatResourceProvider.appsvc,t._resourceIdentifier=process.env.WEBSITE_SITE_NAME,process.env.WEBSITE_HOME_STAMPNAME&&(t._resourceIdentifier+="/"+process.env.WEBSITE_HOME_STAMPNAME)):process.env.FUNCTIONS_WORKER_RUNTIME?(t._resourceProvider=aa.StatsbeatResourceProvider.functions,process.env.WEBSITE_HOSTNAME&&(t._resourceIdentifier=process.env.WEBSITE_HOSTNAME)):t._config&&(t._isVM===void 0||t._isVM==!0?(i=!0,tmi.AzureVirtualMachine.getAzureComputeMetadata(t._config,function(a){t._isVM=a.isVM,t._isVM&&(t._resourceProvider=aa.StatsbeatResourceProvider.vm,t._resourceIdentifier=a.id+"/"+a.subscriptionId,a.osType&&(t._os=a.osType)),r()})):t._resourceProvider=aa.StatsbeatResourceProvider.unknown),i||r()})},e.prototype._shutdownStatsbeat=function(){this.enable(!1)},e.prototype._getConnectionString=function(t){for(var r=t.endpointUrl,n=["westeurope","northeurope","francecentral","francesouth","germanywestcentral","norwayeast","norwaywest","swedencentral","switzerlandnorth","switzerlandwest","uksouth","ukwest"],i=0;i<n.length;i++)if(r.indexOf(n[i])>-1)return e.EU_CONNECTION_STRING;return e.NON_EU_CONNECTION_STRING},e.NON_EU_CONNECTION_STRING="InstrumentationKey=c4a29126-a7cb-47e5-b348-11414998b11e;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com",e.EU_CONNECTION_STRING="InstrumentationKey=7dc56bab-3c0c-4e9f-9ebb-d1acadee8d0f;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com",e.STATS_COLLECTION_SHORT_INTERVAL=9e5,e.STATS_COLLECTION_LONG_INTERVAL=864e5,e.STATS_COLLECTION_INITIAL_DELAY=15e3,e.TAG="Statsbeat",e})();iar.exports=ami});var car=v((pda,sar)=>{"use strict";var omi=require("url"),smi=TFe(),cmi=kir(),umi=TI(),__=Xc(),lmi=Uir(),I2e=zir(),oar=xb(),pmi=aar(),fmi=D2e(),R2e=Js(),Xne=Ci(),dmi=C2e(),hmi=(function(){function e(t){this._telemetryProcessors=[];var r=new smi(t);if(this.config=r,!this.config.instrumentationKey||this.config.instrumentationKey=="")throw new Error("Instrumentation key not found, please provide a connection string before starting Application Insights SDK.");this.context=new umi,this.commonProperties={},this.authorizationHandler=null,this.config.disableStatsbeat||(this._statsbeat=new pmi(this.config,this.context),this._statsbeat.enable(!0));var n=new fmi(this.config,this.getAuthorizationHandler,null,null,this._statsbeat);this.channel=new lmi(function(){return r.disableAppInsights},function(){return r.maxBatchSize},function(){return r.maxBatchIntervalMs},n)}return e.prototype.trackAvailability=function(t){this.track(t,__.TelemetryType.Availability)},e.prototype.trackPageView=function(t){this.track(t,__.TelemetryType.PageView)},e.prototype.trackTrace=function(t){this.track(t,__.TelemetryType.Trace)},e.prototype.trackMetric=function(t){this.track(t,__.TelemetryType.Metric)},e.prototype.trackException=function(t){t&&t.exception&&!R2e.isError(t.exception)&&(t.exception=new Error(t.exception.toString())),this.track(t,__.TelemetryType.Exception)},e.prototype.trackEvent=function(t){this.track(t,__.TelemetryType.Event)},e.prototype.trackRequest=function(t){this.track(t,__.TelemetryType.Request)},e.prototype.trackDependency=function(t){if(t&&!t.target&&t.data)try{t.target=new omi.URL(t.data).host}catch(r){t.target=null,Xne.warn(e.TAG,"The URL object is failed to create.",r)}this.track(t,__.TelemetryType.Dependency)},e.prototype.flush=function(t){this.channel.triggerSend(t?!!t.isAppCrashing:!1,t?t.callback:void 0)},e.prototype.track=function(t,r){if(t&&__.telemetryTypeToBaseType(r)){var n=dmi.createEnvelope(t,r,this.commonProperties,this.context,this.config);t.time&&(n.time=t.time.toISOString());var i=this.runTelemetryProcessors(n,t.contextObjects);i=i&&I2e.samplingTelemetryProcessor(n,{correlationContext:oar.CorrelationContextManager.getCurrentContext()}),I2e.preAggregatedMetricsTelemetryProcessor(n,this.context),i&&(I2e.performanceMetricsTelemetryProcessor(n,this.quickPulseClient),this.channel.send(n))}else Xne.warn(e.TAG,"track() requires telemetry object and telemetryType to be specified.")},e.prototype.setAutoPopulateAzureProperties=function(t){},e.prototype.getAuthorizationHandler=function(t){return t&&t.aadTokenCredential?(this.authorizationHandler||(Xne.info(e.TAG,"Adding authorization handler"),this.authorizationHandler=new cmi(t.aadTokenCredential,t.aadAudience)),this.authorizationHandler):null},e.prototype.addTelemetryProcessor=function(t){this._telemetryProcessors.push(t)},e.prototype.clearTelemetryProcessors=function(){this._telemetryProcessors=[]},e.prototype.runTelemetryProcessors=function(t,r){var n=!0,i=this._telemetryProcessors.length;if(i===0)return n;r=r||{},r.correlationContext=oar.CorrelationContextManager.getCurrentContext();for(var a=0;a<i;++a)try{var o=this._telemetryProcessors[a];if(o&&o.apply(null,[t,r])===!1){n=!1;break}}catch(s){n=!0,Xne.warn(e.TAG,"One of telemetry processors failed, telemetry item will be sent.",s,t)}return n&&(t&&t.tags&&(t.tags=R2e.validateStringMap(t.tags)),t&&t.data&&t.data.baseData&&t.data.baseData.properties&&(t.data.baseData.properties=R2e.validateStringMap(t.data.baseData.properties))),n},e.prototype.getStatsbeat=function(){return this._statsbeat},e.TAG="TelemetryClient",e})();sar.exports=hmi});var par=v((L2e,lar)=>{"use strict";var mmi=L2e&&L2e.__extends||(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),gmi=car(),uar=hFe(),ymi=PI(),Jne=Ci(),vmi=(function(e){mmi(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.trackNodeHttpRequestSync=function(r){r&&r.request&&r.response&&r.duration?uar.trackRequestSync(this,r):Jne.warn("trackNodeHttpRequestSync requires NodeHttpRequestTelemetry object with request, response and duration specified.")},t.prototype.trackNodeHttpRequest=function(r){(r.duration||r.error)&&Jne.warn("trackNodeHttpRequest will ignore supplied duration and error parameters. These values are collected from the request and response objects."),r&&r.request&&r.response?uar.trackRequest(this,r):Jne.warn("trackNodeHttpRequest requires NodeHttpRequestTelemetry object with request and response specified.")},t.prototype.trackNodeHttpDependency=function(r){r&&r.request?ymi.trackRequest(this,r):Jne.warn("trackNodeHttpDependency requires NodeHttpDependencyTelemetry object with request specified.")},t})(gmi);lar.exports=vmi});var dar=v(far=>{"use strict";Object.defineProperty(far,"__esModule",{value:!0})});var V2e=v(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.Configuration=pe.liveMetricsClient=pe.defaultClient=pe.DistributedTracingModes=void 0;pe.setup=xmi;pe.start=gar;pe.getCorrelationContext=Dmi;pe.startOperation=Nmi;pe.wrapWithCorrelationContext=wmi;pe.dispose=Imi;var $2e=xb(),_mi=Ktr(),Emi=Xtr(),k2e=ene(),Tmi=eFe(),bmi=orr(),Smi=yrr(),Omi=PI(),Ami=hFe(),har=UA(),Gq=Ci(),mar=Jrr(),F2e=Zrr(),Cmi=rnr();pe.TelemetryClient=par();pe.Contracts=Xc();pe.azureFunctionsTypes=dar();var M2e;(function(e){e[e.AI=0]="AI",e[e.AI_AND_W3C=1]="AI_AND_W3C"})(M2e||(pe.DistributedTracingModes=M2e={}));var Hq,zq,Yq,Kq,Wq,QI,ZI,cC,Xq,Jq,jp=!1,Qne;function xmi(e){return pe.defaultClient?Gq.info("The default client is already setup"):(pe.defaultClient=new pe.TelemetryClient(e),Hq=new _mi(pe.defaultClient),zq=new Emi(pe.defaultClient),Yq=new k2e(pe.defaultClient),Kq=new Tmi(pe.defaultClient),Wq=new bmi(pe.defaultClient),QI=new Smi(pe.defaultClient),cC=new Ami(pe.defaultClient),Xq=new Omi(pe.defaultClient),ZI||(ZI=new F2e.AutoCollectNativePerformance(pe.defaultClient)),Jq=new Cmi.AzureFunctionsHook(pe.defaultClient)),U2e}function Pmi(){pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectExternalLoggers==null&&(pe.defaultClient.config.enableAutoCollectExternalLoggers=!0),pe.defaultClient.config.enableAutoCollectConsole==null&&(pe.defaultClient.config.enableAutoCollectConsole=!1),pe.defaultClient.config.enableAutoCollectExceptions==null&&(pe.defaultClient.config.enableAutoCollectExceptions=!0),pe.defaultClient.config.enableAutoCollectPerformance==null&&(pe.defaultClient.config.enableAutoCollectPerformance=!0),pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics==null&&(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics=!0),pe.defaultClient.config.enableAutoCollectHeartbeat==null&&(pe.defaultClient.config.enableAutoCollectHeartbeat=!0),pe.defaultClient.config.enableAutoCollectRequests==null&&(pe.defaultClient.config.enableAutoCollectRequests=!0),pe.defaultClient.config.enableAutoCollectDependencies==null&&(pe.defaultClient.config.enableAutoCollectDependencies=!0),pe.defaultClient.config.enableUseDiskRetryCaching==null&&(pe.defaultClient.config.enableUseDiskRetryCaching=!0),pe.defaultClient.config.enableAutoDependencyCorrelation==null&&(pe.defaultClient.config.enableAutoDependencyCorrelation=!0),pe.defaultClient.config.enableSendLiveMetrics==null&&(pe.defaultClient.config.enableSendLiveMetrics=!1),pe.defaultClient.config.enableAutoCollectExtendedMetrics==null&&(pe.defaultClient.config.enableAutoCollectExtendedMetrics=!0),pe.defaultClient.config.enableWebInstrumentation==null&&(pe.defaultClient.config.enableWebInstrumentation=!1),pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions==null&&(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions=!1))}function gar(){if(pe.defaultClient){jp=!0,Pmi(),Hq.enable(pe.defaultClient.config.enableAutoCollectExternalLoggers,pe.defaultClient.config.enableAutoCollectConsole),zq.enable(pe.defaultClient.config.enableAutoCollectExceptions),Yq.enable(pe.defaultClient.config.enableAutoCollectPerformance),Kq.enable(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics),Wq.enable(pe.defaultClient.config.enableAutoCollectHeartbeat),cC.useAutoCorrelation(pe.defaultClient.config.enableAutoDependencyCorrelation,pe.defaultClient.config.enableUseAsyncHooks),cC.enable(pe.defaultClient.config.enableAutoCollectRequests),Xq.enable(pe.defaultClient.config.enableAutoCollectDependencies),QI.enable(pe.defaultClient.config.enableWebInstrumentation,pe.defaultClient.config.webInstrumentationConnectionString),pe.defaultClient.config.enableSendLiveMetrics&&(pe.liveMetricsClient||(pe.liveMetricsClient=new mar(pe.defaultClient.config,pe.defaultClient.context,pe.defaultClient.getAuthorizationHandler,pe.defaultClient),Qne=new k2e(pe.liveMetricsClient,1e3,!0),pe.liveMetricsClient.addCollector(Qne),pe.defaultClient.quickPulseClient=pe.liveMetricsClient),pe.liveMetricsClient.enable(pe.defaultClient.config.enableSendLiveMetrics)),Jq.enable(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions);var e=F2e.AutoCollectNativePerformance.parseEnabled(pe.defaultClient.config.enableAutoCollectExtendedMetrics,pe.defaultClient.config);ZI.enable(pe.defaultClient.config.enableAutoCollectExtendedMetrics,e.disabledMetrics),pe.defaultClient&&pe.defaultClient.channel&&pe.defaultClient.channel.setUseDiskRetryCaching(pe.defaultClient.config.enableUseDiskRetryCaching,pe.defaultClient.config.enableResendInterval,pe.defaultClient.config.enableMaxBytesOnDisk)}else Gq.warn("Start cannot be called before setup");return U2e}function Dmi(){return $2e.CorrelationContextManager.getCurrentContext()}function Nmi(e,t){return $2e.CorrelationContextManager.startOperation(e,t)}function wmi(e,t){return $2e.CorrelationContextManager.wrapCallback(e,t)}var U2e=(function(){function e(){}return e.setDistributedTracingMode=function(t){return har.w3cEnabled=t===M2e.AI_AND_W3C,e},e.setAutoCollectConsole=function(t,r){return r===void 0&&(r=!1),pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectExternalLoggers=t,pe.defaultClient.config.enableAutoCollectConsole=r,jp&&Hq.enable(t,r)),e},e.setAutoCollectExceptions=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectExceptions=t,jp&&zq.enable(t)),e},e.setAutoCollectPerformance=function(t,r){if(r===void 0&&(r=!0),pe.defaultClient){pe.defaultClient.config.enableAutoCollectPerformance=t;var n=F2e.AutoCollectNativePerformance.parseEnabled(r,pe.defaultClient.config);pe.defaultClient.config.enableAutoCollectExtendedMetrics=n.isEnabled,jp&&(Yq.enable(t),ZI.enable(pe.defaultClient.config.enableAutoCollectExtendedMetrics,n.disabledMetrics))}return e},e.setAutoCollectPreAggregatedMetrics=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics=t,jp&&Kq.enable(t)),e},e.setAutoCollectHeartbeat=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectHeartbeat=t,jp&&Wq.enable(t)),e},e.enableAutoWebSnippetInjection=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableWebInstrumentation=t,pe.defaultClient.config.webInstrumentationConnectionString=r,jp&&QI.enable(pe.defaultClient.config.enableAutoWebSnippetInjection,pe.defaultClient.config.webSnippetConnectionString)),e},e.enableWebInstrumentation=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableWebInstrumentation=t,pe.defaultClient.config.webInstrumentationConnectionString=r,jp&&QI.enable(pe.defaultClient.config.enableWebInstrumentation,pe.defaultClient.config.webInstrumentationConnectionString)),e},e.setAutoCollectRequests=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectRequests=t,jp&&cC.enable(t)),e},e.setAutoCollectDependencies=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectDependencies=t,jp&&Xq.enable(t)),e},e.setAutoDependencyCorrelation=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableAutoDependencyCorrelation=t,pe.defaultClient.config.enableUseAsyncHooks=r,jp&&cC.useAutoCorrelation(t,r)),e},e.setUseDiskRetryCaching=function(t,r,n){return pe.defaultClient&&(pe.defaultClient.config.enableUseDiskRetryCaching=t,pe.defaultClient.config.enableResendInterval=r,pe.defaultClient.config.enableMaxBytesOnDisk=n,pe.defaultClient.channel&&pe.defaultClient.channel.setUseDiskRetryCaching(pe.defaultClient.config.enableUseDiskRetryCaching,pe.defaultClient.config.enableResendInterval,pe.defaultClient.config.enableMaxBytesOnDisk)),e},e.setInternalLogging=function(t,r){return t===void 0&&(t=!1),r===void 0&&(r=!0),Gq.enableDebug=t,Gq.disableWarnings=!r,e},e.setAutoCollectIncomingRequestAzureFunctions=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions=t,jp&&Jq.enable(t)),e},e.setSendLiveMetrics=function(t){return t===void 0&&(t=!1),pe.defaultClient?(!pe.liveMetricsClient&&t?(pe.liveMetricsClient=new mar(pe.defaultClient.config,pe.defaultClient.context,pe.defaultClient.getAuthorizationHandler,pe.defaultClient),Qne=new k2e(pe.liveMetricsClient,1e3,!0),pe.liveMetricsClient.addCollector(Qne),pe.defaultClient.quickPulseClient=pe.liveMetricsClient):pe.liveMetricsClient&&pe.liveMetricsClient.enable(t),pe.defaultClient.config.enableSendLiveMetrics=t,e):(Gq.warn("Live metrics client cannot be setup without the default client"),e)},e.start=gar,e})();pe.Configuration=U2e;function Imi(){har.w3cEnabled=!0,pe.defaultClient=null,jp=!1,Hq&&Hq.dispose(),zq&&zq.dispose(),Yq&&Yq.dispose(),Kq&&Kq.dispose(),Wq&&Wq.dispose(),QI&&QI.dispose(),ZI&&ZI.dispose(),cC&&cC.dispose(),Xq&&Xq.dispose(),pe.liveMetricsClient&&(pe.liveMetricsClient.enable(!1),pe.liveMetricsClient=void 0),Jq&&Jq.dispose()}});var eie=v(Zne=>{"use strict";Object.defineProperty(Zne,"__esModule",{value:!0});Zne.EventHeader=void 0;var j2e=class{extensionName;eventName;constructor(t,r){this.extensionName=t,this.eventName=r}getExtensionName(){return this.extensionName}getEventName(){return this.eventName}toString(){return`${this.extensionName}/${this.eventName}`}};Zne.EventHeader=j2e});var rie=v(tie=>{"use strict";Object.defineProperty(tie,"__esModule",{value:!0});tie.SampleRate=void 0;var yar;(function(e){e[e.OnePercent=0]="OnePercent",e[e.TenPercent=1]="TenPercent",e[e.NoSampling=2]="NoSampling"})(yar||(tie.SampleRate=yar={}))});var B2e=v(q2e=>{"use strict";Object.defineProperty(q2e,"__esModule",{value:!0});q2e.configAzureTelemetryClient=Rmi;function Rmi(e){e.channel.setUseDiskRetryCaching(!0),e.addTelemetryProcessor(t=>(t.tags["ai.location.ip"]="0.0.0.0",t.tags["ai.cloud.roleInstance"]="masked",t.tags["ai.cloud.role"]="masked",t.tags["ai.device.type"]="masked",!0))}});var _ar=v((yda,Lmi)=>{Lmi.exports={name:"@sap-ux/telemetry",version:"0.6.83",description:"Library for sending usage telemetry data",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/telemetry"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Atelemetry"},license:"Apache-2.0",private:!1,main:"dist/index.js",scripts:{build:"tsc --build",watch:"tsc --watch",clean:"rimraf --glob dist coverage *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","lint:fix":"eslint --fix",test:"jest --ci --forceExit --detectOpenHandles --colors","test-u":"jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",example:"ts-node example/index.ts"},dependencies:{"@sap-ux/store":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/nodejs-utils":"workspace:*",applicationinsights:"2.9.8",axios:"1.13.5","performance-now":"2.1.0",yaml:"2.3.3"},devDependencies:{"jest-extended":"6.0.0",memfs:"3.4.13",unionfs:"4.4.0",dotenv:"16.6.1"},files:["dist","LICENSE","!dist/*.map","!dist/**/*.map"],engines:{node:">=20.x"}}});var Qq=v(eR=>{"use strict";var Mmi=eR&&eR.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(eR,"__esModule",{value:!0});eR.TelemetrySettings=void 0;var Ear=Mmi(_ar());eR.TelemetrySettings={azureInstrumentationKey:"",telemetryEnabled:!0,telemetryLibName:Ear.default.name,telemetryLibVersion:Ear.default.version,consumerModuleName:"",consumerModuleVersion:""}});var H2e=v(Bg=>{"use strict";var $mi=Bg&&Bg.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),kmi=Bg&&Bg.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Fmi=Bg&&Bg.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),i=0;i<n.length;i++)n[i]!=="default"&&$mi(r,t,n[i]);return kmi(r,t),r}})();Object.defineProperty(Bg,"__esModule",{value:!0});Bg.ApplicationInsightClient=void 0;var Umi=OLe(),Vmi=Fmi(V2e()),jmi=eie(),qg=rie(),qmi=B2e(),Tar=Qq(),G2e=class extends Umi.Client{clients;constructor(t,r,n){super(),this.clients=new Map,this.applicationKey=t,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(qg.SampleRate.OnePercent),a=this.createTelemetryClient(qg.SampleRate.TenPercent),o=this.createTelemetryClient(qg.SampleRate.NoSampling);this.clients.set(qg.SampleRate.OnePercent,i),this.clients.set(qg.SampleRate.TenPercent,a),this.clients.set(qg.SampleRate.NoSampling,o)}reportBlocking(t,r,n,i,a=!1){if(!a||Tar.TelemetrySettings.telemetryEnabled){let{client:o,event:s}=this.prepareClientAndEvent(t,r,n,i);return this.trackEventBlocking(o,s)}return Promise.resolve()}async report(t,r,n,i,a,o){if(o!==void 0&&!o||!Tar.TelemetrySettings.telemetryEnabled)return;let{client:s,event:c}=this.prepareClientAndEvent(t,r,n,i);this.trackEvent(s,c)}prepareClientAndEvent(t,r,n,i=qg.SampleRate.NoSampling){let a=this.clients.get(i),s={name:new jmi.EventHeader(this.extensionName,t).toString(),properties:r,measurements:n};return{client:a,event:s}}async trackEventBlocking(t,r){if(process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true")return new Promise((n,i)=>{try{t.trackEvent(r),t.flush({callback:()=>n()})}catch(a){i(a)}})}trackEvent(t,r){return process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"?(t.trackEvent(r),!0):!1}createTelemetryClient(t){let r;switch(t){case qg.SampleRate.OnePercent:r=1;break;case qg.SampleRate.TenPercent:r=10;break;case qg.SampleRate.NoSampling:default:r=100;break}let n=new Vmi.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,(0,qmi.configAzureTelemetryClient)(n),n}};Bg.ApplicationInsightClient=G2e});var bar=v(nie=>{"use strict";Object.defineProperty(nie,"__esModule",{value:!0});nie.localDatetimeToUTC=void 0;var Bmi=()=>{let e=new Date().getTime();return new Date(e).toISOString()};nie.localDatetimeToUTC=Bmi});var Aar=v(iie=>{"use strict";Object.defineProperty(iie,"__esModule",{value:!0});iie.ToolsSuiteTelemetryClient=void 0;var Gmi=H2e(),Sar=aie(),Oar=bar(),z2e=class extends Gmi.ApplicationInsightClient{constructor(t,r,n){super(t,r,n)}async report(t,r,n,i,a,o){let s=await(0,Sar.processToolsSuiteTelemetry)(a),c={v:this.extensionVersion,datetime:(0,Oar.localDatetimeToUTC)()},u={...r,...s,...c};await super.report(t,u,n,i,a,o)}async reportEvent(t,r,n,i){let{finalProperties:a,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(t,n);return super.report(t.eventName,a,o,r,n,i)}async reportEventBlocking(t,r,n,i){let{finalProperties:a,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(t,n);return super.reportBlocking(t.eventName,a,o,r,i)}async collectToolsSuiteTelemetry(t,r){let n=await(0,Sar.processToolsSuiteTelemetry)(r),i={v:this.extensionVersion,datetime:(0,Oar.localDatetimeToUTC)()},a={...t.properties,...n,...i},o={...t.measurements};return{finalProperties:a,finalMeasurements:o}}};iie.ToolsSuiteTelemetryClient=z2e});var qn=v(rc=>{"use strict";var Y2e=Symbol.for("yaml.alias"),Car=Symbol.for("yaml.document"),oie=Symbol.for("yaml.map"),xar=Symbol.for("yaml.pair"),K2e=Symbol.for("yaml.scalar"),sie=Symbol.for("yaml.seq"),E_=Symbol.for("yaml.node.type"),Hmi=e=>!!e&&typeof e=="object"&&e[E_]===Y2e,zmi=e=>!!e&&typeof e=="object"&&e[E_]===Car,Ymi=e=>!!e&&typeof e=="object"&&e[E_]===oie,Kmi=e=>!!e&&typeof e=="object"&&e[E_]===xar,Par=e=>!!e&&typeof e=="object"&&e[E_]===K2e,Wmi=e=>!!e&&typeof e=="object"&&e[E_]===sie;function Dar(e){if(e&&typeof e=="object")switch(e[E_]){case oie:case sie:return!0}return!1}function Xmi(e){if(e&&typeof e=="object")switch(e[E_]){case Y2e:case oie:case K2e:case sie:return!0}return!1}var Jmi=e=>(Par(e)||Dar(e))&&!!e.anchor;rc.ALIAS=Y2e;rc.DOC=Car;rc.MAP=oie;rc.NODE_TYPE=E_;rc.PAIR=xar;rc.SCALAR=K2e;rc.SEQ=sie;rc.hasAnchor=Jmi;rc.isAlias=Hmi;rc.isCollection=Dar;rc.isDocument=zmi;rc.isMap=Ymi;rc.isNode=Xmi;rc.isPair=Kmi;rc.isScalar=Par;rc.isSeq=Wmi});var Zq=v(W2e=>{"use strict";var ts=qn(),zl=Symbol("break visit"),Nar=Symbol("skip children"),Gg=Symbol("remove node");function cie(e,t){let r=war(t);ts.isDocument(e)?tR(null,e.contents,r,Object.freeze([e]))===Gg&&(e.contents=null):tR(null,e,r,Object.freeze([]))}cie.BREAK=zl;cie.SKIP=Nar;cie.REMOVE=Gg;function tR(e,t,r,n){let i=Iar(e,t,r,n);if(ts.isNode(i)||ts.isPair(i))return Rar(e,n,i),tR(e,i,r,n);if(typeof i!="symbol"){if(ts.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=tR(a,t.items[a],r,n);if(typeof o=="number")a=o-1;else{if(o===zl)return zl;o===Gg&&(t.items.splice(a,1),a-=1)}}}else if(ts.isPair(t)){n=Object.freeze(n.concat(t));let a=tR("key",t.key,r,n);if(a===zl)return zl;a===Gg&&(t.key=null);let o=tR("value",t.value,r,n);if(o===zl)return zl;o===Gg&&(t.value=null)}}return i}async function uie(e,t){let r=war(t);ts.isDocument(e)?await rR(null,e.contents,r,Object.freeze([e]))===Gg&&(e.contents=null):await rR(null,e,r,Object.freeze([]))}uie.BREAK=zl;uie.SKIP=Nar;uie.REMOVE=Gg;async function rR(e,t,r,n){let i=await Iar(e,t,r,n);if(ts.isNode(i)||ts.isPair(i))return Rar(e,n,i),rR(e,i,r,n);if(typeof i!="symbol"){if(ts.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=await rR(a,t.items[a],r,n);if(typeof o=="number")a=o-1;else{if(o===zl)return zl;o===Gg&&(t.items.splice(a,1),a-=1)}}}else if(ts.isPair(t)){n=Object.freeze(n.concat(t));let a=await rR("key",t.key,r,n);if(a===zl)return zl;a===Gg&&(t.key=null);let o=await rR("value",t.value,r,n);if(o===zl)return zl;o===Gg&&(t.value=null)}}return i}function war(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Iar(e,t,r,n){if(typeof r=="function")return r(e,t,n);if(ts.isMap(t))return r.Map?.(e,t,n);if(ts.isSeq(t))return r.Seq?.(e,t,n);if(ts.isPair(t))return r.Pair?.(e,t,n);if(ts.isScalar(t))return r.Scalar?.(e,t,n);if(ts.isAlias(t))return r.Alias?.(e,t,n)}function Rar(e,t,r){let n=t[t.length-1];if(ts.isCollection(n))n.items[e]=r;else if(ts.isPair(n))e==="key"?n.key=r:n.value=r;else if(ts.isDocument(n))n.contents=r;else{let i=ts.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}W2e.visit=cie;W2e.visitAsync=uie});var X2e=v(Mar=>{"use strict";var Lar=qn(),Qmi=Zq(),Zmi={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},egi=e=>e.replace(/[!,[\]{}]/g,t=>Zmi[t]),eB=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let n=t.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[a,o]=n;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[a]=n;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=t.match(/^(.*!)([^!]*)$/);i||r(`The ${t} tag has no suffix`);let a=this.tags[n];if(a)try{return a+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,n]of Object.entries(this.tags))if(t.startsWith(n))return r+egi(t.substring(n.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(t&&n.length>0&&Lar.isNode(t.contents)){let a={};Qmi.visit(t.contents,(o,s)=>{Lar.isNode(s)&&s.tag&&(a[s.tag]=!0)}),i=Object.keys(a)}else i=[];for(let[a,o]of n)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(s=>s.startsWith(o)))&&r.push(`%TAG ${a} ${o}`);return r.join(`
1444
+ `)}),u.length>0&&(u=u.substring(0,u.length-1)),u.length===0)return typeof r=="function"&&r("Empty batch of telemetry items. Nothing to send."),[2];l=Buffer.from?Buffer.from(u):new Buffer(u),Mhi.gzip(l,function(h,d){var m=d;h?(p._logWarn(Hl.dumpObj(h)),m=l,a.headers["Content-Length"]=l.length.toString()):(a.headers["Content-Encoding"]="gzip",a.headers["Content-Length"]=d.length.toString()),p._logInfo(Hl.dumpObj(a)),a[$hi.disableCollectionRequestOption]=!0;var _=+new Date,T=function(A){A.setEncoding("utf-8");var C="";A.on("data",function(P){C+=P}),A.on("end",function(){var P,N=+new Date,F=N-_;if(p._numConsecutiveFailures=0,C.includes(jhi)&&A.statusCode===400&&(P2e.warn("Instrumentation key was invalid, please check the iKey"),(P=p._shutdownStatsbeat)===null||P===void 0||P.call(p)),p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&(Vhi.includes(A.statusCode)?p._statsbeatHasReachedIngestionAtLeastOnce=!0:p._statsbeatFailedToIngest()),p._statsbeat&&(A.statusCode==Uhi||A.statusCode==Fhi?p._statsbeat.countThrottle(kb.StatsbeatNetworkCategory.Breeze,i,A.statusCode):p._statsbeat.countRequest(kb.StatsbeatNetworkCategory.Breeze,i,F,A.statusCode===200,A.statusCode)),p._enableDiskRetryMode){if(A.statusCode===200)p._resendTimer||(p._resendTimer=setTimeout(function(){p._resendTimer=null,p._sendFirstFileOnDisk()},p._resendInterval),p._resendTimer.unref());else if(p._isRetriable(A.statusCode))try{p._statsbeat&&p._statsbeat.countRetry(kb.StatsbeatNetworkCategory.Breeze,i,A.statusCode);var L=JSON.parse(C),B=[];L.errors&&(L.errors.forEach(function(Q){(Q.statusCode==429||Q.statusCode==500||Q.statusCode==503)&&B.push(t[Q.index])}),B.length>0&&p._storeToDisk(B))}catch{p._storeToDisk(t)}}if(A.statusCode===307||A.statusCode===308)if(p._numConsecutiveRedirects++,p._numConsecutiveRedirects<10){var J=A.headers.location?A.headers.location.toString():null;J&&(p._redirectedHost=J,p.send(t,r))}else{var j={name:"Circular Redirect",message:"Error sending telemetry because of circular redirects."};p._statsbeat&&p._statsbeat.countException(kb.StatsbeatNetworkCategory.Breeze,i,j),typeof r=="function"&&r("Error sending telemetry because of circular redirects.")}else p._numConsecutiveRedirects=0,typeof r=="function"&&r(C),p._logInfo(C),typeof p._onSuccess=="function"&&p._onSuccess(C)})},O=Hl.makeRequest(p._config,n,a,T);O.setTimeout(e.HTTP_TIMEOUT,function(){p._requestTimedOut=!0,O.abort()}),O.on("error",function(A){if(p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&p._statsbeatFailedToIngest(),p._numConsecutiveFailures++,p._statsbeat&&p._statsbeat.countException(kb.StatsbeatNetworkCategory.Breeze,i,A),!p._enableDiskRetryMode||p._numConsecutiveFailures>0&&p._numConsecutiveFailures%e.MAX_CONNECTION_FAILURES_BEFORE_WARN===0){var C="Ingestion endpoint could not be reached. This batch of telemetry items has been lost. Use Disk Retry Caching to enable resending of failed telemetry. Error:";p._enableDiskRetryMode&&(C="Ingestion endpoint could not be reached ".concat(p._numConsecutiveFailures," consecutive times. There may be resulting telemetry loss. Most recent error:")),p._logWarn(C,Hl.dumpObj(A))}else{var C="Transient failure to reach ingestion endpoint. This batch of telemetry items will be retried. Error:";p._logInfo(C,Hl.dumpObj(A))}p._onErrorHelper(A),typeof r=="function"&&(A?(p._requestTimedOut&&(A.name="telemetry timeout",A.message="telemetry request timed out"),r(Hl.dumpObj(A))):r("Error sending telemetry")),p._enableDiskRetryMode&&p._storeToDisk(t)}),O.write(m),O.end()}),f.label=5;case 5:return[2]}})})},e.prototype.saveOnCrash=function(t){this._enableDiskRetryMode&&this._storeToDiskSync(Hl.stringify(t))},e.prototype._isRetriable=function(t){return t===206||t===401||t===403||t===408||t===429||t===500||t===502||t===503||t===504},e.prototype._logInfo=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this._isStatsbeatSender||P2e.info(e.TAG,t,r)},e.prototype._logWarn=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this._isStatsbeatSender||P2e.warn(e.TAG,t,r)},e.prototype._statsbeatFailedToIngest=function(){this._shutdownStatsbeat&&(this._failedToIngestCounter++,this._failedToIngestCounter>=3&&this._shutdownStatsbeat())},e.prototype._storeToDisk=function(t){return zne(this,void 0,void 0,function(){var r,n,i,a,o,s,c;return Yne(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),this._logInfo("Checking existence of data storage directory: "+this._tempDir),[4,v_.confirmDirExists(this._tempDir)];case 1:return u.sent(),[3,3];case 2:return r=u.sent(),this._logWarn("Failed to create folder to put telemetry: "+Hl.dumpObj(r)),this._onErrorHelper(r),[2];case 3:return u.trys.push([3,5,,6]),[4,qq.FileAccessControl.applyACLRules(this._tempDir)];case 4:return u.sent(),[3,6];case 5:return n=u.sent(),this._logWarn("Failed to apply file access control to folder: "+Hl.dumpObj(n)),this._onErrorHelper(n),[2];case 6:return u.trys.push([6,8,,9]),[4,v_.getShallowDirectorySize(this._tempDir)];case 7:return i=u.sent(),i>this._maxBytesOnDisk?(this._logWarn("Not saving data due to max size limit being met. Directory size in bytes is: "+i),[2]):[3,9];case 8:return a=u.sent(),this._logWarn("Failed to read directory for retriable telemetry: "+Hl.dumpObj(a)),this._onErrorHelper(a),[2];case 9:return u.trys.push([9,11,,12]),o="".concat(new Date().getTime(),".ai.json"),s=oC.join(this._tempDir,o),this._logInfo("saving data to disk at: "+s),[4,v_.writeFileAsync(s,Hl.stringify(t),{mode:384})];case 10:return u.sent(),[3,12];case 11:return c=u.sent(),this._logWarn("Failed to persist telemetry to disk: "+Hl.dumpObj(c)),this._onErrorHelper(c),[2];case 12:return[2]}})})},e.prototype._storeToDiskSync=function(t){try{this._logInfo("Checking existence of data storage directory: "+this._tempDir),x2e.existsSync(this._tempDir)||x2e.mkdirSync(this._tempDir),qq.FileAccessControl.applyACLRulesSync(this._tempDir);var r=v_.getShallowDirectorySizeSync(this._tempDir);if(r>this._maxBytesOnDisk){this._logInfo("Not saving data due to max size limit being met. Directory size in bytes is: "+r);return}var n="".concat(new Date().getTime(),".ai.json"),i=oC.join(this._tempDir,n);this._logInfo("saving data before crash to disk at: "+i),x2e.writeFileSync(i,t,{mode:384})}catch(a){this._logWarn("Error while saving data to disk: "+Hl.dumpObj(a)),this._onErrorHelper(a)}},e.prototype._sendFirstFileOnDisk=function(){return zne(this,void 0,void 0,function(){var t,r,n,i,a,o;return Yne(this,function(s){switch(s.label){case 0:return s.trys.push([0,6,,7]),[4,v_.readdirAsync(this._tempDir)];case 1:return t=s.sent(),t=t.filter(function(c){return oC.basename(c).indexOf(".ai.json")>-1}),t.length>0?(r=t[0],n=oC.join(this._tempDir,r),[4,v_.readFileAsync(n)]):[3,5];case 2:return i=s.sent(),[4,v_.unlinkAsync(n)];case 3:return s.sent(),a=JSON.parse(i.toString()),[4,this.send(a)];case 4:s.sent(),s.label=5;case 5:return[3,7];case 6:return o=s.sent(),this._onErrorHelper(o),[3,7];case 7:return[2]}})})},e.prototype._onErrorHelper=function(t){typeof this._onError=="function"&&this._onError(t)},e.prototype._fileCleanupTask=function(){return zne(this,void 0,void 0,function(){var t,r,n,i,a,o,s=this;return Yne(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),[4,v_.readdirAsync(this._tempDir)];case 1:if(t=c.sent(),t=t.filter(function(u){return oC.basename(u).indexOf(".ai.json")>-1}),!(t.length>0))return[3,5];r=0,c.label=2;case 2:return r<t.length?(n=new Date(parseInt(t[r].split(".ai.json")[0])),i=new Date(+new Date-e.FILE_RETEMPTION_PERIOD)>n,i?(a=oC.join(this._tempDir,t[r]),[4,v_.unlinkAsync(a).catch(function(u){s._onErrorHelper(u)})]):[3,4]):[3,5];case 3:c.sent(),c.label=4;case 4:return r++,[3,2];case 5:return[3,7];case 6:return o=c.sent(),o.code!="ENOENT"&&this._onErrorHelper(o),[3,7];case 7:return[2]}})})},e.TAG="Sender",e.WAIT_BETWEEN_RESEND=60*1e3,e.MAX_BYTES_ON_DISK=50*1024*1024,e.MAX_CONNECTION_FAILURES_BEFORE_WARN=5,e.CLEANUP_TIMEOUT=3600*1e3,e.FILE_RETEMPTION_PERIOD=10080*60*1e3,e.TEMPDIR_PREFIX="appInsights-node",e.HTTP_TIMEOUT=2e4,e})();Jir.exports=qhi});var Zir=v(Kne=>{"use strict";Object.defineProperty(Kne,"__esModule",{value:!0});Kne.AzureVirtualMachine=void 0;var Qir=Ci(),Bhi=Js(),Ghi=PI(),Hhi="http://169.254.169.254/metadata/instance/compute",zhi="api-version=2017-12-01",Yhi="format=json",Khi="UNREACH",Whi=(function(){function e(){}return e.getAzureComputeMetadata=function(t,r){var n,i=this,a={},o="".concat(Hhi,"?").concat(zhi,"&").concat(Yhi),s=(n={method:"GET"},n[Ghi.disableCollectionRequestOption]=!0,n.headers={Metadata:"True"},n),c=Bhi.makeRequest(t,o,s,function(u){if(u.statusCode===200){a.isVM=!0;var l="";u.on("data",function(p){l+=p}),u.on("end",function(){try{var p=JSON.parse(l);a.id=p.vmId||"",a.subscriptionId=p.subscriptionId||"",a.osType=p.osType||""}catch(f){Qir.info(e.TAG,f)}r(a)})}else r(a)},!1,!1);c&&(setTimeout(function(){i._requestTimedOut=!0,c.abort()},e.HTTP_TIMEOUT),c.on("error",function(u){i._requestTimedOut&&u&&(u.name="telemetry timeout",u.message="telemetry request timed out"),u&&u.message&&u.message.indexOf(Khi)>-1?a.isVM=!1:Qir.info(e.TAG,u),r(a)}),c.end())},e.HTTP_TIMEOUT=2500,e.TAG="AzureVirtualMachine",e})();Kne.AzureVirtualMachine=Whi});var ear=v(Wne=>{"use strict";Object.defineProperty(Wne,"__esModule",{value:!0});Wne.NetworkStatsbeat=void 0;var Xhi=(function(){function e(t,r){this.endpoint=t,this.host=r,this.totalRequestCount=0,this.totalSuccesfulRequestCount=0,this.totalFailedRequestCount=[],this.retryCount=[],this.exceptionCount=[],this.throttleCount=[],this.intervalRequestExecutionTime=0,this.lastIntervalRequestExecutionTime=0,this.lastTime=+new Date,this.lastRequestCount=0}return e})();Wne.NetworkStatsbeat=Xhi});var aar=v((sC,iar)=>{"use strict";var jg=sC&&sC.__assign||function(){return jg=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},jg.apply(this,arguments)},N2e=sC&&sC.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(p){o(p)}}function c(l){try{u(n.throw(l))}catch(p){o(p)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},w2e=sC&&sC.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(l){u=[6,l],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Jhi=require("os"),Qhi=C2e(),tar=Ci(),Zhi=D2e(),aa=na(),emi=Xc(),tmi=Zir(),rmi=TFe(),rar=TI(),nmi=ear(),nar=Js(),imi="node",ami=(function(){function e(t,r){this._attach=aa.StatsbeatAttach.sdk,this._feature=aa.StatsbeatFeature.NONE,this._instrumentation=aa.StatsbeatInstrumentation.NONE,this._isInitialized=!1,this._statbeatMetrics=[],this._networkStatsbeatCollection=[],this._config=t,this._context=r||new rar,this._longHandleTimeout=null;var n=this._getConnectionString(t);this._statsbeatConfig=new rmi(n),this._statsbeatConfig.samplingPercentage=100,this._sender=new Zhi(this._statsbeatConfig,null,null,null,null,!0,this._shutdownStatsbeat.bind(this))}return e.prototype.enable=function(t){var r=this;this._isEnabled=t,this._isEnabled&&!this._isInitialized&&(this._getCustomProperties(),this._isInitialized=!0),t?(this._handle||(this._handle=setInterval(function(){r.trackShortIntervalStatsbeats()},e.STATS_COLLECTION_SHORT_INTERVAL),this._handle.unref()),this._longHandle||(this._longHandleTimeout=setTimeout(function(){r.isEnabled()&&r.trackLongIntervalStatsbeats()},e.STATS_COLLECTION_INITIAL_DELAY),this._longHandleTimeout.unref(),this._longHandle=setInterval(function(){r.trackLongIntervalStatsbeats()},e.STATS_COLLECTION_LONG_INTERVAL),this._longHandle.unref())):(this._handle&&(clearInterval(this._handle),this._handle=null),this._longHandle&&(clearInterval(this._longHandle),this._longHandle=null),this._longHandleTimeout&&(clearTimeout(this._longHandleTimeout),this._longHandleTimeout=null))},e.prototype.isInitialized=function(){return this._isInitialized},e.prototype.isEnabled=function(){return this._isEnabled},e.prototype.setCodelessAttach=function(){this._attach=aa.StatsbeatAttach.codeless},e.prototype.addFeature=function(t){this._feature|=t},e.prototype.removeFeature=function(t){this._feature&=~t},e.prototype.addInstrumentation=function(t){this._instrumentation|=t},e.prototype.removeInstrumentation=function(t){this._instrumentation&=~t},e.prototype.countRequest=function(t,r,n,i,a){if(this.isEnabled()){var o=this._getNetworkStatsbeatCounter(t,r);if(o.totalRequestCount++,o.intervalRequestExecutionTime+=n,i===!1){if(!a)return;var s=o.totalFailedRequestCount.find(function(c){return a===c.statusCode});s?s.count++:o.totalFailedRequestCount.push({statusCode:a,count:1})}else o.totalSuccesfulRequestCount++}},e.prototype.countException=function(t,r,n){if(this.isEnabled()){var i=this._getNetworkStatsbeatCounter(t,r),a=i.exceptionCount.find(function(o){return n.name===o.exceptionType});a?a.count++:i.exceptionCount.push({exceptionType:n.name,count:1})}},e.prototype.countThrottle=function(t,r,n){if(this.isEnabled()){var i=this._getNetworkStatsbeatCounter(t,r),a=i.throttleCount.find(function(o){return n===o.statusCode});a?a.count++:i.throttleCount.push({statusCode:n,count:1})}},e.prototype.countRetry=function(t,r,n){if(this.isEnabled()){var i=this._getNetworkStatsbeatCounter(t,r),a=i.retryCount.find(function(o){return n===o.statusCode});a?a.count++:i.retryCount.push({statusCode:n,count:1})}},e.prototype.trackShortIntervalStatsbeats=function(){return N2e(this,void 0,void 0,function(){var t,r;return w2e(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this._getResourceProvider()];case 1:return n.sent(),t={os:this._os,rp:this._resourceProvider,cikey:this._cikey,runtimeVersion:this._runtimeVersion,language:this._language,version:this._sdkVersion,attach:this._attach},this._trackRequestDuration(t),this._trackRequestsCount(t),[4,this._sendStatsbeats()];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),tar.info(e.TAG,"Failed to send Statsbeat metrics: "+nar.dumpObj(r)),[3,4];case 4:return[2]}})})},e.prototype.trackLongIntervalStatsbeats=function(){return N2e(this,void 0,void 0,function(){var t,r,n,i,a;return w2e(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this._getResourceProvider()];case 1:return o.sent(),t={os:this._os,rp:this._resourceProvider,cikey:this._cikey,runtimeVersion:this._runtimeVersion,language:this._language,version:this._sdkVersion,attach:this._attach},r=Object.assign({rpId:this._resourceIdentifier},t),this._statbeatMetrics.push({name:aa.StatsbeatCounter.ATTACH,value:1,properties:r}),this._instrumentation!=aa.StatsbeatInstrumentation.NONE&&(n=Object.assign({feature:this._instrumentation,type:aa.StatsbeatFeatureType.Instrumentation},t),this._statbeatMetrics.push({name:aa.StatsbeatCounter.FEATURE,value:1,properties:n})),this._feature!=aa.StatsbeatFeature.NONE&&(i=Object.assign({feature:this._feature,type:aa.StatsbeatFeatureType.Feature},t),this._statbeatMetrics.push({name:aa.StatsbeatCounter.FEATURE,value:1,properties:i})),[4,this._sendStatsbeats()];case 2:return o.sent(),[3,4];case 3:return a=o.sent(),tar.info(e.TAG,"Failed to send Statsbeat metrics: "+nar.dumpObj(a)),[3,4];case 4:return[2]}})})},e.prototype._getNetworkStatsbeatCounter=function(t,r){for(var n=this._getShortHost(r),i=0;i<this._networkStatsbeatCollection.length;i++)if(t===this._networkStatsbeatCollection[i].endpoint&&n===this._networkStatsbeatCollection[i].host)return this._networkStatsbeatCollection[i];var a=new nmi.NetworkStatsbeat(t,n);return this._networkStatsbeatCollection.push(a),a},e.prototype._trackRequestDuration=function(t){for(var r=0;r<this._networkStatsbeatCollection.length;r++){var n=this._networkStatsbeatCollection[r];n.time=+new Date;var i=n.totalRequestCount-n.lastRequestCount||0,a=n.intervalRequestExecutionTime-n.lastIntervalRequestExecutionTime,o=a>0&&a/i||0;if(n.lastIntervalRequestExecutionTime=n.intervalRequestExecutionTime,i>0){var s=Object.assign({endpoint:this._networkStatsbeatCollection[r].endpoint,host:this._networkStatsbeatCollection[r].host},t);this._statbeatMetrics.push({name:aa.StatsbeatCounter.REQUEST_DURATION,value:o,properties:s})}n.lastRequestCount=n.totalRequestCount,n.lastTime=n.time}},e.prototype._getShortHost=function(t){var r=t;try{var n=new RegExp(/^https?:\/\/(?:www\.)?([^\/.-]+)/),i=n.exec(t);i!=null&&i.length>1&&(r=i[1]),r=r.replace(".in.applicationinsights.azure.com","")}catch{}return r},e.prototype._trackRequestsCount=function(t){for(var r=this,n=function(s){a=i._networkStatsbeatCollection[s];var c=Object.assign({endpoint:a.endpoint,host:a.host},t);a.totalSuccesfulRequestCount>0&&(i._statbeatMetrics.push({name:aa.StatsbeatCounter.REQUEST_SUCCESS,value:a.totalSuccesfulRequestCount,properties:c}),a.totalSuccesfulRequestCount=0),a.totalFailedRequestCount.length>0&&(a.totalFailedRequestCount.forEach(function(u){c=Object.assign(jg(jg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:aa.StatsbeatCounter.REQUEST_FAILURE,value:u.count,properties:c})}),a.totalFailedRequestCount=[]),a.retryCount.length>0&&(a.retryCount.forEach(function(u){c=Object.assign(jg(jg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:aa.StatsbeatCounter.RETRY_COUNT,value:u.count,properties:c})}),a.retryCount=[]),a.throttleCount.length>0&&(a.throttleCount.forEach(function(u){c=Object.assign(jg(jg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:aa.StatsbeatCounter.THROTTLE_COUNT,value:u.count,properties:c})}),a.throttleCount=[]),a.exceptionCount.length>0&&(a.exceptionCount.forEach(function(u){c=Object.assign(jg(jg({},c),{exceptionType:u.exceptionType})),r._statbeatMetrics.push({name:aa.StatsbeatCounter.EXCEPTION_COUNT,value:u.count,properties:c})}),a.exceptionCount=[])},i=this,a,o=0;o<this._networkStatsbeatCollection.length;o++)n(o)},e.prototype._sendStatsbeats=function(){return N2e(this,void 0,void 0,function(){var t,r,n,i;return w2e(this,function(a){switch(a.label){case 0:if(!(this._statbeatMetrics.length>0))return[3,2];for(t=[],r=0;r<this._statbeatMetrics.length;r++)n={name:this._statbeatMetrics[r].name,value:this._statbeatMetrics[r].value,properties:this._statbeatMetrics[r].properties},i=Qhi.createEnvelope(n,emi.TelemetryType.Metric,null,this._context,this._statsbeatConfig),i.name=aa.StatsbeatTelemetryName,t.push(i);return this._statbeatMetrics=[],[4,this._sender.send(t)];case 1:a.sent(),a.label=2;case 2:return[2]}})})},e.prototype._getCustomProperties=function(){this._language=imi,this._cikey=this._config.instrumentationKey,this._sdkVersion=rar.sdkVersion,this._os=Jhi.type(),this._runtimeVersion=process.version},e.prototype._getResourceProvider=function(){var t=this;return new Promise(function(r,n){var i=!1;t._resourceProvider=aa.StatsbeatResourceProvider.unknown,t._resourceIdentifier=aa.StatsbeatResourceProvider.unknown,process.env.AKS_ARM_NAMESPACE_ID?(t._resourceProvider=aa.StatsbeatResourceProvider.aks,t._resourceIdentifier=process.env.AKS_ARM_NAMESPACE_ID):process.env.WEBSITE_SITE_NAME?(t._resourceProvider=aa.StatsbeatResourceProvider.appsvc,t._resourceIdentifier=process.env.WEBSITE_SITE_NAME,process.env.WEBSITE_HOME_STAMPNAME&&(t._resourceIdentifier+="/"+process.env.WEBSITE_HOME_STAMPNAME)):process.env.FUNCTIONS_WORKER_RUNTIME?(t._resourceProvider=aa.StatsbeatResourceProvider.functions,process.env.WEBSITE_HOSTNAME&&(t._resourceIdentifier=process.env.WEBSITE_HOSTNAME)):t._config&&(t._isVM===void 0||t._isVM==!0?(i=!0,tmi.AzureVirtualMachine.getAzureComputeMetadata(t._config,function(a){t._isVM=a.isVM,t._isVM&&(t._resourceProvider=aa.StatsbeatResourceProvider.vm,t._resourceIdentifier=a.id+"/"+a.subscriptionId,a.osType&&(t._os=a.osType)),r()})):t._resourceProvider=aa.StatsbeatResourceProvider.unknown),i||r()})},e.prototype._shutdownStatsbeat=function(){this.enable(!1)},e.prototype._getConnectionString=function(t){for(var r=t.endpointUrl,n=["westeurope","northeurope","francecentral","francesouth","germanywestcentral","norwayeast","norwaywest","swedencentral","switzerlandnorth","switzerlandwest","uksouth","ukwest"],i=0;i<n.length;i++)if(r.indexOf(n[i])>-1)return e.EU_CONNECTION_STRING;return e.NON_EU_CONNECTION_STRING},e.NON_EU_CONNECTION_STRING="InstrumentationKey=c4a29126-a7cb-47e5-b348-11414998b11e;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com",e.EU_CONNECTION_STRING="InstrumentationKey=7dc56bab-3c0c-4e9f-9ebb-d1acadee8d0f;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com",e.STATS_COLLECTION_SHORT_INTERVAL=9e5,e.STATS_COLLECTION_LONG_INTERVAL=864e5,e.STATS_COLLECTION_INITIAL_DELAY=15e3,e.TAG="Statsbeat",e})();iar.exports=ami});var car=v((pda,sar)=>{"use strict";var omi=require("url"),smi=TFe(),cmi=kir(),umi=TI(),__=Xc(),lmi=Uir(),I2e=zir(),oar=xb(),pmi=aar(),fmi=D2e(),R2e=Js(),Xne=Ci(),dmi=C2e(),hmi=(function(){function e(t){this._telemetryProcessors=[];var r=new smi(t);if(this.config=r,!this.config.instrumentationKey||this.config.instrumentationKey=="")throw new Error("Instrumentation key not found, please provide a connection string before starting Application Insights SDK.");this.context=new umi,this.commonProperties={},this.authorizationHandler=null,this.config.disableStatsbeat||(this._statsbeat=new pmi(this.config,this.context),this._statsbeat.enable(!0));var n=new fmi(this.config,this.getAuthorizationHandler,null,null,this._statsbeat);this.channel=new lmi(function(){return r.disableAppInsights},function(){return r.maxBatchSize},function(){return r.maxBatchIntervalMs},n)}return e.prototype.trackAvailability=function(t){this.track(t,__.TelemetryType.Availability)},e.prototype.trackPageView=function(t){this.track(t,__.TelemetryType.PageView)},e.prototype.trackTrace=function(t){this.track(t,__.TelemetryType.Trace)},e.prototype.trackMetric=function(t){this.track(t,__.TelemetryType.Metric)},e.prototype.trackException=function(t){t&&t.exception&&!R2e.isError(t.exception)&&(t.exception=new Error(t.exception.toString())),this.track(t,__.TelemetryType.Exception)},e.prototype.trackEvent=function(t){this.track(t,__.TelemetryType.Event)},e.prototype.trackRequest=function(t){this.track(t,__.TelemetryType.Request)},e.prototype.trackDependency=function(t){if(t&&!t.target&&t.data)try{t.target=new omi.URL(t.data).host}catch(r){t.target=null,Xne.warn(e.TAG,"The URL object is failed to create.",r)}this.track(t,__.TelemetryType.Dependency)},e.prototype.flush=function(t){this.channel.triggerSend(t?!!t.isAppCrashing:!1,t?t.callback:void 0)},e.prototype.track=function(t,r){if(t&&__.telemetryTypeToBaseType(r)){var n=dmi.createEnvelope(t,r,this.commonProperties,this.context,this.config);t.time&&(n.time=t.time.toISOString());var i=this.runTelemetryProcessors(n,t.contextObjects);i=i&&I2e.samplingTelemetryProcessor(n,{correlationContext:oar.CorrelationContextManager.getCurrentContext()}),I2e.preAggregatedMetricsTelemetryProcessor(n,this.context),i&&(I2e.performanceMetricsTelemetryProcessor(n,this.quickPulseClient),this.channel.send(n))}else Xne.warn(e.TAG,"track() requires telemetry object and telemetryType to be specified.")},e.prototype.setAutoPopulateAzureProperties=function(t){},e.prototype.getAuthorizationHandler=function(t){return t&&t.aadTokenCredential?(this.authorizationHandler||(Xne.info(e.TAG,"Adding authorization handler"),this.authorizationHandler=new cmi(t.aadTokenCredential,t.aadAudience)),this.authorizationHandler):null},e.prototype.addTelemetryProcessor=function(t){this._telemetryProcessors.push(t)},e.prototype.clearTelemetryProcessors=function(){this._telemetryProcessors=[]},e.prototype.runTelemetryProcessors=function(t,r){var n=!0,i=this._telemetryProcessors.length;if(i===0)return n;r=r||{},r.correlationContext=oar.CorrelationContextManager.getCurrentContext();for(var a=0;a<i;++a)try{var o=this._telemetryProcessors[a];if(o&&o.apply(null,[t,r])===!1){n=!1;break}}catch(s){n=!0,Xne.warn(e.TAG,"One of telemetry processors failed, telemetry item will be sent.",s,t)}return n&&(t&&t.tags&&(t.tags=R2e.validateStringMap(t.tags)),t&&t.data&&t.data.baseData&&t.data.baseData.properties&&(t.data.baseData.properties=R2e.validateStringMap(t.data.baseData.properties))),n},e.prototype.getStatsbeat=function(){return this._statsbeat},e.TAG="TelemetryClient",e})();sar.exports=hmi});var par=v((L2e,lar)=>{"use strict";var mmi=L2e&&L2e.__extends||(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),gmi=car(),uar=hFe(),ymi=PI(),Jne=Ci(),vmi=(function(e){mmi(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.trackNodeHttpRequestSync=function(r){r&&r.request&&r.response&&r.duration?uar.trackRequestSync(this,r):Jne.warn("trackNodeHttpRequestSync requires NodeHttpRequestTelemetry object with request, response and duration specified.")},t.prototype.trackNodeHttpRequest=function(r){(r.duration||r.error)&&Jne.warn("trackNodeHttpRequest will ignore supplied duration and error parameters. These values are collected from the request and response objects."),r&&r.request&&r.response?uar.trackRequest(this,r):Jne.warn("trackNodeHttpRequest requires NodeHttpRequestTelemetry object with request and response specified.")},t.prototype.trackNodeHttpDependency=function(r){r&&r.request?ymi.trackRequest(this,r):Jne.warn("trackNodeHttpDependency requires NodeHttpDependencyTelemetry object with request specified.")},t})(gmi);lar.exports=vmi});var dar=v(far=>{"use strict";Object.defineProperty(far,"__esModule",{value:!0})});var V2e=v(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.Configuration=pe.liveMetricsClient=pe.defaultClient=pe.DistributedTracingModes=void 0;pe.setup=xmi;pe.start=gar;pe.getCorrelationContext=Dmi;pe.startOperation=Nmi;pe.wrapWithCorrelationContext=wmi;pe.dispose=Imi;var $2e=xb(),_mi=Ktr(),Emi=Xtr(),k2e=ene(),Tmi=eFe(),bmi=orr(),Smi=yrr(),Omi=PI(),Ami=hFe(),har=UA(),Gq=Ci(),mar=Jrr(),F2e=Zrr(),Cmi=rnr();pe.TelemetryClient=par();pe.Contracts=Xc();pe.azureFunctionsTypes=dar();var M2e;(function(e){e[e.AI=0]="AI",e[e.AI_AND_W3C=1]="AI_AND_W3C"})(M2e||(pe.DistributedTracingModes=M2e={}));var Hq,zq,Yq,Kq,Wq,QI,ZI,cC,Xq,Jq,jp=!1,Qne;function xmi(e){return pe.defaultClient?Gq.info("The default client is already setup"):(pe.defaultClient=new pe.TelemetryClient(e),Hq=new _mi(pe.defaultClient),zq=new Emi(pe.defaultClient),Yq=new k2e(pe.defaultClient),Kq=new Tmi(pe.defaultClient),Wq=new bmi(pe.defaultClient),QI=new Smi(pe.defaultClient),cC=new Ami(pe.defaultClient),Xq=new Omi(pe.defaultClient),ZI||(ZI=new F2e.AutoCollectNativePerformance(pe.defaultClient)),Jq=new Cmi.AzureFunctionsHook(pe.defaultClient)),U2e}function Pmi(){pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectExternalLoggers==null&&(pe.defaultClient.config.enableAutoCollectExternalLoggers=!0),pe.defaultClient.config.enableAutoCollectConsole==null&&(pe.defaultClient.config.enableAutoCollectConsole=!1),pe.defaultClient.config.enableAutoCollectExceptions==null&&(pe.defaultClient.config.enableAutoCollectExceptions=!0),pe.defaultClient.config.enableAutoCollectPerformance==null&&(pe.defaultClient.config.enableAutoCollectPerformance=!0),pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics==null&&(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics=!0),pe.defaultClient.config.enableAutoCollectHeartbeat==null&&(pe.defaultClient.config.enableAutoCollectHeartbeat=!0),pe.defaultClient.config.enableAutoCollectRequests==null&&(pe.defaultClient.config.enableAutoCollectRequests=!0),pe.defaultClient.config.enableAutoCollectDependencies==null&&(pe.defaultClient.config.enableAutoCollectDependencies=!0),pe.defaultClient.config.enableUseDiskRetryCaching==null&&(pe.defaultClient.config.enableUseDiskRetryCaching=!0),pe.defaultClient.config.enableAutoDependencyCorrelation==null&&(pe.defaultClient.config.enableAutoDependencyCorrelation=!0),pe.defaultClient.config.enableSendLiveMetrics==null&&(pe.defaultClient.config.enableSendLiveMetrics=!1),pe.defaultClient.config.enableAutoCollectExtendedMetrics==null&&(pe.defaultClient.config.enableAutoCollectExtendedMetrics=!0),pe.defaultClient.config.enableWebInstrumentation==null&&(pe.defaultClient.config.enableWebInstrumentation=!1),pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions==null&&(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions=!1))}function gar(){if(pe.defaultClient){jp=!0,Pmi(),Hq.enable(pe.defaultClient.config.enableAutoCollectExternalLoggers,pe.defaultClient.config.enableAutoCollectConsole),zq.enable(pe.defaultClient.config.enableAutoCollectExceptions),Yq.enable(pe.defaultClient.config.enableAutoCollectPerformance),Kq.enable(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics),Wq.enable(pe.defaultClient.config.enableAutoCollectHeartbeat),cC.useAutoCorrelation(pe.defaultClient.config.enableAutoDependencyCorrelation,pe.defaultClient.config.enableUseAsyncHooks),cC.enable(pe.defaultClient.config.enableAutoCollectRequests),Xq.enable(pe.defaultClient.config.enableAutoCollectDependencies),QI.enable(pe.defaultClient.config.enableWebInstrumentation,pe.defaultClient.config.webInstrumentationConnectionString),pe.defaultClient.config.enableSendLiveMetrics&&(pe.liveMetricsClient||(pe.liveMetricsClient=new mar(pe.defaultClient.config,pe.defaultClient.context,pe.defaultClient.getAuthorizationHandler,pe.defaultClient),Qne=new k2e(pe.liveMetricsClient,1e3,!0),pe.liveMetricsClient.addCollector(Qne),pe.defaultClient.quickPulseClient=pe.liveMetricsClient),pe.liveMetricsClient.enable(pe.defaultClient.config.enableSendLiveMetrics)),Jq.enable(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions);var e=F2e.AutoCollectNativePerformance.parseEnabled(pe.defaultClient.config.enableAutoCollectExtendedMetrics,pe.defaultClient.config);ZI.enable(pe.defaultClient.config.enableAutoCollectExtendedMetrics,e.disabledMetrics),pe.defaultClient&&pe.defaultClient.channel&&pe.defaultClient.channel.setUseDiskRetryCaching(pe.defaultClient.config.enableUseDiskRetryCaching,pe.defaultClient.config.enableResendInterval,pe.defaultClient.config.enableMaxBytesOnDisk)}else Gq.warn("Start cannot be called before setup");return U2e}function Dmi(){return $2e.CorrelationContextManager.getCurrentContext()}function Nmi(e,t){return $2e.CorrelationContextManager.startOperation(e,t)}function wmi(e,t){return $2e.CorrelationContextManager.wrapCallback(e,t)}var U2e=(function(){function e(){}return e.setDistributedTracingMode=function(t){return har.w3cEnabled=t===M2e.AI_AND_W3C,e},e.setAutoCollectConsole=function(t,r){return r===void 0&&(r=!1),pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectExternalLoggers=t,pe.defaultClient.config.enableAutoCollectConsole=r,jp&&Hq.enable(t,r)),e},e.setAutoCollectExceptions=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectExceptions=t,jp&&zq.enable(t)),e},e.setAutoCollectPerformance=function(t,r){if(r===void 0&&(r=!0),pe.defaultClient){pe.defaultClient.config.enableAutoCollectPerformance=t;var n=F2e.AutoCollectNativePerformance.parseEnabled(r,pe.defaultClient.config);pe.defaultClient.config.enableAutoCollectExtendedMetrics=n.isEnabled,jp&&(Yq.enable(t),ZI.enable(pe.defaultClient.config.enableAutoCollectExtendedMetrics,n.disabledMetrics))}return e},e.setAutoCollectPreAggregatedMetrics=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics=t,jp&&Kq.enable(t)),e},e.setAutoCollectHeartbeat=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectHeartbeat=t,jp&&Wq.enable(t)),e},e.enableAutoWebSnippetInjection=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableWebInstrumentation=t,pe.defaultClient.config.webInstrumentationConnectionString=r,jp&&QI.enable(pe.defaultClient.config.enableAutoWebSnippetInjection,pe.defaultClient.config.webSnippetConnectionString)),e},e.enableWebInstrumentation=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableWebInstrumentation=t,pe.defaultClient.config.webInstrumentationConnectionString=r,jp&&QI.enable(pe.defaultClient.config.enableWebInstrumentation,pe.defaultClient.config.webInstrumentationConnectionString)),e},e.setAutoCollectRequests=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectRequests=t,jp&&cC.enable(t)),e},e.setAutoCollectDependencies=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectDependencies=t,jp&&Xq.enable(t)),e},e.setAutoDependencyCorrelation=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableAutoDependencyCorrelation=t,pe.defaultClient.config.enableUseAsyncHooks=r,jp&&cC.useAutoCorrelation(t,r)),e},e.setUseDiskRetryCaching=function(t,r,n){return pe.defaultClient&&(pe.defaultClient.config.enableUseDiskRetryCaching=t,pe.defaultClient.config.enableResendInterval=r,pe.defaultClient.config.enableMaxBytesOnDisk=n,pe.defaultClient.channel&&pe.defaultClient.channel.setUseDiskRetryCaching(pe.defaultClient.config.enableUseDiskRetryCaching,pe.defaultClient.config.enableResendInterval,pe.defaultClient.config.enableMaxBytesOnDisk)),e},e.setInternalLogging=function(t,r){return t===void 0&&(t=!1),r===void 0&&(r=!0),Gq.enableDebug=t,Gq.disableWarnings=!r,e},e.setAutoCollectIncomingRequestAzureFunctions=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions=t,jp&&Jq.enable(t)),e},e.setSendLiveMetrics=function(t){return t===void 0&&(t=!1),pe.defaultClient?(!pe.liveMetricsClient&&t?(pe.liveMetricsClient=new mar(pe.defaultClient.config,pe.defaultClient.context,pe.defaultClient.getAuthorizationHandler,pe.defaultClient),Qne=new k2e(pe.liveMetricsClient,1e3,!0),pe.liveMetricsClient.addCollector(Qne),pe.defaultClient.quickPulseClient=pe.liveMetricsClient):pe.liveMetricsClient&&pe.liveMetricsClient.enable(t),pe.defaultClient.config.enableSendLiveMetrics=t,e):(Gq.warn("Live metrics client cannot be setup without the default client"),e)},e.start=gar,e})();pe.Configuration=U2e;function Imi(){har.w3cEnabled=!0,pe.defaultClient=null,jp=!1,Hq&&Hq.dispose(),zq&&zq.dispose(),Yq&&Yq.dispose(),Kq&&Kq.dispose(),Wq&&Wq.dispose(),QI&&QI.dispose(),ZI&&ZI.dispose(),cC&&cC.dispose(),Xq&&Xq.dispose(),pe.liveMetricsClient&&(pe.liveMetricsClient.enable(!1),pe.liveMetricsClient=void 0),Jq&&Jq.dispose()}});var eie=v(Zne=>{"use strict";Object.defineProperty(Zne,"__esModule",{value:!0});Zne.EventHeader=void 0;var j2e=class{extensionName;eventName;constructor(t,r){this.extensionName=t,this.eventName=r}getExtensionName(){return this.extensionName}getEventName(){return this.eventName}toString(){return`${this.extensionName}/${this.eventName}`}};Zne.EventHeader=j2e});var rie=v(tie=>{"use strict";Object.defineProperty(tie,"__esModule",{value:!0});tie.SampleRate=void 0;var yar;(function(e){e[e.OnePercent=0]="OnePercent",e[e.TenPercent=1]="TenPercent",e[e.NoSampling=2]="NoSampling"})(yar||(tie.SampleRate=yar={}))});var B2e=v(q2e=>{"use strict";Object.defineProperty(q2e,"__esModule",{value:!0});q2e.configAzureTelemetryClient=Rmi;function Rmi(e){e.channel.setUseDiskRetryCaching(!0),e.addTelemetryProcessor(t=>(t.tags["ai.location.ip"]="0.0.0.0",t.tags["ai.cloud.roleInstance"]="masked",t.tags["ai.cloud.role"]="masked",t.tags["ai.device.type"]="masked",!0))}});var _ar=v((yda,Lmi)=>{Lmi.exports={name:"@sap-ux/telemetry",version:"0.6.84",description:"Library for sending usage telemetry data",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/telemetry"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Atelemetry"},license:"Apache-2.0",private:!1,main:"dist/index.js",scripts:{build:"tsc --build",watch:"tsc --watch",clean:"rimraf --glob dist coverage *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","lint:fix":"eslint --fix",test:"jest --ci --forceExit --detectOpenHandles --colors","test-u":"jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",example:"ts-node example/index.ts"},dependencies:{"@sap-ux/store":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/nodejs-utils":"workspace:*",applicationinsights:"2.9.8",axios:"1.13.5","performance-now":"2.1.0",yaml:"2.3.3"},devDependencies:{"jest-extended":"6.0.0",memfs:"3.4.13",unionfs:"4.4.0",dotenv:"16.6.1"},files:["dist","LICENSE","!dist/*.map","!dist/**/*.map"],engines:{node:">=20.x"}}});var Qq=v(eR=>{"use strict";var Mmi=eR&&eR.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(eR,"__esModule",{value:!0});eR.TelemetrySettings=void 0;var Ear=Mmi(_ar());eR.TelemetrySettings={azureInstrumentationKey:"",telemetryEnabled:!0,telemetryLibName:Ear.default.name,telemetryLibVersion:Ear.default.version,consumerModuleName:"",consumerModuleVersion:""}});var H2e=v(Bg=>{"use strict";var $mi=Bg&&Bg.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),kmi=Bg&&Bg.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Fmi=Bg&&Bg.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),i=0;i<n.length;i++)n[i]!=="default"&&$mi(r,t,n[i]);return kmi(r,t),r}})();Object.defineProperty(Bg,"__esModule",{value:!0});Bg.ApplicationInsightClient=void 0;var Umi=OLe(),Vmi=Fmi(V2e()),jmi=eie(),qg=rie(),qmi=B2e(),Tar=Qq(),G2e=class extends Umi.Client{clients;constructor(t,r,n){super(),this.clients=new Map,this.applicationKey=t,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(qg.SampleRate.OnePercent),a=this.createTelemetryClient(qg.SampleRate.TenPercent),o=this.createTelemetryClient(qg.SampleRate.NoSampling);this.clients.set(qg.SampleRate.OnePercent,i),this.clients.set(qg.SampleRate.TenPercent,a),this.clients.set(qg.SampleRate.NoSampling,o)}reportBlocking(t,r,n,i,a=!1){if(!a||Tar.TelemetrySettings.telemetryEnabled){let{client:o,event:s}=this.prepareClientAndEvent(t,r,n,i);return this.trackEventBlocking(o,s)}return Promise.resolve()}async report(t,r,n,i,a,o){if(o!==void 0&&!o||!Tar.TelemetrySettings.telemetryEnabled)return;let{client:s,event:c}=this.prepareClientAndEvent(t,r,n,i);this.trackEvent(s,c)}prepareClientAndEvent(t,r,n,i=qg.SampleRate.NoSampling){let a=this.clients.get(i),s={name:new jmi.EventHeader(this.extensionName,t).toString(),properties:r,measurements:n};return{client:a,event:s}}async trackEventBlocking(t,r){if(process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true")return new Promise((n,i)=>{try{t.trackEvent(r),t.flush({callback:()=>n()})}catch(a){i(a)}})}trackEvent(t,r){return process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"?(t.trackEvent(r),!0):!1}createTelemetryClient(t){let r;switch(t){case qg.SampleRate.OnePercent:r=1;break;case qg.SampleRate.TenPercent:r=10;break;case qg.SampleRate.NoSampling:default:r=100;break}let n=new Vmi.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,(0,qmi.configAzureTelemetryClient)(n),n}};Bg.ApplicationInsightClient=G2e});var bar=v(nie=>{"use strict";Object.defineProperty(nie,"__esModule",{value:!0});nie.localDatetimeToUTC=void 0;var Bmi=()=>{let e=new Date().getTime();return new Date(e).toISOString()};nie.localDatetimeToUTC=Bmi});var Aar=v(iie=>{"use strict";Object.defineProperty(iie,"__esModule",{value:!0});iie.ToolsSuiteTelemetryClient=void 0;var Gmi=H2e(),Sar=aie(),Oar=bar(),z2e=class extends Gmi.ApplicationInsightClient{constructor(t,r,n){super(t,r,n)}async report(t,r,n,i,a,o){let s=await(0,Sar.processToolsSuiteTelemetry)(a),c={v:this.extensionVersion,datetime:(0,Oar.localDatetimeToUTC)()},u={...r,...s,...c};await super.report(t,u,n,i,a,o)}async reportEvent(t,r,n,i){let{finalProperties:a,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(t,n);return super.report(t.eventName,a,o,r,n,i)}async reportEventBlocking(t,r,n,i){let{finalProperties:a,finalMeasurements:o}=await this.collectToolsSuiteTelemetry(t,n);return super.reportBlocking(t.eventName,a,o,r,i)}async collectToolsSuiteTelemetry(t,r){let n=await(0,Sar.processToolsSuiteTelemetry)(r),i={v:this.extensionVersion,datetime:(0,Oar.localDatetimeToUTC)()},a={...t.properties,...n,...i},o={...t.measurements};return{finalProperties:a,finalMeasurements:o}}};iie.ToolsSuiteTelemetryClient=z2e});var qn=v(rc=>{"use strict";var Y2e=Symbol.for("yaml.alias"),Car=Symbol.for("yaml.document"),oie=Symbol.for("yaml.map"),xar=Symbol.for("yaml.pair"),K2e=Symbol.for("yaml.scalar"),sie=Symbol.for("yaml.seq"),E_=Symbol.for("yaml.node.type"),Hmi=e=>!!e&&typeof e=="object"&&e[E_]===Y2e,zmi=e=>!!e&&typeof e=="object"&&e[E_]===Car,Ymi=e=>!!e&&typeof e=="object"&&e[E_]===oie,Kmi=e=>!!e&&typeof e=="object"&&e[E_]===xar,Par=e=>!!e&&typeof e=="object"&&e[E_]===K2e,Wmi=e=>!!e&&typeof e=="object"&&e[E_]===sie;function Dar(e){if(e&&typeof e=="object")switch(e[E_]){case oie:case sie:return!0}return!1}function Xmi(e){if(e&&typeof e=="object")switch(e[E_]){case Y2e:case oie:case K2e:case sie:return!0}return!1}var Jmi=e=>(Par(e)||Dar(e))&&!!e.anchor;rc.ALIAS=Y2e;rc.DOC=Car;rc.MAP=oie;rc.NODE_TYPE=E_;rc.PAIR=xar;rc.SCALAR=K2e;rc.SEQ=sie;rc.hasAnchor=Jmi;rc.isAlias=Hmi;rc.isCollection=Dar;rc.isDocument=zmi;rc.isMap=Ymi;rc.isNode=Xmi;rc.isPair=Kmi;rc.isScalar=Par;rc.isSeq=Wmi});var Zq=v(W2e=>{"use strict";var ts=qn(),zl=Symbol("break visit"),Nar=Symbol("skip children"),Gg=Symbol("remove node");function cie(e,t){let r=war(t);ts.isDocument(e)?tR(null,e.contents,r,Object.freeze([e]))===Gg&&(e.contents=null):tR(null,e,r,Object.freeze([]))}cie.BREAK=zl;cie.SKIP=Nar;cie.REMOVE=Gg;function tR(e,t,r,n){let i=Iar(e,t,r,n);if(ts.isNode(i)||ts.isPair(i))return Rar(e,n,i),tR(e,i,r,n);if(typeof i!="symbol"){if(ts.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=tR(a,t.items[a],r,n);if(typeof o=="number")a=o-1;else{if(o===zl)return zl;o===Gg&&(t.items.splice(a,1),a-=1)}}}else if(ts.isPair(t)){n=Object.freeze(n.concat(t));let a=tR("key",t.key,r,n);if(a===zl)return zl;a===Gg&&(t.key=null);let o=tR("value",t.value,r,n);if(o===zl)return zl;o===Gg&&(t.value=null)}}return i}async function uie(e,t){let r=war(t);ts.isDocument(e)?await rR(null,e.contents,r,Object.freeze([e]))===Gg&&(e.contents=null):await rR(null,e,r,Object.freeze([]))}uie.BREAK=zl;uie.SKIP=Nar;uie.REMOVE=Gg;async function rR(e,t,r,n){let i=await Iar(e,t,r,n);if(ts.isNode(i)||ts.isPair(i))return Rar(e,n,i),rR(e,i,r,n);if(typeof i!="symbol"){if(ts.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=await rR(a,t.items[a],r,n);if(typeof o=="number")a=o-1;else{if(o===zl)return zl;o===Gg&&(t.items.splice(a,1),a-=1)}}}else if(ts.isPair(t)){n=Object.freeze(n.concat(t));let a=await rR("key",t.key,r,n);if(a===zl)return zl;a===Gg&&(t.key=null);let o=await rR("value",t.value,r,n);if(o===zl)return zl;o===Gg&&(t.value=null)}}return i}function war(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Iar(e,t,r,n){if(typeof r=="function")return r(e,t,n);if(ts.isMap(t))return r.Map?.(e,t,n);if(ts.isSeq(t))return r.Seq?.(e,t,n);if(ts.isPair(t))return r.Pair?.(e,t,n);if(ts.isScalar(t))return r.Scalar?.(e,t,n);if(ts.isAlias(t))return r.Alias?.(e,t,n)}function Rar(e,t,r){let n=t[t.length-1];if(ts.isCollection(n))n.items[e]=r;else if(ts.isPair(n))e==="key"?n.key=r:n.value=r;else if(ts.isDocument(n))n.contents=r;else{let i=ts.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}W2e.visit=cie;W2e.visitAsync=uie});var X2e=v(Mar=>{"use strict";var Lar=qn(),Qmi=Zq(),Zmi={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},egi=e=>e.replace(/[!,[\]{}]/g,t=>Zmi[t]),eB=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let n=t.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[a,o]=n;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[a]=n;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=t.match(/^(.*!)([^!]*)$/);i||r(`The ${t} tag has no suffix`);let a=this.tags[n];if(a)try{return a+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,n]of Object.entries(this.tags))if(t.startsWith(n))return r+egi(t.substring(n.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(t&&n.length>0&&Lar.isNode(t.contents)){let a={};Qmi.visit(t.contents,(o,s)=>{Lar.isNode(s)&&s.tag&&(a[s.tag]=!0)}),i=Object.keys(a)}else i=[];for(let[a,o]of n)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(s=>s.startsWith(o)))&&r.push(`%TAG ${a} ${o}`);return r.join(`
1445
1445
  `)}};eB.defaultYaml={explicit:!1,version:"1.2"};eB.defaultTags={"!!":"tag:yaml.org,2002:"};Mar.Directives=eB});var lie=v(tB=>{"use strict";var $ar=qn(),tgi=Zq();function rgi(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function kar(e){let t=new Set;return tgi.visit(e,{Value(r,n){n.anchor&&t.add(n.anchor)}}),t}function Far(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function ngi(e,t){let r=[],n=new Map,i=null;return{onAnchor:a=>{r.push(a),i||(i=kar(e));let o=Far(t,i);return i.add(o),o},setAnchors:()=>{for(let a of r){let o=n.get(a);if(typeof o=="object"&&o.anchor&&($ar.isScalar(o.node)||$ar.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:n}}tB.anchorIsValid=rgi;tB.anchorNames=kar;tB.createNodeAnchors=ngi;tB.findNewAnchor=Far});var J2e=v(Uar=>{"use strict";function rB(e,t,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,a=n.length;i<a;++i){let o=n[i],s=rB(e,n,String(i),o);s===void 0?delete n[i]:s!==o&&(n[i]=s)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let a=n.get(i),o=rB(e,n,i,a);o===void 0?n.delete(i):o!==a&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let a=rB(e,n,i,i);a===void 0?n.delete(i):a!==i&&(n.delete(i),n.add(a))}else for(let[i,a]of Object.entries(n)){let o=rB(e,n,i,a);o===void 0?delete n[i]:o!==a&&(n[i]=o)}return e.call(t,r,n)}Uar.applyReviver=rB});var Fb=v(jar=>{"use strict";var igi=qn();function Var(e,t,r){if(Array.isArray(e))return e.map((n,i)=>Var(n,String(i),r));if(e&&typeof e.toJSON=="function"){if(!r||!igi.hasAnchor(e))return e.toJSON(t,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(e,n),r.onCreate=a=>{n.res=a,delete r.onCreate};let i=e.toJSON(t,r);return r.onCreate&&r.onCreate(i),i}return typeof e=="bigint"&&!r?.keep?Number(e):e}jar.toJS=Var});var pie=v(Bar=>{"use strict";var agi=J2e(),qar=qn(),ogi=Fb(),Q2e=class{constructor(t){Object.defineProperty(this,qar.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:a}={}){if(!qar.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},s=ogi.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:u}of o.anchors.values())i(u,c);return typeof a=="function"?agi.applyReviver(a,{"":s},"",s):s}};Bar.NodeBase=Q2e});var nB=v(Har=>{"use strict";var sgi=lie(),Gar=Zq(),fie=qn(),cgi=pie(),ugi=Fb(),Z2e=class extends cgi.NodeBase{constructor(t){super(fie.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t){let r;return Gar.visit(t,{Node:(n,i)=>{if(i===this)return Gar.visit.BREAK;i.anchor===this.source&&(r=i)}}),r}toJSON(t,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:a}=r,o=this.resolve(i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=n.get(o);if(s||(ugi.toJS(o,null,r),s=n.get(o)),!s||s.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=die(i,o,n)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(t,r,n){let i=`*${this.source}`;if(t){if(sgi.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${i} `}return i}};function die(e,t,r){if(fie.isAlias(t)){let n=t.resolve(e),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(fie.isCollection(t)){let n=0;for(let i of t.items){let a=die(e,i,r);a>n&&(n=a)}return n}else if(fie.isPair(t)){let n=die(e,t.key,r),i=die(e,t.value,r);return Math.max(n,i)}return 1}Har.Alias=Z2e});var Lo=v(eUe=>{"use strict";var lgi=qn(),pgi=pie(),fgi=Fb(),dgi=e=>!e||typeof e!="function"&&typeof e!="object",Ub=class extends pgi.NodeBase{constructor(t){super(lgi.SCALAR),this.value=t}toJSON(t,r){return r?.keep?this.value:fgi.toJS(this.value,t,r)}toString(){return String(this.value)}};Ub.BLOCK_FOLDED="BLOCK_FOLDED";Ub.BLOCK_LITERAL="BLOCK_LITERAL";Ub.PLAIN="PLAIN";Ub.QUOTE_DOUBLE="QUOTE_DOUBLE";Ub.QUOTE_SINGLE="QUOTE_SINGLE";eUe.Scalar=Ub;eUe.isScalarValue=dgi});var iB=v(Yar=>{"use strict";var hgi=nB(),uC=qn(),zar=Lo(),mgi="tag:yaml.org,2002:";function ggi(e,t,r){if(t){let n=r.filter(a=>a.tag===t),i=n.find(a=>!a.format)??n[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return r.find(n=>n.identify?.(e)&&!n.format)}function ygi(e,t,r){if(uC.isDocument(e)&&(e=e.contents),uC.isNode(e))return e;if(uC.isPair(e)){let p=r.schema[uC.MAP].createNode?.(r.schema,null,r);return p.items.push(e),p}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=r,c;if(n&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor||(c.anchor=i(e)),new hgi.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=mgi+t.slice(2));let u=ggi(e,t,o.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let p=new zar.Scalar(e);return c&&(c.node=p),p}u=e instanceof Map?o[uC.MAP]:Symbol.iterator in Object(e)?o[uC.SEQ]:o[uC.MAP]}a&&(a(u),delete r.onTagObj);let l=u?.createNode?u.createNode(r.schema,e,r):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(r.schema,e,r):new zar.Scalar(e);return t?l.tag=t:u.default||(l.tag=u.tag),c&&(c.node=l),l}Yar.createNode=ygi});var aB=v(mie=>{"use strict";var vgi=iB(),Hg=qn(),_gi=pie();function tUe(e,t,r){let n=r;for(let i=t.length-1;i>=0;--i){let a=t[i];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=n,n=o}else n=new Map([[a,n]])}return vgi.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Kar=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,hie=class extends _gi.NodeBase{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(n=>Hg.isNode(n)||Hg.isPair(n)?n.clone(t):n),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(Kar(t))this.add(r);else{let[n,...i]=t,a=this.get(n,!0);if(Hg.isCollection(a))a.addIn(i,r);else if(a===void 0&&this.schema)this.set(n,tUe(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(t){let[r,...n]=t;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Hg.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(t,r){let[n,...i]=t,a=this.get(n,!0);return i.length===0?!r&&Hg.isScalar(a)?a.value:a:Hg.isCollection(a)?a.getIn(i,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!Hg.isPair(r))return!1;let n=r.value;return n==null||t&&Hg.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(t){let[r,...n]=t;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Hg.isCollection(i)?i.hasIn(n):!1}setIn(t,r){let[n,...i]=t;if(i.length===0)this.set(n,r);else{let a=this.get(n,!0);if(Hg.isCollection(a))a.setIn(i,r);else if(a===void 0&&this.schema)this.set(n,tUe(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};hie.maxFlowStringSingleLineLength=60;mie.Collection=hie;mie.collectionFromPath=tUe;mie.isEmptyPath=Kar});var oB=v(gie=>{"use strict";var Egi=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function rUe(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Tgi=(e,t,r)=>e.endsWith(`
1446
1446
  `)?rUe(r,t):r.includes(`
1447
1447
  `)?`
@@ -1607,7 +1607,7 @@ ${n.message}`:d,T=[_,t,e].filter(Boolean).join(`
1607
1607
 
1608
1608
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let p=l[1];if(t===l[0]){o(l);continue}if(n.external){let h=n.external.registry.get(l[0])?.id;if(t!==l[0]&&h){o(l);continue}}if(this.metadataRegistry.get(l[0])?.id){o(l);continue}if(p.cycle){o(l);continue}if(p.count>1&&n.reused==="ref"){o(l);continue}}let s=(l,p)=>{let f=this.seen.get(l),h=f.def??f.schema,d={...h};if(f.ref===null)return;let m=f.ref;if(f.ref=null,m){s(m,p);let _=this.seen.get(m).schema;_.$ref&&(p.target==="draft-7"||p.target==="draft-4"||p.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(_)):(Object.assign(h,_),Object.assign(h,d))}f.isParent||this.override({zodSchema:l,jsonSchema:h,path:f.path??[]})};for(let l of[...this.seen.entries()].reverse())s(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(t)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,i.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let p=l[1];p.def&&p.defId&&(u[p.defId]=p.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function gS(e,t){if(e instanceof px){let n=new jL(t),i={};for(let s of e._idmap.entries()){let[c,u]=s;n.process(u)}let a={},o={registry:e,uri:t?.uri,defs:i};for(let s of e._idmap.entries()){let[c,u]=s;a[c]=n.emit(u,{...t,external:o})}if(Object.keys(i).length>0){let s=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:i}}return{schemas:a}}let r=new jL(t);return r.process(e),r.emit(e,t)}function nu(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return nu(n.element,r);if(n.type==="set")return nu(n.valueType,r);if(n.type==="lazy")return nu(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return nu(n.innerType,r);if(n.type==="intersection")return nu(n.left,r)||nu(n.right,r);if(n.type==="record"||n.type==="map")return nu(n.keyType,r)||nu(n.valueType,r);if(n.type==="pipe")return nu(n.in,r)||nu(n.out,r);if(n.type==="object"){for(let i in n.shape)if(nu(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(nu(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(nu(i,r))return!0;return!!(n.rest&&nu(n.rest,r))}return!1}var _4e={};function Cx(e){return!!e._zod}function z_(e,t){return Cx(e)?lS(e,t):e.safeParse(t)}function ZG(e){if(!e)return;let t;if(Cx(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function b4e(e){if(Cx(e)){let a=e._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var yS={};Fo(yS,{$brand:()=>rL,$input:()=>uG,$output:()=>cG,NEVER:()=>I3,TimePrecision:()=>dG,ZodAny:()=>D4e,ZodArray:()=>R4e,ZodBase64:()=>jce,ZodBase64URL:()=>qce,ZodBigInt:()=>YL,ZodBigIntFormat:()=>Hce,ZodBoolean:()=>zL,ZodCIDRv4:()=>Uce,ZodCIDRv6:()=>Vce,ZodCUID:()=>Ice,ZodCUID2:()=>Rce,ZodCatch:()=>X4e,ZodCodec:()=>Zce,ZodCustom:()=>fH,ZodCustomStringFormat:()=>GL,ZodDate:()=>uH,ZodDefault:()=>G4e,ZodDiscriminatedUnion:()=>L4e,ZodE164:()=>Bce,ZodEmail:()=>Pce,ZodEmoji:()=>Nce,ZodEnum:()=>qL,ZodError:()=>dce,ZodFile:()=>j4e,ZodFirstPartyTypeKind:()=>tue,ZodFunction:()=>aGe,ZodGUID:()=>iH,ZodIPv4:()=>kce,ZodIPv6:()=>Fce,ZodISODate:()=>tH,ZodISODateTime:()=>eH,ZodISODuration:()=>nH,ZodISOTime:()=>rH,ZodIntersection:()=>M4e,ZodIssueCode:()=>GTr,ZodJWT:()=>Gce,ZodKSUID:()=>$ce,ZodLazy:()=>rGe,ZodLiteral:()=>V4e,ZodMAC:()=>A4e,ZodMap:()=>F4e,ZodNaN:()=>Q4e,ZodNanoID:()=>wce,ZodNever:()=>w4e,ZodNonOptional:()=>Jce,ZodNull:()=>P4e,ZodNullable:()=>B4e,ZodNumber:()=>HL,ZodNumberFormat:()=>Px,ZodObject:()=>lH,ZodOptional:()=>Xce,ZodPipe:()=>Qce,ZodPrefault:()=>z4e,ZodPromise:()=>iGe,ZodReadonly:()=>Z4e,ZodRealError:()=>Hu,ZodRecord:()=>Kce,ZodSet:()=>U4e,ZodString:()=>BL,ZodStringFormat:()=>bi,ZodSuccess:()=>W4e,ZodSymbol:()=>C4e,ZodTemplateLiteral:()=>tGe,ZodTransform:()=>q4e,ZodTuple:()=>$4e,ZodType:()=>Nr,ZodULID:()=>Lce,ZodURL:()=>sH,ZodUUID:()=>py,ZodUndefined:()=>x4e,ZodUnion:()=>Yce,ZodUnknown:()=>N4e,ZodVoid:()=>I4e,ZodXID:()=>Mce,_ZodString:()=>xce,_default:()=>H4e,_function:()=>kTr,any:()=>cH,array:()=>qt,base64:()=>aTr,base64url:()=>oTr,bigint:()=>yTr,boolean:()=>ji,catch:()=>J4e,check:()=>FTr,cidrv4:()=>nTr,cidrv6:()=>iTr,clone:()=>Ds,codec:()=>LTr,coerce:()=>rue,config:()=>Oa,core:()=>sp,cuid:()=>WEr,cuid2:()=>XEr,custom:()=>eue,date:()=>STr,decode:()=>_ce,decodeAsync:()=>Tce,describe:()=>UTr,discriminatedUnion:()=>pH,e164:()=>sTr,email:()=>VEr,emoji:()=>YEr,encode:()=>vce,encodeAsync:()=>Ece,endsWith:()=>Ex,enum:()=>fi,file:()=>NTr,flattenError:()=>QC,float32:()=>dTr,float64:()=>hTr,formatError:()=>ZC,function:()=>kTr,getErrorMap:()=>zTr,globalRegistry:()=>sc,gt:()=>zh,gte:()=>cc,guid:()=>jEr,hash:()=>fTr,hex:()=>pTr,hostname:()=>lTr,httpUrl:()=>zEr,includes:()=>vx,instanceof:()=>jTr,int:()=>Cce,int32:()=>mTr,int64:()=>vTr,intersection:()=>WL,ipv4:()=>eTr,ipv6:()=>rTr,iso:()=>xx,json:()=>BTr,jwt:()=>cTr,keyof:()=>OTr,ksuid:()=>ZEr,lazy:()=>nGe,length:()=>hS,literal:()=>ht,locales:()=>lx,looseObject:()=>uc,lowercase:()=>gx,lt:()=>Hh,lte:()=>Gu,mac:()=>tTr,map:()=>xTr,maxLength:()=>dS,maxSize:()=>fS,meta:()=>VTr,mime:()=>Tx,minLength:()=>ly,minSize:()=>H_,multipleOf:()=>G_,nan:()=>RTr,nanoid:()=>KEr,nativeEnum:()=>DTr,negative:()=>qG,never:()=>zce,nonnegative:()=>GG,nonoptional:()=>K4e,nonpositive:()=>BG,normalize:()=>bx,null:()=>KL,nullable:()=>aH,nullish:()=>wTr,number:()=>Cn,object:()=>$e,optional:()=>Hn,overwrite:()=>Dd,parse:()=>hce,parseAsync:()=>mce,partialRecord:()=>CTr,pipe:()=>oH,positive:()=>jG,prefault:()=>Y4e,preprocess:()=>dH,prettifyError:()=>$3,promise:()=>$Tr,property:()=>HG,readonly:()=>eGe,record:()=>zn,refine:()=>oGe,regex:()=>mx,regexes:()=>Bu,registry:()=>_L,safeDecode:()=>Sce,safeDecodeAsync:()=>Ace,safeEncode:()=>bce,safeEncodeAsync:()=>Oce,safeParse:()=>gce,safeParseAsync:()=>yce,set:()=>PTr,setErrorMap:()=>HTr,size:()=>hx,slugify:()=>VL,startsWith:()=>_x,strictObject:()=>ATr,string:()=>te,stringFormat:()=>uTr,stringbool:()=>qTr,success:()=>ITr,superRefine:()=>sGe,symbol:()=>ETr,templateLiteral:()=>MTr,toJSONSchema:()=>gS,toLowerCase:()=>Ox,toUpperCase:()=>Ax,transform:()=>Wce,treeifyError:()=>M3,trim:()=>Sx,tuple:()=>k4e,uint32:()=>gTr,uint64:()=>_Tr,ulid:()=>JEr,undefined:()=>TTr,union:()=>hn,unknown:()=>Mn,uppercase:()=>yx,url:()=>Dce,util:()=>Ue,uuid:()=>qEr,uuidv4:()=>BEr,uuidv6:()=>GEr,uuidv7:()=>HEr,void:()=>bTr,xid:()=>QEr});var xx={};Fo(xx,{ZodISODate:()=>tH,ZodISODateTime:()=>eH,ZodISODuration:()=>nH,ZodISOTime:()=>rH,date:()=>lce,datetime:()=>uce,duration:()=>fce,time:()=>pce});var eH=ne("ZodISODateTime",(e,t)=>{l4.init(e,t),bi.init(e,t)});function uce(e){return hG(eH,e)}var tH=ne("ZodISODate",(e,t)=>{p4.init(e,t),bi.init(e,t)});function lce(e){return mG(tH,e)}var rH=ne("ZodISOTime",(e,t)=>{f4.init(e,t),bi.init(e,t)});function pce(e){return gG(rH,e)}var nH=ne("ZodISODuration",(e,t)=>{d4.init(e,t),bi.init(e,t)});function fce(e){return yG(nH,e)}var O4e=(e,t)=>{uL.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ZC(e,r)},flatten:{value:r=>QC(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,WC,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,WC,2)}},isEmpty:{get(){return e.issues.length===0}}})},dce=ne("ZodError",O4e),Hu=ne("ZodError",O4e,{Parent:Error});var hce=ex(Hu),mce=rx(Hu),gce=ix(Hu),yce=ax(Hu),vce=k3(Hu),_ce=F3(Hu),Ece=U3(Hu),Tce=V3(Hu),bce=j3(Hu),Sce=q3(Hu),Oce=B3(Hu),Ace=G3(Hu);var Nr=ne("ZodType",(e,t)=>(Jt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Ue.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>Ds(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>hce(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>gce(e,r,n),e.parseAsync=async(r,n)=>mce(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>yce(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>vce(e,r,n),e.decode=(r,n)=>_ce(e,r,n),e.encodeAsync=async(r,n)=>Ece(e,r,n),e.decodeAsync=async(r,n)=>Tce(e,r,n),e.safeEncode=(r,n)=>bce(e,r,n),e.safeDecode=(r,n)=>Sce(e,r,n),e.safeEncodeAsync=async(r,n)=>Oce(e,r,n),e.safeDecodeAsync=async(r,n)=>Ace(e,r,n),e.refine=(r,n)=>e.check(oGe(r,n)),e.superRefine=r=>e.check(sGe(r)),e.overwrite=r=>e.check(Dd(r)),e.optional=()=>Hn(e),e.nullable=()=>aH(e),e.nullish=()=>Hn(aH(e)),e.nonoptional=r=>K4e(e,r),e.array=()=>qt(e),e.or=r=>hn([e,r]),e.and=r=>WL(e,r),e.transform=r=>oH(e,Wce(r)),e.default=r=>H4e(e,r),e.prefault=r=>Y4e(e,r),e.catch=r=>J4e(e,r),e.pipe=r=>oH(e,r),e.readonly=()=>eGe(e),e.describe=r=>{let n=e.clone();return sc.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return sc.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return sc.get(e);let n=e.clone();return sc.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),xce=ne("_ZodString",(e,t)=>{B_.init(e,t),Nr.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(mx(...n)),e.includes=(...n)=>e.check(vx(...n)),e.startsWith=(...n)=>e.check(_x(...n)),e.endsWith=(...n)=>e.check(Ex(...n)),e.min=(...n)=>e.check(ly(...n)),e.max=(...n)=>e.check(dS(...n)),e.length=(...n)=>e.check(hS(...n)),e.nonempty=(...n)=>e.check(ly(1,...n)),e.lowercase=n=>e.check(gx(n)),e.uppercase=n=>e.check(yx(n)),e.trim=()=>e.check(Sx()),e.normalize=(...n)=>e.check(bx(...n)),e.toLowerCase=()=>e.check(Ox()),e.toUpperCase=()=>e.check(Ax()),e.slugify=()=>e.check(VL())}),BL=ne("ZodString",(e,t)=>{B_.init(e,t),xce.init(e,t),e.email=r=>e.check(EL(Pce,r)),e.url=r=>e.check(dx(sH,r)),e.jwt=r=>e.check(UL(Gce,r)),e.emoji=r=>e.check(AL(Nce,r)),e.guid=r=>e.check(fx(iH,r)),e.uuid=r=>e.check(TL(py,r)),e.uuidv4=r=>e.check(bL(py,r)),e.uuidv6=r=>e.check(SL(py,r)),e.uuidv7=r=>e.check(OL(py,r)),e.nanoid=r=>e.check(CL(wce,r)),e.guid=r=>e.check(fx(iH,r)),e.cuid=r=>e.check(xL(Ice,r)),e.cuid2=r=>e.check(PL(Rce,r)),e.ulid=r=>e.check(DL(Lce,r)),e.base64=r=>e.check($L(jce,r)),e.base64url=r=>e.check(kL(qce,r)),e.xid=r=>e.check(NL(Mce,r)),e.ksuid=r=>e.check(wL($ce,r)),e.ipv4=r=>e.check(IL(kce,r)),e.ipv6=r=>e.check(RL(Fce,r)),e.cidrv4=r=>e.check(LL(Uce,r)),e.cidrv6=r=>e.check(ML(Vce,r)),e.e164=r=>e.check(FL(Bce,r)),e.datetime=r=>e.check(uce(r)),e.date=r=>e.check(lce(r)),e.time=r=>e.check(pce(r)),e.duration=r=>e.check(fce(r))});function te(e){return lG(BL,e)}var bi=ne("ZodStringFormat",(e,t)=>{ri.init(e,t),xce.init(e,t)}),Pce=ne("ZodEmail",(e,t)=>{t4.init(e,t),bi.init(e,t)});function VEr(e){return EL(Pce,e)}var iH=ne("ZodGUID",(e,t)=>{Z3.init(e,t),bi.init(e,t)});function jEr(e){return fx(iH,e)}var py=ne("ZodUUID",(e,t)=>{e4.init(e,t),bi.init(e,t)});function qEr(e){return TL(py,e)}function BEr(e){return bL(py,e)}function GEr(e){return SL(py,e)}function HEr(e){return OL(py,e)}var sH=ne("ZodURL",(e,t)=>{r4.init(e,t),bi.init(e,t)});function Dce(e){return dx(sH,e)}function zEr(e){return dx(sH,{protocol:/^https?$/,hostname:Bu.domain,...Ue.normalizeParams(e)})}var Nce=ne("ZodEmoji",(e,t)=>{n4.init(e,t),bi.init(e,t)});function YEr(e){return AL(Nce,e)}var wce=ne("ZodNanoID",(e,t)=>{i4.init(e,t),bi.init(e,t)});function KEr(e){return CL(wce,e)}var Ice=ne("ZodCUID",(e,t)=>{a4.init(e,t),bi.init(e,t)});function WEr(e){return xL(Ice,e)}var Rce=ne("ZodCUID2",(e,t)=>{o4.init(e,t),bi.init(e,t)});function XEr(e){return PL(Rce,e)}var Lce=ne("ZodULID",(e,t)=>{s4.init(e,t),bi.init(e,t)});function JEr(e){return DL(Lce,e)}var Mce=ne("ZodXID",(e,t)=>{c4.init(e,t),bi.init(e,t)});function QEr(e){return NL(Mce,e)}var $ce=ne("ZodKSUID",(e,t)=>{u4.init(e,t),bi.init(e,t)});function ZEr(e){return wL($ce,e)}var kce=ne("ZodIPv4",(e,t)=>{h4.init(e,t),bi.init(e,t)});function eTr(e){return IL(kce,e)}var A4e=ne("ZodMAC",(e,t)=>{g4.init(e,t),bi.init(e,t)});function tTr(e){return fG(A4e,e)}var Fce=ne("ZodIPv6",(e,t)=>{m4.init(e,t),bi.init(e,t)});function rTr(e){return RL(Fce,e)}var Uce=ne("ZodCIDRv4",(e,t)=>{y4.init(e,t),bi.init(e,t)});function nTr(e){return LL(Uce,e)}var Vce=ne("ZodCIDRv6",(e,t)=>{v4.init(e,t),bi.init(e,t)});function iTr(e){return ML(Vce,e)}var jce=ne("ZodBase64",(e,t)=>{_4.init(e,t),bi.init(e,t)});function aTr(e){return $L(jce,e)}var qce=ne("ZodBase64URL",(e,t)=>{E4.init(e,t),bi.init(e,t)});function oTr(e){return kL(qce,e)}var Bce=ne("ZodE164",(e,t)=>{T4.init(e,t),bi.init(e,t)});function sTr(e){return FL(Bce,e)}var Gce=ne("ZodJWT",(e,t)=>{b4.init(e,t),bi.init(e,t)});function cTr(e){return UL(Gce,e)}var GL=ne("ZodCustomStringFormat",(e,t)=>{S4.init(e,t),bi.init(e,t)});function uTr(e,t,r={}){return mS(GL,e,t,r)}function lTr(e){return mS(GL,"hostname",Bu.hostname,e)}function pTr(e){return mS(GL,"hex",Bu.hex,e)}function fTr(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=Bu[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return mS(GL,n,i,t)}var HL=ne("ZodNumber",(e,t)=>{dL.init(e,t),Nr.init(e,t),e.gt=(n,i)=>e.check(zh(n,i)),e.gte=(n,i)=>e.check(cc(n,i)),e.min=(n,i)=>e.check(cc(n,i)),e.lt=(n,i)=>e.check(Hh(n,i)),e.lte=(n,i)=>e.check(Gu(n,i)),e.max=(n,i)=>e.check(Gu(n,i)),e.int=n=>e.check(Cce(n)),e.safe=n=>e.check(Cce(n)),e.positive=n=>e.check(zh(0,n)),e.nonnegative=n=>e.check(cc(0,n)),e.negative=n=>e.check(Hh(0,n)),e.nonpositive=n=>e.check(Gu(0,n)),e.multipleOf=(n,i)=>e.check(G_(n,i)),e.step=(n,i)=>e.check(G_(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Cn(e){return vG(HL,e)}var Px=ne("ZodNumberFormat",(e,t)=>{O4.init(e,t),HL.init(e,t)});function Cce(e){return EG(Px,e)}function dTr(e){return TG(Px,e)}function hTr(e){return bG(Px,e)}function mTr(e){return SG(Px,e)}function gTr(e){return OG(Px,e)}var zL=ne("ZodBoolean",(e,t)=>{cx.init(e,t),Nr.init(e,t)});function ji(e){return AG(zL,e)}var YL=ne("ZodBigInt",(e,t)=>{hL.init(e,t),Nr.init(e,t),e.gte=(n,i)=>e.check(cc(n,i)),e.min=(n,i)=>e.check(cc(n,i)),e.gt=(n,i)=>e.check(zh(n,i)),e.gte=(n,i)=>e.check(cc(n,i)),e.min=(n,i)=>e.check(cc(n,i)),e.lt=(n,i)=>e.check(Hh(n,i)),e.lte=(n,i)=>e.check(Gu(n,i)),e.max=(n,i)=>e.check(Gu(n,i)),e.positive=n=>e.check(zh(BigInt(0),n)),e.negative=n=>e.check(Hh(BigInt(0),n)),e.nonpositive=n=>e.check(Gu(BigInt(0),n)),e.nonnegative=n=>e.check(cc(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(G_(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function yTr(e){return xG(YL,e)}var Hce=ne("ZodBigIntFormat",(e,t)=>{A4.init(e,t),YL.init(e,t)});function vTr(e){return DG(Hce,e)}function _Tr(e){return NG(Hce,e)}var C4e=ne("ZodSymbol",(e,t)=>{C4.init(e,t),Nr.init(e,t)});function ETr(e){return wG(C4e,e)}var x4e=ne("ZodUndefined",(e,t)=>{x4.init(e,t),Nr.init(e,t)});function TTr(e){return IG(x4e,e)}var P4e=ne("ZodNull",(e,t)=>{P4.init(e,t),Nr.init(e,t)});function KL(e){return RG(P4e,e)}var D4e=ne("ZodAny",(e,t)=>{D4.init(e,t),Nr.init(e,t)});function cH(){return LG(D4e)}var N4e=ne("ZodUnknown",(e,t)=>{N4.init(e,t),Nr.init(e,t)});function Mn(){return MG(N4e)}var w4e=ne("ZodNever",(e,t)=>{w4.init(e,t),Nr.init(e,t)});function zce(e){return $G(w4e,e)}var I4e=ne("ZodVoid",(e,t)=>{I4.init(e,t),Nr.init(e,t)});function bTr(e){return kG(I4e,e)}var uH=ne("ZodDate",(e,t)=>{R4.init(e,t),Nr.init(e,t),e.min=(n,i)=>e.check(cc(n,i)),e.max=(n,i)=>e.check(Gu(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function STr(e){return FG(uH,e)}var R4e=ne("ZodArray",(e,t)=>{L4.init(e,t),Nr.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(ly(r,n)),e.nonempty=r=>e.check(ly(1,r)),e.max=(r,n)=>e.check(dS(r,n)),e.length=(r,n)=>e.check(hS(r,n)),e.unwrap=()=>e.element});function qt(e,t){return cce(R4e,e,t)}function OTr(e){let t=e._zod.def.shape;return fi(Object.keys(t))}var lH=ne("ZodObject",(e,t)=>{sce.init(e,t),Nr.init(e,t),Ue.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>fi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Mn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Mn()}),e.strict=()=>e.clone({...e._zod.def,catchall:zce()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Ue.extend(e,r),e.safeExtend=r=>Ue.safeExtend(e,r),e.merge=r=>Ue.merge(e,r),e.pick=r=>Ue.pick(e,r),e.omit=r=>Ue.omit(e,r),e.partial=(...r)=>Ue.partial(Xce,e,r[0]),e.required=(...r)=>Ue.required(Jce,e,r[0])});function $e(e,t){let r={type:"object",shape:e??{},...Ue.normalizeParams(t)};return new lH(r)}function ATr(e,t){return new lH({type:"object",shape:e,catchall:zce(),...Ue.normalizeParams(t)})}function uc(e,t){return new lH({type:"object",shape:e,catchall:Mn(),...Ue.normalizeParams(t)})}var Yce=ne("ZodUnion",(e,t)=>{mL.init(e,t),Nr.init(e,t),e.options=t.options});function hn(e,t){return new Yce({type:"union",options:e,...Ue.normalizeParams(t)})}var L4e=ne("ZodDiscriminatedUnion",(e,t)=>{Yce.init(e,t),M4.init(e,t)});function pH(e,t,r){return new L4e({type:"union",options:t,discriminator:e,...Ue.normalizeParams(r)})}var M4e=ne("ZodIntersection",(e,t)=>{$4.init(e,t),Nr.init(e,t)});function WL(e,t){return new M4e({type:"intersection",left:e,right:t})}var $4e=ne("ZodTuple",(e,t)=>{gL.init(e,t),Nr.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function k4e(e,t,r){let n=t instanceof Jt,i=n?r:t,a=n?t:null;return new $4e({type:"tuple",items:e,rest:a,...Ue.normalizeParams(i)})}var Kce=ne("ZodRecord",(e,t)=>{k4.init(e,t),Nr.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function zn(e,t,r){return new Kce({type:"record",keyType:e,valueType:t,...Ue.normalizeParams(r)})}function CTr(e,t,r){let n=Ds(e);return n._zod.values=void 0,new Kce({type:"record",keyType:n,valueType:t,...Ue.normalizeParams(r)})}var F4e=ne("ZodMap",(e,t)=>{F4.init(e,t),Nr.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function xTr(e,t,r){return new F4e({type:"map",keyType:e,valueType:t,...Ue.normalizeParams(r)})}var U4e=ne("ZodSet",(e,t)=>{U4.init(e,t),Nr.init(e,t),e.min=(...r)=>e.check(H_(...r)),e.nonempty=r=>e.check(H_(1,r)),e.max=(...r)=>e.check(fS(...r)),e.size=(...r)=>e.check(hx(...r))});function PTr(e,t){return new U4e({type:"set",valueType:e,...Ue.normalizeParams(t)})}var qL=ne("ZodEnum",(e,t)=>{V4.init(e,t),Nr.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let a={};for(let o of n)if(r.has(o))a[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new qL({...t,checks:[],...Ue.normalizeParams(i),entries:a})},e.exclude=(n,i)=>{let a={...t.entries};for(let o of n)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new qL({...t,checks:[],...Ue.normalizeParams(i),entries:a})}});function fi(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new qL({type:"enum",entries:r,...Ue.normalizeParams(t)})}function DTr(e,t){return new qL({type:"enum",entries:e,...Ue.normalizeParams(t)})}var V4e=ne("ZodLiteral",(e,t)=>{j4.init(e,t),Nr.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ht(e,t){return new V4e({type:"literal",values:Array.isArray(e)?e:[e],...Ue.normalizeParams(t)})}var j4e=ne("ZodFile",(e,t)=>{q4.init(e,t),Nr.init(e,t),e.min=(r,n)=>e.check(H_(r,n)),e.max=(r,n)=>e.check(fS(r,n)),e.mime=(r,n)=>e.check(Tx(Array.isArray(r)?r:[r],n))});function NTr(e){return zG(j4e,e)}var q4e=ne("ZodTransform",(e,t)=>{B4.init(e,t),Nr.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new k_(e.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(Ue.issue(a,r.value,t));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(Ue.issue(o))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(a=>(r.value=a,r)):(r.value=i,r)}});function Wce(e){return new q4e({type:"transform",transform:e})}var Xce=ne("ZodOptional",(e,t)=>{G4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Hn(e){return new Xce({type:"optional",innerType:e})}var B4e=ne("ZodNullable",(e,t)=>{H4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function aH(e){return new B4e({type:"nullable",innerType:e})}function wTr(e){return Hn(aH(e))}var G4e=ne("ZodDefault",(e,t)=>{z4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function H4e(e,t){return new G4e({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ue.shallowClone(t)}})}var z4e=ne("ZodPrefault",(e,t)=>{Y4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Y4e(e,t){return new z4e({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ue.shallowClone(t)}})}var Jce=ne("ZodNonOptional",(e,t)=>{K4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function K4e(e,t){return new Jce({type:"nonoptional",innerType:e,...Ue.normalizeParams(t)})}var W4e=ne("ZodSuccess",(e,t)=>{W4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ITr(e){return new W4e({type:"success",innerType:e})}var X4e=ne("ZodCatch",(e,t)=>{X4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function J4e(e,t){return new X4e({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Q4e=ne("ZodNaN",(e,t)=>{J4.init(e,t),Nr.init(e,t)});function RTr(e){return VG(Q4e,e)}var Qce=ne("ZodPipe",(e,t)=>{Q4.init(e,t),Nr.init(e,t),e.in=t.in,e.out=t.out});function oH(e,t){return new Qce({type:"pipe",in:e,out:t})}var Zce=ne("ZodCodec",(e,t)=>{Qce.init(e,t),ux.init(e,t)});function LTr(e,t,r){return new Zce({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Z4e=ne("ZodReadonly",(e,t)=>{Z4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eGe(e){return new Z4e({type:"readonly",innerType:e})}var tGe=ne("ZodTemplateLiteral",(e,t)=>{eG.init(e,t),Nr.init(e,t)});function MTr(e,t){return new tGe({type:"template_literal",parts:e,...Ue.normalizeParams(t)})}var rGe=ne("ZodLazy",(e,t)=>{nG.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.getter()});function nGe(e){return new rGe({type:"lazy",getter:e})}var iGe=ne("ZodPromise",(e,t)=>{rG.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function $Tr(e){return new iGe({type:"promise",innerType:e})}var aGe=ne("ZodFunction",(e,t)=>{tG.init(e,t),Nr.init(e,t)});function kTr(e){return new aGe({type:"function",input:Array.isArray(e?.input)?k4e(e?.input):e?.input??qt(Mn()),output:e?.output??Mn()})}var fH=ne("ZodCustom",(e,t)=>{iG.init(e,t),Nr.init(e,t)});function FTr(e){let t=new pi({check:"custom"});return t._zod.check=e,t}function eue(e,t){return YG(fH,e??(()=>!0),t)}function oGe(e,t={}){return KG(fH,e,t)}function sGe(e){return WG(e)}var UTr=XG,VTr=JG;function jTr(e,t={error:`Input not instance of ${e.name}`}){let r=new fH({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...Ue.normalizeParams(t)});return r._zod.bag.Class=e,r}var qTr=(...e)=>QG({Codec:Zce,Boolean:zL,String:BL},...e);function BTr(e){let t=nGe(()=>hn([te(e),Cn(),ji(),KL(),qt(t),zn(te(),t)]));return t}function dH(e,t){return oH(Wce(e),t)}var GTr={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function HTr(e){Oa({customError:e})}function zTr(){return Oa().customError}var tue;tue||(tue={});var rue={};Fo(rue,{bigint:()=>XTr,boolean:()=>WTr,date:()=>JTr,number:()=>KTr,string:()=>YTr});function YTr(e){return pG(BL,e)}function KTr(e){return _G(HL,e)}function WTr(e){return CG(zL,e)}function XTr(e){return PG(YL,e)}function JTr(e){return UG(uH,e)}Oa(aG());var iue="2025-11-25";var cGe=[iue,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Y_="io.modelcontextprotocol/related-task",mH="2.0",Ns=eue(e=>e!==null&&(typeof e=="object"||typeof e=="function")),uGe=hn([te(),Cn().int()]),lGe=te(),MCi=uc({ttl:hn([Cn(),KL()]).optional(),pollInterval:Cn().optional()}),ZTr=$e({ttl:Cn().optional()}),ebr=$e({taskId:te()}),aue=uc({progressToken:uGe.optional(),[Y_]:ebr.optional()}),cp=$e({_meta:aue.optional()}),XL=cp.extend({task:ZTr.optional()}),pGe=e=>XL.safeParse(e).success,ws=$e({method:te(),params:cp.loose().optional()}),Qp=$e({_meta:aue.optional()}),Zp=$e({method:te(),params:Qp.loose().optional()}),Is=uc({_meta:aue.optional()}),gH=hn([te(),Cn().int()]),fGe=$e({jsonrpc:ht(mH),id:gH,...ws.shape}).strict(),oue=e=>fGe.safeParse(e).success,dGe=$e({jsonrpc:ht(mH),...Zp.shape}).strict(),hGe=e=>dGe.safeParse(e).success,sue=$e({jsonrpc:ht(mH),id:gH,result:Is}).strict(),JL=e=>sue.safeParse(e).success;var on;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(on||(on={}));var cue=$e({jsonrpc:ht(mH),id:gH.optional(),error:$e({code:Cn().int(),message:te(),data:Mn().optional()})}).strict();var mGe=e=>cue.safeParse(e).success;var gGe=hn([fGe,dGe,sue,cue]),$Ci=hn([sue,cue]),yH=Is.strict(),tbr=Qp.extend({requestId:gH.optional(),reason:te().optional()}),vH=Zp.extend({method:ht("notifications/cancelled"),params:tbr}),rbr=$e({src:te(),mimeType:te().optional(),sizes:qt(te()).optional(),theme:fi(["light","dark"]).optional()}),QL=$e({icons:qt(rbr).optional()}),Dx=$e({name:te(),title:te().optional()}),yGe=Dx.extend({...Dx.shape,...QL.shape,version:te(),websiteUrl:te().optional(),description:te().optional()}),nbr=WL($e({applyDefaults:ji().optional()}),zn(te(),Mn())),ibr=dH(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,WL($e({form:nbr.optional(),url:Ns.optional()}),zn(te(),Mn()).optional())),abr=uc({list:Ns.optional(),cancel:Ns.optional(),requests:uc({sampling:uc({createMessage:Ns.optional()}).optional(),elicitation:uc({create:Ns.optional()}).optional()}).optional()}),obr=uc({list:Ns.optional(),cancel:Ns.optional(),requests:uc({tools:uc({call:Ns.optional()}).optional()}).optional()}),sbr=$e({experimental:zn(te(),Ns).optional(),sampling:$e({context:Ns.optional(),tools:Ns.optional()}).optional(),elicitation:ibr.optional(),roots:$e({listChanged:ji().optional()}).optional(),tasks:abr.optional()}),cbr=cp.extend({protocolVersion:te(),capabilities:sbr,clientInfo:yGe}),ZL=ws.extend({method:ht("initialize"),params:cbr});var ubr=$e({experimental:zn(te(),Ns).optional(),logging:Ns.optional(),completions:Ns.optional(),prompts:$e({listChanged:ji().optional()}).optional(),resources:$e({subscribe:ji().optional(),listChanged:ji().optional()}).optional(),tools:$e({listChanged:ji().optional()}).optional(),tasks:obr.optional()}),lbr=Is.extend({protocolVersion:te(),capabilities:ubr,serverInfo:yGe,instructions:te().optional()}),uue=Zp.extend({method:ht("notifications/initialized"),params:Qp.optional()});var _H=ws.extend({method:ht("ping"),params:cp.optional()}),pbr=$e({progress:Cn(),total:Hn(Cn()),message:Hn(te())}),fbr=$e({...Qp.shape,...pbr.shape,progressToken:uGe}),EH=Zp.extend({method:ht("notifications/progress"),params:fbr}),dbr=cp.extend({cursor:lGe.optional()}),eM=ws.extend({params:dbr.optional()}),tM=Is.extend({nextCursor:lGe.optional()}),hbr=fi(["working","input_required","completed","failed","cancelled"]),rM=$e({taskId:te(),status:hbr,ttl:hn([Cn(),KL()]),createdAt:te(),lastUpdatedAt:te(),pollInterval:Hn(Cn()),statusMessage:Hn(te())}),Nx=Is.extend({task:rM}),mbr=Qp.merge(rM),nM=Zp.extend({method:ht("notifications/tasks/status"),params:mbr}),TH=ws.extend({method:ht("tasks/get"),params:cp.extend({taskId:te()})}),bH=Is.merge(rM),SH=ws.extend({method:ht("tasks/result"),params:cp.extend({taskId:te()})}),kCi=Is.loose(),OH=eM.extend({method:ht("tasks/list")}),AH=tM.extend({tasks:qt(rM)}),CH=ws.extend({method:ht("tasks/cancel"),params:cp.extend({taskId:te()})}),vGe=Is.merge(rM),_Ge=$e({uri:te(),mimeType:Hn(te()),_meta:zn(te(),Mn()).optional()}),EGe=_Ge.extend({text:te()}),lue=te().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),TGe=_Ge.extend({blob:lue}),iM=fi(["user","assistant"]),wx=$e({audience:qt(iM).optional(),priority:Cn().min(0).max(1).optional(),lastModified:xx.datetime({offset:!0}).optional()}),bGe=$e({...Dx.shape,...QL.shape,uri:te(),description:Hn(te()),mimeType:Hn(te()),annotations:wx.optional(),_meta:Hn(uc({}))}),gbr=$e({...Dx.shape,...QL.shape,uriTemplate:te(),description:Hn(te()),mimeType:Hn(te()),annotations:wx.optional(),_meta:Hn(uc({}))}),ybr=eM.extend({method:ht("resources/list")}),vbr=tM.extend({resources:qt(bGe)}),_br=eM.extend({method:ht("resources/templates/list")}),Ebr=tM.extend({resourceTemplates:qt(gbr)}),pue=cp.extend({uri:te()}),Tbr=pue,bbr=ws.extend({method:ht("resources/read"),params:Tbr}),Sbr=Is.extend({contents:qt(hn([EGe,TGe]))}),Obr=Zp.extend({method:ht("notifications/resources/list_changed"),params:Qp.optional()}),Abr=pue,Cbr=ws.extend({method:ht("resources/subscribe"),params:Abr}),xbr=pue,Pbr=ws.extend({method:ht("resources/unsubscribe"),params:xbr}),Dbr=Qp.extend({uri:te()}),Nbr=Zp.extend({method:ht("notifications/resources/updated"),params:Dbr}),wbr=$e({name:te(),description:Hn(te()),required:Hn(ji())}),Ibr=$e({...Dx.shape,...QL.shape,description:Hn(te()),arguments:Hn(qt(wbr)),_meta:Hn(uc({}))}),Rbr=eM.extend({method:ht("prompts/list")}),Lbr=tM.extend({prompts:qt(Ibr)}),Mbr=cp.extend({name:te(),arguments:zn(te(),te()).optional()}),$br=ws.extend({method:ht("prompts/get"),params:Mbr}),fue=$e({type:ht("text"),text:te(),annotations:wx.optional(),_meta:zn(te(),Mn()).optional()}),due=$e({type:ht("image"),data:lue,mimeType:te(),annotations:wx.optional(),_meta:zn(te(),Mn()).optional()}),hue=$e({type:ht("audio"),data:lue,mimeType:te(),annotations:wx.optional(),_meta:zn(te(),Mn()).optional()}),kbr=$e({type:ht("tool_use"),name:te(),id:te(),input:zn(te(),Mn()),_meta:zn(te(),Mn()).optional()}),Fbr=$e({type:ht("resource"),resource:hn([EGe,TGe]),annotations:wx.optional(),_meta:zn(te(),Mn()).optional()}),Ubr=bGe.extend({type:ht("resource_link")}),mue=hn([fue,due,hue,Ubr,Fbr]),Vbr=$e({role:iM,content:mue}),jbr=Is.extend({description:te().optional(),messages:qt(Vbr)}),qbr=Zp.extend({method:ht("notifications/prompts/list_changed"),params:Qp.optional()}),Bbr=$e({title:te().optional(),readOnlyHint:ji().optional(),destructiveHint:ji().optional(),idempotentHint:ji().optional(),openWorldHint:ji().optional()}),Gbr=$e({taskSupport:fi(["required","optional","forbidden"]).optional()}),SGe=$e({...Dx.shape,...QL.shape,description:te().optional(),inputSchema:$e({type:ht("object"),properties:zn(te(),Ns).optional(),required:qt(te()).optional()}).catchall(Mn()),outputSchema:$e({type:ht("object"),properties:zn(te(),Ns).optional(),required:qt(te()).optional()}).catchall(Mn()).optional(),annotations:Bbr.optional(),execution:Gbr.optional(),_meta:zn(te(),Mn()).optional()}),gue=eM.extend({method:ht("tools/list")}),Hbr=tM.extend({tools:qt(SGe)}),xH=Is.extend({content:qt(mue).default([]),structuredContent:zn(te(),Mn()).optional(),isError:ji().optional()}),FCi=xH.or(Is.extend({toolResult:Mn()})),zbr=XL.extend({name:te(),arguments:zn(te(),Mn()).optional()}),aM=ws.extend({method:ht("tools/call"),params:zbr}),Ybr=Zp.extend({method:ht("notifications/tools/list_changed"),params:Qp.optional()}),UCi=$e({autoRefresh:ji().default(!0),debounceMs:Cn().int().nonnegative().default(300)}),oM=fi(["debug","info","notice","warning","error","critical","alert","emergency"]),Kbr=cp.extend({level:oM}),yue=ws.extend({method:ht("logging/setLevel"),params:Kbr}),Wbr=Qp.extend({level:oM,logger:te().optional(),data:Mn()}),Xbr=Zp.extend({method:ht("notifications/message"),params:Wbr}),Jbr=$e({name:te().optional()}),Qbr=$e({hints:qt(Jbr).optional(),costPriority:Cn().min(0).max(1).optional(),speedPriority:Cn().min(0).max(1).optional(),intelligencePriority:Cn().min(0).max(1).optional()}),Zbr=$e({mode:fi(["auto","required","none"]).optional()}),eSr=$e({type:ht("tool_result"),toolUseId:te().describe("The unique identifier for the corresponding tool call."),content:qt(mue).default([]),structuredContent:$e({}).loose().optional(),isError:ji().optional(),_meta:zn(te(),Mn()).optional()}),tSr=pH("type",[fue,due,hue]),hH=pH("type",[fue,due,hue,kbr,eSr]),rSr=$e({role:iM,content:hn([hH,qt(hH)]),_meta:zn(te(),Mn()).optional()}),nSr=XL.extend({messages:qt(rSr),modelPreferences:Qbr.optional(),systemPrompt:te().optional(),includeContext:fi(["none","thisServer","allServers"]).optional(),temperature:Cn().optional(),maxTokens:Cn().int(),stopSequences:qt(te()).optional(),metadata:Ns.optional(),tools:qt(SGe).optional(),toolChoice:Zbr.optional()}),iSr=ws.extend({method:ht("sampling/createMessage"),params:nSr}),vue=Is.extend({model:te(),stopReason:Hn(fi(["endTurn","stopSequence","maxTokens"]).or(te())),role:iM,content:tSr}),_ue=Is.extend({model:te(),stopReason:Hn(fi(["endTurn","stopSequence","maxTokens","toolUse"]).or(te())),role:iM,content:hn([hH,qt(hH)])}),aSr=$e({type:ht("boolean"),title:te().optional(),description:te().optional(),default:ji().optional()}),oSr=$e({type:ht("string"),title:te().optional(),description:te().optional(),minLength:Cn().optional(),maxLength:Cn().optional(),format:fi(["email","uri","date","date-time"]).optional(),default:te().optional()}),sSr=$e({type:fi(["number","integer"]),title:te().optional(),description:te().optional(),minimum:Cn().optional(),maximum:Cn().optional(),default:Cn().optional()}),cSr=$e({type:ht("string"),title:te().optional(),description:te().optional(),enum:qt(te()),default:te().optional()}),uSr=$e({type:ht("string"),title:te().optional(),description:te().optional(),oneOf:qt($e({const:te(),title:te()})),default:te().optional()}),lSr=$e({type:ht("string"),title:te().optional(),description:te().optional(),enum:qt(te()),enumNames:qt(te()).optional(),default:te().optional()}),pSr=hn([cSr,uSr]),fSr=$e({type:ht("array"),title:te().optional(),description:te().optional(),minItems:Cn().optional(),maxItems:Cn().optional(),items:$e({type:ht("string"),enum:qt(te())}),default:qt(te()).optional()}),dSr=$e({type:ht("array"),title:te().optional(),description:te().optional(),minItems:Cn().optional(),maxItems:Cn().optional(),items:$e({anyOf:qt($e({const:te(),title:te()}))}),default:qt(te()).optional()}),hSr=hn([fSr,dSr]),mSr=hn([lSr,pSr,hSr]),gSr=hn([mSr,aSr,oSr,sSr]),ySr=XL.extend({mode:ht("form").optional(),message:te(),requestedSchema:$e({type:ht("object"),properties:zn(te(),gSr),required:qt(te()).optional()})}),vSr=XL.extend({mode:ht("url"),message:te(),elicitationId:te(),url:te().url()}),_Sr=hn([ySr,vSr]),ESr=ws.extend({method:ht("elicitation/create"),params:_Sr}),TSr=Qp.extend({elicitationId:te()}),bSr=Zp.extend({method:ht("notifications/elicitation/complete"),params:TSr}),PH=Is.extend({action:fi(["accept","decline","cancel"]),content:dH(e=>e===null?void 0:e,zn(te(),hn([te(),Cn(),ji(),qt(te())])).optional())}),SSr=$e({type:ht("ref/resource"),uri:te()});var OSr=$e({type:ht("ref/prompt"),name:te()}),ASr=cp.extend({ref:hn([OSr,SSr]),argument:$e({name:te(),value:te()}),context:$e({arguments:zn(te(),te()).optional()}).optional()}),CSr=ws.extend({method:ht("completion/complete"),params:ASr});var xSr=Is.extend({completion:uc({values:qt(te()).max(100),total:Hn(Cn().int()),hasMore:Hn(ji())})}),PSr=$e({uri:te().startsWith("file://"),name:te().optional(),_meta:zn(te(),Mn()).optional()}),DSr=ws.extend({method:ht("roots/list"),params:cp.optional()}),Eue=Is.extend({roots:qt(PSr)}),NSr=Zp.extend({method:ht("notifications/roots/list_changed"),params:Qp.optional()}),VCi=hn([_H,ZL,CSr,yue,$br,Rbr,ybr,_br,bbr,Cbr,Pbr,aM,gue,TH,SH,OH,CH]),jCi=hn([vH,EH,uue,NSr,nM]),qCi=hn([yH,vue,_ue,PH,Eue,bH,AH,Nx]),BCi=hn([_H,iSr,ESr,DSr,TH,SH,OH,CH]),GCi=hn([vH,EH,Xbr,Nbr,Obr,Ybr,qbr,nM,bSr]),HCi=hn([yH,lbr,xSr,jbr,Lbr,vbr,Ebr,Sbr,xH,Hbr,bH,AH,Nx]),Sr=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===on.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new nue(i.elicitations,r)}return new e(t,r,n)}},nue=class extends Sr{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(on.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function K_(e){return e==="completed"||e==="failed"||e==="cancelled"}var Axi=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Tue(e){let r=ZG(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=b4e(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function bue(e,t){let r=z_(e,t);if(!r.success)throw r.error;return r.data}var $Sr=6e4,DH=class{constructor(t){this._options=t,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._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(vH,r=>{this._oncancel(r)}),this.setNotificationHandler(EH,r=>{this._onprogress(r)}),this.setRequestHandler(_H,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(TH,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Sr(on.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(SH,async(r,n)=>{let i=async()=>{let a=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(a,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let p=c,f=new Sr(p.error.code,p.error.message,p.error.data);l(f)}else{let p=s.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let o=await this._taskStore.getTask(a,n.sessionId);if(!o)throw new Sr(on.InvalidParams,`Task not found: ${a}`);if(!K_(o.status))return await this._waitForTaskUpdate(a,n.signal),await i();if(K_(o.status)){let s=await this._taskStore.getTaskResult(a,n.sessionId);return this._clearTaskQueue(a),{...s,_meta:{...s._meta,[Y_]:{taskId:a}}}}return await i()};return await i()}),this.setRequestHandler(OH,async(r,n)=>{try{let{tasks:i,nextCursor:a}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:a,_meta:{}}}catch(i){throw new Sr(on.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(CH,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Sr(on.InvalidParams,`Task not found: ${r.params.taskId}`);if(K_(i.status))throw new Sr(on.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let a=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!a)throw new Sr(on.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof Sr?i:new Sr(on.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,i,a=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),Sr.fromError(on.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=a=>{n?.(a),this._onerror(a)};let i=this._transport?.onmessage;this._transport.onmessage=(a,o)=>{i?.(a,o),JL(a)||mGe(a)?this._onresponse(a):oue(a)?this._onrequest(a,o):hGe(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=Sr.fromError(on.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,i=this._transport,a=t.params?._meta?.[Y_]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:on.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:l,timestamp:Date.now()},i?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):i?.send(l).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(t.id,o);let s=pGe(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,i?.sessionId):void 0,u={signal:o.signal,sessionId:i?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(o.signal.aborted)return;let p={relatedRequestId:t.id};a&&(p.relatedTask={taskId:a}),await this.notification(l,p)},sendRequest:async(l,p,f)=>{if(o.signal.aborted)throw new Sr(on.ConnectionClosed,"Request was cancelled");let h={...f,relatedRequestId:t.id};a&&!h.relatedTask&&(h.relatedTask={taskId:a});let d=h.relatedTask?.taskId??a;return d&&c&&await c.updateTaskStatus(d,"input_required"),await this.request(l,p,h)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:a,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(o.signal.aborted)return;let p={result:l,jsonrpc:"2.0",id:t.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:p,timestamp:Date.now()},i?.sessionId):await i?.send(p)},async l=>{if(o.signal.aborted)return;let p={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:on.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:p,timestamp:Date.now()},i?.sessionId):await i?.send(p)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.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(t)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(c);return}a(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),JL(t))n(t);else{let o=new Sr(t.error.code,t.error.message,t.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let a=!1;if(JL(t)&&t.result&&typeof t.result=="object"){let o=t.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,r))}}if(a||this._progressHandlers.delete(r),JL(t))i(t);else{let o=Sr.fromError(t.error.code,t.error.message,t.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(t,r,n)}}catch(o){yield{type:"error",error:o instanceof Sr?o:new Sr(on.InternalError,String(o))}}return}let a;try{let o=await this.request(t,Nx,n);if(o.task)a=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new Sr(on.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:a},n);if(yield{type:"taskStatus",task:s},K_(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)}:s.status==="failed"?yield{type:"error",error:new Sr(on.InternalError,`Task ${a} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new Sr(on.InternalError,`Task ${a} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof Sr?o:new Sr(on.InternalError,String(o))}}}request(t,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let p=O=>{l(O)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(O){p(O);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,h={...t,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),h.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),s&&(h.params={...h.params,task:s}),c&&(h.params={...h.params,_meta:{...h.params?._meta||{},[Y_]:c}});let d=O=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(O)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let A=O instanceof Sr?O:new Sr(on.RequestTimeout,String(O));l(A)};this._responseHandlers.set(f,O=>{if(!n?.signal?.aborted){if(O instanceof Error)return l(O);try{let A=z_(r,O.result);A.success?u(A.data):l(A.error)}catch(A){l(A)}}}),n?.signal?.addEventListener("abort",()=>{d(n?.signal?.reason)});let m=n?.timeout??$Sr,_=()=>d(Sr.fromError(on.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(f,m,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let T=c?.taskId;if(T){let O=A=>{let C=this._responseHandlers.get(f);C?C(A):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,O),this._enqueueTaskMessage(T,{type:"request",message:h,timestamp:Date.now()}).catch(A=>{this._cleanupTimeout(f),l(A)})}else this._transport.send(h,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(f),l(O)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},bH,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},AH,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},vGe,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Y_]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Y_]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let o={...t,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Y_]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(t,r){let n=Tue(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>{let o=bue(t,i);return Promise.resolve(r(o,a))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Tue(t);this._notificationHandlers.set(n,i=>{let a=bue(t,i);return Promise.resolve(r(a))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,i)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let i of n)if(i.type==="request"&&oue(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new Sr(on.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(t);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,a)=>{if(r.aborted){a(new Sr(on.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(o),a(new Sr(on.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!t)throw new Error("No request provided");return await n.createTask(i,t.id,{method:t.method,params:t.params},r)},getTask:async i=>{let a=await n.getTask(i,r);if(!a)throw new Sr(on.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await n.storeTaskResult(i,a,o,r);let s=await n.getTask(i,r);if(s){let c=nM.parse({method:"notifications/tasks/status",params:s});await this.notification(c),K_(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,a,o)=>{let s=await n.getTask(i,r);if(!s)throw new Sr(on.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(K_(s.status))throw new Sr(on.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,a,o,r);let c=await n.getTask(i,r);if(c){let u=nM.parse({method:"notifications/tasks/status",params:c});await this.notification(u),K_(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function OGe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function AGe(e,t){let r={...e};for(let n in t){let i=n,a=t[i];if(a===void 0)continue;let o=r[i];OGe(o)&&OGe(a)?r[i]={...o,...a}:r[i]=a}return r}var u5e=Gt(cpe(),1),l5e=Gt(c5e(),1);function CPr(){let e=new u5e.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,l5e.default)(e),e}var fz=class{constructor(t){this._ajv=t??CPr()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var dz=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function p5e(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function f5e(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var hz=class extends DH{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(oM.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new fz,this.setRequestHandler(ZL,n=>this._oninitialize(n)),this.setNotificationHandler(uue,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(yue,async(n,i)=>{let a=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=n.params,s=oM.safeParse(o);return s.success&&this._loggingLevels.set(a,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new dz(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=AGe(this._capabilities,t)}setRequestHandler(t,r){let i=ZG(t)?.method;if(!i)throw new Error("Schema is missing a method literal");let a;if(Cx(i)){let s=i;a=s._zod?.def?.value??s.value}else{let s=i;a=s._def?.value??s.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");if(a==="tools/call"){let s=async(c,u)=>{let l=z_(aM,c);if(!l.success){let d=l.error instanceof Error?l.error.message:String(l.error);throw new Sr(on.InvalidParams,`Invalid tools/call request: ${d}`)}let{params:p}=l.data,f=await Promise.resolve(r(c,u));if(p.task){let d=z_(Nx,f);if(!d.success){let m=d.error instanceof Error?d.error.message:String(d.error);throw new Sr(on.InvalidParams,`Invalid task creation result: ${m}`)}return d.data}let h=z_(xH,f);if(!h.success){let d=h.error instanceof Error?h.error.message:String(h.error);throw new Sr(on.InvalidParams,`Invalid tools/call result: ${d}`)}return h.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);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 ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);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 ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){f5e(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&p5e(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:cGe.includes(r)?r:iue,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"},yH)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],a=i.some(u=>u.type==="tool_result"),o=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],c=s.some(u=>u.type==="tool_use");if(a){if(i.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(p=>p.type==="tool_use").map(p=>p.id)),l=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==l.size||![...u].every(p=>l.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},_ue,r):this.request({method:"sampling/createMessage",params:t},vue,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},PH,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},a=await this.request({method:"elicitation/create",params:i},PH,r);if(a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new Sr(on.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){throw o instanceof Sr?o:new Sr(on.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return a}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},Eue,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}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 gpe=Gt(require("node:process"),1);var mz=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
1609
1609
  `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),xPr(r)}clear(){this._buffer=void 0}};function xPr(e){return gGe.parse(JSON.parse(e))}function d5e(e){return JSON.stringify(e)+`
1610
- `}var gz=class{constructor(t=gpe.default.stdin,r=gpe.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new mz,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(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(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=d5e(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var m5e="0.6.39";var PS={name:"@sap-ux/fiori-mcp-server",description:"SAP Fiori - Model Context Protocol (MCP) server",version:m5e,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 && pnpm run copy-icons","copy-icons":`node -e "const fs=require('node:fs');const path=require('node:path');['icon.png','icon.svg'].forEach(f=>fs.copyFileSync(path.join('assets',f),path.join('dist',f)))"`,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","lint:fix":"eslint --fix",test:"jest --ci --forceExit --detectOpenHandles --colors",inspector:"npx @modelcontextprotocol/inspector node dist/index.js","inspector-ts":"npx @modelcontextprotocol/inspector ts-node -T src/index.ts --log-level=debug",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","assets/icon.svg","assets/icon.png"],bin:{"fiori-mcp":"./dist/index.js"},devDependencies:{"npm-run-all2":"8.0.4",esbuild:"0.27.2","@modelcontextprotocol/sdk":"1.26.0","@sap-ux/axios-extension":"workspace:*","@sap/ux-specification":"1.142.0","@sap-ux/project-access":"workspace:*","@sap-ux/fiori-annotation-api":"workspace:*","@sap-ux/annotation-converter":"0.10.19","@sap-ux/vocabularies-types":"0.14.5","@sap-ux/edmx-parser":"0.10.0","@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.8.12","os-name":"4.0.1","ts-node":"10.9.2",zod:"4.1.13","@sap-ai-sdk/foundation-models":"2.3.0","@sap-ai-sdk/langchain":"2.8.0",promptfoo:"0.120.25","@langchain/mcp-adapters":"1.1.3","@langchain/core":"1.1.26"},dependencies:{"@sap-ux/fiori-docs-embeddings":"workspace:*","@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 v5e=$e({name:te().describe("Name of the Fiori application. Usually derived from the `sap.app/id` field in the application's manifest.json."),appPath:te().describe("Absolute path to the Fiori application's root directory."),projectPath:te().describe("Absolute path to the root directory of the project containing this Fiori application. For EDMXBackend (standalone) projects, this is the same as `appPath`. For CAP projects, this points to the CAP project root, which may contain multiple Fiori applications."),projectType:fi(["EDMXBackend","CAPJava","CAPNodejs"]).describe("Type of project the application belongs to."),odataVersion:te().describe("OData protocol version used by the application's main service.")}),NS=hn([te(),qt(hn([te(),Cn()]))]),_5e=$e({functionalityId:NS.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),description:te()}),g5e=fi(["object","array","string","number","boolean","null","integer","any"]),y5e=$e({type:hn([g5e,qt(g5e)]).optional(),description:te().optional(),properties:cH().optional()}).catchall(cH()),E5e=y5e.extend({properties:zn(te(),hn([y5e,ji()])).optional()});var T5e=$e({searchPath:qt(te()).describe("Path to search for Fiori applications (defaults to current directory). If VSCode - list of VS Code workspace folder paths(`workspace.workspaceFolders`)")}),b5e=$e({appPath:te().describe("Path to the root folder of the Fiori application (where package.json and ui5.yaml reside) if one exists or to the current directory. Path should be an absolute path.")}),S5e=$e({appPath:te().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path."),functionalityId:NS.describe("The ID of the functionality to get details for")}),O5e=$e({functionalityId:NS.describe("The ID of the functionality to execute"),parameters:zn(te(),Mn()).describe("Parameters for the functionality execution"),appPath:te().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path.")}).describe('Input object for executing a functionality. Only three top-level properties are allowed: "functionalityId", "parameters", and "appPath". All other dynamic or functionality-specific inputs must be included inside the "parameters" object. Do not place any additional fields at the root level.'),awi=$e({query:te().min(2).describe("The search query for fiori elements, annotations, sapui5, fiori tools documentation")});var swi=te().describe("Search results as formatted text"),A5e=$e({applications:qt(v5e)}),C5e=$e({applicationPath:te(),functionalities:qt(_5e)}),x5e=$e({functionalityId:NS.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),name:te(),description:te(),technicalDescription:te().optional(),parameters:E5e,prerequisites:qt(te()).optional(),impact:te().optional(),examples:qt(te()).optional(),pageName:te().optional()}),P5e=$e({functionalityId:NS,status:te(),message:te(),parameters:Mn(),appPath:te(),changes:qt(te()),timestamp:te()});var s0e=Gt(require("node:fs/promises")),xf=Gt(require("node:path"));var mu=Gt(_E()),_yt=Gt(Wd()),Eyt=require("node:path");function Tpn(){let e=globalThis.LOG_LEVEL,t=process.env.LOG_LEVEL,r=process.argv.find(i=>i.startsWith("--log-level="))?.split("=")[1],n=e??t??r;if(n)switch(n.toUpperCase()){case"OFF":return;case"ERROR":return mu.LogLevel.Error;case"WARN":return mu.LogLevel.Warn;case"INFO":return mu.LogLevel.Info;case"DEBUG":return mu.LogLevel.Debug;case"VERBOSE":return mu.LogLevel.Verbose;case"SILLY":return mu.LogLevel.Silly;default:break}return mu.LogLevel.Error}var vyt=Tpn(),ft=new mu.ToolsLogger({logLevel:vyt??mu.LogLevel.Error,transports:vyt===void 0?[new mu.NullTransport]:[new mu.FileTransport({filename:(0,Eyt.join)(_yt.fioriToolsDirectory,"fiori-mcp-server.log"),maxsize:10*1024*1024,maxFiles:5})],logPrefix:"fiori-mcp"}),WF={info:(e,...t)=>{ft.info(`@sap/ux-specification: ${e}`);for(let r of t)ft.info(typeof r=="number"?r.toString():r)},warning:(e,...t)=>{ft.warn(`@sap/ux-specification: ${e}`);for(let r of t)ft.warn(typeof r=="number"?r.toString():r)},error:(e,...t)=>{ft.error(`@sap/ux-specification: ${e}`);for(let r of t)ft.error(typeof r=="number"?r.toString():r)},reset:()=>{}};async function Tyt(){try{let r;try{r=require("@sap-ux/fiori-docs-embeddings")}catch{try{r=await import("@sap-ux/fiori-docs-embeddings")}catch{r=null}}if(!r||typeof r.getDataPath!="function")throw new Error("Package not found or invalid");let n=r.getDataPath();return await s0e.default.access(n),ft.log("\u2713 Using @sap-ux/fiori-docs-embeddings package"),{dataPath:n,embeddingsPath:xf.default.join(n,"embeddings"),searchPath:xf.default.join(n,"search"),docsPath:xf.default.join(n,"docs"),isExternalPackage:!0,isAvailable:!0}}catch{ft.warn("Could not load @sap-ux/fiori-docs-embeddings package, trying local data...")}let e=xf.default.join(__dirname,"../../data");try{return await s0e.default.access(e),ft.log("\u2713 Using local data directory"),{dataPath:e,embeddingsPath:xf.default.join(e,"embeddings"),searchPath:xf.default.join(e,"search"),docsPath:xf.default.join(e,"docs"),isExternalPackage:!1,isAvailable:!0}}catch{ft.warn("Local data directory not available either")}let t=xf.default.join(__dirname,"../../data");return ft.warn("\u26A0\uFE0F No embeddings data available - running in limited mode"),{dataPath:t,embeddingsPath:xf.default.join(t,"embeddings"),searchPath:xf.default.join(t,"search"),docsPath:xf.default.join(t,"docs"),isExternalPackage:!1,isAvailable:!1}}var xc=Gt(Wd()),XF=require("node:path");async function gu(e){try{e=(0,XF.join)(e);try{let t=await(0,xc.createApplicationAccess)(e);return{root:t.project.root,appId:t.getAppId(),applicationAccess:t}}catch(t){ft.warn(`Application was not found by given path. Error: ${t}`);let r=await(0,xc.findProjectRoot)(e),n=await(0,xc.getProject)(r);if(n)return{root:n.root,appId:""}}}catch(t){ft.warn(`Project was not found by given path. Error: ${t}`);return}}var QK=e=>{let t;switch(e){case xc.DirName.View:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.View);break}case xc.DirName.Fragment:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.Fragment);break}case xc.DirName.Controller:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.Controller);break}default:t=e}return t},Cm=(e,t,r=new Set)=>{if(!e||typeof e!="object")return{};if(e.$ref?.startsWith("#/definitions/")){let i=e.$ref,a=i.replace("#/definitions/",""),o=t.definitions?.[a]??null;if(r.has(i))return{...o};if(r.add(i),o){let s={...e};return delete s.$ref,Cm({...o,...s},t,r)}}let n={...e};return n.properties&&(n.properties=Object.fromEntries(Object.entries(n.properties).map(([i,a])=>[i,Cm(a,t,r)]))),n.items&&(Array.isArray(n.items)?n.items=n.items.map(i=>Cm(i,t,r)):n.items=Cm(n.items,t,r)),n.allOf&&(n.allOf=n.allOf.map(i=>Cm(i,t,r))),n.anyOf&&(n.anyOf=n.anyOf.map(i=>Cm(i,t,r))),n.oneOf&&(n.oneOf=n.oneOf.map(i=>Cm(i,t,r))),typeof n.additionalProperties=="object"&&(n.additionalProperties=Cm(n.additionalProperties,t,r)),n},byt=(e,t)=>({type:"object",properties:{[e]:t}}),Na=e=>{let t=gS(e);return delete t.$schema,t},xm=(e,t)=>{try{return e.parse(t)}catch(r){throw r instanceof dce?new Error(`Missing required fields in parameters. ${JSON.stringify(r.issues,null,4)}`):new Error("Unknown error. Recheck input parameters.")}};var CPt=require("node:util"),xPt=require("node:child_process"),PPt=Gt(fxe());async function ZW(e="1.18.5"){let t="@sap/generator-fiori";if((await(0,PPt.findInstalledPackages)(t,{minVersion:e}))?.length<1)throw new Error(`Fiori generator not found. Please install the Fiori generator >=${e} with 'npm install -g ${t}' and retry this call`)}var e7=(0,CPt.promisify)(xPt.exec);var DPt=require("@lancedb/lancedb");var dxe=Gt(require("node:fs/promises")),hxe=Gt(require("node:path")),t7=class{connection=null;tables=[];tableIndex=null;metadata=null;dataPath;constructor(t){this.dataPath=t||""}async initialize(){try{ft.log("Loading vector database from pre-built embeddings...");let t=await Tyt();if(!t.isAvailable)throw new Error("No embeddings data available");this.dataPath=t.embeddingsPath,ft.log(`Using embeddings path: ${this.dataPath} (external: ${t.isExternalPackage})`);let r=hxe.default.join(this.dataPath,"metadata.json"),n=await dxe.default.readFile(r,"utf-8");this.metadata=JSON.parse(n),ft.log("\u2713 Embedding metadata loaded:"),ft.log(` Model: ${this?.metadata?.model}`),ft.log(` Dimensions: ${this?.metadata?.dimensions}`),ft.log(` Total vectors: ${this?.metadata?.totalVectors}`),ft.log(` Created: ${this?.metadata?.createdAt}`),this.connection=await(0,DPt.connect)(this.dataPath);let i=hxe.default.join(this.dataPath,"table_index.json");try{let a=await dxe.default.readFile(i,"utf-8");this.tableIndex=JSON.parse(a),this.tables=[];for(let o of this.tableIndex?.tables||[]){let s=await this.connection.openTable(o);this.tables.push(s)}ft.log(`\u2713 Loaded ${this.tables.length} split tables`)}catch{ft.log("No table index found, trying single table...");try{let a=await this.connection.openTable("documents");this.tables=[a],this.tableIndex={tables:["documents"],totalTables:1,maxVectorsPerTable:-1,totalVectors:this.metadata?.totalVectors||0}}catch(a){throw new Error(`No tables found: ${a}`)}}ft.log("\u2713 Vector database loaded and ready")}catch(t){throw new Error(`Failed to load vector database: ${t}`)}}async semanticSearch(t,r=10,n){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let i=[];for(let o of this.tables){let s=o.vectorSearch(t).limit(r*2);n&&(s=s.where(`category = "${n}"`));let c=await s.toArray();i.push(...c)}return i.sort((o,s)=>(o._distance||0)-(s._distance||0)),i.slice(0,r).map(o=>({document:{id:o.document_id,vector:o.vector,content:o.content,title:o.title,category:o.category,path:o.path,chunk_index:o.chunk_index,metadata:{tags:this.parseJsonField(o.tags_json)||[],headers:this.parseJsonField(o.headers_json)||[],lastModified:new Date(o.lastModified),wordCount:o.wordCount,excerpt:o.excerpt}},score:1-(o._distance||0),distance:o._distance||0}))}catch(i){throw ft.error(`Semantic search failed: ${i}`),new Error(`Semantic search failed: ${i}`)}}async findSimilarToText(t,r=5){return ft.warn("findSimilarToText requires embedding generation - not available in simplified mode"),[]}async findSimilarToDocument(t,r=5){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let n=null;for(let s of this.tables){let c=await s.search("").where(`document_id = "${t}" AND chunk_index = 0`).limit(1).toArray();if(c.length>0){n=c[0].vector;break}}if(!n)return[];let i=[];for(let s of this.tables){let c=await s.vectorSearch(n).where(`document_id != "${t}"`).limit(r*2).toArray();i.push(...c)}let a=new Map;for(let s of i){let c=s.document_id,u=1-(s._distance||0);(!a.has(c)||a.get(c).score<u)&&a.set(c,{...s,score:u,distance:s._distance||0})}return Array.from(a.values()).sort((s,c)=>c.score-s.score).slice(0,r).map(s=>({document:{id:s.document_id,vector:s.vector,content:s.content,title:s.title,category:s.category,path:s.path,chunk_index:s.chunk_index,metadata:{tags:this.parseJsonField(s.tags_json)||[],headers:this.parseJsonField(s.headers_json)||[],lastModified:new Date(s.lastModified),wordCount:s.wordCount,excerpt:s.excerpt}},score:s.score,distance:s.distance}))}catch(n){return ft.error(`Find similar documents failed: ${n}`),[]}}async getDocumentsByCategory(t,r){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let n=[];for(let a of this.tables){let o=a.search("").where(`category = "${t}" AND chunk_index = 0`);r&&(o=o.limit(Math.ceil(r/this.tables.length)+10));let s=await o.toArray();n.push(...s)}return(r?n.slice(0,r):n).map(a=>({document:{id:a.document_id,vector:a.vector,content:a.content,title:a.title,category:a.category,path:a.path,chunk_index:a.chunk_index,metadata:{tags:this.parseJsonField(a.tags_json)||[],headers:this.parseJsonField(a.headers_json)||[],lastModified:new Date(a.lastModified),wordCount:a.wordCount,excerpt:a.excerpt}},score:1,distance:0}))}catch(n){return ft.error(`Get documents by category failed: ${n}`),[]}}getMetadata(){return this.metadata}parseJsonField(t){try{return t?JSON.parse(t):[]}catch{return[]}}isInitialized(){return this.tables.length>0&&this.metadata!==null}async close(){this.connection&&(this.connection=null,this.tables=[],ft.log("Vector database connection closed"))}};var r7=class{pipeline=null;initialized=!1;async initialize(){if(!this.initialized)try{let{pipeline:t}=await import("@xenova/transformers");this.pipeline=await t("feature-extraction","Xenova/all-MiniLM-L6-v2",{quantized:!1}),this.initialized=!0}catch(t){throw new Error(`Failed to initialize text embedding service: ${t}. Make sure @xenova/transformers is available.`)}}async generateEmbedding(t){if(!this.initialized||!this.pipeline)throw new Error("Text embedding service not initialized. Call initialize() first.");try{let r=t.replace(/\n+/g," ").replace(/\s+/g," ").trim().substring(0,8192);if(!r)throw new Error("Empty text provided for embedding");let n=await this.pipeline(r,{pooling:"mean",normalize:!0});return Array.from(n.data)}catch(r){throw new Error(`Failed to generate embedding: ${r}`)}}isInitialized(){return this.initialized}};async function mxe(e,t=!1){let{query:r,maxResults:n}=e;try{let i=new t7,a=new r7;await i.initialize(),await a.initialize();let o=await a.generateEmbedding(r),s=await i.semanticSearch(o,n??10);if(t){let c="";for(let[u,l]of s.entries())c+=`Result ${u+1}:
1610
+ `}var gz=class{constructor(t=gpe.default.stdin,r=gpe.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new mz,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(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(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=d5e(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var m5e="0.6.40";var PS={name:"@sap-ux/fiori-mcp-server",description:"SAP Fiori - Model Context Protocol (MCP) server",version:m5e,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 && pnpm run copy-icons","copy-icons":`node -e "const fs=require('node:fs');const path=require('node:path');['icon.png','icon.svg'].forEach(f=>fs.copyFileSync(path.join('assets',f),path.join('dist',f)))"`,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","lint:fix":"eslint --fix",test:"jest --ci --forceExit --detectOpenHandles --colors",inspector:"npx @modelcontextprotocol/inspector node dist/index.js","inspector-ts":"npx @modelcontextprotocol/inspector ts-node -T src/index.ts --log-level=debug",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","assets/icon.svg","assets/icon.png"],bin:{"fiori-mcp":"./dist/index.js"},devDependencies:{"npm-run-all2":"8.0.4",esbuild:"0.27.2","@modelcontextprotocol/sdk":"1.26.0","@sap-ux/axios-extension":"workspace:*","@sap/ux-specification":"1.142.0","@sap-ux/project-access":"workspace:*","@sap-ux/fiori-annotation-api":"workspace:*","@sap-ux/annotation-converter":"0.10.19","@sap-ux/vocabularies-types":"0.14.5","@sap-ux/edmx-parser":"0.10.0","@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.8.12","os-name":"4.0.1","ts-node":"10.9.2",zod:"4.1.13","@sap-ai-sdk/foundation-models":"2.8.0","@sap-ai-sdk/langchain":"2.8.0",promptfoo:"0.120.25","@langchain/mcp-adapters":"1.1.3","@langchain/core":"1.1.26"},dependencies:{"@sap-ux/fiori-docs-embeddings":"workspace:*","@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 v5e=$e({name:te().describe("Name of the Fiori application. Usually derived from the `sap.app/id` field in the application's manifest.json."),appPath:te().describe("Absolute path to the Fiori application's root directory."),projectPath:te().describe("Absolute path to the root directory of the project containing this Fiori application. For EDMXBackend (standalone) projects, this is the same as `appPath`. For CAP projects, this points to the CAP project root, which may contain multiple Fiori applications."),projectType:fi(["EDMXBackend","CAPJava","CAPNodejs"]).describe("Type of project the application belongs to."),odataVersion:te().describe("OData protocol version used by the application's main service.")}),NS=hn([te(),qt(hn([te(),Cn()]))]),_5e=$e({functionalityId:NS.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),description:te()}),g5e=fi(["object","array","string","number","boolean","null","integer","any"]),y5e=$e({type:hn([g5e,qt(g5e)]).optional(),description:te().optional(),properties:cH().optional()}).catchall(cH()),E5e=y5e.extend({properties:zn(te(),hn([y5e,ji()])).optional()});var T5e=$e({searchPath:qt(te()).describe("Path to search for Fiori applications (defaults to current directory). If VSCode - list of VS Code workspace folder paths(`workspace.workspaceFolders`)")}),b5e=$e({appPath:te().describe("Path to the root folder of the Fiori application (where package.json and ui5.yaml reside) if one exists or to the current directory. Path should be an absolute path.")}),S5e=$e({appPath:te().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path."),functionalityId:NS.describe("The ID of the functionality to get details for")}),O5e=$e({functionalityId:NS.describe("The ID of the functionality to execute"),parameters:zn(te(),Mn()).describe("Parameters for the functionality execution"),appPath:te().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path.")}).describe('Input object for executing a functionality. Only three top-level properties are allowed: "functionalityId", "parameters", and "appPath". All other dynamic or functionality-specific inputs must be included inside the "parameters" object. Do not place any additional fields at the root level.'),awi=$e({query:te().min(2).describe("The search query for fiori elements, annotations, sapui5, fiori tools documentation")});var swi=te().describe("Search results as formatted text"),A5e=$e({applications:qt(v5e)}),C5e=$e({applicationPath:te(),functionalities:qt(_5e)}),x5e=$e({functionalityId:NS.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),name:te(),description:te(),technicalDescription:te().optional(),parameters:E5e,prerequisites:qt(te()).optional(),impact:te().optional(),examples:qt(te()).optional(),pageName:te().optional()}),P5e=$e({functionalityId:NS,status:te(),message:te(),parameters:Mn(),appPath:te(),changes:qt(te()),timestamp:te()});var s0e=Gt(require("node:fs/promises")),xf=Gt(require("node:path"));var mu=Gt(_E()),_yt=Gt(Wd()),Eyt=require("node:path");function Tpn(){let e=globalThis.LOG_LEVEL,t=process.env.LOG_LEVEL,r=process.argv.find(i=>i.startsWith("--log-level="))?.split("=")[1],n=e??t??r;if(n)switch(n.toUpperCase()){case"OFF":return;case"ERROR":return mu.LogLevel.Error;case"WARN":return mu.LogLevel.Warn;case"INFO":return mu.LogLevel.Info;case"DEBUG":return mu.LogLevel.Debug;case"VERBOSE":return mu.LogLevel.Verbose;case"SILLY":return mu.LogLevel.Silly;default:break}return mu.LogLevel.Error}var vyt=Tpn(),ft=new mu.ToolsLogger({logLevel:vyt??mu.LogLevel.Error,transports:vyt===void 0?[new mu.NullTransport]:[new mu.FileTransport({filename:(0,Eyt.join)(_yt.fioriToolsDirectory,"fiori-mcp-server.log"),maxsize:10*1024*1024,maxFiles:5})],logPrefix:"fiori-mcp"}),WF={info:(e,...t)=>{ft.info(`@sap/ux-specification: ${e}`);for(let r of t)ft.info(typeof r=="number"?r.toString():r)},warning:(e,...t)=>{ft.warn(`@sap/ux-specification: ${e}`);for(let r of t)ft.warn(typeof r=="number"?r.toString():r)},error:(e,...t)=>{ft.error(`@sap/ux-specification: ${e}`);for(let r of t)ft.error(typeof r=="number"?r.toString():r)},reset:()=>{}};async function Tyt(){try{let r;try{r=require("@sap-ux/fiori-docs-embeddings")}catch{try{r=await import("@sap-ux/fiori-docs-embeddings")}catch{r=null}}if(!r||typeof r.getDataPath!="function")throw new Error("Package not found or invalid");let n=r.getDataPath();return await s0e.default.access(n),ft.log("\u2713 Using @sap-ux/fiori-docs-embeddings package"),{dataPath:n,embeddingsPath:xf.default.join(n,"embeddings"),searchPath:xf.default.join(n,"search"),docsPath:xf.default.join(n,"docs"),isExternalPackage:!0,isAvailable:!0}}catch{ft.warn("Could not load @sap-ux/fiori-docs-embeddings package, trying local data...")}let e=xf.default.join(__dirname,"../../data");try{return await s0e.default.access(e),ft.log("\u2713 Using local data directory"),{dataPath:e,embeddingsPath:xf.default.join(e,"embeddings"),searchPath:xf.default.join(e,"search"),docsPath:xf.default.join(e,"docs"),isExternalPackage:!1,isAvailable:!0}}catch{ft.warn("Local data directory not available either")}let t=xf.default.join(__dirname,"../../data");return ft.warn("\u26A0\uFE0F No embeddings data available - running in limited mode"),{dataPath:t,embeddingsPath:xf.default.join(t,"embeddings"),searchPath:xf.default.join(t,"search"),docsPath:xf.default.join(t,"docs"),isExternalPackage:!1,isAvailable:!1}}var xc=Gt(Wd()),XF=require("node:path");async function gu(e){try{e=(0,XF.join)(e);try{let t=await(0,xc.createApplicationAccess)(e);return{root:t.project.root,appId:t.getAppId(),applicationAccess:t}}catch(t){ft.warn(`Application was not found by given path. Error: ${t}`);let r=await(0,xc.findProjectRoot)(e),n=await(0,xc.getProject)(r);if(n)return{root:n.root,appId:""}}}catch(t){ft.warn(`Project was not found by given path. Error: ${t}`);return}}var QK=e=>{let t;switch(e){case xc.DirName.View:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.View);break}case xc.DirName.Fragment:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.Fragment);break}case xc.DirName.Controller:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.Controller);break}default:t=e}return t},Cm=(e,t,r=new Set)=>{if(!e||typeof e!="object")return{};if(e.$ref?.startsWith("#/definitions/")){let i=e.$ref,a=i.replace("#/definitions/",""),o=t.definitions?.[a]??null;if(r.has(i))return{...o};if(r.add(i),o){let s={...e};return delete s.$ref,Cm({...o,...s},t,r)}}let n={...e};return n.properties&&(n.properties=Object.fromEntries(Object.entries(n.properties).map(([i,a])=>[i,Cm(a,t,r)]))),n.items&&(Array.isArray(n.items)?n.items=n.items.map(i=>Cm(i,t,r)):n.items=Cm(n.items,t,r)),n.allOf&&(n.allOf=n.allOf.map(i=>Cm(i,t,r))),n.anyOf&&(n.anyOf=n.anyOf.map(i=>Cm(i,t,r))),n.oneOf&&(n.oneOf=n.oneOf.map(i=>Cm(i,t,r))),typeof n.additionalProperties=="object"&&(n.additionalProperties=Cm(n.additionalProperties,t,r)),n},byt=(e,t)=>({type:"object",properties:{[e]:t}}),Na=e=>{let t=gS(e);return delete t.$schema,t},xm=(e,t)=>{try{return e.parse(t)}catch(r){throw r instanceof dce?new Error(`Missing required fields in parameters. ${JSON.stringify(r.issues,null,4)}`):new Error("Unknown error. Recheck input parameters.")}};var CPt=require("node:util"),xPt=require("node:child_process"),PPt=Gt(fxe());async function ZW(e="1.18.5"){let t="@sap/generator-fiori";if((await(0,PPt.findInstalledPackages)(t,{minVersion:e}))?.length<1)throw new Error(`Fiori generator not found. Please install the Fiori generator >=${e} with 'npm install -g ${t}' and retry this call`)}var e7=(0,CPt.promisify)(xPt.exec);var DPt=require("@lancedb/lancedb");var dxe=Gt(require("node:fs/promises")),hxe=Gt(require("node:path")),t7=class{connection=null;tables=[];tableIndex=null;metadata=null;dataPath;constructor(t){this.dataPath=t||""}async initialize(){try{ft.log("Loading vector database from pre-built embeddings...");let t=await Tyt();if(!t.isAvailable)throw new Error("No embeddings data available");this.dataPath=t.embeddingsPath,ft.log(`Using embeddings path: ${this.dataPath} (external: ${t.isExternalPackage})`);let r=hxe.default.join(this.dataPath,"metadata.json"),n=await dxe.default.readFile(r,"utf-8");this.metadata=JSON.parse(n),ft.log("\u2713 Embedding metadata loaded:"),ft.log(` Model: ${this?.metadata?.model}`),ft.log(` Dimensions: ${this?.metadata?.dimensions}`),ft.log(` Total vectors: ${this?.metadata?.totalVectors}`),ft.log(` Created: ${this?.metadata?.createdAt}`),this.connection=await(0,DPt.connect)(this.dataPath);let i=hxe.default.join(this.dataPath,"table_index.json");try{let a=await dxe.default.readFile(i,"utf-8");this.tableIndex=JSON.parse(a),this.tables=[];for(let o of this.tableIndex?.tables||[]){let s=await this.connection.openTable(o);this.tables.push(s)}ft.log(`\u2713 Loaded ${this.tables.length} split tables`)}catch{ft.log("No table index found, trying single table...");try{let a=await this.connection.openTable("documents");this.tables=[a],this.tableIndex={tables:["documents"],totalTables:1,maxVectorsPerTable:-1,totalVectors:this.metadata?.totalVectors||0}}catch(a){throw new Error(`No tables found: ${a}`)}}ft.log("\u2713 Vector database loaded and ready")}catch(t){throw new Error(`Failed to load vector database: ${t}`)}}async semanticSearch(t,r=10,n){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let i=[];for(let o of this.tables){let s=o.vectorSearch(t).limit(r*2);n&&(s=s.where(`category = "${n}"`));let c=await s.toArray();i.push(...c)}return i.sort((o,s)=>(o._distance||0)-(s._distance||0)),i.slice(0,r).map(o=>({document:{id:o.document_id,vector:o.vector,content:o.content,title:o.title,category:o.category,path:o.path,chunk_index:o.chunk_index,metadata:{tags:this.parseJsonField(o.tags_json)||[],headers:this.parseJsonField(o.headers_json)||[],lastModified:new Date(o.lastModified),wordCount:o.wordCount,excerpt:o.excerpt}},score:1-(o._distance||0),distance:o._distance||0}))}catch(i){throw ft.error(`Semantic search failed: ${i}`),new Error(`Semantic search failed: ${i}`)}}async findSimilarToText(t,r=5){return ft.warn("findSimilarToText requires embedding generation - not available in simplified mode"),[]}async findSimilarToDocument(t,r=5){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let n=null;for(let s of this.tables){let c=await s.search("").where(`document_id = "${t}" AND chunk_index = 0`).limit(1).toArray();if(c.length>0){n=c[0].vector;break}}if(!n)return[];let i=[];for(let s of this.tables){let c=await s.vectorSearch(n).where(`document_id != "${t}"`).limit(r*2).toArray();i.push(...c)}let a=new Map;for(let s of i){let c=s.document_id,u=1-(s._distance||0);(!a.has(c)||a.get(c).score<u)&&a.set(c,{...s,score:u,distance:s._distance||0})}return Array.from(a.values()).sort((s,c)=>c.score-s.score).slice(0,r).map(s=>({document:{id:s.document_id,vector:s.vector,content:s.content,title:s.title,category:s.category,path:s.path,chunk_index:s.chunk_index,metadata:{tags:this.parseJsonField(s.tags_json)||[],headers:this.parseJsonField(s.headers_json)||[],lastModified:new Date(s.lastModified),wordCount:s.wordCount,excerpt:s.excerpt}},score:s.score,distance:s.distance}))}catch(n){return ft.error(`Find similar documents failed: ${n}`),[]}}async getDocumentsByCategory(t,r){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let n=[];for(let a of this.tables){let o=a.search("").where(`category = "${t}" AND chunk_index = 0`);r&&(o=o.limit(Math.ceil(r/this.tables.length)+10));let s=await o.toArray();n.push(...s)}return(r?n.slice(0,r):n).map(a=>({document:{id:a.document_id,vector:a.vector,content:a.content,title:a.title,category:a.category,path:a.path,chunk_index:a.chunk_index,metadata:{tags:this.parseJsonField(a.tags_json)||[],headers:this.parseJsonField(a.headers_json)||[],lastModified:new Date(a.lastModified),wordCount:a.wordCount,excerpt:a.excerpt}},score:1,distance:0}))}catch(n){return ft.error(`Get documents by category failed: ${n}`),[]}}getMetadata(){return this.metadata}parseJsonField(t){try{return t?JSON.parse(t):[]}catch{return[]}}isInitialized(){return this.tables.length>0&&this.metadata!==null}async close(){this.connection&&(this.connection=null,this.tables=[],ft.log("Vector database connection closed"))}};var r7=class{pipeline=null;initialized=!1;async initialize(){if(!this.initialized)try{let{pipeline:t}=await import("@xenova/transformers");this.pipeline=await t("feature-extraction","Xenova/all-MiniLM-L6-v2",{quantized:!1}),this.initialized=!0}catch(t){throw new Error(`Failed to initialize text embedding service: ${t}. Make sure @xenova/transformers is available.`)}}async generateEmbedding(t){if(!this.initialized||!this.pipeline)throw new Error("Text embedding service not initialized. Call initialize() first.");try{let r=t.replace(/\n+/g," ").replace(/\s+/g," ").trim().substring(0,8192);if(!r)throw new Error("Empty text provided for embedding");let n=await this.pipeline(r,{pooling:"mean",normalize:!0});return Array.from(n.data)}catch(r){throw new Error(`Failed to generate embedding: ${r}`)}}isInitialized(){return this.initialized}};async function mxe(e,t=!1){let{query:r,maxResults:n}=e;try{let i=new t7,a=new r7;await i.initialize(),await a.initialize();let o=await a.generateEmbedding(r),s=await i.semanticSearch(o,n??10);if(t){let c="";for(let[u,l]of s.entries())c+=`Result ${u+1}:
1611
1611
 
1612
1612
  `,c+=`${l.document.content}
1613
1613
  `,c+=`---
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.6.39",
4
+ "version": "0.6.40",
5
5
  "keywords": [
6
6
  "SAP Fiori tools",
7
7
  "SAP Fiori elements",
@@ -45,24 +45,24 @@
45
45
  "os-name": "4.0.1",
46
46
  "ts-node": "10.9.2",
47
47
  "zod": "4.1.13",
48
- "@sap-ai-sdk/foundation-models": "2.3.0",
48
+ "@sap-ai-sdk/foundation-models": "2.8.0",
49
49
  "@sap-ai-sdk/langchain": "2.8.0",
50
50
  "promptfoo": "0.120.25",
51
51
  "@langchain/mcp-adapters": "1.1.3",
52
52
  "@langchain/core": "1.1.26",
53
- "@sap-ux/axios-extension": "1.25.19",
54
- "@sap-ux/fiori-annotation-api": "0.9.26",
53
+ "@sap-ux/axios-extension": "1.25.20",
55
54
  "@sap-ux/project-access": "1.35.11",
55
+ "@sap-ux/fiori-annotation-api": "0.9.27",
56
56
  "@sap-ux/fiori-docs-embeddings": "0.4.16",
57
57
  "@sap-ux/i18n": "0.3.9",
58
- "@sap-ux/logger": "0.8.1",
58
+ "@sap-ux/logger": "0.8.2",
59
59
  "@sap-ux/odata-annotation-core-types": "0.5.6",
60
60
  "@sap-ux/odata-entity-model": "0.3.6",
61
61
  "@sap-ux/text-document-utils": "0.3.3",
62
+ "@sap-ux/btp-utils": "1.1.9",
62
63
  "@sap-ux/feature-toggle": "0.3.7",
63
64
  "@sap-ux/nodejs-utils": "0.2.16",
64
- "@sap-ux/telemetry": "0.6.83",
65
- "@sap-ux/btp-utils": "1.1.9"
65
+ "@sap-ux/telemetry": "0.6.84"
66
66
  },
67
67
  "dependencies": {
68
68
  "@xenova/transformers": "2.17.2",
@@ -70,7 +70,7 @@
70
70
  "mem-fs": "2.1.0",
71
71
  "mem-fs-editor": "9.4.0",
72
72
  "@sap-ux/fiori-docs-embeddings": "0.4.16",
73
- "@sap-ux/store": "1.5.8"
73
+ "@sap-ux/store": "1.5.9"
74
74
  },
75
75
  "engines": {
76
76
  "node": ">=20.x"