@sap-ux/fiori-mcp-server 0.6.19 → 0.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1441,7 +1441,7 @@ cfg: { // Application Insights Configuration\r
|
|
|
1441
1441
|
${_Wn.sanitize(Object.assign(Object.assign({},this),{request:this.request,response:this.response}))}`}};hq.RestError=KN;KN.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR";KN.PARSE_ERROR="PARSE_ERROR";function EWn(e){return e instanceof KN?!0:(0,yWn.isError)(e)&&e.name==="RestError"}});var S$e=y(YN=>{"use strict";Object.defineProperty(YN,"__esModule",{value:!0});YN.tracingPolicyName=void 0;YN.tracingPolicy=CWn;var TWn=JWt(),OWn=o0(),SWn=i$e(),$te=AA(),mq=fg(),AWn=kte(),xWn=vte();YN.tracingPolicyName="tracingPolicy";function CWn(e={}){let t=(0,SWn.getUserAgentValue)(e.userAgentPrefix),r=new xWn.Sanitizer({additionalAllowedQueryParameters:e.additionalAllowedQueryParameters}),n=PWn();return{name:YN.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=DWn(n,i,u))!==null&&s!==void 0?s:{};if(!l||!p)return a(i);try{let d=await n.withContext(p,a,i);return NWn(l,d),d}catch(d){throw wWn(l,d),d}}}}function PWn(){try{return(0,TWn.createTracingClient)({namespace:"",packageName:"@azure/core-rest-pipeline",packageVersion:OWn.SDK_VERSION})}catch(e){$te.logger.warning(`Error when creating the TracingClient: ${(0,mq.getErrorMessage)(e)}`);return}}function DWn(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){$te.logger.warning(`Skipping creating a tracing span due to an error: ${(0,mq.getErrorMessage)(n)}`);return}}function wWn(e,t){try{e.setStatus({status:"error",error:(0,mq.isError)(t)?t:void 0}),(0,AWn.isRestError)(t)&&t.statusCode&&e.setAttribute("http.status_code",t.statusCode),e.end()}catch(r){$te.logger.warning(`Skipping tracing span processing due to an error: ${(0,mq.getErrorMessage)(r)}`)}}function NWn(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){$te.logger.warning(`Skipping tracing span processing due to an error: ${(0,mq.getErrorMessage)(r)}`)}}});var t7t=y(A$e=>{"use strict";Object.defineProperty(A$e,"__esModule",{value:!0});A$e.createPipelineFromOptions=BWn;var IWn=e$e(),RWn=Ake(),LWn=t$e(),kWn=a$e(),QWt=u$e(),$Wn=l$e(),MWn=d$e(),FWn=g$e(),e7t=fg(),jWn=y$e(),VWn=v$e(),qWn=b$e(),UWn=S$e();function BWn(e){var t;let r=(0,RWn.createEmptyPipeline)();return e7t.isNodeLike&&(e.tlsOptions&&r.addPolicy((0,qWn.tlsPolicy)(e.tlsOptions)),r.addPolicy((0,jWn.proxyPolicy)(e.proxyOptions)),r.addPolicy((0,$Wn.decompressResponsePolicy)())),r.addPolicy((0,FWn.formDataPolicy)(),{beforePolicies:[QWt.multipartPolicyName]}),r.addPolicy((0,kWn.userAgentPolicy)(e.userAgentOptions)),r.addPolicy((0,VWn.setClientRequestIdPolicy)((t=e.telemetryOptions)===null||t===void 0?void 0:t.clientRequestIdHeaderName)),r.addPolicy((0,QWt.multipartPolicy)(),{afterPhase:"Deserialize"}),r.addPolicy((0,MWn.defaultRetryPolicy)(e.retryOptions),{phase:"Retry"}),r.addPolicy((0,UWn.tracingPolicy)(Object.assign(Object.assign({},e.userAgentOptions),e.loggingOptions)),{afterPhase:"Retry"}),e7t.isNodeLike&&r.addPolicy((0,LWn.redirectPolicy)(e.redirectOptions),{afterPhase:"Retry"}),r.addPolicy((0,IWn.logPolicy)(e.loggingOptions),{afterPhase:"Sign"}),r}});var s7t=y(Fte=>{"use strict";Object.defineProperty(Fte,"__esModule",{value:!0});Fte.getBodyLength=o7t;Fte.createNodeHttpClient=XWn;var D$e=(OA(),ln(TA)),x$e=D$e.__importStar(require("node:http")),C$e=D$e.__importStar(require("node:https")),r7t=D$e.__importStar(require("node:zlib")),zWn=require("node:stream"),n7t=uq(),HWn=dq(),vq=kte(),gq=AA(),GWn={};function yq(e){return e&&typeof e.pipe=="function"}function i7t(e){return new Promise(t=>{e.on("close",t),e.on("end",t),e.on("error",t)})}function a7t(e){return e&&typeof e.byteLength=="number"}var Mte=class extends zWn.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}},P$e=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 n7t.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=o7t(u);p!==null&&t.headers.set("Content-Length",p)}let l;try{if(u&&t.onUploadProgress){let v=t.onUploadProgress,E=new Mte(v);E.on("error",O=>{gq.logger.error("Error in upload progress",O)}),yq(u)?u.pipe(E):E.end(u),u=E}let p=await this.makeRequest(t,a,u),d=KWn(p),h={status:(r=p.statusCode)!==null&&r!==void 0?r:0,headers:d,request:t};if(t.method==="HEAD")return p.resume(),h;l=c?YWn(p,d):p;let g=t.onDownloadProgress;if(g){let v=new Mte(g);v.on("error",E=>{gq.logger.error("Error in download progress",E)}),l.pipe(v),l=v}return!((n=t.streamResponseStatusCodes)===null||n===void 0)&&n.has(Number.POSITIVE_INFINITY)||!((i=t.streamResponseStatusCodes)===null||i===void 0)&&i.has(h.status)?h.readableStreamBody=l:h.bodyAsText=await WWn(l),h}finally{if(t.abortSignal&&o){let p=Promise.resolve();yq(u)&&(p=i7t(u));let d=Promise.resolve();yq(l)&&(d=i7t(l)),Promise.all([p,d]).then(()=>{var f;o&&((f=t.abortSignal)===null||f===void 0||f.removeEventListener("abort",o))}).catch(f=>{gq.logger.warning("Error when cleaning up abortListener on httpRequest",f)})}}}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?x$e.request(c,u):C$e.request(c,u);p.once("error",d=>{var f;l(new vq.RestError(d.message,{code:(f=d.code)!==null&&f!==void 0?f:vq.RestError.REQUEST_SEND_ERROR,request:t}))}),r.signal.addEventListener("abort",()=>{let d=new n7t.AbortError("The operation was aborted.");p.destroy(d),l(d)}),n&&yq(n)?n.pipe(p):n?typeof n=="string"||Buffer.isBuffer(n)?p.end(n):a7t(n)?p.end(ArrayBuffer.isView(n)?Buffer.from(n.buffer):Buffer.from(n)):(gq.logger.error("Unrecognized body type",n),l(new vq.RestError("Unrecognized body type"))):p.end()})}getOrCreateAgent(t,r){var n;let i=t.disableKeepAlive;if(r)return i?x$e.globalAgent:(this.cachedHttpAgent||(this.cachedHttpAgent=new x$e.Agent({keepAlive:!0})),this.cachedHttpAgent);{if(i&&!t.tlsSettings)return C$e.globalAgent;let a=(n=t.tlsSettings)!==null&&n!==void 0?n:GWn,o=this.cachedHttpsAgents.get(a);return o&&o.options.keepAlive===!i||(gq.logger.info("No cached TLS Agent exist, creating a new Agent"),o=new C$e.Agent(Object.assign({keepAlive:!i},a)),this.cachedHttpsAgents.set(a,o)),o}}};function KWn(e){let t=(0,HWn.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 YWn(e,t){let r=t.get("Content-Encoding");if(r==="gzip"){let n=r7t.createGunzip();return e.pipe(n),n}else if(r==="deflate"){let n=r7t.createInflate();return e.pipe(n),n}return e}function WWn(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 vq.RestError(`Error reading response as text: ${i.message}`,{code:vq.RestError.PARSE_ERROR}))})})}function o7t(e){return e?Buffer.isBuffer(e)?e.length:yq(e)?null:a7t(e)?e.byteLength:typeof e=="string"?Buffer.from(e).length:null:0}function XWn(){return new P$e}});var c7t=y(w$e=>{"use strict";Object.defineProperty(w$e,"__esModule",{value:!0});w$e.createDefaultHttpClient=ZWn;var JWn=s7t();function ZWn(){return(0,JWn.createNodeHttpClient)()}});var u7t=y(I$e=>{"use strict";Object.defineProperty(I$e,"__esModule",{value:!0});I$e.createPipelineRequest=t7n;var QWn=dq(),e7n=fg(),N$e=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,QWn.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,e7n.randomUUID)(),this.allowInsecureConnection=(s=t.allowInsecureConnection)!==null&&s!==void 0?s:!1,this.enableBrowserStreams=(c=t.enableBrowserStreams)!==null&&c!==void 0?c:!1}};function t7n(e){return new N$e(e)}});var l7t=y(bq=>{"use strict";Object.defineProperty(bq,"__esModule",{value:!0});bq.exponentialRetryPolicyName=void 0;bq.exponentialRetryPolicy=a7n;var r7n=Cte(),n7n=VN(),i7n=o0();bq.exponentialRetryPolicyName="exponentialRetryPolicy";function a7n(e={}){var t;return(0,n7n.retryPolicy)([(0,r7n.exponentialRetryStrategy)(Object.assign(Object.assign({},e),{ignoreSystemErrors:!0}))],{maxRetries:(t=e.maxRetries)!==null&&t!==void 0?t:i7n.DEFAULT_RETRY_POLICY_COUNT})}});var p7t=y(WN=>{"use strict";Object.defineProperty(WN,"__esModule",{value:!0});WN.systemErrorRetryPolicyName=void 0;WN.systemErrorRetryPolicy=u7n;var o7n=Cte(),s7n=VN(),c7n=o0();WN.systemErrorRetryPolicyName="systemErrorRetryPolicy";function u7n(e={}){var t;return{name:WN.systemErrorRetryPolicyName,sendRequest:(0,s7n.retryPolicy)([(0,o7n.exponentialRetryStrategy)(Object.assign(Object.assign({},e),{ignoreHttpStatusCodes:!0}))],{maxRetries:(t=e.maxRetries)!==null&&t!==void 0?t:c7n.DEFAULT_RETRY_POLICY_COUNT}).sendRequest}}});var f7t=y(XN=>{"use strict";Object.defineProperty(XN,"__esModule",{value:!0});XN.throttlingRetryPolicyName=void 0;XN.throttlingRetryPolicy=d7n;var l7n=xte(),p7n=VN(),f7n=o0();XN.throttlingRetryPolicyName="throttlingRetryPolicy";function d7n(e={}){var t;return{name:XN.throttlingRetryPolicyName,sendRequest:(0,p7n.retryPolicy)([(0,l7n.throttlingRetryStrategy)()],{maxRetries:(t=e.maxRetries)!==null&&t!==void 0?t:f7n.DEFAULT_RETRY_POLICY_COUNT}).sendRequest}}});var R$e=y(JN=>{"use strict";Object.defineProperty(JN,"__esModule",{value:!0});JN.DEFAULT_CYCLER_OPTIONS=void 0;JN.createTokenCycler=g7n;var h7n=Ste();JN.DEFAULT_CYCLER_OPTIONS={forcedRefreshWindowInMs:1e3,retryIntervalInMs:3e3,refreshWindowInMs:1e3*60*2};async function m7n(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,h7n.delay)(t),i=await n();return i}function g7n(e,t){let r=null,n=null,i,a=Object.assign(Object.assign({},JN.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=m7n(()=>e.getToken(c,u),a.retryIntervalInMs,(l=n?.expiresOnTimestamp)!==null&&l!==void 0?l:Date.now()).then(d=>(r=null,n=d,i=u.tenantId,n)).catch(d=>{throw r=null,n=null,i=void 0,d})),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 d7t=y(ZN=>{"use strict";Object.defineProperty(ZN,"__esModule",{value:!0});ZN.bearerTokenAuthenticationPolicyName=void 0;ZN.bearerTokenAuthenticationPolicy=E7n;var y7n=R$e(),v7n=AA();ZN.bearerTokenAuthenticationPolicyName="bearerTokenAuthenticationPolicy";async function b7n(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 _7n(e){let t=e.headers.get("WWW-Authenticate");if(e.status===401&&t)return t}function E7n(e){var t;let{credential:r,scopes:n,challengeCallbacks:i}=e,a=e.logger||v7n.logger,o=Object.assign({authorizeRequest:(t=i?.authorizeRequest)!==null&&t!==void 0?t:b7n,authorizeRequestOnChallenge:i?.authorizeRequestOnChallenge},i),s=r?(0,y7n.createTokenCycler)(r):()=>Promise.resolve(null);return{name:ZN.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(d){p=d,l=d.response}if(o.authorizeRequestOnChallenge&&l?.status===401&&_7n(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 h7t=y(QN=>{"use strict";Object.defineProperty(QN,"__esModule",{value:!0});QN.ndJsonPolicyName=void 0;QN.ndJsonPolicy=T7n;QN.ndJsonPolicyName="ndJsonPolicy";function T7n(){return{name:QN.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 g7t=y(PA=>{"use strict";Object.defineProperty(PA,"__esModule",{value:!0});PA.auxiliaryAuthenticationHeaderPolicyName=void 0;PA.auxiliaryAuthenticationHeaderPolicy=x7n;var O7n=R$e(),S7n=AA();PA.auxiliaryAuthenticationHeaderPolicyName="auxiliaryAuthenticationHeaderPolicy";var m7t="x-ms-authorization-auxiliary";async function A7n(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 x7n(e){let{credentials:t,scopes:r}=e,n=e.logger||S7n.logger,i=new WeakMap;return{name:PA.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(`${PA.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,O7n.createTokenCycler)(u),i.set(u,l)),s.push(A7n({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. ${m7t} header will not be set.`),o(a)):(a.headers.set(m7t,c.map(u=>`Bearer ${u}`).join(", ")),o(a))}}}});var L7t=y(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.createFileFromStream=Me.createFile=Me.auxiliaryAuthenticationHeaderPolicyName=Me.auxiliaryAuthenticationHeaderPolicy=Me.ndJsonPolicyName=Me.ndJsonPolicy=Me.bearerTokenAuthenticationPolicyName=Me.bearerTokenAuthenticationPolicy=Me.formDataPolicyName=Me.formDataPolicy=Me.tlsPolicyName=Me.tlsPolicy=Me.userAgentPolicyName=Me.userAgentPolicy=Me.defaultRetryPolicy=Me.tracingPolicyName=Me.tracingPolicy=Me.retryPolicy=Me.throttlingRetryPolicyName=Me.throttlingRetryPolicy=Me.systemErrorRetryPolicyName=Me.systemErrorRetryPolicy=Me.redirectPolicyName=Me.redirectPolicy=Me.getDefaultProxySettings=Me.proxyPolicyName=Me.proxyPolicy=Me.multipartPolicyName=Me.multipartPolicy=Me.logPolicyName=Me.logPolicy=Me.setClientRequestIdPolicyName=Me.setClientRequestIdPolicy=Me.exponentialRetryPolicyName=Me.exponentialRetryPolicy=Me.decompressResponsePolicyName=Me.decompressResponsePolicy=Me.isRestError=Me.RestError=Me.createPipelineRequest=Me.createHttpHeaders=Me.createDefaultHttpClient=Me.createPipelineFromOptions=Me.createEmptyPipeline=void 0;var C7n=Ake();Object.defineProperty(Me,"createEmptyPipeline",{enumerable:!0,get:function(){return C7n.createEmptyPipeline}});var P7n=t7t();Object.defineProperty(Me,"createPipelineFromOptions",{enumerable:!0,get:function(){return P7n.createPipelineFromOptions}});var D7n=c7t();Object.defineProperty(Me,"createDefaultHttpClient",{enumerable:!0,get:function(){return D7n.createDefaultHttpClient}});var w7n=dq();Object.defineProperty(Me,"createHttpHeaders",{enumerable:!0,get:function(){return w7n.createHttpHeaders}});var N7n=u7t();Object.defineProperty(Me,"createPipelineRequest",{enumerable:!0,get:function(){return N7n.createPipelineRequest}});var y7t=kte();Object.defineProperty(Me,"RestError",{enumerable:!0,get:function(){return y7t.RestError}});Object.defineProperty(Me,"isRestError",{enumerable:!0,get:function(){return y7t.isRestError}});var v7t=l$e();Object.defineProperty(Me,"decompressResponsePolicy",{enumerable:!0,get:function(){return v7t.decompressResponsePolicy}});Object.defineProperty(Me,"decompressResponsePolicyName",{enumerable:!0,get:function(){return v7t.decompressResponsePolicyName}});var b7t=l7t();Object.defineProperty(Me,"exponentialRetryPolicy",{enumerable:!0,get:function(){return b7t.exponentialRetryPolicy}});Object.defineProperty(Me,"exponentialRetryPolicyName",{enumerable:!0,get:function(){return b7t.exponentialRetryPolicyName}});var _7t=v$e();Object.defineProperty(Me,"setClientRequestIdPolicy",{enumerable:!0,get:function(){return _7t.setClientRequestIdPolicy}});Object.defineProperty(Me,"setClientRequestIdPolicyName",{enumerable:!0,get:function(){return _7t.setClientRequestIdPolicyName}});var E7t=e$e();Object.defineProperty(Me,"logPolicy",{enumerable:!0,get:function(){return E7t.logPolicy}});Object.defineProperty(Me,"logPolicyName",{enumerable:!0,get:function(){return E7t.logPolicyName}});var T7t=u$e();Object.defineProperty(Me,"multipartPolicy",{enumerable:!0,get:function(){return T7t.multipartPolicy}});Object.defineProperty(Me,"multipartPolicyName",{enumerable:!0,get:function(){return T7t.multipartPolicyName}});var L$e=y$e();Object.defineProperty(Me,"proxyPolicy",{enumerable:!0,get:function(){return L$e.proxyPolicy}});Object.defineProperty(Me,"proxyPolicyName",{enumerable:!0,get:function(){return L$e.proxyPolicyName}});Object.defineProperty(Me,"getDefaultProxySettings",{enumerable:!0,get:function(){return L$e.getDefaultProxySettings}});var O7t=t$e();Object.defineProperty(Me,"redirectPolicy",{enumerable:!0,get:function(){return O7t.redirectPolicy}});Object.defineProperty(Me,"redirectPolicyName",{enumerable:!0,get:function(){return O7t.redirectPolicyName}});var S7t=p7t();Object.defineProperty(Me,"systemErrorRetryPolicy",{enumerable:!0,get:function(){return S7t.systemErrorRetryPolicy}});Object.defineProperty(Me,"systemErrorRetryPolicyName",{enumerable:!0,get:function(){return S7t.systemErrorRetryPolicyName}});var A7t=f7t();Object.defineProperty(Me,"throttlingRetryPolicy",{enumerable:!0,get:function(){return A7t.throttlingRetryPolicy}});Object.defineProperty(Me,"throttlingRetryPolicyName",{enumerable:!0,get:function(){return A7t.throttlingRetryPolicyName}});var I7n=VN();Object.defineProperty(Me,"retryPolicy",{enumerable:!0,get:function(){return I7n.retryPolicy}});var x7t=S$e();Object.defineProperty(Me,"tracingPolicy",{enumerable:!0,get:function(){return x7t.tracingPolicy}});Object.defineProperty(Me,"tracingPolicyName",{enumerable:!0,get:function(){return x7t.tracingPolicyName}});var R7n=d$e();Object.defineProperty(Me,"defaultRetryPolicy",{enumerable:!0,get:function(){return R7n.defaultRetryPolicy}});var C7t=a$e();Object.defineProperty(Me,"userAgentPolicy",{enumerable:!0,get:function(){return C7t.userAgentPolicy}});Object.defineProperty(Me,"userAgentPolicyName",{enumerable:!0,get:function(){return C7t.userAgentPolicyName}});var P7t=b$e();Object.defineProperty(Me,"tlsPolicy",{enumerable:!0,get:function(){return P7t.tlsPolicy}});Object.defineProperty(Me,"tlsPolicyName",{enumerable:!0,get:function(){return P7t.tlsPolicyName}});var D7t=g$e();Object.defineProperty(Me,"formDataPolicy",{enumerable:!0,get:function(){return D7t.formDataPolicy}});Object.defineProperty(Me,"formDataPolicyName",{enumerable:!0,get:function(){return D7t.formDataPolicyName}});var w7t=d7t();Object.defineProperty(Me,"bearerTokenAuthenticationPolicy",{enumerable:!0,get:function(){return w7t.bearerTokenAuthenticationPolicy}});Object.defineProperty(Me,"bearerTokenAuthenticationPolicyName",{enumerable:!0,get:function(){return w7t.bearerTokenAuthenticationPolicyName}});var N7t=h7t();Object.defineProperty(Me,"ndJsonPolicy",{enumerable:!0,get:function(){return N7t.ndJsonPolicy}});Object.defineProperty(Me,"ndJsonPolicyName",{enumerable:!0,get:function(){return N7t.ndJsonPolicyName}});var I7t=g7t();Object.defineProperty(Me,"auxiliaryAuthenticationHeaderPolicy",{enumerable:!0,get:function(){return I7t.auxiliaryAuthenticationHeaderPolicy}});Object.defineProperty(Me,"auxiliaryAuthenticationHeaderPolicyName",{enumerable:!0,get:function(){return I7t.auxiliaryAuthenticationHeaderPolicyName}});var R7t=o$e();Object.defineProperty(Me,"createFile",{enumerable:!0,get:function(){return R7t.createFile}});Object.defineProperty(Me,"createFileFromStream",{enumerable:!0,get:function(){return R7t.createFileFromStream}})});var $7t=y((Eq,k7t)=>{"use strict";var L7n=Eq&&Eq.__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())})},k7n=Eq&&Eq.__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}}},$7n=di(),M7n="https://monitor.azure.com//.default",_q;try{_q=L7t()}catch{$7n.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 F7n(e){return null}var j7n=function(){function e(t,r){if(_q){var n=r?[r]:[M7n];this._azureTokenPolicy=_q.bearerTokenAuthenticationPolicy({credential:t,scopes:n})}}return e.prototype.addAuthorizationHeader=function(t){return L7n(this,void 0,void 0,function(){var r,n;return k7n(this,function(i){switch(i.label){case 0:return _q?(r="authorization",n=_q.createPipelineRequest({url:"https://"}),[4,this._azureTokenPolicy.sendRequest(n,F7n)]):[3,2];case 1:i.sent(),t.headers[r]=n.headers.get(r),i.label=2;case 2:return[2]}})})},e}();k7t.exports=j7n});var F7t=y((tWi,M7t)=>{"use strict";var V7n=di(),q7n=Ms(),U7n=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){V7n.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||q7n.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}();M7t.exports=U7n});var j7t=y(k$e=>{"use strict";Object.defineProperty(k$e,"__esModule",{value:!0});k$e.azureRoleEnvironmentTelemetryProcessor=B7n;function B7n(e,t){}});var U7t=y(jte=>{"use strict";Object.defineProperty(jte,"__esModule",{value:!0});jte.samplingTelemetryProcessor=z7n;jte.getSamplingHashCode=q7t;var V7t=kc();function z7n(e,t){var r=e.sampleRate,n=!1;return r==null||r>=100||e.data&&V7t.TelemetryType.Metric===V7t.baseTypeToTelemetryType(e.data.baseType)?!0:(t.correlationContext&&t.correlationContext.operation?n=q7t(t.correlationContext.operation.id)<r:n=Math.random()*100<r,n)}function q7t(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 B7t=y(zv=>{"use strict";var H7n=zv&&zv.__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]}),G7n=zv&&zv.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),K7n=zv&&zv.__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)&&H7n(t,e,r);return G7n(t,e),t};Object.defineProperty(zv,"__esModule",{value:!0});zv.performanceMetricsTelemetryProcessor=Y7n;var $$e=Bee(),M$e=K7n(kc());function Y7n(e,t){switch(t&&t.addDocument(e),e.data.baseType){case M$e.TelemetryTypeString.Exception:$$e.countException();break;case M$e.TelemetryTypeString.Request:var r=e.data.baseData;$$e.countRequest(r.duration,r.success);break;case M$e.TelemetryTypeString.Dependency:var n=e.data.baseData;$$e.countDependency(n.duration,n.success);break}return!0}});var z7t=y(uh=>{"use strict";var dg=uh&&uh.__assign||function(){return dg=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},dg.apply(this,arguments)},W7n=uh&&uh.__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]}),X7n=uh&&uh.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),J7n=uh&&uh.__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)&&W7n(t,e,r);return X7n(t,e),t};Object.defineProperty(uh,"__esModule",{value:!0});uh.preAggregatedMetricsTelemetryProcessor=Q7n;var Z7n=kc(),Tq=tke(),Vte=J7n(kc());function Q7n(e,t){if(Tq.isEnabled())switch(e.data.baseType){case Vte.TelemetryTypeString.Exception:var r=e.data.baseData;r.properties=dg(dg({},r.properties),{"_MS.ProcessedByMetricExtractors":"(Name:'Exceptions', Ver:'1.1')"});var n={cloudRoleInstance:e.tags[t.keys.cloudRoleInstance],cloudRoleName:e.tags[t.keys.cloudRole]};Tq.countException(n);break;case Vte.TelemetryTypeString.Trace:var i=e.data.baseData;i.properties=dg(dg({},i.properties),{"_MS.ProcessedByMetricExtractors":"(Name:'Traces', Ver:'1.1')"});var a={cloudRoleInstance:e.tags[t.keys.cloudRoleInstance],cloudRoleName:e.tags[t.keys.cloudRole],traceSeverityLevel:Z7n.SeverityLevel[i.severity]};Tq.countTrace(a);break;case Vte.TelemetryTypeString.Request:var o=e.data.baseData;o.properties=dg(dg({},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};Tq.countRequest(o.duration,s);break;case Vte.TelemetryTypeString.Dependency:var c=e.data.baseData;c.properties=dg(dg({},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};Tq.countDependency(c.duration,u);break}return!0}});var H7t=y(hg=>{"use strict";var eXn=hg&&hg.__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]}),qte=hg&&hg.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&eXn(t,e,r)};Object.defineProperty(hg,"__esModule",{value:!0});qte(j7t(),hg);qte(U7t(),hg);qte(B7t(),hg);qte(z7t(),hg)});var F$e=y((sWi,Y7t)=>{"use strict";var Gt=kc(),xl=Ms(),G7t=JE(),tXn=di(),rXn=function(){function e(){}return e.createEnvelope=function(t,r,n,i,a){var o=null;switch(r){case Gt.TelemetryType.Trace:o=e.createTraceData(t);break;case Gt.TelemetryType.Dependency:o=e.createDependencyData(t);break;case Gt.TelemetryType.Event:o=e.createEventData(t);break;case Gt.TelemetryType.Exception:o=e.createExceptionData(t);break;case Gt.TelemetryType.Request:o=e.createRequestData(t);break;case Gt.TelemetryType.Metric:o=e.createMetricData(t);break;case Gt.TelemetryType.Availability:o=e.createAvailabilityData(t);break;case Gt.TelemetryType.PageView:o=e.createPageViewData(t);break}if(o&&o.baseData&&Gt.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=xl.validateStringMap(o.baseData.properties))}var c=a&&a.instrumentationKey||"",u=new Gt.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===Gt.TelemetryType.Metric&&(u.sampleRate=100),u},e.addAzureFunctionsCorrelationProperties=function(t){var r=G7t.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&&(xl.isDate(i[a])||(i[a]==null&&(i[a]=""),typeof i[a]=="object"&&(i[a]=xl.stringify(i[a])),r[n[a]]=String(i[a]).substring(0,8192)),r[n[a]]=i[a]);return r}catch(o){tXn.warn("Failed to properly truncate telemetry properties: ",o)}},e.createTraceData=function(t){var r,n=new Gt.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=Gt.SeverityLevel.Information:n.severityLevel=t.severity;var i=new Gt.Data;return i.baseType=Gt.telemetryTypeToBaseType(Gt.TelemetryType.Trace),i.baseData=n,i},e.createDependencyData=function(t){var r,n,i,a=new Gt.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=xl.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=xl.w3cTraceId();var o=new Gt.Data;return o.baseType=Gt.telemetryTypeToBaseType(Gt.TelemetryType.Dependency),o.baseData=a,o},e.createEventData=function(t){var r,n=new Gt.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 Gt.Data;return i.baseType=Gt.telemetryTypeToBaseType(Gt.TelemetryType.Event),i.baseData=n,i},e.createExceptionData=function(t){var r,n,i=new Gt.ExceptionData;i.properties=this.truncateProperties(t),isNaN(t.severity)?i.severityLevel=Gt.SeverityLevel.Error:i.severityLevel=t.severity,i.measurements=t.measurements,i.exceptions=[];var a=t.exception.stack,o=new Gt.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=xl.isArray(o.parsedStack)&&o.parsedStack.length>0,i.exceptions.push(o);var s=new Gt.Data;return s.baseType=Gt.telemetryTypeToBaseType(Gt.TelemetryType.Exception),s.baseData=i,s},e.createRequestData=function(t){var r,n,i,a,o=new Gt.RequestData;t.id?o.id=t.id:o.id=xl.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=xl.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 Gt.Data;return s.baseType=Gt.telemetryTypeToBaseType(Gt.TelemetryType.Request),s.baseData=o,s},e.createMetricData=function(t){var r,n=new Gt.MetricData;n.metrics=[];var i=new Gt.DataPoint;i.count=isNaN(t.count)?1:t.count,i.kind=Gt.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 Gt.Data;return a.baseType=Gt.telemetryTypeToBaseType(Gt.TelemetryType.Metric),a.baseData=n,a},e.createAvailabilityData=function(t){var r,n,i=new Gt.AvailabilityData;t.id?i.id=t.id:i.id=xl.w3cTraceId(),i.name=(r=t.name)===null||r===void 0?void 0:r.substring(0,1024),i.duration=xl.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 Gt.Data;return a.baseType=Gt.telemetryTypeToBaseType(Gt.TelemetryType.Availability),a.baseData=i,a},e.createPageViewData=function(t){var r,n,i=new Gt.PageViewData;i.name=(r=t.name)===null||r===void 0?void 0:r.substring(0,1024),i.duration=xl.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 Gt.Data;return a.baseType=Gt.telemetryTypeToBaseType(Gt.TelemetryType.PageView),a.baseData=i,a},e.getTags=function(t,r){var n=G7t.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(K7t.regex.test(s)){var c=new K7t(n[o],i++);a+=c.sizeInBytes,r.push(c)}}var u=32*1024;if(a>u)for(var l=0,p=r.length-1,d=0,f=l,h=p;l<p;){var g=r[l].sizeInBytes,v=r[p].sizeInBytes;if(d+=g+v,d>u){var E=h-f+1;r.splice(f,E);break}f=l,h=p,l++,p--}}return r},e}(),K7t=function(){function e(t,r){this.sizeInBytes=0,this.level=r,this.method="<no_method>",this.assembly=xl.trim(t);var n=t.match(e.regex);n&&n.length>=5&&(this.method=xl.trim(n[2])||this.method,this.fileName=xl.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}();Y7t.exports=rXn});var W7t=y(s0=>{"use strict";var nXn=s0&&s0.__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())})},iXn=s0&&s0.__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(s0,"__esModule",{value:!0});s0.FileAccessControl=void 0;var aXn=require("fs"),oXn=require("os"),eI=require("child_process"),sXn=di(),cXn=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=aXn.existsSync(e.ICACLS_PATH)}catch{}e.OS_PROVIDES_FILE_PROTECTION||sXn.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 nXn(this,void 0,void 0,function(){var r,n;return iXn(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=eI.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(eI.spawnSync){var r=eI.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=eI.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(eI.spawnSync){var t=eI.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=oXn.type()==="Windows_NT",e}();s0.FileAccessControl=cXn});var q$e=y((Sq,X7t)=>{"use strict";var Ute=Sq&&Sq.__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())})},Bte=Sq&&Sq.__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}}},j$e=require("fs"),uXn=require("os"),DA=require("path"),lXn=require("zlib"),c0=Hi(),pXn=wN(),Hv=SNe(),Cl=Ms(),fXn=require("url"),V$e=di(),Oq=W7t(),dXn=439,hXn=402,mXn=[200,206,402,408,429,439,500],gXn="Invalid instrumentation key",yXn=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=DA.join(uXn.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&&Oq.FileAccessControl.checkFileProtection(),this._enableDiskRetryMode=Oq.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&&!Oq.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(c0.StatsbeatFeature.DISK_RETRY),this._fileCleanupTimer||(this._fileCleanupTimer=setTimeout(function(){i._fileCleanupTask()},e.CLEANUP_TIMEOUT),this._fileCleanupTimer.unref())):(this._statsbeat&&this._statsbeat.removeFeature(c0.StatsbeatFeature.DISK_RETRY),this._fileCleanupTimer&&clearTimeout(this._fileCleanupTimer))},e.prototype.send=function(t,r){return Ute(this,void 0,void 0,function(){var n,i,a,o,s,c,u,l,p=this;return Bte(this,function(d){switch(d.label){case 0:if(!(t&&t.length>0))return[3,5];if(n=this._redirectedHost||this._config.endpointUrl,i=new fXn.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(c0.StatsbeatFeature.AAD_HANDLING),d.label=1;case 1:return d.trys.push([1,3,,4]),[4,o.addAuthorizationHeader(a)];case 2:return d.sent(),[3,4];case 3:return s=d.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(f){var h=Cl.stringify(f);typeof h=="string"&&(u+=h+`
|
|
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),lXn.gzip(l,function(f,h){var g=h;f?(p._logWarn(Cl.dumpObj(f)),g=l,a.headers["Content-Length"]=l.length.toString()):(a.headers["Content-Encoding"]="gzip",a.headers["Content-Length"]=h.length.toString()),p._logInfo(Cl.dumpObj(a)),a[pXn.disableCollectionRequestOption]=!0;var v=+new Date,E=function(S){S.setEncoding("utf-8");var A="";S.on("data",function(x){A+=x}),S.on("end",function(){var x,D=+new Date,k=D-v;if(p._numConsecutiveFailures=0,A.includes(gXn)&&S.statusCode===400&&(V$e.warn("Instrumentation key was invalid, please check the iKey"),(x=p._shutdownStatsbeat)===null||x===void 0||x.call(p)),p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&(mXn.includes(S.statusCode)?p._statsbeatHasReachedIngestionAtLeastOnce=!0:p._statsbeatFailedToIngest()),p._statsbeat&&(S.statusCode==hXn||S.statusCode==dXn?p._statsbeat.countThrottle(c0.StatsbeatNetworkCategory.Breeze,i,S.statusCode):p._statsbeat.countRequest(c0.StatsbeatNetworkCategory.Breeze,i,k,S.statusCode===200,S.statusCode)),p._enableDiskRetryMode){if(S.statusCode===200)p._resendTimer||(p._resendTimer=setTimeout(function(){p._resendTimer=null,p._sendFirstFileOnDisk()},p._resendInterval),p._resendTimer.unref());else if(p._isRetriable(S.statusCode))try{p._statsbeat&&p._statsbeat.countRetry(c0.StatsbeatNetworkCategory.Breeze,i,S.statusCode);var N=JSON.parse(A),V=[];N.errors&&(N.errors.forEach(function(G){(G.statusCode==429||G.statusCode==500||G.statusCode==503)&&V.push(t[G.index])}),V.length>0&&p._storeToDisk(V))}catch{p._storeToDisk(t)}}if(S.statusCode===307||S.statusCode===308)if(p._numConsecutiveRedirects++,p._numConsecutiveRedirects<10){var X=S.headers.location?S.headers.location.toString():null;X&&(p._redirectedHost=X,p.send(t,r))}else{var M={name:"Circular Redirect",message:"Error sending telemetry because of circular redirects."};p._statsbeat&&p._statsbeat.countException(c0.StatsbeatNetworkCategory.Breeze,i,M),typeof r=="function"&&r("Error sending telemetry because of circular redirects.")}else p._numConsecutiveRedirects=0,typeof r=="function"&&r(A),p._logInfo(A),typeof p._onSuccess=="function"&&p._onSuccess(A)})},O=Cl.makeRequest(p._config,n,a,E);O.setTimeout(e.HTTP_TIMEOUT,function(){p._requestTimedOut=!0,O.abort()}),O.on("error",function(S){if(p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&p._statsbeatFailedToIngest(),p._numConsecutiveFailures++,p._statsbeat&&p._statsbeat.countException(c0.StatsbeatNetworkCategory.Breeze,i,S),!p._enableDiskRetryMode||p._numConsecutiveFailures>0&&p._numConsecutiveFailures%e.MAX_CONNECTION_FAILURES_BEFORE_WARN===0){var A="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&&(A="Ingestion endpoint could not be reached ".concat(p._numConsecutiveFailures," consecutive times. There may be resulting telemetry loss. Most recent error:")),p._logWarn(A,Cl.dumpObj(S))}else{var A="Transient failure to reach ingestion endpoint. This batch of telemetry items will be retried. Error:";p._logInfo(A,Cl.dumpObj(S))}p._onErrorHelper(S),typeof r=="function"&&(S?(p._requestTimedOut&&(S.name="telemetry timeout",S.message="telemetry request timed out"),r(Cl.dumpObj(S))):r("Error sending telemetry")),p._enableDiskRetryMode&&p._storeToDisk(t)}),O.write(g),O.end()}),d.label=5;case 5:return[2]}})})},e.prototype.saveOnCrash=function(t){this._enableDiskRetryMode&&this._storeToDiskSync(Cl.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||V$e.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||V$e.warn(e.TAG,t,r)},e.prototype._statsbeatFailedToIngest=function(){this._shutdownStatsbeat&&(this._failedToIngestCounter++,this._failedToIngestCounter>=3&&this._shutdownStatsbeat())},e.prototype._storeToDisk=function(t){return Ute(this,void 0,void 0,function(){var r,n,i,a,o,s,c;return Bte(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,Hv.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: "+Cl.dumpObj(r)),this._onErrorHelper(r),[2];case 3:return u.trys.push([3,5,,6]),[4,Oq.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: "+Cl.dumpObj(n)),this._onErrorHelper(n),[2];case 6:return u.trys.push([6,8,,9]),[4,Hv.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: "+Cl.dumpObj(a)),this._onErrorHelper(a),[2];case 9:return u.trys.push([9,11,,12]),o="".concat(new Date().getTime(),".ai.json"),s=DA.join(this._tempDir,o),this._logInfo("saving data to disk at: "+s),[4,Hv.writeFileAsync(s,Cl.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: "+Cl.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),j$e.existsSync(this._tempDir)||j$e.mkdirSync(this._tempDir),Oq.FileAccessControl.applyACLRulesSync(this._tempDir);var r=Hv.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=DA.join(this._tempDir,n);this._logInfo("saving data before crash to disk at: "+i),j$e.writeFileSync(i,t,{mode:384})}catch(a){this._logWarn("Error while saving data to disk: "+Cl.dumpObj(a)),this._onErrorHelper(a)}},e.prototype._sendFirstFileOnDisk=function(){return Ute(this,void 0,void 0,function(){var t,r,n,i,a,o;return Bte(this,function(s){switch(s.label){case 0:return s.trys.push([0,6,,7]),[4,Hv.readdirAsync(this._tempDir)];case 1:return t=s.sent(),t=t.filter(function(c){return DA.basename(c).indexOf(".ai.json")>-1}),t.length>0?(r=t[0],n=DA.join(this._tempDir,r),[4,Hv.readFileAsync(n)]):[3,5];case 2:return i=s.sent(),[4,Hv.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 Ute(this,void 0,void 0,function(){var t,r,n,i,a,o,s=this;return Bte(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),[4,Hv.readdirAsync(this._tempDir)];case 1:if(t=c.sent(),t=t.filter(function(u){return DA.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=DA.join(this._tempDir,t[r]),[4,Hv.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=60*60*1e3,e.FILE_RETEMPTION_PERIOD=7*24*60*60*1e3,e.TEMPDIR_PREFIX="appInsights-node",e.HTTP_TIMEOUT=2e4,e}();X7t.exports=yXn});var Z7t=y(zte=>{"use strict";Object.defineProperty(zte,"__esModule",{value:!0});zte.AzureVirtualMachine=void 0;var J7t=di(),vXn=Ms(),bXn=wN(),_Xn="http://169.254.169.254/metadata/instance/compute",EXn="api-version=2017-12-01",TXn="format=json",OXn="UNREACH",SXn=function(){function e(){}return e.getAzureComputeMetadata=function(t,r){var n,i=this,a={},o="".concat(_Xn,"?").concat(EXn,"&").concat(TXn),s=(n={method:"GET"},n[bXn.disableCollectionRequestOption]=!0,n.headers={Metadata:"True"},n),c=vXn.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(d){J7t.info(e.TAG,d)}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(OXn)>-1?a.isVM=!1:J7t.info(e.TAG,u),r(a)}),c.end())},e.HTTP_TIMEOUT=2500,e.TAG="AzureVirtualMachine",e}();zte.AzureVirtualMachine=SXn});var Q7t=y(Hte=>{"use strict";Object.defineProperty(Hte,"__esModule",{value:!0});Hte.NetworkStatsbeat=void 0;var AXn=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}();Hte.NetworkStatsbeat=AXn});var iXt=y((wA,nXt)=>{"use strict";var mg=wA&&wA.__assign||function(){return mg=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},mg.apply(this,arguments)},U$e=wA&&wA.__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())})},B$e=wA&&wA.__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}}},xXn=require("os"),CXn=F$e(),eXt=di(),PXn=q$e(),Ki=Hi(),DXn=kc(),wXn=Z7t(),NXn=Tke(),tXt=ON(),IXn=Q7t(),rXt=Ms(),RXn="node",LXn=function(){function e(t,r){this._attach=Ki.StatsbeatAttach.sdk,this._feature=Ki.StatsbeatFeature.NONE,this._instrumentation=Ki.StatsbeatInstrumentation.NONE,this._isInitialized=!1,this._statbeatMetrics=[],this._networkStatsbeatCollection=[],this._config=t,this._context=r||new tXt,this._longHandleTimeout=null;var n=this._getConnectionString(t);this._statsbeatConfig=new NXn(n),this._statsbeatConfig.samplingPercentage=100,this._sender=new PXn(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=Ki.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 U$e(this,void 0,void 0,function(){var t,r;return B$e(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(),eXt.info(e.TAG,"Failed to send Statsbeat metrics: "+rXt.dumpObj(r)),[3,4];case 4:return[2]}})})},e.prototype.trackLongIntervalStatsbeats=function(){return U$e(this,void 0,void 0,function(){var t,r,n,i,a;return B$e(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:Ki.StatsbeatCounter.ATTACH,value:1,properties:r}),this._instrumentation!=Ki.StatsbeatInstrumentation.NONE&&(n=Object.assign({feature:this._instrumentation,type:Ki.StatsbeatFeatureType.Instrumentation},t),this._statbeatMetrics.push({name:Ki.StatsbeatCounter.FEATURE,value:1,properties:n})),this._feature!=Ki.StatsbeatFeature.NONE&&(i=Object.assign({feature:this._feature,type:Ki.StatsbeatFeatureType.Feature},t),this._statbeatMetrics.push({name:Ki.StatsbeatCounter.FEATURE,value:1,properties:i})),[4,this._sendStatsbeats()];case 2:return o.sent(),[3,4];case 3:return a=o.sent(),eXt.info(e.TAG,"Failed to send Statsbeat metrics: "+rXt.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 IXn.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:Ki.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:Ki.StatsbeatCounter.REQUEST_SUCCESS,value:a.totalSuccesfulRequestCount,properties:c}),a.totalSuccesfulRequestCount=0),a.totalFailedRequestCount.length>0&&(a.totalFailedRequestCount.forEach(function(u){c=Object.assign(mg(mg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:Ki.StatsbeatCounter.REQUEST_FAILURE,value:u.count,properties:c})}),a.totalFailedRequestCount=[]),a.retryCount.length>0&&(a.retryCount.forEach(function(u){c=Object.assign(mg(mg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:Ki.StatsbeatCounter.RETRY_COUNT,value:u.count,properties:c})}),a.retryCount=[]),a.throttleCount.length>0&&(a.throttleCount.forEach(function(u){c=Object.assign(mg(mg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:Ki.StatsbeatCounter.THROTTLE_COUNT,value:u.count,properties:c})}),a.throttleCount=[]),a.exceptionCount.length>0&&(a.exceptionCount.forEach(function(u){c=Object.assign(mg(mg({},c),{exceptionType:u.exceptionType})),r._statbeatMetrics.push({name:Ki.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 U$e(this,void 0,void 0,function(){var t,r,n,i;return B$e(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=CXn.createEnvelope(n,DXn.TelemetryType.Metric,null,this._context,this._statsbeatConfig),i.name=Ki.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=RXn,this._cikey=this._config.instrumentationKey,this._sdkVersion=tXt.sdkVersion,this._os=xXn.type(),this._runtimeVersion=process.version},e.prototype._getResourceProvider=function(){var t=this;return new Promise(function(r,n){var i=!1;t._resourceProvider=Ki.StatsbeatResourceProvider.unknown,t._resourceIdentifier=Ki.StatsbeatResourceProvider.unknown,process.env.AKS_ARM_NAMESPACE_ID?(t._resourceProvider=Ki.StatsbeatResourceProvider.aks,t._resourceIdentifier=process.env.AKS_ARM_NAMESPACE_ID):process.env.WEBSITE_SITE_NAME?(t._resourceProvider=Ki.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=Ki.StatsbeatResourceProvider.functions,process.env.WEBSITE_HOSTNAME&&(t._resourceIdentifier=process.env.WEBSITE_HOSTNAME)):t._config&&(t._isVM===void 0||t._isVM==!0?(i=!0,wXn.AzureVirtualMachine.getAzureComputeMetadata(t._config,function(a){t._isVM=a.isVM,t._isVM&&(t._resourceProvider=Ki.StatsbeatResourceProvider.vm,t._resourceIdentifier=a.id+"/"+a.subscriptionId,a.osType&&(t._os=a.osType)),r()})):t._resourceProvider=Ki.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}();nXt.exports=LXn});var sXt=y((pWi,oXt)=>{"use strict";var kXn=require("url"),$Xn=Tke(),MXn=$7t(),FXn=ON(),Gv=kc(),jXn=F7t(),z$e=H7t(),aXt=JE(),VXn=iXt(),qXn=q$e(),H$e=Ms(),Gte=di(),UXn=F$e(),BXn=function(){function e(t){this._telemetryProcessors=[];var r=new $Xn(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 FXn,this.commonProperties={},this.authorizationHandler=null,this.config.disableStatsbeat||(this._statsbeat=new VXn(this.config,this.context),this._statsbeat.enable(!0));var n=new qXn(this.config,this.getAuthorizationHandler,null,null,this._statsbeat);this.channel=new jXn(function(){return r.disableAppInsights},function(){return r.maxBatchSize},function(){return r.maxBatchIntervalMs},n)}return e.prototype.trackAvailability=function(t){this.track(t,Gv.TelemetryType.Availability)},e.prototype.trackPageView=function(t){this.track(t,Gv.TelemetryType.PageView)},e.prototype.trackTrace=function(t){this.track(t,Gv.TelemetryType.Trace)},e.prototype.trackMetric=function(t){this.track(t,Gv.TelemetryType.Metric)},e.prototype.trackException=function(t){t&&t.exception&&!H$e.isError(t.exception)&&(t.exception=new Error(t.exception.toString())),this.track(t,Gv.TelemetryType.Exception)},e.prototype.trackEvent=function(t){this.track(t,Gv.TelemetryType.Event)},e.prototype.trackRequest=function(t){this.track(t,Gv.TelemetryType.Request)},e.prototype.trackDependency=function(t){if(t&&!t.target&&t.data)try{t.target=new kXn.URL(t.data).host}catch(r){t.target=null,Gte.warn(e.TAG,"The URL object is failed to create.",r)}this.track(t,Gv.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&&Gv.telemetryTypeToBaseType(r)){var n=UXn.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&&z$e.samplingTelemetryProcessor(n,{correlationContext:aXt.CorrelationContextManager.getCurrentContext()}),z$e.preAggregatedMetricsTelemetryProcessor(n,this.context),i&&(z$e.performanceMetricsTelemetryProcessor(n,this.quickPulseClient),this.channel.send(n))}else Gte.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||(Gte.info(e.TAG,"Adding authorization handler"),this.authorizationHandler=new MXn(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=aXt.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,Gte.warn(e.TAG,"One of telemetry processors failed, telemetry item will be sent.",s,t)}return n&&(t&&t.tags&&(t.tags=H$e.validateStringMap(t.tags)),t&&t.data&&t.data.baseData&&t.data.baseData.properties&&(t.data.baseData.properties=H$e.validateStringMap(t.data.baseData.properties))),n},e.prototype.getStatsbeat=function(){return this._statsbeat},e.TAG="TelemetryClient",e}();oXt.exports=BXn});var lXt=y((G$e,uXt)=>{"use strict";var zXn=G$e&&G$e.__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)}}(),HXn=sXt(),cXt=mke(),GXn=wN(),Kte=di(),KXn=function(e){zXn(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?cXt.trackRequestSync(this,r):Kte.warn("trackNodeHttpRequestSync requires NodeHttpRequestTelemetry object with request, response and duration specified.")},t.prototype.trackNodeHttpRequest=function(r){(r.duration||r.error)&&Kte.warn("trackNodeHttpRequest will ignore supplied duration and error parameters. These values are collected from the request and response objects."),r&&r.request&&r.response?cXt.trackRequest(this,r):Kte.warn("trackNodeHttpRequest requires NodeHttpRequestTelemetry object with request and response specified.")},t.prototype.trackNodeHttpDependency=function(r){r&&r.request?GXn.trackRequest(this,r):Kte.warn("trackNodeHttpDependency requires NodeHttpDependencyTelemetry object with request specified.")},t}(HXn);uXt.exports=KXn});var fXt=y(pXt=>{"use strict";Object.defineProperty(pXt,"__esModule",{value:!0})});var Z$e=y(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.Configuration=pe.liveMetricsClient=pe.defaultClient=pe.DistributedTracingModes=void 0;pe.setup=rJn;pe.start=mXt;pe.getCorrelationContext=iJn;pe.startOperation=aJn;pe.wrapWithCorrelationContext=oJn;pe.dispose=sJn;var Y$e=JE(),YXn=oKt(),WXn=cKt(),W$e=Bee(),XXn=tke(),JXn=vKt(),ZXn=DKt(),QXn=wN(),eJn=mke(),dXt=aA(),Aq=di(),hXt=uYt(),X$e=pYt(),tJn=hYt();pe.TelemetryClient=lXt();pe.Contracts=kc();pe.azureFunctionsTypes=fXt();var K$e;(function(e){e[e.AI=0]="AI",e[e.AI_AND_W3C=1]="AI_AND_W3C"})(K$e||(pe.DistributedTracingModes=K$e={}));var xq,Cq,Pq,Dq,wq,tI,rI,NA,Nq,Iq,Sp=!1,Yte;function rJn(e){return pe.defaultClient?Aq.info("The default client is already setup"):(pe.defaultClient=new pe.TelemetryClient(e),xq=new YXn(pe.defaultClient),Cq=new WXn(pe.defaultClient),Pq=new W$e(pe.defaultClient),Dq=new XXn(pe.defaultClient),wq=new JXn(pe.defaultClient),tI=new ZXn(pe.defaultClient),NA=new eJn(pe.defaultClient),Nq=new QXn(pe.defaultClient),rI||(rI=new X$e.AutoCollectNativePerformance(pe.defaultClient)),Iq=new tJn.AzureFunctionsHook(pe.defaultClient)),J$e}function nJn(){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 mXt(){if(pe.defaultClient){Sp=!0,nJn(),xq.enable(pe.defaultClient.config.enableAutoCollectExternalLoggers,pe.defaultClient.config.enableAutoCollectConsole),Cq.enable(pe.defaultClient.config.enableAutoCollectExceptions),Pq.enable(pe.defaultClient.config.enableAutoCollectPerformance),Dq.enable(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics),wq.enable(pe.defaultClient.config.enableAutoCollectHeartbeat),NA.useAutoCorrelation(pe.defaultClient.config.enableAutoDependencyCorrelation,pe.defaultClient.config.enableUseAsyncHooks),NA.enable(pe.defaultClient.config.enableAutoCollectRequests),Nq.enable(pe.defaultClient.config.enableAutoCollectDependencies),tI.enable(pe.defaultClient.config.enableWebInstrumentation,pe.defaultClient.config.webInstrumentationConnectionString),pe.defaultClient.config.enableSendLiveMetrics&&(pe.liveMetricsClient||(pe.liveMetricsClient=new hXt(pe.defaultClient.config,pe.defaultClient.context,pe.defaultClient.getAuthorizationHandler,pe.defaultClient),Yte=new W$e(pe.liveMetricsClient,1e3,!0),pe.liveMetricsClient.addCollector(Yte),pe.defaultClient.quickPulseClient=pe.liveMetricsClient),pe.liveMetricsClient.enable(pe.defaultClient.config.enableSendLiveMetrics)),Iq.enable(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions);var e=X$e.AutoCollectNativePerformance.parseEnabled(pe.defaultClient.config.enableAutoCollectExtendedMetrics,pe.defaultClient.config);rI.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 Aq.warn("Start cannot be called before setup");return J$e}function iJn(){return Y$e.CorrelationContextManager.getCurrentContext()}function aJn(e,t){return Y$e.CorrelationContextManager.startOperation(e,t)}function oJn(e,t){return Y$e.CorrelationContextManager.wrapCallback(e,t)}var J$e=function(){function e(){}return e.setDistributedTracingMode=function(t){return dXt.w3cEnabled=t===K$e.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,Sp&&xq.enable(t,r)),e},e.setAutoCollectExceptions=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectExceptions=t,Sp&&Cq.enable(t)),e},e.setAutoCollectPerformance=function(t,r){if(r===void 0&&(r=!0),pe.defaultClient){pe.defaultClient.config.enableAutoCollectPerformance=t;var n=X$e.AutoCollectNativePerformance.parseEnabled(r,pe.defaultClient.config);pe.defaultClient.config.enableAutoCollectExtendedMetrics=n.isEnabled,Sp&&(Pq.enable(t),rI.enable(pe.defaultClient.config.enableAutoCollectExtendedMetrics,n.disabledMetrics))}return e},e.setAutoCollectPreAggregatedMetrics=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics=t,Sp&&Dq.enable(t)),e},e.setAutoCollectHeartbeat=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectHeartbeat=t,Sp&&wq.enable(t)),e},e.enableAutoWebSnippetInjection=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableWebInstrumentation=t,pe.defaultClient.config.webInstrumentationConnectionString=r,Sp&&tI.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,Sp&&tI.enable(pe.defaultClient.config.enableWebInstrumentation,pe.defaultClient.config.webInstrumentationConnectionString)),e},e.setAutoCollectRequests=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectRequests=t,Sp&&NA.enable(t)),e},e.setAutoCollectDependencies=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectDependencies=t,Sp&&Nq.enable(t)),e},e.setAutoDependencyCorrelation=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableAutoDependencyCorrelation=t,pe.defaultClient.config.enableUseAsyncHooks=r,Sp&&NA.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),Aq.enableDebug=t,Aq.disableWarnings=!r,e},e.setAutoCollectIncomingRequestAzureFunctions=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions=t,Sp&&Iq.enable(t)),e},e.setSendLiveMetrics=function(t){return t===void 0&&(t=!1),pe.defaultClient?(!pe.liveMetricsClient&&t?(pe.liveMetricsClient=new hXt(pe.defaultClient.config,pe.defaultClient.context,pe.defaultClient.getAuthorizationHandler,pe.defaultClient),Yte=new W$e(pe.liveMetricsClient,1e3,!0),pe.liveMetricsClient.addCollector(Yte),pe.defaultClient.quickPulseClient=pe.liveMetricsClient):pe.liveMetricsClient&&pe.liveMetricsClient.enable(t),pe.defaultClient.config.enableSendLiveMetrics=t,e):(Aq.warn("Live metrics client cannot be setup without the default client"),e)},e.start=mXt,e}();pe.Configuration=J$e;function sJn(){dXt.w3cEnabled=!0,pe.defaultClient=null,Sp=!1,xq&&xq.dispose(),Cq&&Cq.dispose(),Pq&&Pq.dispose(),Dq&&Dq.dispose(),wq&&wq.dispose(),tI&&tI.dispose(),rI&&rI.dispose(),NA&&NA.dispose(),Nq&&Nq.dispose(),pe.liveMetricsClient&&(pe.liveMetricsClient.enable(!1),pe.liveMetricsClient=void 0),Iq&&Iq.dispose()}});var Xte=y(Wte=>{"use strict";Object.defineProperty(Wte,"__esModule",{value:!0});Wte.EventHeader=void 0;var Q$e=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}`}};Wte.EventHeader=Q$e});var Zte=y(Jte=>{"use strict";Object.defineProperty(Jte,"__esModule",{value:!0});Jte.SampleRate=void 0;var gXt;(function(e){e[e.OnePercent=0]="OnePercent",e[e.TenPercent=1]="TenPercent",e[e.NoSampling=2]="NoSampling"})(gXt||(Jte.SampleRate=gXt={}))});var tMe=y(eMe=>{"use strict";Object.defineProperty(eMe,"__esModule",{value:!0});eMe.configAzureTelemetryClient=cJn;function cJn(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 yXt=y((yWi,uJn)=>{uJn.exports={name:"@sap-ux/telemetry",version:"0.6.60",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.12.2","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 Rq=y(nI=>{"use strict";var lJn=nI&&nI.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nI,"__esModule",{value:!0});nI.TelemetrySettings=void 0;var vXt=lJn(yXt());nI.TelemetrySettings={azureInstrumentationKey:"",telemetryEnabled:!0,telemetryLibName:vXt.default.name,telemetryLibVersion:vXt.default.version,consumerModuleName:"",consumerModuleVersion:""}});var nMe=y(yg=>{"use strict";var pJn=yg&&yg.__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]}),fJn=yg&&yg.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dJn=yg&&yg.__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"&&pJn(r,t,n[i]);return fJn(r,t),r}}();Object.defineProperty(yg,"__esModule",{value:!0});yg.ApplicationInsightClient=void 0;var hJn=_Ne(),mJn=dJn(Z$e()),gJn=Xte(),gg=Zte(),yJn=tMe(),bXt=Rq(),rMe=class extends hJn.Client{clients;constructor(t,r,n){super(),this.clients=new Map,this.applicationKey=t,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(gg.SampleRate.OnePercent),a=this.createTelemetryClient(gg.SampleRate.TenPercent),o=this.createTelemetryClient(gg.SampleRate.NoSampling);this.clients.set(gg.SampleRate.OnePercent,i),this.clients.set(gg.SampleRate.TenPercent,a),this.clients.set(gg.SampleRate.NoSampling,o)}reportBlocking(t,r,n,i,a=!1){if(!a||bXt.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||!bXt.TelemetrySettings.telemetryEnabled)return;let{client:s,event:c}=this.prepareClientAndEvent(t,r,n,i);this.trackEvent(s,c)}prepareClientAndEvent(t,r,n,i=gg.SampleRate.NoSampling){let a=this.clients.get(i),s={name:new gJn.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 gg.SampleRate.OnePercent:r=1;break;case gg.SampleRate.TenPercent:r=10;break;case gg.SampleRate.NoSampling:default:r=100;break}let n=new mJn.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,(0,yJn.configAzureTelemetryClient)(n),n}};yg.ApplicationInsightClient=rMe});var _Xt=y(Qte=>{"use strict";Object.defineProperty(Qte,"__esModule",{value:!0});Qte.localDatetimeToUTC=void 0;var vJn=()=>{let e=new Date().getTime();return new Date(e).toISOString()};Qte.localDatetimeToUTC=vJn});var OXt=y(ere=>{"use strict";Object.defineProperty(ere,"__esModule",{value:!0});ere.ToolsSuiteTelemetryClient=void 0;var bJn=nMe(),EXt=tre(),TXt=_Xt(),iMe=class extends bJn.ApplicationInsightClient{constructor(t,r,n){super(t,r,n)}async report(t,r,n,i,a,o){let s=await(0,EXt.processToolsSuiteTelemetry)(a),c={v:this.extensionVersion,datetime:(0,TXt.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,EXt.processToolsSuiteTelemetry)(r),i={v:this.extensionVersion,datetime:(0,TXt.localDatetimeToUTC)()},a={...t.properties,...n,...i},o={...t.measurements};return{finalProperties:a,finalMeasurements:o}}};ere.ToolsSuiteTelemetryClient=iMe});var Rn=y(Us=>{"use strict";var aMe=Symbol.for("yaml.alias"),SXt=Symbol.for("yaml.document"),rre=Symbol.for("yaml.map"),AXt=Symbol.for("yaml.pair"),oMe=Symbol.for("yaml.scalar"),nre=Symbol.for("yaml.seq"),Kv=Symbol.for("yaml.node.type"),_Jn=e=>!!e&&typeof e=="object"&&e[Kv]===aMe,EJn=e=>!!e&&typeof e=="object"&&e[Kv]===SXt,TJn=e=>!!e&&typeof e=="object"&&e[Kv]===rre,OJn=e=>!!e&&typeof e=="object"&&e[Kv]===AXt,xXt=e=>!!e&&typeof e=="object"&&e[Kv]===oMe,SJn=e=>!!e&&typeof e=="object"&&e[Kv]===nre;function CXt(e){if(e&&typeof e=="object")switch(e[Kv]){case rre:case nre:return!0}return!1}function AJn(e){if(e&&typeof e=="object")switch(e[Kv]){case aMe:case rre:case oMe:case nre:return!0}return!1}var xJn=e=>(xXt(e)||CXt(e))&&!!e.anchor;Us.ALIAS=aMe;Us.DOC=SXt;Us.MAP=rre;Us.NODE_TYPE=Kv;Us.PAIR=AXt;Us.SCALAR=oMe;Us.SEQ=nre;Us.hasAnchor=xJn;Us.isAlias=_Jn;Us.isCollection=CXt;Us.isDocument=EJn;Us.isMap=TJn;Us.isNode=AJn;Us.isPair=OJn;Us.isScalar=xXt;Us.isSeq=SJn});var Lq=y(sMe=>{"use strict";var Vo=Rn(),Pl=Symbol("break visit"),PXt=Symbol("skip children"),vg=Symbol("remove node");function ire(e,t){let r=DXt(t);Vo.isDocument(e)?iI(null,e.contents,r,Object.freeze([e]))===vg&&(e.contents=null):iI(null,e,r,Object.freeze([]))}ire.BREAK=Pl;ire.SKIP=PXt;ire.REMOVE=vg;function iI(e,t,r,n){let i=wXt(e,t,r,n);if(Vo.isNode(i)||Vo.isPair(i))return NXt(e,n,i),iI(e,i,r,n);if(typeof i!="symbol"){if(Vo.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=iI(a,t.items[a],r,n);if(typeof o=="number")a=o-1;else{if(o===Pl)return Pl;o===vg&&(t.items.splice(a,1),a-=1)}}}else if(Vo.isPair(t)){n=Object.freeze(n.concat(t));let a=iI("key",t.key,r,n);if(a===Pl)return Pl;a===vg&&(t.key=null);let o=iI("value",t.value,r,n);if(o===Pl)return Pl;o===vg&&(t.value=null)}}return i}async function are(e,t){let r=DXt(t);Vo.isDocument(e)?await aI(null,e.contents,r,Object.freeze([e]))===vg&&(e.contents=null):await aI(null,e,r,Object.freeze([]))}are.BREAK=Pl;are.SKIP=PXt;are.REMOVE=vg;async function aI(e,t,r,n){let i=await wXt(e,t,r,n);if(Vo.isNode(i)||Vo.isPair(i))return NXt(e,n,i),aI(e,i,r,n);if(typeof i!="symbol"){if(Vo.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=await aI(a,t.items[a],r,n);if(typeof o=="number")a=o-1;else{if(o===Pl)return Pl;o===vg&&(t.items.splice(a,1),a-=1)}}}else if(Vo.isPair(t)){n=Object.freeze(n.concat(t));let a=await aI("key",t.key,r,n);if(a===Pl)return Pl;a===vg&&(t.key=null);let o=await aI("value",t.value,r,n);if(o===Pl)return Pl;o===vg&&(t.value=null)}}return i}function DXt(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 wXt(e,t,r,n){if(typeof r=="function")return r(e,t,n);if(Vo.isMap(t))return r.Map?.(e,t,n);if(Vo.isSeq(t))return r.Seq?.(e,t,n);if(Vo.isPair(t))return r.Pair?.(e,t,n);if(Vo.isScalar(t))return r.Scalar?.(e,t,n);if(Vo.isAlias(t))return r.Alias?.(e,t,n)}function NXt(e,t,r){let n=t[t.length-1];if(Vo.isCollection(n))n.items[e]=r;else if(Vo.isPair(n))e==="key"?n.key=r:n.value=r;else if(Vo.isDocument(n))n.contents=r;else{let i=Vo.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}sMe.visit=ire;sMe.visitAsync=are});var cMe=y(RXt=>{"use strict";var IXt=Rn(),CJn=Lq(),PJn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},DJn=e=>e.replace(/[!,[\]{}]/g,t=>PJn[t]),kq=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+DJn(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&&IXt.isNode(t.contents)){let a={};CJn.visit(t.contents,(o,s)=>{IXt.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),lXn.gzip(l,function(f,h){var g=h;f?(p._logWarn(Cl.dumpObj(f)),g=l,a.headers["Content-Length"]=l.length.toString()):(a.headers["Content-Encoding"]="gzip",a.headers["Content-Length"]=h.length.toString()),p._logInfo(Cl.dumpObj(a)),a[pXn.disableCollectionRequestOption]=!0;var v=+new Date,E=function(S){S.setEncoding("utf-8");var A="";S.on("data",function(x){A+=x}),S.on("end",function(){var x,D=+new Date,k=D-v;if(p._numConsecutiveFailures=0,A.includes(gXn)&&S.statusCode===400&&(V$e.warn("Instrumentation key was invalid, please check the iKey"),(x=p._shutdownStatsbeat)===null||x===void 0||x.call(p)),p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&(mXn.includes(S.statusCode)?p._statsbeatHasReachedIngestionAtLeastOnce=!0:p._statsbeatFailedToIngest()),p._statsbeat&&(S.statusCode==hXn||S.statusCode==dXn?p._statsbeat.countThrottle(c0.StatsbeatNetworkCategory.Breeze,i,S.statusCode):p._statsbeat.countRequest(c0.StatsbeatNetworkCategory.Breeze,i,k,S.statusCode===200,S.statusCode)),p._enableDiskRetryMode){if(S.statusCode===200)p._resendTimer||(p._resendTimer=setTimeout(function(){p._resendTimer=null,p._sendFirstFileOnDisk()},p._resendInterval),p._resendTimer.unref());else if(p._isRetriable(S.statusCode))try{p._statsbeat&&p._statsbeat.countRetry(c0.StatsbeatNetworkCategory.Breeze,i,S.statusCode);var N=JSON.parse(A),V=[];N.errors&&(N.errors.forEach(function(G){(G.statusCode==429||G.statusCode==500||G.statusCode==503)&&V.push(t[G.index])}),V.length>0&&p._storeToDisk(V))}catch{p._storeToDisk(t)}}if(S.statusCode===307||S.statusCode===308)if(p._numConsecutiveRedirects++,p._numConsecutiveRedirects<10){var X=S.headers.location?S.headers.location.toString():null;X&&(p._redirectedHost=X,p.send(t,r))}else{var M={name:"Circular Redirect",message:"Error sending telemetry because of circular redirects."};p._statsbeat&&p._statsbeat.countException(c0.StatsbeatNetworkCategory.Breeze,i,M),typeof r=="function"&&r("Error sending telemetry because of circular redirects.")}else p._numConsecutiveRedirects=0,typeof r=="function"&&r(A),p._logInfo(A),typeof p._onSuccess=="function"&&p._onSuccess(A)})},O=Cl.makeRequest(p._config,n,a,E);O.setTimeout(e.HTTP_TIMEOUT,function(){p._requestTimedOut=!0,O.abort()}),O.on("error",function(S){if(p._isStatsbeatSender&&!p._statsbeatHasReachedIngestionAtLeastOnce&&p._statsbeatFailedToIngest(),p._numConsecutiveFailures++,p._statsbeat&&p._statsbeat.countException(c0.StatsbeatNetworkCategory.Breeze,i,S),!p._enableDiskRetryMode||p._numConsecutiveFailures>0&&p._numConsecutiveFailures%e.MAX_CONNECTION_FAILURES_BEFORE_WARN===0){var A="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&&(A="Ingestion endpoint could not be reached ".concat(p._numConsecutiveFailures," consecutive times. There may be resulting telemetry loss. Most recent error:")),p._logWarn(A,Cl.dumpObj(S))}else{var A="Transient failure to reach ingestion endpoint. This batch of telemetry items will be retried. Error:";p._logInfo(A,Cl.dumpObj(S))}p._onErrorHelper(S),typeof r=="function"&&(S?(p._requestTimedOut&&(S.name="telemetry timeout",S.message="telemetry request timed out"),r(Cl.dumpObj(S))):r("Error sending telemetry")),p._enableDiskRetryMode&&p._storeToDisk(t)}),O.write(g),O.end()}),d.label=5;case 5:return[2]}})})},e.prototype.saveOnCrash=function(t){this._enableDiskRetryMode&&this._storeToDiskSync(Cl.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||V$e.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||V$e.warn(e.TAG,t,r)},e.prototype._statsbeatFailedToIngest=function(){this._shutdownStatsbeat&&(this._failedToIngestCounter++,this._failedToIngestCounter>=3&&this._shutdownStatsbeat())},e.prototype._storeToDisk=function(t){return Ute(this,void 0,void 0,function(){var r,n,i,a,o,s,c;return Bte(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,Hv.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: "+Cl.dumpObj(r)),this._onErrorHelper(r),[2];case 3:return u.trys.push([3,5,,6]),[4,Oq.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: "+Cl.dumpObj(n)),this._onErrorHelper(n),[2];case 6:return u.trys.push([6,8,,9]),[4,Hv.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: "+Cl.dumpObj(a)),this._onErrorHelper(a),[2];case 9:return u.trys.push([9,11,,12]),o="".concat(new Date().getTime(),".ai.json"),s=DA.join(this._tempDir,o),this._logInfo("saving data to disk at: "+s),[4,Hv.writeFileAsync(s,Cl.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: "+Cl.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),j$e.existsSync(this._tempDir)||j$e.mkdirSync(this._tempDir),Oq.FileAccessControl.applyACLRulesSync(this._tempDir);var r=Hv.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=DA.join(this._tempDir,n);this._logInfo("saving data before crash to disk at: "+i),j$e.writeFileSync(i,t,{mode:384})}catch(a){this._logWarn("Error while saving data to disk: "+Cl.dumpObj(a)),this._onErrorHelper(a)}},e.prototype._sendFirstFileOnDisk=function(){return Ute(this,void 0,void 0,function(){var t,r,n,i,a,o;return Bte(this,function(s){switch(s.label){case 0:return s.trys.push([0,6,,7]),[4,Hv.readdirAsync(this._tempDir)];case 1:return t=s.sent(),t=t.filter(function(c){return DA.basename(c).indexOf(".ai.json")>-1}),t.length>0?(r=t[0],n=DA.join(this._tempDir,r),[4,Hv.readFileAsync(n)]):[3,5];case 2:return i=s.sent(),[4,Hv.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 Ute(this,void 0,void 0,function(){var t,r,n,i,a,o,s=this;return Bte(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),[4,Hv.readdirAsync(this._tempDir)];case 1:if(t=c.sent(),t=t.filter(function(u){return DA.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=DA.join(this._tempDir,t[r]),[4,Hv.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=60*60*1e3,e.FILE_RETEMPTION_PERIOD=7*24*60*60*1e3,e.TEMPDIR_PREFIX="appInsights-node",e.HTTP_TIMEOUT=2e4,e}();X7t.exports=yXn});var Z7t=y(zte=>{"use strict";Object.defineProperty(zte,"__esModule",{value:!0});zte.AzureVirtualMachine=void 0;var J7t=di(),vXn=Ms(),bXn=wN(),_Xn="http://169.254.169.254/metadata/instance/compute",EXn="api-version=2017-12-01",TXn="format=json",OXn="UNREACH",SXn=function(){function e(){}return e.getAzureComputeMetadata=function(t,r){var n,i=this,a={},o="".concat(_Xn,"?").concat(EXn,"&").concat(TXn),s=(n={method:"GET"},n[bXn.disableCollectionRequestOption]=!0,n.headers={Metadata:"True"},n),c=vXn.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(d){J7t.info(e.TAG,d)}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(OXn)>-1?a.isVM=!1:J7t.info(e.TAG,u),r(a)}),c.end())},e.HTTP_TIMEOUT=2500,e.TAG="AzureVirtualMachine",e}();zte.AzureVirtualMachine=SXn});var Q7t=y(Hte=>{"use strict";Object.defineProperty(Hte,"__esModule",{value:!0});Hte.NetworkStatsbeat=void 0;var AXn=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}();Hte.NetworkStatsbeat=AXn});var iXt=y((wA,nXt)=>{"use strict";var mg=wA&&wA.__assign||function(){return mg=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},mg.apply(this,arguments)},U$e=wA&&wA.__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())})},B$e=wA&&wA.__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}}},xXn=require("os"),CXn=F$e(),eXt=di(),PXn=q$e(),Ki=Hi(),DXn=kc(),wXn=Z7t(),NXn=Tke(),tXt=ON(),IXn=Q7t(),rXt=Ms(),RXn="node",LXn=function(){function e(t,r){this._attach=Ki.StatsbeatAttach.sdk,this._feature=Ki.StatsbeatFeature.NONE,this._instrumentation=Ki.StatsbeatInstrumentation.NONE,this._isInitialized=!1,this._statbeatMetrics=[],this._networkStatsbeatCollection=[],this._config=t,this._context=r||new tXt,this._longHandleTimeout=null;var n=this._getConnectionString(t);this._statsbeatConfig=new NXn(n),this._statsbeatConfig.samplingPercentage=100,this._sender=new PXn(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=Ki.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 U$e(this,void 0,void 0,function(){var t,r;return B$e(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(),eXt.info(e.TAG,"Failed to send Statsbeat metrics: "+rXt.dumpObj(r)),[3,4];case 4:return[2]}})})},e.prototype.trackLongIntervalStatsbeats=function(){return U$e(this,void 0,void 0,function(){var t,r,n,i,a;return B$e(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:Ki.StatsbeatCounter.ATTACH,value:1,properties:r}),this._instrumentation!=Ki.StatsbeatInstrumentation.NONE&&(n=Object.assign({feature:this._instrumentation,type:Ki.StatsbeatFeatureType.Instrumentation},t),this._statbeatMetrics.push({name:Ki.StatsbeatCounter.FEATURE,value:1,properties:n})),this._feature!=Ki.StatsbeatFeature.NONE&&(i=Object.assign({feature:this._feature,type:Ki.StatsbeatFeatureType.Feature},t),this._statbeatMetrics.push({name:Ki.StatsbeatCounter.FEATURE,value:1,properties:i})),[4,this._sendStatsbeats()];case 2:return o.sent(),[3,4];case 3:return a=o.sent(),eXt.info(e.TAG,"Failed to send Statsbeat metrics: "+rXt.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 IXn.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:Ki.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:Ki.StatsbeatCounter.REQUEST_SUCCESS,value:a.totalSuccesfulRequestCount,properties:c}),a.totalSuccesfulRequestCount=0),a.totalFailedRequestCount.length>0&&(a.totalFailedRequestCount.forEach(function(u){c=Object.assign(mg(mg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:Ki.StatsbeatCounter.REQUEST_FAILURE,value:u.count,properties:c})}),a.totalFailedRequestCount=[]),a.retryCount.length>0&&(a.retryCount.forEach(function(u){c=Object.assign(mg(mg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:Ki.StatsbeatCounter.RETRY_COUNT,value:u.count,properties:c})}),a.retryCount=[]),a.throttleCount.length>0&&(a.throttleCount.forEach(function(u){c=Object.assign(mg(mg({},c),{statusCode:u.statusCode})),r._statbeatMetrics.push({name:Ki.StatsbeatCounter.THROTTLE_COUNT,value:u.count,properties:c})}),a.throttleCount=[]),a.exceptionCount.length>0&&(a.exceptionCount.forEach(function(u){c=Object.assign(mg(mg({},c),{exceptionType:u.exceptionType})),r._statbeatMetrics.push({name:Ki.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 U$e(this,void 0,void 0,function(){var t,r,n,i;return B$e(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=CXn.createEnvelope(n,DXn.TelemetryType.Metric,null,this._context,this._statsbeatConfig),i.name=Ki.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=RXn,this._cikey=this._config.instrumentationKey,this._sdkVersion=tXt.sdkVersion,this._os=xXn.type(),this._runtimeVersion=process.version},e.prototype._getResourceProvider=function(){var t=this;return new Promise(function(r,n){var i=!1;t._resourceProvider=Ki.StatsbeatResourceProvider.unknown,t._resourceIdentifier=Ki.StatsbeatResourceProvider.unknown,process.env.AKS_ARM_NAMESPACE_ID?(t._resourceProvider=Ki.StatsbeatResourceProvider.aks,t._resourceIdentifier=process.env.AKS_ARM_NAMESPACE_ID):process.env.WEBSITE_SITE_NAME?(t._resourceProvider=Ki.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=Ki.StatsbeatResourceProvider.functions,process.env.WEBSITE_HOSTNAME&&(t._resourceIdentifier=process.env.WEBSITE_HOSTNAME)):t._config&&(t._isVM===void 0||t._isVM==!0?(i=!0,wXn.AzureVirtualMachine.getAzureComputeMetadata(t._config,function(a){t._isVM=a.isVM,t._isVM&&(t._resourceProvider=Ki.StatsbeatResourceProvider.vm,t._resourceIdentifier=a.id+"/"+a.subscriptionId,a.osType&&(t._os=a.osType)),r()})):t._resourceProvider=Ki.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}();nXt.exports=LXn});var sXt=y((pWi,oXt)=>{"use strict";var kXn=require("url"),$Xn=Tke(),MXn=$7t(),FXn=ON(),Gv=kc(),jXn=F7t(),z$e=H7t(),aXt=JE(),VXn=iXt(),qXn=q$e(),H$e=Ms(),Gte=di(),UXn=F$e(),BXn=function(){function e(t){this._telemetryProcessors=[];var r=new $Xn(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 FXn,this.commonProperties={},this.authorizationHandler=null,this.config.disableStatsbeat||(this._statsbeat=new VXn(this.config,this.context),this._statsbeat.enable(!0));var n=new qXn(this.config,this.getAuthorizationHandler,null,null,this._statsbeat);this.channel=new jXn(function(){return r.disableAppInsights},function(){return r.maxBatchSize},function(){return r.maxBatchIntervalMs},n)}return e.prototype.trackAvailability=function(t){this.track(t,Gv.TelemetryType.Availability)},e.prototype.trackPageView=function(t){this.track(t,Gv.TelemetryType.PageView)},e.prototype.trackTrace=function(t){this.track(t,Gv.TelemetryType.Trace)},e.prototype.trackMetric=function(t){this.track(t,Gv.TelemetryType.Metric)},e.prototype.trackException=function(t){t&&t.exception&&!H$e.isError(t.exception)&&(t.exception=new Error(t.exception.toString())),this.track(t,Gv.TelemetryType.Exception)},e.prototype.trackEvent=function(t){this.track(t,Gv.TelemetryType.Event)},e.prototype.trackRequest=function(t){this.track(t,Gv.TelemetryType.Request)},e.prototype.trackDependency=function(t){if(t&&!t.target&&t.data)try{t.target=new kXn.URL(t.data).host}catch(r){t.target=null,Gte.warn(e.TAG,"The URL object is failed to create.",r)}this.track(t,Gv.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&&Gv.telemetryTypeToBaseType(r)){var n=UXn.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&&z$e.samplingTelemetryProcessor(n,{correlationContext:aXt.CorrelationContextManager.getCurrentContext()}),z$e.preAggregatedMetricsTelemetryProcessor(n,this.context),i&&(z$e.performanceMetricsTelemetryProcessor(n,this.quickPulseClient),this.channel.send(n))}else Gte.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||(Gte.info(e.TAG,"Adding authorization handler"),this.authorizationHandler=new MXn(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=aXt.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,Gte.warn(e.TAG,"One of telemetry processors failed, telemetry item will be sent.",s,t)}return n&&(t&&t.tags&&(t.tags=H$e.validateStringMap(t.tags)),t&&t.data&&t.data.baseData&&t.data.baseData.properties&&(t.data.baseData.properties=H$e.validateStringMap(t.data.baseData.properties))),n},e.prototype.getStatsbeat=function(){return this._statsbeat},e.TAG="TelemetryClient",e}();oXt.exports=BXn});var lXt=y((G$e,uXt)=>{"use strict";var zXn=G$e&&G$e.__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)}}(),HXn=sXt(),cXt=mke(),GXn=wN(),Kte=di(),KXn=function(e){zXn(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?cXt.trackRequestSync(this,r):Kte.warn("trackNodeHttpRequestSync requires NodeHttpRequestTelemetry object with request, response and duration specified.")},t.prototype.trackNodeHttpRequest=function(r){(r.duration||r.error)&&Kte.warn("trackNodeHttpRequest will ignore supplied duration and error parameters. These values are collected from the request and response objects."),r&&r.request&&r.response?cXt.trackRequest(this,r):Kte.warn("trackNodeHttpRequest requires NodeHttpRequestTelemetry object with request and response specified.")},t.prototype.trackNodeHttpDependency=function(r){r&&r.request?GXn.trackRequest(this,r):Kte.warn("trackNodeHttpDependency requires NodeHttpDependencyTelemetry object with request specified.")},t}(HXn);uXt.exports=KXn});var fXt=y(pXt=>{"use strict";Object.defineProperty(pXt,"__esModule",{value:!0})});var Z$e=y(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.Configuration=pe.liveMetricsClient=pe.defaultClient=pe.DistributedTracingModes=void 0;pe.setup=rJn;pe.start=mXt;pe.getCorrelationContext=iJn;pe.startOperation=aJn;pe.wrapWithCorrelationContext=oJn;pe.dispose=sJn;var Y$e=JE(),YXn=oKt(),WXn=cKt(),W$e=Bee(),XXn=tke(),JXn=vKt(),ZXn=DKt(),QXn=wN(),eJn=mke(),dXt=aA(),Aq=di(),hXt=uYt(),X$e=pYt(),tJn=hYt();pe.TelemetryClient=lXt();pe.Contracts=kc();pe.azureFunctionsTypes=fXt();var K$e;(function(e){e[e.AI=0]="AI",e[e.AI_AND_W3C=1]="AI_AND_W3C"})(K$e||(pe.DistributedTracingModes=K$e={}));var xq,Cq,Pq,Dq,wq,tI,rI,NA,Nq,Iq,Sp=!1,Yte;function rJn(e){return pe.defaultClient?Aq.info("The default client is already setup"):(pe.defaultClient=new pe.TelemetryClient(e),xq=new YXn(pe.defaultClient),Cq=new WXn(pe.defaultClient),Pq=new W$e(pe.defaultClient),Dq=new XXn(pe.defaultClient),wq=new JXn(pe.defaultClient),tI=new ZXn(pe.defaultClient),NA=new eJn(pe.defaultClient),Nq=new QXn(pe.defaultClient),rI||(rI=new X$e.AutoCollectNativePerformance(pe.defaultClient)),Iq=new tJn.AzureFunctionsHook(pe.defaultClient)),J$e}function nJn(){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 mXt(){if(pe.defaultClient){Sp=!0,nJn(),xq.enable(pe.defaultClient.config.enableAutoCollectExternalLoggers,pe.defaultClient.config.enableAutoCollectConsole),Cq.enable(pe.defaultClient.config.enableAutoCollectExceptions),Pq.enable(pe.defaultClient.config.enableAutoCollectPerformance),Dq.enable(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics),wq.enable(pe.defaultClient.config.enableAutoCollectHeartbeat),NA.useAutoCorrelation(pe.defaultClient.config.enableAutoDependencyCorrelation,pe.defaultClient.config.enableUseAsyncHooks),NA.enable(pe.defaultClient.config.enableAutoCollectRequests),Nq.enable(pe.defaultClient.config.enableAutoCollectDependencies),tI.enable(pe.defaultClient.config.enableWebInstrumentation,pe.defaultClient.config.webInstrumentationConnectionString),pe.defaultClient.config.enableSendLiveMetrics&&(pe.liveMetricsClient||(pe.liveMetricsClient=new hXt(pe.defaultClient.config,pe.defaultClient.context,pe.defaultClient.getAuthorizationHandler,pe.defaultClient),Yte=new W$e(pe.liveMetricsClient,1e3,!0),pe.liveMetricsClient.addCollector(Yte),pe.defaultClient.quickPulseClient=pe.liveMetricsClient),pe.liveMetricsClient.enable(pe.defaultClient.config.enableSendLiveMetrics)),Iq.enable(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions);var e=X$e.AutoCollectNativePerformance.parseEnabled(pe.defaultClient.config.enableAutoCollectExtendedMetrics,pe.defaultClient.config);rI.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 Aq.warn("Start cannot be called before setup");return J$e}function iJn(){return Y$e.CorrelationContextManager.getCurrentContext()}function aJn(e,t){return Y$e.CorrelationContextManager.startOperation(e,t)}function oJn(e,t){return Y$e.CorrelationContextManager.wrapCallback(e,t)}var J$e=function(){function e(){}return e.setDistributedTracingMode=function(t){return dXt.w3cEnabled=t===K$e.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,Sp&&xq.enable(t,r)),e},e.setAutoCollectExceptions=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectExceptions=t,Sp&&Cq.enable(t)),e},e.setAutoCollectPerformance=function(t,r){if(r===void 0&&(r=!0),pe.defaultClient){pe.defaultClient.config.enableAutoCollectPerformance=t;var n=X$e.AutoCollectNativePerformance.parseEnabled(r,pe.defaultClient.config);pe.defaultClient.config.enableAutoCollectExtendedMetrics=n.isEnabled,Sp&&(Pq.enable(t),rI.enable(pe.defaultClient.config.enableAutoCollectExtendedMetrics,n.disabledMetrics))}return e},e.setAutoCollectPreAggregatedMetrics=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectPreAggregatedMetrics=t,Sp&&Dq.enable(t)),e},e.setAutoCollectHeartbeat=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectHeartbeat=t,Sp&&wq.enable(t)),e},e.enableAutoWebSnippetInjection=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableWebInstrumentation=t,pe.defaultClient.config.webInstrumentationConnectionString=r,Sp&&tI.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,Sp&&tI.enable(pe.defaultClient.config.enableWebInstrumentation,pe.defaultClient.config.webInstrumentationConnectionString)),e},e.setAutoCollectRequests=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectRequests=t,Sp&&NA.enable(t)),e},e.setAutoCollectDependencies=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectDependencies=t,Sp&&Nq.enable(t)),e},e.setAutoDependencyCorrelation=function(t,r){return pe.defaultClient&&(pe.defaultClient.config.enableAutoDependencyCorrelation=t,pe.defaultClient.config.enableUseAsyncHooks=r,Sp&&NA.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),Aq.enableDebug=t,Aq.disableWarnings=!r,e},e.setAutoCollectIncomingRequestAzureFunctions=function(t){return pe.defaultClient&&(pe.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions=t,Sp&&Iq.enable(t)),e},e.setSendLiveMetrics=function(t){return t===void 0&&(t=!1),pe.defaultClient?(!pe.liveMetricsClient&&t?(pe.liveMetricsClient=new hXt(pe.defaultClient.config,pe.defaultClient.context,pe.defaultClient.getAuthorizationHandler,pe.defaultClient),Yte=new W$e(pe.liveMetricsClient,1e3,!0),pe.liveMetricsClient.addCollector(Yte),pe.defaultClient.quickPulseClient=pe.liveMetricsClient):pe.liveMetricsClient&&pe.liveMetricsClient.enable(t),pe.defaultClient.config.enableSendLiveMetrics=t,e):(Aq.warn("Live metrics client cannot be setup without the default client"),e)},e.start=mXt,e}();pe.Configuration=J$e;function sJn(){dXt.w3cEnabled=!0,pe.defaultClient=null,Sp=!1,xq&&xq.dispose(),Cq&&Cq.dispose(),Pq&&Pq.dispose(),Dq&&Dq.dispose(),wq&&wq.dispose(),tI&&tI.dispose(),rI&&rI.dispose(),NA&&NA.dispose(),Nq&&Nq.dispose(),pe.liveMetricsClient&&(pe.liveMetricsClient.enable(!1),pe.liveMetricsClient=void 0),Iq&&Iq.dispose()}});var Xte=y(Wte=>{"use strict";Object.defineProperty(Wte,"__esModule",{value:!0});Wte.EventHeader=void 0;var Q$e=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}`}};Wte.EventHeader=Q$e});var Zte=y(Jte=>{"use strict";Object.defineProperty(Jte,"__esModule",{value:!0});Jte.SampleRate=void 0;var gXt;(function(e){e[e.OnePercent=0]="OnePercent",e[e.TenPercent=1]="TenPercent",e[e.NoSampling=2]="NoSampling"})(gXt||(Jte.SampleRate=gXt={}))});var tMe=y(eMe=>{"use strict";Object.defineProperty(eMe,"__esModule",{value:!0});eMe.configAzureTelemetryClient=cJn;function cJn(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 yXt=y((yWi,uJn)=>{uJn.exports={name:"@sap-ux/telemetry",version:"0.6.61",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.12.2","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 Rq=y(nI=>{"use strict";var lJn=nI&&nI.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nI,"__esModule",{value:!0});nI.TelemetrySettings=void 0;var vXt=lJn(yXt());nI.TelemetrySettings={azureInstrumentationKey:"",telemetryEnabled:!0,telemetryLibName:vXt.default.name,telemetryLibVersion:vXt.default.version,consumerModuleName:"",consumerModuleVersion:""}});var nMe=y(yg=>{"use strict";var pJn=yg&&yg.__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]}),fJn=yg&&yg.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dJn=yg&&yg.__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"&&pJn(r,t,n[i]);return fJn(r,t),r}}();Object.defineProperty(yg,"__esModule",{value:!0});yg.ApplicationInsightClient=void 0;var hJn=_Ne(),mJn=dJn(Z$e()),gJn=Xte(),gg=Zte(),yJn=tMe(),bXt=Rq(),rMe=class extends hJn.Client{clients;constructor(t,r,n){super(),this.clients=new Map,this.applicationKey=t,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(gg.SampleRate.OnePercent),a=this.createTelemetryClient(gg.SampleRate.TenPercent),o=this.createTelemetryClient(gg.SampleRate.NoSampling);this.clients.set(gg.SampleRate.OnePercent,i),this.clients.set(gg.SampleRate.TenPercent,a),this.clients.set(gg.SampleRate.NoSampling,o)}reportBlocking(t,r,n,i,a=!1){if(!a||bXt.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||!bXt.TelemetrySettings.telemetryEnabled)return;let{client:s,event:c}=this.prepareClientAndEvent(t,r,n,i);this.trackEvent(s,c)}prepareClientAndEvent(t,r,n,i=gg.SampleRate.NoSampling){let a=this.clients.get(i),s={name:new gJn.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 gg.SampleRate.OnePercent:r=1;break;case gg.SampleRate.TenPercent:r=10;break;case gg.SampleRate.NoSampling:default:r=100;break}let n=new mJn.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,(0,yJn.configAzureTelemetryClient)(n),n}};yg.ApplicationInsightClient=rMe});var _Xt=y(Qte=>{"use strict";Object.defineProperty(Qte,"__esModule",{value:!0});Qte.localDatetimeToUTC=void 0;var vJn=()=>{let e=new Date().getTime();return new Date(e).toISOString()};Qte.localDatetimeToUTC=vJn});var OXt=y(ere=>{"use strict";Object.defineProperty(ere,"__esModule",{value:!0});ere.ToolsSuiteTelemetryClient=void 0;var bJn=nMe(),EXt=tre(),TXt=_Xt(),iMe=class extends bJn.ApplicationInsightClient{constructor(t,r,n){super(t,r,n)}async report(t,r,n,i,a,o){let s=await(0,EXt.processToolsSuiteTelemetry)(a),c={v:this.extensionVersion,datetime:(0,TXt.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,EXt.processToolsSuiteTelemetry)(r),i={v:this.extensionVersion,datetime:(0,TXt.localDatetimeToUTC)()},a={...t.properties,...n,...i},o={...t.measurements};return{finalProperties:a,finalMeasurements:o}}};ere.ToolsSuiteTelemetryClient=iMe});var Rn=y(Us=>{"use strict";var aMe=Symbol.for("yaml.alias"),SXt=Symbol.for("yaml.document"),rre=Symbol.for("yaml.map"),AXt=Symbol.for("yaml.pair"),oMe=Symbol.for("yaml.scalar"),nre=Symbol.for("yaml.seq"),Kv=Symbol.for("yaml.node.type"),_Jn=e=>!!e&&typeof e=="object"&&e[Kv]===aMe,EJn=e=>!!e&&typeof e=="object"&&e[Kv]===SXt,TJn=e=>!!e&&typeof e=="object"&&e[Kv]===rre,OJn=e=>!!e&&typeof e=="object"&&e[Kv]===AXt,xXt=e=>!!e&&typeof e=="object"&&e[Kv]===oMe,SJn=e=>!!e&&typeof e=="object"&&e[Kv]===nre;function CXt(e){if(e&&typeof e=="object")switch(e[Kv]){case rre:case nre:return!0}return!1}function AJn(e){if(e&&typeof e=="object")switch(e[Kv]){case aMe:case rre:case oMe:case nre:return!0}return!1}var xJn=e=>(xXt(e)||CXt(e))&&!!e.anchor;Us.ALIAS=aMe;Us.DOC=SXt;Us.MAP=rre;Us.NODE_TYPE=Kv;Us.PAIR=AXt;Us.SCALAR=oMe;Us.SEQ=nre;Us.hasAnchor=xJn;Us.isAlias=_Jn;Us.isCollection=CXt;Us.isDocument=EJn;Us.isMap=TJn;Us.isNode=AJn;Us.isPair=OJn;Us.isScalar=xXt;Us.isSeq=SJn});var Lq=y(sMe=>{"use strict";var Vo=Rn(),Pl=Symbol("break visit"),PXt=Symbol("skip children"),vg=Symbol("remove node");function ire(e,t){let r=DXt(t);Vo.isDocument(e)?iI(null,e.contents,r,Object.freeze([e]))===vg&&(e.contents=null):iI(null,e,r,Object.freeze([]))}ire.BREAK=Pl;ire.SKIP=PXt;ire.REMOVE=vg;function iI(e,t,r,n){let i=wXt(e,t,r,n);if(Vo.isNode(i)||Vo.isPair(i))return NXt(e,n,i),iI(e,i,r,n);if(typeof i!="symbol"){if(Vo.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=iI(a,t.items[a],r,n);if(typeof o=="number")a=o-1;else{if(o===Pl)return Pl;o===vg&&(t.items.splice(a,1),a-=1)}}}else if(Vo.isPair(t)){n=Object.freeze(n.concat(t));let a=iI("key",t.key,r,n);if(a===Pl)return Pl;a===vg&&(t.key=null);let o=iI("value",t.value,r,n);if(o===Pl)return Pl;o===vg&&(t.value=null)}}return i}async function are(e,t){let r=DXt(t);Vo.isDocument(e)?await aI(null,e.contents,r,Object.freeze([e]))===vg&&(e.contents=null):await aI(null,e,r,Object.freeze([]))}are.BREAK=Pl;are.SKIP=PXt;are.REMOVE=vg;async function aI(e,t,r,n){let i=await wXt(e,t,r,n);if(Vo.isNode(i)||Vo.isPair(i))return NXt(e,n,i),aI(e,i,r,n);if(typeof i!="symbol"){if(Vo.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=await aI(a,t.items[a],r,n);if(typeof o=="number")a=o-1;else{if(o===Pl)return Pl;o===vg&&(t.items.splice(a,1),a-=1)}}}else if(Vo.isPair(t)){n=Object.freeze(n.concat(t));let a=await aI("key",t.key,r,n);if(a===Pl)return Pl;a===vg&&(t.key=null);let o=await aI("value",t.value,r,n);if(o===Pl)return Pl;o===vg&&(t.value=null)}}return i}function DXt(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 wXt(e,t,r,n){if(typeof r=="function")return r(e,t,n);if(Vo.isMap(t))return r.Map?.(e,t,n);if(Vo.isSeq(t))return r.Seq?.(e,t,n);if(Vo.isPair(t))return r.Pair?.(e,t,n);if(Vo.isScalar(t))return r.Scalar?.(e,t,n);if(Vo.isAlias(t))return r.Alias?.(e,t,n)}function NXt(e,t,r){let n=t[t.length-1];if(Vo.isCollection(n))n.items[e]=r;else if(Vo.isPair(n))e==="key"?n.key=r:n.value=r;else if(Vo.isDocument(n))n.contents=r;else{let i=Vo.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}sMe.visit=ire;sMe.visitAsync=are});var cMe=y(RXt=>{"use strict";var IXt=Rn(),CJn=Lq(),PJn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},DJn=e=>e.replace(/[!,[\]{}]/g,t=>PJn[t]),kq=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+DJn(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&&IXt.isNode(t.contents)){let a={};CJn.visit(t.contents,(o,s)=>{IXt.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
|
`)}};kq.defaultYaml={explicit:!1,version:"1.2"};kq.defaultTags={"!!":"tag:yaml.org,2002:"};RXt.Directives=kq});var ore=y($q=>{"use strict";var LXt=Rn(),wJn=Lq();function NJn(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 kXt(e){let t=new Set;return wJn.visit(e,{Value(r,n){n.anchor&&t.add(n.anchor)}}),t}function $Xt(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function IJn(e,t){let r=[],n=new Map,i=null;return{onAnchor:a=>{r.push(a),i||(i=kXt(e));let o=$Xt(t,i);return i.add(o),o},setAnchors:()=>{for(let a of r){let o=n.get(a);if(typeof o=="object"&&o.anchor&&(LXt.isScalar(o.node)||LXt.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}}$q.anchorIsValid=NJn;$q.anchorNames=kXt;$q.createNodeAnchors=IJn;$q.findNewAnchor=$Xt});var uMe=y(MXt=>{"use strict";function Mq(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=Mq(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=Mq(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=Mq(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=Mq(e,n,i,a);o===void 0?delete n[i]:o!==a&&(n[i]=o)}return e.call(t,r,n)}MXt.applyReviver=Mq});var u0=y(jXt=>{"use strict";var RJn=Rn();function FXt(e,t,r){if(Array.isArray(e))return e.map((n,i)=>FXt(n,String(i),r));if(e&&typeof e.toJSON=="function"){if(!r||!RJn.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}jXt.toJS=FXt});var sre=y(qXt=>{"use strict";var LJn=uMe(),VXt=Rn(),kJn=u0(),lMe=class{constructor(t){Object.defineProperty(this,VXt.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(!VXt.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=kJn.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:u}of o.anchors.values())i(u,c);return typeof a=="function"?LJn.applyReviver(a,{"":s},"",s):s}};qXt.NodeBase=lMe});var Fq=y(BXt=>{"use strict";var $Jn=ore(),UXt=Lq(),cre=Rn(),MJn=sre(),FJn=u0(),pMe=class extends MJn.NodeBase{constructor(t){super(cre.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t){let r;return UXt.visit(t,{Node:(n,i)=>{if(i===this)return UXt.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||(FJn.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=ure(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($Jn.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 ure(e,t,r){if(cre.isAlias(t)){let n=t.resolve(e),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(cre.isCollection(t)){let n=0;for(let i of t.items){let a=ure(e,i,r);a>n&&(n=a)}return n}else if(cre.isPair(t)){let n=ure(e,t.key,r),i=ure(e,t.value,r);return Math.max(n,i)}return 1}BXt.Alias=pMe});var To=y(fMe=>{"use strict";var jJn=Rn(),VJn=sre(),qJn=u0(),UJn=e=>!e||typeof e!="function"&&typeof e!="object",l0=class extends VJn.NodeBase{constructor(t){super(jJn.SCALAR),this.value=t}toJSON(t,r){return r?.keep?this.value:qJn.toJS(this.value,t,r)}toString(){return String(this.value)}};l0.BLOCK_FOLDED="BLOCK_FOLDED";l0.BLOCK_LITERAL="BLOCK_LITERAL";l0.PLAIN="PLAIN";l0.QUOTE_DOUBLE="QUOTE_DOUBLE";l0.QUOTE_SINGLE="QUOTE_SINGLE";fMe.Scalar=l0;fMe.isScalarValue=UJn});var jq=y(HXt=>{"use strict";var BJn=Fq(),IA=Rn(),zXt=To(),zJn="tag:yaml.org,2002:";function HJn(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 GJn(e,t,r){if(IA.isDocument(e)&&(e=e.contents),IA.isNode(e))return e;if(IA.isPair(e)){let p=r.schema[IA.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 BJn.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=zJn+t.slice(2));let u=HJn(e,t,o.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let p=new zXt.Scalar(e);return c&&(c.node=p),p}u=e instanceof Map?o[IA.MAP]:Symbol.iterator in Object(e)?o[IA.SEQ]:o[IA.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 zXt.Scalar(e);return t?l.tag=t:u.default||(l.tag=u.tag),c&&(c.node=l),l}HXt.createNode=GJn});var Vq=y(pre=>{"use strict";var KJn=jq(),bg=Rn(),YJn=sre();function dMe(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 KJn.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 GXt=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,lre=class extends YJn.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=>bg.isNode(n)||bg.isPair(n)?n.clone(t):n),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(GXt(t))this.add(r);else{let[n,...i]=t,a=this.get(n,!0);if(bg.isCollection(a))a.addIn(i,r);else if(a===void 0&&this.schema)this.set(n,dMe(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(bg.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&&bg.isScalar(a)?a.value:a:bg.isCollection(a)?a.getIn(i,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!bg.isPair(r))return!1;let n=r.value;return n==null||t&&bg.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 bg.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(bg.isCollection(a))a.setIn(i,r);else if(a===void 0&&this.schema)this.set(n,dMe(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};lre.maxFlowStringSingleLineLength=60;pre.Collection=lre;pre.collectionFromPath=dMe;pre.isEmptyPath=GXt});var qq=y(fre=>{"use strict";var WJn=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function hMe(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var XJn=(e,t,r)=>e.endsWith(`
|
|
1446
1446
|
`)?hMe(r,t):r.includes(`
|
|
1447
1447
|
`)?`
|
|
@@ -1607,7 +1607,7 @@ ${n.message}`:h,E=[v,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 f=n.external.registry.get(l[0])?.id;if(t!==l[0]&&f){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 d=this.seen.get(l),f=d.def??d.schema,h={...f};if(d.ref===null)return;let g=d.ref;if(d.ref=null,g){s(g,p);let v=this.seen.get(g).schema;v.$ref&&(p.target==="draft-7"||p.target==="draft-4"||p.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(v)):(Object.assign(f,v),Object.assign(f,h))}d.isParent||this.override({zodSchema:l,jsonSchema:f,path:d.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 U0(e,t){if(e instanceof Rx){let n=new KR(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 KR(t);return r.process(e),r.emit(e,t)}function Bc(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 Bc(n.element,r);if(n.type==="set")return Bc(n.valueType,r);if(n.type==="lazy")return Bc(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 Bc(n.innerType,r);if(n.type==="intersection")return Bc(n.left,r)||Bc(n.right,r);if(n.type==="record"||n.type==="map")return Bc(n.keyType,r)||Bc(n.valueType,r);if(n.type==="pipe")return Bc(n.in,r)||Bc(n.out,r);if(n.type==="object"){for(let i in n.shape)if(Bc(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(Bc(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(Bc(i,r))return!0;return!!(n.rest&&Bc(n.rest,r))}return!1}var jUe={};function Yx(e){return!!e._zod}function Eb(e,t){return Yx(e)?$0(e,t):e.safeParse(t)}function k4(e){if(!e)return;let t;if(Yx(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function UUe(e){if(Yx(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 B0={};Di(B0,{$brand:()=>cR,$input:()=>H3,$output:()=>z3,NEVER:()=>hB,TimePrecision:()=>W3,ZodAny:()=>WUe,ZodArray:()=>QUe,ZodBase64:()=>$oe,ZodBase64URL:()=>Moe,ZodBigInt:()=>QR,ZodBigIntFormat:()=>Voe,ZodBoolean:()=>ZR,ZodCIDRv4:()=>Loe,ZodCIDRv6:()=>koe,ZodCUID:()=>Coe,ZodCUID2:()=>Poe,ZodCatch:()=>gBe,ZodCodec:()=>Yoe,ZodCustom:()=>Y4,ZodCustomStringFormat:()=>XR,ZodDate:()=>H4,ZodDefault:()=>lBe,ZodDiscriminatedUnion:()=>eBe,ZodE164:()=>Foe,ZodEmail:()=>Ooe,ZodEmoji:()=>Aoe,ZodEnum:()=>YR,ZodError:()=>coe,ZodFile:()=>sBe,ZodFirstPartyTypeKind:()=>Xoe,ZodFunction:()=>ABe,ZodGUID:()=>V4,ZodIPv4:()=>Ioe,ZodIPv6:()=>Roe,ZodISODate:()=>M4,ZodISODateTime:()=>$4,ZodISODuration:()=>j4,ZodISOTime:()=>F4,ZodIntersection:()=>tBe,ZodIssueCode:()=>adr,ZodJWT:()=>joe,ZodKSUID:()=>Noe,ZodLazy:()=>TBe,ZodLiteral:()=>oBe,ZodMAC:()=>HUe,ZodMap:()=>iBe,ZodNaN:()=>vBe,ZodNanoID:()=>xoe,ZodNever:()=>JUe,ZodNonOptional:()=>Goe,ZodNull:()=>YUe,ZodNullable:()=>uBe,ZodNumber:()=>JR,ZodNumberFormat:()=>Xx,ZodObject:()=>G4,ZodOptional:()=>Hoe,ZodPipe:()=>Koe,ZodPrefault:()=>fBe,ZodPromise:()=>SBe,ZodReadonly:()=>bBe,ZodRealError:()=>Nu,ZodRecord:()=>Boe,ZodSet:()=>aBe,ZodString:()=>WR,ZodStringFormat:()=>li,ZodSuccess:()=>mBe,ZodSymbol:()=>GUe,ZodTemplateLiteral:()=>EBe,ZodTransform:()=>cBe,ZodTuple:()=>rBe,ZodType:()=>Sr,ZodULID:()=>Doe,ZodURL:()=>B4,ZodUUID:()=>jg,ZodUndefined:()=>KUe,ZodUnion:()=>Uoe,ZodUnknown:()=>XUe,ZodVoid:()=>ZUe,ZodXID:()=>woe,_ZodString:()=>Toe,_default:()=>pBe,_function:()=>Zfr,any:()=>z4,array:()=>Ut,base64:()=>_fr,base64url:()=>Efr,bigint:()=>Ifr,boolean:()=>wi,catch:()=>yBe,check:()=>Qfr,cidrv4:()=>vfr,cidrv6:()=>bfr,clone:()=>hs,codec:()=>Wfr,coerce:()=>Joe,config:()=>fa,core:()=>Bl,cuid:()=>lfr,cuid2:()=>pfr,custom:()=>Woe,date:()=>Ffr,decode:()=>hoe,decodeAsync:()=>goe,describe:()=>edr,discriminatedUnion:()=>K4,e164:()=>Tfr,email:()=>tfr,emoji:()=>cfr,encode:()=>doe,encodeAsync:()=>moe,endsWith:()=>Ux,enum:()=>ri,file:()=>Hfr,flattenError:()=>_x,float32:()=>Pfr,float64:()=>Dfr,formatError:()=>Ex,function:()=>Zfr,getErrorMap:()=>sdr,globalRegistry:()=>Ks,gt:()=>Eh,gte:()=>Ys,guid:()=>rfr,hash:()=>Cfr,hex:()=>xfr,hostname:()=>Afr,httpUrl:()=>sfr,includes:()=>Vx,instanceof:()=>rdr,int:()=>Eoe,int32:()=>wfr,int64:()=>Rfr,intersection:()=>tL,ipv4:()=>mfr,ipv6:()=>yfr,iso:()=>Wx,json:()=>idr,jwt:()=>Ofr,keyof:()=>jfr,ksuid:()=>hfr,lazy:()=>OBe,length:()=>V0,literal:()=>dt,locales:()=>Ix,looseObject:()=>Ws,lowercase:()=>Fx,lt:()=>_h,lte:()=>wu,mac:()=>gfr,map:()=>Ufr,maxLength:()=>j0,maxSize:()=>F0,meta:()=>tdr,mime:()=>Bx,minLength:()=>Fg,minSize:()=>_b,multipleOf:()=>bb,nan:()=>Yfr,nanoid:()=>ufr,nativeEnum:()=>zfr,negative:()=>S4,never:()=>qoe,nonnegative:()=>x4,nonoptional:()=>hBe,nonpositive:()=>A4,normalize:()=>zx,null:()=>eL,nullable:()=>q4,nullish:()=>Gfr,number:()=>gn,object:()=>we,optional:()=>kn,overwrite:()=>ld,parse:()=>uoe,parseAsync:()=>loe,partialRecord:()=>qfr,pipe:()=>U4,positive:()=>O4,prefault:()=>dBe,preprocess:()=>W4,prettifyError:()=>vB,promise:()=>Jfr,property:()=>C4,readonly:()=>_Be,record:()=>$n,refine:()=>xBe,regex:()=>Mx,regexes:()=>Du,registry:()=>AR,safeDecode:()=>voe,safeDecodeAsync:()=>_oe,safeEncode:()=>yoe,safeEncodeAsync:()=>boe,safeParse:()=>poe,safeParseAsync:()=>foe,set:()=>Bfr,setErrorMap:()=>odr,size:()=>$x,slugify:()=>GR,startsWith:()=>qx,strictObject:()=>Vfr,string:()=>ee,stringFormat:()=>Sfr,stringbool:()=>ndr,success:()=>Kfr,superRefine:()=>CBe,symbol:()=>kfr,templateLiteral:()=>Xfr,toJSONSchema:()=>U0,toLowerCase:()=>Gx,toUpperCase:()=>Kx,transform:()=>zoe,treeifyError:()=>yB,trim:()=>Hx,tuple:()=>nBe,uint32:()=>Nfr,uint64:()=>Lfr,ulid:()=>ffr,undefined:()=>$fr,union:()=>nn,unknown:()=>xn,uppercase:()=>jx,url:()=>Soe,util:()=>Le,uuid:()=>nfr,uuidv4:()=>ifr,uuidv6:()=>afr,uuidv7:()=>ofr,void:()=>Mfr,xid:()=>dfr});var Wx={};Di(Wx,{ZodISODate:()=>M4,ZodISODateTime:()=>$4,ZodISODuration:()=>j4,ZodISOTime:()=>F4,date:()=>aoe,datetime:()=>ioe,duration:()=>soe,time:()=>ooe});var $4=ne("ZodISODateTime",(e,t)=>{GB.init(e,t),li.init(e,t)});function ioe(e){return X3($4,e)}var M4=ne("ZodISODate",(e,t)=>{KB.init(e,t),li.init(e,t)});function aoe(e){return J3(M4,e)}var F4=ne("ZodISOTime",(e,t)=>{YB.init(e,t),li.init(e,t)});function ooe(e){return Z3(F4,e)}var j4=ne("ZodISODuration",(e,t)=>{WB.init(e,t),li.init(e,t)});function soe(e){return Q3(j4,e)}var zUe=(e,t)=>{mR.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ex(e,r)},flatten:{value:r=>_x(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,yx,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,yx,2)}},isEmpty:{get(){return e.issues.length===0}}})},coe=ne("ZodError",zUe),Nu=ne("ZodError",zUe,{Parent:Error});var uoe=Tx(Nu),loe=Sx(Nu),poe=xx(Nu),foe=Cx(Nu),doe=bB(Nu),hoe=_B(Nu),moe=EB(Nu),goe=TB(Nu),yoe=OB(Nu),voe=SB(Nu),boe=AB(Nu),_oe=xB(Nu);var Sr=ne("ZodType",(e,t)=>(Yt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Le.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>hs(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>uoe(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>poe(e,r,n),e.parseAsync=async(r,n)=>loe(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>foe(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>doe(e,r,n),e.decode=(r,n)=>hoe(e,r,n),e.encodeAsync=async(r,n)=>moe(e,r,n),e.decodeAsync=async(r,n)=>goe(e,r,n),e.safeEncode=(r,n)=>yoe(e,r,n),e.safeDecode=(r,n)=>voe(e,r,n),e.safeEncodeAsync=async(r,n)=>boe(e,r,n),e.safeDecodeAsync=async(r,n)=>_oe(e,r,n),e.refine=(r,n)=>e.check(xBe(r,n)),e.superRefine=r=>e.check(CBe(r)),e.overwrite=r=>e.check(ld(r)),e.optional=()=>kn(e),e.nullable=()=>q4(e),e.nullish=()=>kn(q4(e)),e.nonoptional=r=>hBe(e,r),e.array=()=>Ut(e),e.or=r=>nn([e,r]),e.and=r=>tL(e,r),e.transform=r=>U4(e,zoe(r)),e.default=r=>pBe(e,r),e.prefault=r=>dBe(e,r),e.catch=r=>yBe(e,r),e.pipe=r=>U4(e,r),e.readonly=()=>_Be(e),e.describe=r=>{let n=e.clone();return Ks.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ks.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ks.get(e);let n=e.clone();return Ks.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Toe=ne("_ZodString",(e,t)=>{vb.init(e,t),Sr.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(qx(...n)),e.endsWith=(...n)=>e.check(Ux(...n)),e.min=(...n)=>e.check(Fg(...n)),e.max=(...n)=>e.check(j0(...n)),e.length=(...n)=>e.check(V0(...n)),e.nonempty=(...n)=>e.check(Fg(1,...n)),e.lowercase=n=>e.check(Fx(n)),e.uppercase=n=>e.check(jx(n)),e.trim=()=>e.check(Hx()),e.normalize=(...n)=>e.check(zx(...n)),e.toLowerCase=()=>e.check(Gx()),e.toUpperCase=()=>e.check(Kx()),e.slugify=()=>e.check(GR())}),WR=ne("ZodString",(e,t)=>{vb.init(e,t),Toe.init(e,t),e.email=r=>e.check(xR(Ooe,r)),e.url=r=>e.check(kx(B4,r)),e.jwt=r=>e.check(HR(joe,r)),e.emoji=r=>e.check(NR(Aoe,r)),e.guid=r=>e.check(Lx(V4,r)),e.uuid=r=>e.check(CR(jg,r)),e.uuidv4=r=>e.check(PR(jg,r)),e.uuidv6=r=>e.check(DR(jg,r)),e.uuidv7=r=>e.check(wR(jg,r)),e.nanoid=r=>e.check(IR(xoe,r)),e.guid=r=>e.check(Lx(V4,r)),e.cuid=r=>e.check(RR(Coe,r)),e.cuid2=r=>e.check(LR(Poe,r)),e.ulid=r=>e.check(kR(Doe,r)),e.base64=r=>e.check(UR($oe,r)),e.base64url=r=>e.check(BR(Moe,r)),e.xid=r=>e.check($R(woe,r)),e.ksuid=r=>e.check(MR(Noe,r)),e.ipv4=r=>e.check(FR(Ioe,r)),e.ipv6=r=>e.check(jR(Roe,r)),e.cidrv4=r=>e.check(VR(Loe,r)),e.cidrv6=r=>e.check(qR(koe,r)),e.e164=r=>e.check(zR(Foe,r)),e.datetime=r=>e.check(ioe(r)),e.date=r=>e.check(aoe(r)),e.time=r=>e.check(ooe(r)),e.duration=r=>e.check(soe(r))});function ee(e){return G3(WR,e)}var li=ne("ZodStringFormat",(e,t)=>{Kn.init(e,t),Toe.init(e,t)}),Ooe=ne("ZodEmail",(e,t)=>{MB.init(e,t),li.init(e,t)});function tfr(e){return xR(Ooe,e)}var V4=ne("ZodGUID",(e,t)=>{kB.init(e,t),li.init(e,t)});function rfr(e){return Lx(V4,e)}var jg=ne("ZodUUID",(e,t)=>{$B.init(e,t),li.init(e,t)});function nfr(e){return CR(jg,e)}function ifr(e){return PR(jg,e)}function afr(e){return DR(jg,e)}function ofr(e){return wR(jg,e)}var B4=ne("ZodURL",(e,t)=>{FB.init(e,t),li.init(e,t)});function Soe(e){return kx(B4,e)}function sfr(e){return kx(B4,{protocol:/^https?$/,hostname:Du.domain,...Le.normalizeParams(e)})}var Aoe=ne("ZodEmoji",(e,t)=>{jB.init(e,t),li.init(e,t)});function cfr(e){return NR(Aoe,e)}var xoe=ne("ZodNanoID",(e,t)=>{VB.init(e,t),li.init(e,t)});function ufr(e){return IR(xoe,e)}var Coe=ne("ZodCUID",(e,t)=>{qB.init(e,t),li.init(e,t)});function lfr(e){return RR(Coe,e)}var Poe=ne("ZodCUID2",(e,t)=>{UB.init(e,t),li.init(e,t)});function pfr(e){return LR(Poe,e)}var Doe=ne("ZodULID",(e,t)=>{BB.init(e,t),li.init(e,t)});function ffr(e){return kR(Doe,e)}var woe=ne("ZodXID",(e,t)=>{zB.init(e,t),li.init(e,t)});function dfr(e){return $R(woe,e)}var Noe=ne("ZodKSUID",(e,t)=>{HB.init(e,t),li.init(e,t)});function hfr(e){return MR(Noe,e)}var Ioe=ne("ZodIPv4",(e,t)=>{XB.init(e,t),li.init(e,t)});function mfr(e){return FR(Ioe,e)}var HUe=ne("ZodMAC",(e,t)=>{ZB.init(e,t),li.init(e,t)});function gfr(e){return Y3(HUe,e)}var Roe=ne("ZodIPv6",(e,t)=>{JB.init(e,t),li.init(e,t)});function yfr(e){return jR(Roe,e)}var Loe=ne("ZodCIDRv4",(e,t)=>{QB.init(e,t),li.init(e,t)});function vfr(e){return VR(Loe,e)}var koe=ne("ZodCIDRv6",(e,t)=>{e3.init(e,t),li.init(e,t)});function bfr(e){return qR(koe,e)}var $oe=ne("ZodBase64",(e,t)=>{t3.init(e,t),li.init(e,t)});function _fr(e){return UR($oe,e)}var Moe=ne("ZodBase64URL",(e,t)=>{r3.init(e,t),li.init(e,t)});function Efr(e){return BR(Moe,e)}var Foe=ne("ZodE164",(e,t)=>{n3.init(e,t),li.init(e,t)});function Tfr(e){return zR(Foe,e)}var joe=ne("ZodJWT",(e,t)=>{i3.init(e,t),li.init(e,t)});function Ofr(e){return HR(joe,e)}var XR=ne("ZodCustomStringFormat",(e,t)=>{a3.init(e,t),li.init(e,t)});function Sfr(e,t,r={}){return q0(XR,e,t,r)}function Afr(e){return q0(XR,"hostname",Du.hostname,e)}function xfr(e){return q0(XR,"hex",Du.hex,e)}function Cfr(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=Du[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return q0(XR,n,i,t)}var JR=ne("ZodNumber",(e,t)=>{bR.init(e,t),Sr.init(e,t),e.gt=(n,i)=>e.check(Eh(n,i)),e.gte=(n,i)=>e.check(Ys(n,i)),e.min=(n,i)=>e.check(Ys(n,i)),e.lt=(n,i)=>e.check(_h(n,i)),e.lte=(n,i)=>e.check(wu(n,i)),e.max=(n,i)=>e.check(wu(n,i)),e.int=n=>e.check(Eoe(n)),e.safe=n=>e.check(Eoe(n)),e.positive=n=>e.check(Eh(0,n)),e.nonnegative=n=>e.check(Ys(0,n)),e.negative=n=>e.check(_h(0,n)),e.nonpositive=n=>e.check(wu(0,n)),e.multipleOf=(n,i)=>e.check(bb(n,i)),e.step=(n,i)=>e.check(bb(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 gn(e){return e4(JR,e)}var Xx=ne("ZodNumberFormat",(e,t)=>{o3.init(e,t),JR.init(e,t)});function Eoe(e){return r4(Xx,e)}function Pfr(e){return n4(Xx,e)}function Dfr(e){return i4(Xx,e)}function wfr(e){return a4(Xx,e)}function Nfr(e){return o4(Xx,e)}var ZR=ne("ZodBoolean",(e,t)=>{wx.init(e,t),Sr.init(e,t)});function wi(e){return s4(ZR,e)}var QR=ne("ZodBigInt",(e,t)=>{_R.init(e,t),Sr.init(e,t),e.gte=(n,i)=>e.check(Ys(n,i)),e.min=(n,i)=>e.check(Ys(n,i)),e.gt=(n,i)=>e.check(Eh(n,i)),e.gte=(n,i)=>e.check(Ys(n,i)),e.min=(n,i)=>e.check(Ys(n,i)),e.lt=(n,i)=>e.check(_h(n,i)),e.lte=(n,i)=>e.check(wu(n,i)),e.max=(n,i)=>e.check(wu(n,i)),e.positive=n=>e.check(Eh(BigInt(0),n)),e.negative=n=>e.check(_h(BigInt(0),n)),e.nonpositive=n=>e.check(wu(BigInt(0),n)),e.nonnegative=n=>e.check(Ys(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(bb(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Ifr(e){return u4(QR,e)}var Voe=ne("ZodBigIntFormat",(e,t)=>{s3.init(e,t),QR.init(e,t)});function Rfr(e){return p4(Voe,e)}function Lfr(e){return f4(Voe,e)}var GUe=ne("ZodSymbol",(e,t)=>{c3.init(e,t),Sr.init(e,t)});function kfr(e){return d4(GUe,e)}var KUe=ne("ZodUndefined",(e,t)=>{u3.init(e,t),Sr.init(e,t)});function $fr(e){return h4(KUe,e)}var YUe=ne("ZodNull",(e,t)=>{l3.init(e,t),Sr.init(e,t)});function eL(e){return m4(YUe,e)}var WUe=ne("ZodAny",(e,t)=>{p3.init(e,t),Sr.init(e,t)});function z4(){return g4(WUe)}var XUe=ne("ZodUnknown",(e,t)=>{f3.init(e,t),Sr.init(e,t)});function xn(){return y4(XUe)}var JUe=ne("ZodNever",(e,t)=>{d3.init(e,t),Sr.init(e,t)});function qoe(e){return v4(JUe,e)}var ZUe=ne("ZodVoid",(e,t)=>{h3.init(e,t),Sr.init(e,t)});function Mfr(e){return b4(ZUe,e)}var H4=ne("ZodDate",(e,t)=>{m3.init(e,t),Sr.init(e,t),e.min=(n,i)=>e.check(Ys(n,i)),e.max=(n,i)=>e.check(wu(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 Ffr(e){return _4(H4,e)}var QUe=ne("ZodArray",(e,t)=>{g3.init(e,t),Sr.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Fg(r,n)),e.nonempty=r=>e.check(Fg(1,r)),e.max=(r,n)=>e.check(j0(r,n)),e.length=(r,n)=>e.check(V0(r,n)),e.unwrap=()=>e.element});function Ut(e,t){return noe(QUe,e,t)}function jfr(e){let t=e._zod.def.shape;return ri(Object.keys(t))}var G4=ne("ZodObject",(e,t)=>{roe.init(e,t),Sr.init(e,t),Le.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>ri(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:xn()}),e.loose=()=>e.clone({...e._zod.def,catchall:xn()}),e.strict=()=>e.clone({...e._zod.def,catchall:qoe()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Le.extend(e,r),e.safeExtend=r=>Le.safeExtend(e,r),e.merge=r=>Le.merge(e,r),e.pick=r=>Le.pick(e,r),e.omit=r=>Le.omit(e,r),e.partial=(...r)=>Le.partial(Hoe,e,r[0]),e.required=(...r)=>Le.required(Goe,e,r[0])});function we(e,t){let r={type:"object",shape:e??{},...Le.normalizeParams(t)};return new G4(r)}function Vfr(e,t){return new G4({type:"object",shape:e,catchall:qoe(),...Le.normalizeParams(t)})}function Ws(e,t){return new G4({type:"object",shape:e,catchall:xn(),...Le.normalizeParams(t)})}var Uoe=ne("ZodUnion",(e,t)=>{ER.init(e,t),Sr.init(e,t),e.options=t.options});function nn(e,t){return new Uoe({type:"union",options:e,...Le.normalizeParams(t)})}var eBe=ne("ZodDiscriminatedUnion",(e,t)=>{Uoe.init(e,t),y3.init(e,t)});function K4(e,t,r){return new eBe({type:"union",options:t,discriminator:e,...Le.normalizeParams(r)})}var tBe=ne("ZodIntersection",(e,t)=>{v3.init(e,t),Sr.init(e,t)});function tL(e,t){return new tBe({type:"intersection",left:e,right:t})}var rBe=ne("ZodTuple",(e,t)=>{TR.init(e,t),Sr.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function nBe(e,t,r){let n=t instanceof Yt,i=n?r:t,a=n?t:null;return new rBe({type:"tuple",items:e,rest:a,...Le.normalizeParams(i)})}var Boe=ne("ZodRecord",(e,t)=>{b3.init(e,t),Sr.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function $n(e,t,r){return new Boe({type:"record",keyType:e,valueType:t,...Le.normalizeParams(r)})}function qfr(e,t,r){let n=hs(e);return n._zod.values=void 0,new Boe({type:"record",keyType:n,valueType:t,...Le.normalizeParams(r)})}var iBe=ne("ZodMap",(e,t)=>{_3.init(e,t),Sr.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Ufr(e,t,r){return new iBe({type:"map",keyType:e,valueType:t,...Le.normalizeParams(r)})}var aBe=ne("ZodSet",(e,t)=>{E3.init(e,t),Sr.init(e,t),e.min=(...r)=>e.check(_b(...r)),e.nonempty=r=>e.check(_b(1,r)),e.max=(...r)=>e.check(F0(...r)),e.size=(...r)=>e.check($x(...r))});function Bfr(e,t){return new aBe({type:"set",valueType:e,...Le.normalizeParams(t)})}var YR=ne("ZodEnum",(e,t)=>{T3.init(e,t),Sr.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 YR({...t,checks:[],...Le.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 YR({...t,checks:[],...Le.normalizeParams(i),entries:a})}});function ri(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new YR({type:"enum",entries:r,...Le.normalizeParams(t)})}function zfr(e,t){return new YR({type:"enum",entries:e,...Le.normalizeParams(t)})}var oBe=ne("ZodLiteral",(e,t)=>{O3.init(e,t),Sr.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 dt(e,t){return new oBe({type:"literal",values:Array.isArray(e)?e:[e],...Le.normalizeParams(t)})}var sBe=ne("ZodFile",(e,t)=>{S3.init(e,t),Sr.init(e,t),e.min=(r,n)=>e.check(_b(r,n)),e.max=(r,n)=>e.check(F0(r,n)),e.mime=(r,n)=>e.check(Bx(Array.isArray(r)?r:[r],n))});function Hfr(e){return P4(sBe,e)}var cBe=ne("ZodTransform",(e,t)=>{A3.init(e,t),Sr.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new fb(e.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(Le.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(Le.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 zoe(e){return new cBe({type:"transform",transform:e})}var Hoe=ne("ZodOptional",(e,t)=>{x3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function kn(e){return new Hoe({type:"optional",innerType:e})}var uBe=ne("ZodNullable",(e,t)=>{C3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function q4(e){return new uBe({type:"nullable",innerType:e})}function Gfr(e){return kn(q4(e))}var lBe=ne("ZodDefault",(e,t)=>{P3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pBe(e,t){return new lBe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Le.shallowClone(t)}})}var fBe=ne("ZodPrefault",(e,t)=>{D3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dBe(e,t){return new fBe({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Le.shallowClone(t)}})}var Goe=ne("ZodNonOptional",(e,t)=>{w3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function hBe(e,t){return new Goe({type:"nonoptional",innerType:e,...Le.normalizeParams(t)})}var mBe=ne("ZodSuccess",(e,t)=>{N3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Kfr(e){return new mBe({type:"success",innerType:e})}var gBe=ne("ZodCatch",(e,t)=>{I3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yBe(e,t){return new gBe({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var vBe=ne("ZodNaN",(e,t)=>{R3.init(e,t),Sr.init(e,t)});function Yfr(e){return T4(vBe,e)}var Koe=ne("ZodPipe",(e,t)=>{L3.init(e,t),Sr.init(e,t),e.in=t.in,e.out=t.out});function U4(e,t){return new Koe({type:"pipe",in:e,out:t})}var Yoe=ne("ZodCodec",(e,t)=>{Koe.init(e,t),Nx.init(e,t)});function Wfr(e,t,r){return new Yoe({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var bBe=ne("ZodReadonly",(e,t)=>{k3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _Be(e){return new bBe({type:"readonly",innerType:e})}var EBe=ne("ZodTemplateLiteral",(e,t)=>{$3.init(e,t),Sr.init(e,t)});function Xfr(e,t){return new EBe({type:"template_literal",parts:e,...Le.normalizeParams(t)})}var TBe=ne("ZodLazy",(e,t)=>{j3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.getter()});function OBe(e){return new TBe({type:"lazy",getter:e})}var SBe=ne("ZodPromise",(e,t)=>{F3.init(e,t),Sr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Jfr(e){return new SBe({type:"promise",innerType:e})}var ABe=ne("ZodFunction",(e,t)=>{M3.init(e,t),Sr.init(e,t)});function Zfr(e){return new ABe({type:"function",input:Array.isArray(e?.input)?nBe(e?.input):e?.input??Ut(xn()),output:e?.output??xn()})}var Y4=ne("ZodCustom",(e,t)=>{V3.init(e,t),Sr.init(e,t)});function Qfr(e){let t=new ti({check:"custom"});return t._zod.check=e,t}function Woe(e,t){return D4(Y4,e??(()=>!0),t)}function xBe(e,t={}){return w4(Y4,e,t)}function CBe(e){return N4(e)}var edr=I4,tdr=R4;function rdr(e,t={error:`Input not instance of ${e.name}`}){let r=new Y4({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...Le.normalizeParams(t)});return r._zod.bag.Class=e,r}var ndr=(...e)=>L4({Codec:Yoe,Boolean:ZR,String:WR},...e);function idr(e){let t=OBe(()=>nn([ee(e),gn(),wi(),eL(),Ut(t),$n(ee(),t)]));return t}function W4(e,t){return U4(zoe(e),t)}var adr={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 odr(e){fa({customError:e})}function sdr(){return fa().customError}var Xoe;Xoe||(Xoe={});var Joe={};Di(Joe,{bigint:()=>pdr,boolean:()=>ldr,date:()=>fdr,number:()=>udr,string:()=>cdr});function cdr(e){return K3(WR,e)}function udr(e){return t4(JR,e)}function ldr(e){return c4(ZR,e)}function pdr(e){return l4(QR,e)}function fdr(e){return E4(H4,e)}fa(q3());var Qoe="2025-11-25";var PBe=[Qoe,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Tb="io.modelcontextprotocol/related-task",J4="2.0",ms=Woe(e=>e!==null&&(typeof e=="object"||typeof e=="function")),DBe=nn([ee(),gn().int()]),wBe=ee(),Aui=Ws({ttl:nn([gn(),eL()]).optional(),pollInterval:gn().optional()}),hdr=we({ttl:gn().optional()}),mdr=we({taskId:ee()}),ese=Ws({progressToken:DBe.optional(),[Tb]:mdr.optional()}),zl=we({_meta:ese.optional()}),rL=zl.extend({task:hdr.optional()}),NBe=e=>rL.safeParse(e).success,gs=we({method:ee(),params:zl.loose().optional()}),Fp=we({_meta:ese.optional()}),jp=we({method:ee(),params:Fp.loose().optional()}),ys=Ws({_meta:ese.optional()}),Z4=nn([ee(),gn().int()]),IBe=we({jsonrpc:dt(J4),id:Z4,...gs.shape}).strict(),tse=e=>IBe.safeParse(e).success,RBe=we({jsonrpc:dt(J4),...jp.shape}).strict(),LBe=e=>RBe.safeParse(e).success,rse=we({jsonrpc:dt(J4),id:Z4,result:ys}).strict(),nL=e=>rse.safeParse(e).success;var an;(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"})(an||(an={}));var nse=we({jsonrpc:dt(J4),id:Z4.optional(),error:we({code:gn().int(),message:ee(),data:xn().optional()})}).strict();var kBe=e=>nse.safeParse(e).success;var $Be=nn([IBe,RBe,rse,nse]),xui=nn([rse,nse]),Q4=ys.strict(),gdr=Fp.extend({requestId:Z4.optional(),reason:ee().optional()}),ez=jp.extend({method:dt("notifications/cancelled"),params:gdr}),ydr=we({src:ee(),mimeType:ee().optional(),sizes:Ut(ee()).optional(),theme:ri(["light","dark"]).optional()}),iL=we({icons:Ut(ydr).optional()}),Jx=we({name:ee(),title:ee().optional()}),MBe=Jx.extend({...Jx.shape,...iL.shape,version:ee(),websiteUrl:ee().optional(),description:ee().optional()}),vdr=tL(we({applyDefaults:wi().optional()}),$n(ee(),xn())),bdr=W4(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,tL(we({form:vdr.optional(),url:ms.optional()}),$n(ee(),xn()).optional())),_dr=Ws({list:ms.optional(),cancel:ms.optional(),requests:Ws({sampling:Ws({createMessage:ms.optional()}).optional(),elicitation:Ws({create:ms.optional()}).optional()}).optional()}),Edr=Ws({list:ms.optional(),cancel:ms.optional(),requests:Ws({tools:Ws({call:ms.optional()}).optional()}).optional()}),Tdr=we({experimental:$n(ee(),ms).optional(),sampling:we({context:ms.optional(),tools:ms.optional()}).optional(),elicitation:bdr.optional(),roots:we({listChanged:wi().optional()}).optional(),tasks:_dr.optional()}),Odr=zl.extend({protocolVersion:ee(),capabilities:Tdr,clientInfo:MBe}),aL=gs.extend({method:dt("initialize"),params:Odr});var Sdr=we({experimental:$n(ee(),ms).optional(),logging:ms.optional(),completions:ms.optional(),prompts:we({listChanged:wi().optional()}).optional(),resources:we({subscribe:wi().optional(),listChanged:wi().optional()}).optional(),tools:we({listChanged:wi().optional()}).optional(),tasks:Edr.optional()}),Adr=ys.extend({protocolVersion:ee(),capabilities:Sdr,serverInfo:MBe,instructions:ee().optional()}),ise=jp.extend({method:dt("notifications/initialized"),params:Fp.optional()});var tz=gs.extend({method:dt("ping"),params:zl.optional()}),xdr=we({progress:gn(),total:kn(gn()),message:kn(ee())}),Cdr=we({...Fp.shape,...xdr.shape,progressToken:DBe}),rz=jp.extend({method:dt("notifications/progress"),params:Cdr}),Pdr=zl.extend({cursor:wBe.optional()}),oL=gs.extend({params:Pdr.optional()}),sL=ys.extend({nextCursor:wBe.optional()}),Ddr=ri(["working","input_required","completed","failed","cancelled"]),cL=we({taskId:ee(),status:Ddr,ttl:nn([gn(),eL()]),createdAt:ee(),lastUpdatedAt:ee(),pollInterval:kn(gn()),statusMessage:kn(ee())}),Zx=ys.extend({task:cL}),wdr=Fp.merge(cL),uL=jp.extend({method:dt("notifications/tasks/status"),params:wdr}),nz=gs.extend({method:dt("tasks/get"),params:zl.extend({taskId:ee()})}),iz=ys.merge(cL),az=gs.extend({method:dt("tasks/result"),params:zl.extend({taskId:ee()})}),Cui=ys.loose(),oz=oL.extend({method:dt("tasks/list")}),sz=sL.extend({tasks:Ut(cL)}),cz=gs.extend({method:dt("tasks/cancel"),params:zl.extend({taskId:ee()})}),FBe=ys.merge(cL),jBe=we({uri:ee(),mimeType:kn(ee()),_meta:$n(ee(),xn()).optional()}),VBe=jBe.extend({text:ee()}),ase=ee().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),qBe=jBe.extend({blob:ase}),lL=ri(["user","assistant"]),Qx=we({audience:Ut(lL).optional(),priority:gn().min(0).max(1).optional(),lastModified:Wx.datetime({offset:!0}).optional()}),UBe=we({...Jx.shape,...iL.shape,uri:ee(),description:kn(ee()),mimeType:kn(ee()),annotations:Qx.optional(),_meta:kn(Ws({}))}),Ndr=we({...Jx.shape,...iL.shape,uriTemplate:ee(),description:kn(ee()),mimeType:kn(ee()),annotations:Qx.optional(),_meta:kn(Ws({}))}),Idr=oL.extend({method:dt("resources/list")}),Rdr=sL.extend({resources:Ut(UBe)}),Ldr=oL.extend({method:dt("resources/templates/list")}),kdr=sL.extend({resourceTemplates:Ut(Ndr)}),ose=zl.extend({uri:ee()}),$dr=ose,Mdr=gs.extend({method:dt("resources/read"),params:$dr}),Fdr=ys.extend({contents:Ut(nn([VBe,qBe]))}),jdr=jp.extend({method:dt("notifications/resources/list_changed"),params:Fp.optional()}),Vdr=ose,qdr=gs.extend({method:dt("resources/subscribe"),params:Vdr}),Udr=ose,Bdr=gs.extend({method:dt("resources/unsubscribe"),params:Udr}),zdr=Fp.extend({uri:ee()}),Hdr=jp.extend({method:dt("notifications/resources/updated"),params:zdr}),Gdr=we({name:ee(),description:kn(ee()),required:kn(wi())}),Kdr=we({...Jx.shape,...iL.shape,description:kn(ee()),arguments:kn(Ut(Gdr)),_meta:kn(Ws({}))}),Ydr=oL.extend({method:dt("prompts/list")}),Wdr=sL.extend({prompts:Ut(Kdr)}),Xdr=zl.extend({name:ee(),arguments:$n(ee(),ee()).optional()}),Jdr=gs.extend({method:dt("prompts/get"),params:Xdr}),sse=we({type:dt("text"),text:ee(),annotations:Qx.optional(),_meta:$n(ee(),xn()).optional()}),cse=we({type:dt("image"),data:ase,mimeType:ee(),annotations:Qx.optional(),_meta:$n(ee(),xn()).optional()}),use=we({type:dt("audio"),data:ase,mimeType:ee(),annotations:Qx.optional(),_meta:$n(ee(),xn()).optional()}),Zdr=we({type:dt("tool_use"),name:ee(),id:ee(),input:$n(ee(),xn()),_meta:$n(ee(),xn()).optional()}),Qdr=we({type:dt("resource"),resource:nn([VBe,qBe]),annotations:Qx.optional(),_meta:$n(ee(),xn()).optional()}),ehr=UBe.extend({type:dt("resource_link")}),lse=nn([sse,cse,use,ehr,Qdr]),thr=we({role:lL,content:lse}),rhr=ys.extend({description:ee().optional(),messages:Ut(thr)}),nhr=jp.extend({method:dt("notifications/prompts/list_changed"),params:Fp.optional()}),ihr=we({title:ee().optional(),readOnlyHint:wi().optional(),destructiveHint:wi().optional(),idempotentHint:wi().optional(),openWorldHint:wi().optional()}),ahr=we({taskSupport:ri(["required","optional","forbidden"]).optional()}),BBe=we({...Jx.shape,...iL.shape,description:ee().optional(),inputSchema:we({type:dt("object"),properties:$n(ee(),ms).optional(),required:Ut(ee()).optional()}).catchall(xn()),outputSchema:we({type:dt("object"),properties:$n(ee(),ms).optional(),required:Ut(ee()).optional()}).catchall(xn()).optional(),annotations:ihr.optional(),execution:ahr.optional(),_meta:$n(ee(),xn()).optional()}),pse=oL.extend({method:dt("tools/list")}),ohr=sL.extend({tools:Ut(BBe)}),uz=ys.extend({content:Ut(lse).default([]),structuredContent:$n(ee(),xn()).optional(),isError:wi().optional()}),Pui=uz.or(ys.extend({toolResult:xn()})),shr=rL.extend({name:ee(),arguments:$n(ee(),xn()).optional()}),pL=gs.extend({method:dt("tools/call"),params:shr}),chr=jp.extend({method:dt("notifications/tools/list_changed"),params:Fp.optional()}),Dui=we({autoRefresh:wi().default(!0),debounceMs:gn().int().nonnegative().default(300)}),fL=ri(["debug","info","notice","warning","error","critical","alert","emergency"]),uhr=zl.extend({level:fL}),fse=gs.extend({method:dt("logging/setLevel"),params:uhr}),lhr=Fp.extend({level:fL,logger:ee().optional(),data:xn()}),phr=jp.extend({method:dt("notifications/message"),params:lhr}),fhr=we({name:ee().optional()}),dhr=we({hints:Ut(fhr).optional(),costPriority:gn().min(0).max(1).optional(),speedPriority:gn().min(0).max(1).optional(),intelligencePriority:gn().min(0).max(1).optional()}),hhr=we({mode:ri(["auto","required","none"]).optional()}),mhr=we({type:dt("tool_result"),toolUseId:ee().describe("The unique identifier for the corresponding tool call."),content:Ut(lse).default([]),structuredContent:we({}).loose().optional(),isError:wi().optional(),_meta:$n(ee(),xn()).optional()}),ghr=K4("type",[sse,cse,use]),X4=K4("type",[sse,cse,use,Zdr,mhr]),yhr=we({role:lL,content:nn([X4,Ut(X4)]),_meta:$n(ee(),xn()).optional()}),vhr=rL.extend({messages:Ut(yhr),modelPreferences:dhr.optional(),systemPrompt:ee().optional(),includeContext:ri(["none","thisServer","allServers"]).optional(),temperature:gn().optional(),maxTokens:gn().int(),stopSequences:Ut(ee()).optional(),metadata:ms.optional(),tools:Ut(BBe).optional(),toolChoice:hhr.optional()}),bhr=gs.extend({method:dt("sampling/createMessage"),params:vhr}),dse=ys.extend({model:ee(),stopReason:kn(ri(["endTurn","stopSequence","maxTokens"]).or(ee())),role:lL,content:ghr}),hse=ys.extend({model:ee(),stopReason:kn(ri(["endTurn","stopSequence","maxTokens","toolUse"]).or(ee())),role:lL,content:nn([X4,Ut(X4)])}),_hr=we({type:dt("boolean"),title:ee().optional(),description:ee().optional(),default:wi().optional()}),Ehr=we({type:dt("string"),title:ee().optional(),description:ee().optional(),minLength:gn().optional(),maxLength:gn().optional(),format:ri(["email","uri","date","date-time"]).optional(),default:ee().optional()}),Thr=we({type:ri(["number","integer"]),title:ee().optional(),description:ee().optional(),minimum:gn().optional(),maximum:gn().optional(),default:gn().optional()}),Ohr=we({type:dt("string"),title:ee().optional(),description:ee().optional(),enum:Ut(ee()),default:ee().optional()}),Shr=we({type:dt("string"),title:ee().optional(),description:ee().optional(),oneOf:Ut(we({const:ee(),title:ee()})),default:ee().optional()}),Ahr=we({type:dt("string"),title:ee().optional(),description:ee().optional(),enum:Ut(ee()),enumNames:Ut(ee()).optional(),default:ee().optional()}),xhr=nn([Ohr,Shr]),Chr=we({type:dt("array"),title:ee().optional(),description:ee().optional(),minItems:gn().optional(),maxItems:gn().optional(),items:we({type:dt("string"),enum:Ut(ee())}),default:Ut(ee()).optional()}),Phr=we({type:dt("array"),title:ee().optional(),description:ee().optional(),minItems:gn().optional(),maxItems:gn().optional(),items:we({anyOf:Ut(we({const:ee(),title:ee()}))}),default:Ut(ee()).optional()}),Dhr=nn([Chr,Phr]),whr=nn([Ahr,xhr,Dhr]),Nhr=nn([whr,_hr,Ehr,Thr]),Ihr=rL.extend({mode:dt("form").optional(),message:ee(),requestedSchema:we({type:dt("object"),properties:$n(ee(),Nhr),required:Ut(ee()).optional()})}),Rhr=rL.extend({mode:dt("url"),message:ee(),elicitationId:ee(),url:ee().url()}),Lhr=nn([Ihr,Rhr]),khr=gs.extend({method:dt("elicitation/create"),params:Lhr}),$hr=Fp.extend({elicitationId:ee()}),Mhr=jp.extend({method:dt("notifications/elicitation/complete"),params:$hr}),lz=ys.extend({action:ri(["accept","decline","cancel"]),content:W4(e=>e===null?void 0:e,$n(ee(),nn([ee(),gn(),wi(),Ut(ee())])).optional())}),Fhr=we({type:dt("ref/resource"),uri:ee()});var jhr=we({type:dt("ref/prompt"),name:ee()}),Vhr=zl.extend({ref:nn([jhr,Fhr]),argument:we({name:ee(),value:ee()}),context:we({arguments:$n(ee(),ee()).optional()}).optional()}),qhr=gs.extend({method:dt("completion/complete"),params:Vhr});var Uhr=ys.extend({completion:Ws({values:Ut(ee()).max(100),total:kn(gn().int()),hasMore:kn(wi())})}),Bhr=we({uri:ee().startsWith("file://"),name:ee().optional(),_meta:$n(ee(),xn()).optional()}),zhr=gs.extend({method:dt("roots/list"),params:zl.optional()}),mse=ys.extend({roots:Ut(Bhr)}),Hhr=jp.extend({method:dt("notifications/roots/list_changed"),params:Fp.optional()}),wui=nn([tz,aL,qhr,fse,Jdr,Ydr,Idr,Ldr,Mdr,qdr,Bdr,pL,pse,nz,az,oz,cz]),Nui=nn([ez,rz,ise,Hhr,uL]),Iui=nn([Q4,dse,hse,lz,mse,iz,sz,Zx]),Rui=nn([tz,bhr,khr,zhr,nz,az,oz,cz]),Lui=nn([ez,rz,phr,Hdr,jdr,chr,nhr,uL,Mhr]),kui=nn([Q4,Adr,Uhr,rhr,Wdr,Rdr,kdr,Fdr,uz,ohr,iz,sz,Zx]),Ar=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===an.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new Zoe(i.elicitations,r)}return new e(t,r,n)}},Zoe=class extends Ar{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(an.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Ob(e){return e==="completed"||e==="failed"||e==="cancelled"}var Ghr=Symbol("Let zodToJsonSchema decide on which parser to use");var mli=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function gse(e){let r=k4(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=UUe(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function yse(e,t){let r=Eb(e,t);if(!r.success)throw r.error;return r.data}var Zhr=6e4,pz=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(ez,r=>{this._oncancel(r)}),this.setNotificationHandler(rz,r=>{this._onprogress(r)}),this.setRequestHandler(tz,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(nz,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Ar(an.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(az,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,d=new Ar(p.error.code,p.error.message,p.error.data);l(d)}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 Ar(an.InvalidParams,`Task not found: ${a}`);if(!Ob(o.status))return await this._waitForTaskUpdate(a,n.signal),await i();if(Ob(o.status)){let s=await this._taskStore.getTaskResult(a,n.sessionId);return this._clearTaskQueue(a),{...s,_meta:{...s._meta,[Tb]:{taskId:a}}}}return await i()};return await i()}),this.setRequestHandler(oz,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 Ar(an.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(cz,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Ar(an.InvalidParams,`Task not found: ${r.params.taskId}`);if(Ob(i.status))throw new Ar(an.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 Ar(an.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof Ar?i:new Ar(an.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),Ar.fromError(an.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){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),nL(a)||kBe(a)?this._onresponse(a):tse(a)?this._onrequest(a,o):LBe(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();let r=Ar.fromError(an.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?.[Tb]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:an.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=NBe(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=>{let p={relatedRequestId:t.id};a&&(p.relatedTask={taskId:a}),await this.notification(l,p)},sendRequest:async(l,p,d)=>{let f={...d,relatedRequestId:t.id};a&&!f.relatedTask&&(f.relatedTask={taskId:a});let h=f.relatedTask?.taskId??a;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,p,f)},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:an.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),nL(t))n(t);else{let o=new Ar(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(nL(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),nL(t))i(t);else{let o=Ar.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 Ar?o:new Ar(an.InternalError,String(o))}}return}let a;try{let o=await this.request(t,Zx,n);if(o.task)a=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new Ar(an.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:a},n);if(yield{type:"taskStatus",task:s},Ob(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)}:s.status==="failed"?yield{type:"error",error:new Ar(an.InternalError,`Task ${a} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new Ar(an.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 Ar?o:new Ar(an.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 d=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:d}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Tb]:c}});let h=O=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(O)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let S=O instanceof Ar?O:new Ar(an.RequestTimeout,String(O));l(S)};this._responseHandlers.set(d,O=>{if(!n?.signal?.aborted){if(O instanceof Error)return l(O);try{let S=Eb(r,O.result);S.success?u(S.data):l(S.error)}catch(S){l(S)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let g=n?.timeout??Zhr,v=()=>h(Ar.fromError(an.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(d,g,n?.maxTotalTimeout,v,n?.resetTimeoutOnProgress??!1);let E=c?.taskId;if(E){let O=S=>{let A=this._responseHandlers.get(d);A?A(S):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,O),this._enqueueTaskMessage(E,{type:"request",message:f,timestamp:Date.now()}).catch(S=>{this._cleanupTimeout(d),l(S)})}else this._transport.send(f,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(d),l(O)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},iz,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},sz,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},FBe,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||{},[Tb]: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||{},[Tb]: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||{},[Tb]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(t,r){let n=gse(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>{let o=yse(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=gse(t);this._notificationHandlers.set(n,i=>{let a=yse(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"&&tse(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new Ar(an.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 Ar(an.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(o),a(new Ar(an.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 Ar(an.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=uL.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Ob(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 Ar(an.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Ob(s.status))throw new Ar(an.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=uL.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Ob(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function zBe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function HBe(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];zBe(o)&&zBe(a)?r[i]={...o,...a}:r[i]=a}return r}var Mze=Pt(Gz(),1),Fze=Pt($ze(),1);function V_r(){let e=new Mze.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Fze.default)(e),e}var Yz=class{constructor(t){this._ajv=t??V_r()}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 Wz=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 jze(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 Vze(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 Xz=class extends pz{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(fL.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 Yz,this.setRequestHandler(aL,n=>this._oninitialize(n)),this.setNotificationHandler(ise,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(fse,async(n,i)=>{let a=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=n.params,s=fL.safeParse(o);return s.success&&this._loggingLevels.set(a,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Wz(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=HBe(this._capabilities,t)}setRequestHandler(t,r){let i=k4(t)?.method;if(!i)throw new Error("Schema is missing a method literal");let a;if(Yx(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=Eb(pL,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new Ar(an.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:p}=l.data,d=await Promise.resolve(r(c,u));if(p.task){let h=Eb(Zx,d);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new Ar(an.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let f=Eb(uz,d);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new Ar(an.InvalidParams,`Invalid tools/call result: ${h}`)}return f.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){Vze(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&jze(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:PBe.includes(r)?r:Qoe,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"},Q4)}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},hse,r):this.request({method:"sampling/createMessage",params:t},dse,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},lz,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},lz,r);if(a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new Ar(an.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){throw o instanceof Ar?o:new Ar(an.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},mse,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 cue=Pt(require("node:process"),1);var Jz=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),q_r(r)}clear(){this._buffer=void 0}};function q_r(e){return $Be.parse(JSON.parse(e))}function qze(e){return JSON.stringify(e)+`
|
|
1610
|
-
`}var Zz=class{constructor(t=cue.default.stdin,r=cue.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Jz,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=qze(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Bze="0.6.19";var eT={name:"@sap-ux/fiori-mcp-server",description:"SAP Fiori - Model Context Protocol (MCP) server",version:Bze,keywords:["SAP Fiori tools","SAP Fiori elements","SAP Fiori freestyle","MCP","AI"],repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/fiori-mcp-server"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-mcp-server"},license:"Apache-2.0",main:"dist/index.js",scripts:{"build-esbuild-base":"esbuild --bundle --platform=node --target=node20 --outdir=dist --external:vscode --external:@lancedb/lancedb --external:@xenova/transformers --external:@sap-ux/fiori-docs-embeddings --external:@sap-ux/store --main-fields=module,main src/index.ts","build-dev":"pnpm run build-esbuild-base --sourcemap=inline","build-compile":"tsc --noEmit","build-bundle":"pnpm run build-esbuild-base --minify",build:"npm-run-all build-compile build-bundle",watch:"tsc --watch",bundle:"npm-run-all build tgz:package tgz:rename","tgz:package":"pnpm pack","tgz:rename":"node -e \"const fs=require('fs'), p=require('./package.json'), d=new Date().toISOString().split('T')[0], oldName=p.name.startsWith('@') ? `${p.name.replace('@', '').replace('/', '-')}-${p.version}.tgz` : `${p.name}-${p.version}.tgz`; fs.renameSync(oldName, `${oldName.replace('.tgz','')}-${d}.tgz`)\"",clean:"rimraf --glob dist test/test-output *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","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"],bin:{"fiori-mcp":"./dist/index.js"},devDependencies:{"npm-run-all2":"8.0.4",esbuild:"0.25.6","@modelcontextprotocol/sdk":"1.25.2","@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/edmx-parser":"0.9.6","@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.0","os-name":"4.0.1",zod:"4.1.13","@sap-ai-sdk/foundation-models":"2.3.0","@sap-ai-sdk/langchain":"2.3.0",promptfoo:"0.119.14","@langchain/mcp-adapters":"1.0.2","@langchain/core":"1.1.8"},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 Gze=we({name:ee().describe("Name of the Fiori application. Usually derived from the `sap.app/id` field in the application's manifest.json."),appPath:ee().describe("Absolute path to the Fiori application's root directory."),projectPath:ee().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:ri(["EDMXBackend","CAPJava","CAPNodejs"]).describe("Type of project the application belongs to."),odataVersion:ee().describe("OData protocol version used by the application's main service.")}),rT=nn([ee(),Ut(nn([ee(),gn()]))]),Kze=we({functionalityId:rT.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),description:ee()}),zze=ri(["object","array","string","number","boolean","null","integer","any"]),Hze=we({type:nn([zze,Ut(zze)]).optional(),description:ee().optional(),properties:z4().optional()}).catchall(z4()),Yze=Hze.extend({properties:$n(ee(),nn([Hze,wi()])).optional()});var Wze=we({searchPath:Ut(ee()).describe("Path to search for Fiori applications (defaults to current directory). If VSCode - list of VS Code workspace folder paths(`workspace.workspaceFolders`)")}),Xze=we({appPath:ee().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.")}),Jze=we({appPath:ee().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path."),functionalityId:rT.describe("The ID of the functionality to get details for")}),Zze=we({functionalityId:rT.describe("The ID of the functionality to execute"),parameters:$n(ee(),xn()).describe("Parameters for the functionality execution"),appPath:ee().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.'),Whi=we({query:ee().min(2).describe("The search query for fiori elements, annotations, sapui5, fiori tools documentation")});var Jhi=ee().describe("Search results as formatted text"),Qze=we({applications:Ut(Gze)}),e5e=we({applicationPath:ee(),functionalities:Ut(Kze)}),t5e=we({functionalityId:rT.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),name:ee(),description:ee(),technicalDescription:ee().optional(),parameters:Yze,prerequisites:Ut(ee()).optional(),impact:ee().optional(),examples:Ut(ee()).optional(),pageName:ee().optional()}),r5e=we({functionalityId:rT,status:ee(),message:ee(),parameters:xn(),appPath:ee(),changes:Ut(ee()),timestamp:ee()});var L_e=Pt(require("node:fs/promises")),lf=Pt(require("node:path"));var tu=Pt(Yb()),$dt=Pt(Cd()),Mdt=require("node:path");function KZr(){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 tu.LogLevel.Error;case"WARN":return tu.LogLevel.Warn;case"INFO":return tu.LogLevel.Info;case"DEBUG":return tu.LogLevel.Debug;case"VERBOSE":return tu.LogLevel.Verbose;case"SILLY":return tu.LogLevel.Silly;default:break}return tu.LogLevel.Error}var kdt=KZr(),pt=new tu.ToolsLogger({logLevel:kdt??tu.LogLevel.Error,transports:kdt===void 0?[new tu.NullTransport]:[new tu.FileTransport({filename:(0,Mdt.join)($dt.fioriToolsDirectory,"fiori-mcp-server.log"),maxsize:10*1024*1024,maxFiles:5})],logPrefix:"fiori-mcp"}),RM={info:(e,...t)=>{pt.info(`@sap/ux-specification: ${e}`);for(let r of t)pt.info(typeof r=="number"?r.toString():r)},warning:(e,...t)=>{pt.warn(`@sap/ux-specification: ${e}`);for(let r of t)pt.warn(typeof r=="number"?r.toString():r)},error:(e,...t)=>{pt.error(`@sap/ux-specification: ${e}`);for(let r of t)pt.error(typeof r=="number"?r.toString():r)},reset:()=>{}};async function Fdt(){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 L_e.default.access(n),pt.log("\u2713 Using @sap-ux/fiori-docs-embeddings package"),{dataPath:n,embeddingsPath:lf.default.join(n,"embeddings"),searchPath:lf.default.join(n,"search"),docsPath:lf.default.join(n,"docs"),isExternalPackage:!0,isAvailable:!0}}catch{pt.warn("Could not load @sap-ux/fiori-docs-embeddings package, trying local data...")}let e=lf.default.join(__dirname,"../../data");try{return await L_e.default.access(e),pt.log("\u2713 Using local data directory"),{dataPath:e,embeddingsPath:lf.default.join(e,"embeddings"),searchPath:lf.default.join(e,"search"),docsPath:lf.default.join(e,"docs"),isExternalPackage:!1,isAvailable:!0}}catch{pt.warn("Local data directory not available either")}let t=lf.default.join(__dirname,"../../data");return pt.warn("\u26A0\uFE0F No embeddings data available - running in limited mode"),{dataPath:t,embeddingsPath:lf.default.join(t,"embeddings"),searchPath:lf.default.join(t,"search"),docsPath:lf.default.join(t,"docs"),isExternalPackage:!1,isAvailable:!1}}var uc=Pt(Cd()),LM=require("node:path");async function ru(e){try{e=(0,LM.join)(e);try{let t=await(0,uc.createApplicationAccess)(e);return{root:t.project.root,appId:t.getAppId(),applicationAccess:t}}catch(t){pt.warn(`Application was not found by given path. Error: ${t}`);let r=await(0,uc.findProjectRoot)(e),n=await(0,uc.getProject)(r);if(n)return{root:n.root,appId:""}}}catch(t){pt.warn(`Project was not found by given path. Error: ${t}`);return}}var c9=e=>{let t;switch(e){case uc.DirName.View:{t=(0,LM.join)(uc.DirName.Ext,uc.DirName.View);break}case uc.DirName.Fragment:{t=(0,LM.join)(uc.DirName.Ext,uc.DirName.Fragment);break}case uc.DirName.Controller:{t=(0,LM.join)(uc.DirName.Ext,uc.DirName.Controller);break}default:t=e}return t},Xh=(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,Xh({...o,...s},t,r)}}let n={...e};return n.properties&&(n.properties=Object.fromEntries(Object.entries(n.properties).map(([i,a])=>[i,Xh(a,t,r)]))),n.items&&(Array.isArray(n.items)?n.items=n.items.map(i=>Xh(i,t,r)):n.items=Xh(n.items,t,r)),n.allOf&&(n.allOf=n.allOf.map(i=>Xh(i,t,r))),n.anyOf&&(n.anyOf=n.anyOf.map(i=>Xh(i,t,r))),n.oneOf&&(n.oneOf=n.oneOf.map(i=>Xh(i,t,r))),typeof n.additionalProperties=="object"&&(n.additionalProperties=Xh(n.additionalProperties,t,r)),n},jdt=(e,t)=>({type:"object",properties:{[e]:t}}),va=e=>{let t=U0(e);return delete t.$schema,t},Jh=(e,t)=>{try{return e.parse(t)}catch(r){throw r instanceof coe?new Error(`Missing required fields in parameters. ${JSON.stringify(r.issues,null,4)}`):new Error("Unknown error. Recheck input parameters.")}};var NAt=require("node:util"),IAt=require("node:child_process"),RAt=Pt(cSe());async function OY(e="1.18.5"){let t="@sap/generator-fiori";if((await(0,RAt.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 SY=(0,NAt.promisify)(IAt.exec);var LAt=require("@lancedb/lancedb");var uSe=Pt(require("node:fs/promises")),lSe=Pt(require("node:path")),AY=class{connection=null;tables=[];tableIndex=null;metadata=null;dataPath;constructor(t){this.dataPath=t||""}async initialize(){try{pt.log("Loading vector database from pre-built embeddings...");let t=await Fdt();if(!t.isAvailable)throw new Error("No embeddings data available");this.dataPath=t.embeddingsPath,pt.log(`Using embeddings path: ${this.dataPath} (external: ${t.isExternalPackage})`);let r=lSe.default.join(this.dataPath,"metadata.json"),n=await uSe.default.readFile(r,"utf-8");this.metadata=JSON.parse(n),pt.log("\u2713 Embedding metadata loaded:"),pt.log(` Model: ${this?.metadata?.model}`),pt.log(` Dimensions: ${this?.metadata?.dimensions}`),pt.log(` Total vectors: ${this?.metadata?.totalVectors}`),pt.log(` Created: ${this?.metadata?.createdAt}`),this.connection=await(0,LAt.connect)(this.dataPath);let i=lSe.default.join(this.dataPath,"table_index.json");try{let a=await uSe.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)}pt.log(`\u2713 Loaded ${this.tables.length} split tables`)}catch{pt.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}`)}}pt.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 pt.error(`Semantic search failed: ${i}`),new Error(`Semantic search failed: ${i}`)}}async findSimilarToText(t,r=5){return pt.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 pt.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 pt.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=[],pt.log("Vector database connection closed"))}};var xY=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 pSe(e,t=!1){let{query:r,maxResults:n}=e;try{let i=new AY,a=new xY;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 Zz=class{constructor(t=cue.default.stdin,r=cue.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Jz,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=qze(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Bze="0.6.20";var eT={name:"@sap-ux/fiori-mcp-server",description:"SAP Fiori - Model Context Protocol (MCP) server",version:Bze,keywords:["SAP Fiori tools","SAP Fiori elements","SAP Fiori freestyle","MCP","AI"],repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/fiori-mcp-server"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-mcp-server"},license:"Apache-2.0",main:"dist/index.js",scripts:{"build-esbuild-base":"esbuild --bundle --platform=node --target=node20 --outdir=dist --external:vscode --external:@lancedb/lancedb --external:@xenova/transformers --external:@sap-ux/fiori-docs-embeddings --external:@sap-ux/store --main-fields=module,main src/index.ts","build-dev":"pnpm run build-esbuild-base --sourcemap=inline","build-compile":"tsc --noEmit","build-bundle":"pnpm run build-esbuild-base --minify",build:"npm-run-all build-compile build-bundle",watch:"tsc --watch",bundle:"npm-run-all build tgz:package tgz:rename","tgz:package":"pnpm pack","tgz:rename":"node -e \"const fs=require('fs'), p=require('./package.json'), d=new Date().toISOString().split('T')[0], oldName=p.name.startsWith('@') ? `${p.name.replace('@', '').replace('/', '-')}-${p.version}.tgz` : `${p.name}-${p.version}.tgz`; fs.renameSync(oldName, `${oldName.replace('.tgz','')}-${d}.tgz`)\"",clean:"rimraf --glob dist test/test-output *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","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"],bin:{"fiori-mcp":"./dist/index.js"},devDependencies:{"npm-run-all2":"8.0.4",esbuild:"0.25.6","@modelcontextprotocol/sdk":"1.25.2","@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/edmx-parser":"0.9.6","@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.0","os-name":"4.0.1",zod:"4.1.13","@sap-ai-sdk/foundation-models":"2.3.0","@sap-ai-sdk/langchain":"2.3.0",promptfoo:"0.119.14","@langchain/mcp-adapters":"1.0.2","@langchain/core":"1.1.8"},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 Gze=we({name:ee().describe("Name of the Fiori application. Usually derived from the `sap.app/id` field in the application's manifest.json."),appPath:ee().describe("Absolute path to the Fiori application's root directory."),projectPath:ee().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:ri(["EDMXBackend","CAPJava","CAPNodejs"]).describe("Type of project the application belongs to."),odataVersion:ee().describe("OData protocol version used by the application's main service.")}),rT=nn([ee(),Ut(nn([ee(),gn()]))]),Kze=we({functionalityId:rT.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),description:ee()}),zze=ri(["object","array","string","number","boolean","null","integer","any"]),Hze=we({type:nn([zze,Ut(zze)]).optional(),description:ee().optional(),properties:z4().optional()}).catchall(z4()),Yze=Hze.extend({properties:$n(ee(),nn([Hze,wi()])).optional()});var Wze=we({searchPath:Ut(ee()).describe("Path to search for Fiori applications (defaults to current directory). If VSCode - list of VS Code workspace folder paths(`workspace.workspaceFolders`)")}),Xze=we({appPath:ee().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.")}),Jze=we({appPath:ee().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path."),functionalityId:rT.describe("The ID of the functionality to get details for")}),Zze=we({functionalityId:rT.describe("The ID of the functionality to execute"),parameters:$n(ee(),xn()).describe("Parameters for the functionality execution"),appPath:ee().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.'),Whi=we({query:ee().min(2).describe("The search query for fiori elements, annotations, sapui5, fiori tools documentation")});var Jhi=ee().describe("Search results as formatted text"),Qze=we({applications:Ut(Gze)}),e5e=we({applicationPath:ee(),functionalities:Ut(Kze)}),t5e=we({functionalityId:rT.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),name:ee(),description:ee(),technicalDescription:ee().optional(),parameters:Yze,prerequisites:Ut(ee()).optional(),impact:ee().optional(),examples:Ut(ee()).optional(),pageName:ee().optional()}),r5e=we({functionalityId:rT,status:ee(),message:ee(),parameters:xn(),appPath:ee(),changes:Ut(ee()),timestamp:ee()});var L_e=Pt(require("node:fs/promises")),lf=Pt(require("node:path"));var tu=Pt(Yb()),$dt=Pt(Cd()),Mdt=require("node:path");function KZr(){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 tu.LogLevel.Error;case"WARN":return tu.LogLevel.Warn;case"INFO":return tu.LogLevel.Info;case"DEBUG":return tu.LogLevel.Debug;case"VERBOSE":return tu.LogLevel.Verbose;case"SILLY":return tu.LogLevel.Silly;default:break}return tu.LogLevel.Error}var kdt=KZr(),pt=new tu.ToolsLogger({logLevel:kdt??tu.LogLevel.Error,transports:kdt===void 0?[new tu.NullTransport]:[new tu.FileTransport({filename:(0,Mdt.join)($dt.fioriToolsDirectory,"fiori-mcp-server.log"),maxsize:10*1024*1024,maxFiles:5})],logPrefix:"fiori-mcp"}),RM={info:(e,...t)=>{pt.info(`@sap/ux-specification: ${e}`);for(let r of t)pt.info(typeof r=="number"?r.toString():r)},warning:(e,...t)=>{pt.warn(`@sap/ux-specification: ${e}`);for(let r of t)pt.warn(typeof r=="number"?r.toString():r)},error:(e,...t)=>{pt.error(`@sap/ux-specification: ${e}`);for(let r of t)pt.error(typeof r=="number"?r.toString():r)},reset:()=>{}};async function Fdt(){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 L_e.default.access(n),pt.log("\u2713 Using @sap-ux/fiori-docs-embeddings package"),{dataPath:n,embeddingsPath:lf.default.join(n,"embeddings"),searchPath:lf.default.join(n,"search"),docsPath:lf.default.join(n,"docs"),isExternalPackage:!0,isAvailable:!0}}catch{pt.warn("Could not load @sap-ux/fiori-docs-embeddings package, trying local data...")}let e=lf.default.join(__dirname,"../../data");try{return await L_e.default.access(e),pt.log("\u2713 Using local data directory"),{dataPath:e,embeddingsPath:lf.default.join(e,"embeddings"),searchPath:lf.default.join(e,"search"),docsPath:lf.default.join(e,"docs"),isExternalPackage:!1,isAvailable:!0}}catch{pt.warn("Local data directory not available either")}let t=lf.default.join(__dirname,"../../data");return pt.warn("\u26A0\uFE0F No embeddings data available - running in limited mode"),{dataPath:t,embeddingsPath:lf.default.join(t,"embeddings"),searchPath:lf.default.join(t,"search"),docsPath:lf.default.join(t,"docs"),isExternalPackage:!1,isAvailable:!1}}var uc=Pt(Cd()),LM=require("node:path");async function ru(e){try{e=(0,LM.join)(e);try{let t=await(0,uc.createApplicationAccess)(e);return{root:t.project.root,appId:t.getAppId(),applicationAccess:t}}catch(t){pt.warn(`Application was not found by given path. Error: ${t}`);let r=await(0,uc.findProjectRoot)(e),n=await(0,uc.getProject)(r);if(n)return{root:n.root,appId:""}}}catch(t){pt.warn(`Project was not found by given path. Error: ${t}`);return}}var c9=e=>{let t;switch(e){case uc.DirName.View:{t=(0,LM.join)(uc.DirName.Ext,uc.DirName.View);break}case uc.DirName.Fragment:{t=(0,LM.join)(uc.DirName.Ext,uc.DirName.Fragment);break}case uc.DirName.Controller:{t=(0,LM.join)(uc.DirName.Ext,uc.DirName.Controller);break}default:t=e}return t},Xh=(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,Xh({...o,...s},t,r)}}let n={...e};return n.properties&&(n.properties=Object.fromEntries(Object.entries(n.properties).map(([i,a])=>[i,Xh(a,t,r)]))),n.items&&(Array.isArray(n.items)?n.items=n.items.map(i=>Xh(i,t,r)):n.items=Xh(n.items,t,r)),n.allOf&&(n.allOf=n.allOf.map(i=>Xh(i,t,r))),n.anyOf&&(n.anyOf=n.anyOf.map(i=>Xh(i,t,r))),n.oneOf&&(n.oneOf=n.oneOf.map(i=>Xh(i,t,r))),typeof n.additionalProperties=="object"&&(n.additionalProperties=Xh(n.additionalProperties,t,r)),n},jdt=(e,t)=>({type:"object",properties:{[e]:t}}),va=e=>{let t=U0(e);return delete t.$schema,t},Jh=(e,t)=>{try{return e.parse(t)}catch(r){throw r instanceof coe?new Error(`Missing required fields in parameters. ${JSON.stringify(r.issues,null,4)}`):new Error("Unknown error. Recheck input parameters.")}};var NAt=require("node:util"),IAt=require("node:child_process"),RAt=Pt(cSe());async function OY(e="1.18.5"){let t="@sap/generator-fiori";if((await(0,RAt.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 SY=(0,NAt.promisify)(IAt.exec);var LAt=require("@lancedb/lancedb");var uSe=Pt(require("node:fs/promises")),lSe=Pt(require("node:path")),AY=class{connection=null;tables=[];tableIndex=null;metadata=null;dataPath;constructor(t){this.dataPath=t||""}async initialize(){try{pt.log("Loading vector database from pre-built embeddings...");let t=await Fdt();if(!t.isAvailable)throw new Error("No embeddings data available");this.dataPath=t.embeddingsPath,pt.log(`Using embeddings path: ${this.dataPath} (external: ${t.isExternalPackage})`);let r=lSe.default.join(this.dataPath,"metadata.json"),n=await uSe.default.readFile(r,"utf-8");this.metadata=JSON.parse(n),pt.log("\u2713 Embedding metadata loaded:"),pt.log(` Model: ${this?.metadata?.model}`),pt.log(` Dimensions: ${this?.metadata?.dimensions}`),pt.log(` Total vectors: ${this?.metadata?.totalVectors}`),pt.log(` Created: ${this?.metadata?.createdAt}`),this.connection=await(0,LAt.connect)(this.dataPath);let i=lSe.default.join(this.dataPath,"table_index.json");try{let a=await uSe.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)}pt.log(`\u2713 Loaded ${this.tables.length} split tables`)}catch{pt.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}`)}}pt.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 pt.error(`Semantic search failed: ${i}`),new Error(`Semantic search failed: ${i}`)}}async findSimilarToText(t,r=5){return pt.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 pt.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 pt.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=[],pt.log("Vector database connection closed"))}};var xY=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 pSe(e,t=!1){let{query:r,maxResults:n}=e;try{let i=new AY,a=new xY;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.
|
|
4
|
+
"version": "0.6.20",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"SAP Fiori tools",
|
|
7
7
|
"SAP Fiori elements",
|
|
@@ -46,19 +46,19 @@
|
|
|
46
46
|
"promptfoo": "0.119.14",
|
|
47
47
|
"@langchain/mcp-adapters": "1.0.2",
|
|
48
48
|
"@langchain/core": "1.1.8",
|
|
49
|
-
"@sap-ux/axios-extension": "1.25.
|
|
50
|
-
"@sap-ux/
|
|
51
|
-
"@sap-ux/
|
|
49
|
+
"@sap-ux/axios-extension": "1.25.8",
|
|
50
|
+
"@sap-ux/project-access": "1.34.4",
|
|
51
|
+
"@sap-ux/fiori-annotation-api": "0.9.6",
|
|
52
52
|
"@sap-ux/fiori-docs-embeddings": "0.4.12",
|
|
53
53
|
"@sap-ux/i18n": "0.3.7",
|
|
54
|
-
"@sap-ux/logger": "0.8.
|
|
54
|
+
"@sap-ux/logger": "0.8.1",
|
|
55
55
|
"@sap-ux/odata-annotation-core-types": "0.5.3",
|
|
56
56
|
"@sap-ux/odata-entity-model": "0.3.4",
|
|
57
57
|
"@sap-ux/text-document-utils": "0.3.3",
|
|
58
58
|
"@sap-ux/btp-utils": "1.1.6",
|
|
59
59
|
"@sap-ux/feature-toggle": "0.3.5",
|
|
60
60
|
"@sap-ux/nodejs-utils": "0.2.11",
|
|
61
|
-
"@sap-ux/telemetry": "0.6.
|
|
61
|
+
"@sap-ux/telemetry": "0.6.61"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@xenova/transformers": "2.17.2",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"mem-fs": "2.1.0",
|
|
67
67
|
"mem-fs-editor": "9.4.0",
|
|
68
68
|
"@sap-ux/fiori-docs-embeddings": "0.4.12",
|
|
69
|
-
"@sap-ux/store": "1.5.
|
|
69
|
+
"@sap-ux/store": "1.5.3"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=20.x"
|