deepv-code 1.0.303 → 1.0.304
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/bundle/dvcode.js +9 -9
- package/package.json +1 -1
package/bundle/dvcode.js
CHANGED
|
@@ -534,7 +534,7 @@ ${h}`)}return e}),n0e=mIr(UFt);g0e=class extends G0e{create(t,r){var a;let{api_v
|
|
|
534
534
|
`):[]}};xB.NEWLINE_CHARS=new Set([`
|
|
535
535
|
`,"\r"]);xB.NEWLINE_REGEXP=/\r\n|[\n\r]/g;Z0e={off:0,error:200,warn:300,info:400,debug:500},kFt=(n,t,r)=>{if(n){if(jur(Z0e,n))return n;Qb(r).warn(`${t} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(Z0e))}`)}};GIr={error:rK,warn:rK,info:rK,debug:rK},LFt=new WeakMap;mQ=n=>(n.options&&(n.options=Object.assign({},n.options),delete n.options.headers),n.headers&&(n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([t,r])=>[t,t.toLowerCase()==="x-goog-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in n&&(n.retryOfRequestLogID&&(n.retryOf=n.retryOfRequestLogID),delete n.retryOfRequestLogID),n);_He=class n{constructor(t,r,a){this.iterator=t,this.controller=r,this.client=a}static fromSSEResponse(t,r,a){let i=!1,s=a?Qb(a):console;function e(){return RB(this,arguments,function*(){var u,d,I,h;if(i)throw new rf("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var G=!0,W=pQ(gIr(t,r)),y;y=yield eu(W.next()),u=y.done,!u;G=!0){h=y.value,G=!1;let R=h;if(!c)if(R.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield eu(JSON.parse(R.data))}catch(F){throw s.error("Could not parse message into JSON:",R.data),s.error("From chunk:",R.raw),F}}}catch(R){d={error:R}}finally{try{!G&&!u&&(I=W.return)&&(yield eu(I.call(W)))}finally{if(d)throw d.error}}c=!0}catch(R){if(OHe(R))return yield eu(void 0);throw R}finally{c||r.abort()}})}return new n(e,r,a)}static fromReadableStream(t,r,a){let i=!1;function s(){return RB(this,arguments,function*(){var u,d,I,h;let c=new xB,G=TFt(t);try{for(var W=!0,y=pQ(G),R;R=yield eu(y.next()),u=R.done,!u;W=!0){h=R.value,W=!1;let F=h;for(let C of c.decode(F))yield yield eu(C)}}catch(F){d={error:F}}finally{try{!W&&!u&&(I=y.return)&&(yield eu(I.call(y)))}finally{if(d)throw d.error}}for(let F of c.flush())yield yield eu(F)})}function e(){return RB(this,arguments,function*(){var u,d,I,h;if(i)throw new rf("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var G=!0,W=pQ(s()),y;y=yield eu(W.next()),u=y.done,!u;G=!0){h=y.value,G=!1;let R=h;c||R&&(yield yield eu(JSON.parse(R)))}}catch(R){d={error:R}}finally{try{!G&&!u&&(I=W.return)&&(yield eu(I.call(W)))}finally{if(d)throw d.error}}c=!0}catch(R){if(OHe(R))return yield eu(void 0);throw R}finally{c||r.abort()}})}return new n(e,r,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],a=this.iterator(),i=s=>({next:()=>{if(s.length===0){let e=a.next();t.push(e),r.push(e)}return s.shift()}});return[new n(()=>i(t),this.controller,this.client),new n(()=>i(r),this.controller,this.client)]}toReadableStream(){let t=this,r;return JFt({async start(){r=t[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:s}=await r.next();if(s)return a.close();let e=qHe(JSON.stringify(i)+`
|
|
536
536
|
`);a.enqueue(e)}catch(i){a.error(i)}},async cancel(){var a;await((a=r.return)===null||a===void 0?void 0:a.call(r))}})}};PHe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;let s={event:this.event,data:this.data.join(`
|
|
537
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(t),t.startsWith(":"))return null;let[r,a,i]=ZIr(t,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};jHe=class n extends Promise{constructor(t,r,a=NIr){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=t}_thenUnwrap(t){return new n(this.client,this.responsePromise,async(r,a)=>t(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){let[t,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,r){return this.parse().then(t,r)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}};MFt=Symbol("brand.privateNullableHeaders");nK=n=>{let t=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[s,e]of AIr(a)){let o=s.toLowerCase();i.has(o)||(t.delete(s),i.add(o)),e===null?(t.delete(s),r.add(o)):(t.append(s,e),r.delete(o))}}return{[MFt]:!0,values:t,nulls:r}};DHe=n=>{var t,r,a,i,s,e;if(typeof globalThis.process<"u")return(a=(r=(t=globalThis.process.env)===null||t===void 0?void 0:t[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(e=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,n))===null||e===void 0?void 0:e.trim()};N0e=class n{constructor(t){var r,a,i,s,e,o,u,{baseURL:d=DHe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:I=(r=DHe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=t,c=s0e(t,["baseURL","apiKey","apiVersion"]);let G=Object.assign(Object.assign({apiKey:I,apiVersion:h},c),{baseURL:d||"https://generativelanguage.googleapis.com"});this.baseURL=G.baseURL,this.timeout=(a=G.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=G.logger)!==null&&i!==void 0?i:console;let W="warn";this.logLevel=W,this.logLevel=(e=(s=kFt(G.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:kFt(DHe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&e!==void 0?e:W,this.fetchOptions=G.fetchOptions,this.maxRetries=(o=G.maxRetries)!==null&&o!==void 0?o:2,this.fetch=(u=G.fetch)!==null&&u!==void 0?u:aIr(),this.encoder=sIr,this._options=G,this.apiKey=I,this.apiVersion=h,this.clientAdapter=G.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:r}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){let r=nK([t.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return nK([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return nK([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new rf(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${EB}`}defaultIdempotencyKey(){return`stainless-node-retry-${Our()}`}makeStatusError(t,r,a,i){return af.generate(t,r,a,i)}buildURL(t,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,s=Mur(t)?new URL(t):new URL(i+(i.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),e=this.defaultQuery();return Pur(e)||(r=Object.assign(Object.assign({},e),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(s.search=this.stringifyQuery(r)),s.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){let r=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(t,{url:r,options:a}){}get(t,r){return this.methodRequest("get",t,r)}post(t,r){return this.methodRequest("post",t,r)}patch(t,r){return this.methodRequest("patch",t,r)}put(t,r){return this.methodRequest("put",t,r)}delete(t,r){return this.methodRequest("delete",t,r)}methodRequest(t,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:t,path:r},i)))}request(t,r=null){return new jHe(this,this.makeRequest(t,r,void 0))}async makeRequest(t,r,a){var i,s,e;let o=await t,u=(i=o.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=u),await this.prepareOptions(o);let{req:d,url:I,timeout:h}=await this.buildRequest(o,{retryCount:u-r});await this.prepareRequest(d,{url:I,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),G=a===void 0?"":`, retryOf: ${a}`,W=Date.now();if(Qb(this).debug(`[${c}] sending request`,mQ({retryOfRequestLogID:a,method:o.method,url:I,options:o,headers:d.headers})),!((s=o.signal)===null||s===void 0)&&s.aborted)throw new aK;let y=new AbortController,R=await this.fetchWithTimeout(I,d,h,y).catch(UHe),F=Date.now();if(R instanceof globalThis.Error){let A=`retrying, ${r} attempts remaining`;if(!((e=o.signal)===null||e===void 0)&&e.aborted)throw new aK;let E=OHe(R)||/timed? ?out/i.test(String(R)+("cause"in R?String(R.cause):""));if(r)return Qb(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${A}`),Qb(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${A})`,mQ({retryOfRequestLogID:a,url:I,durationMs:F-W,message:R.message})),this.retryRequest(o,r,a??c);throw Qb(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),Qb(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,mQ({retryOfRequestLogID:a,url:I,durationMs:F-W,message:R.message})),E?new c0e:new YB({cause:R})}let C=`[${c}${G}] ${d.method} ${I} ${R.ok?"succeeded":"failed"} with status ${R.status} in ${F-W}ms`;if(!R.ok){let A=await this.shouldRetry(R);if(r&&A){let m=`retrying, ${r} attempts remaining`;return await lIr(R.body),Qb(this).info(`${C} - ${m}`),Qb(this).debug(`[${c}] response error (${m})`,mQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,durationMs:F-W})),this.retryRequest(o,r,a??c,R.headers)}let E=A?"error; no more retries left":"error; not retryable";Qb(this).info(`${C} - ${E}`);let f=await R.text().catch(m=>UHe(m).message),g=qur(f),v=g?void 0:f;throw Qb(this).debug(`[${c}] response error (${E})`,mQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,message:v,durationMs:Date.now()-W})),this.makeStatusError(R.status,g,v,R.headers)}return Qb(this).info(C),Qb(this).debug(`[${c}] response start`,mQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,durationMs:F-W})),{response:R,options:o,controller:y,requestLogID:c,retryOfRequestLogID:a,startTime:W}}async fetchWithTimeout(t,r,a,i){let s=r||{},{signal:e,method:o}=s,u=s0e(s,["signal","method"]);e&&e.addEventListener("abort",()=>i.abort());let d=setTimeout(()=>i.abort(),a),I=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},I?{duplex:"half"}:{}),{method:"GET"}),u);o&&(h.method=o.toUpperCase());try{return await this.fetch.call(void 0,t,h)}finally{clearTimeout(d)}}async shouldRetry(t){let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,r,a,i){var s;let e,o=i?.get("retry-after-ms");if(o){let d=parseFloat(o);Number.isNaN(d)||(e=d)}let u=i?.get("retry-after");if(u&&!e){let d=parseFloat(u);Number.isNaN(d)?e=Date.parse(u)-Date.now():e=d*1e3}if(!(e&&0<=e&&e<60*1e3)){let d=(s=t.maxRetries)!==null&&s!==void 0?s:this.maxRetries;e=this.calculateDefaultRetryTimeoutMillis(r,d)}return await $ur(e),this.makeRequest(t,r-1,a)}calculateDefaultRetryTimeoutMillis(t,r){let s=r-t,e=Math.min(.5*Math.pow(2,s),8),o=1-Math.random()*.25;return e*o*1e3}async buildRequest(t,{retryCount:r=0}={}){var a,i,s;let e=Object.assign({},t),{method:o,path:u,query:d,defaultBaseURL:I}=e,h=this.buildURL(u,d,I);"timeout"in e&&Kur("timeout",e.timeout),e.timeout=(a=e.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:G}=this.buildBody({options:e}),W=await this.buildHeaders({options:t,method:o,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:o,headers:W},e.signal&&{signal:e.signal}),globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"}),G&&{body:G}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=e.fetchOptions)!==null&&s!==void 0?s:{}),url:h,timeout:e.timeout}}async buildHeaders({options:t,method:r,bodyHeaders:a,retryCount:i}){let s={};this.idempotencyHeader&&r!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=t.idempotencyKey);let e=await this.authHeaders(t),o=nK([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),rIr()),this._options.defaultHeaders,a,t.headers,e]);return this.validateHeaders(o),o.values}buildBody({options:{body:t,headers:r}}){if(!t)return{bodyHeaders:void 0,body:void 0};let a=nK([r]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&a.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:iIr(t)}:this.encoder({body:t,headers:a})}};N0e.DEFAULT_TIMEOUT=6e4;g0=class extends N0e{constructor(){super(...arguments),this.interactions=new v0e(this)}};zFt=g0;g0.GeminiNextGenAPIClient=zFt;g0.GeminiNextGenAPIClientError=rf;g0.APIError=af;g0.APIConnectionError=YB;g0.APIConnectionTimeoutError=c0e;g0.APIUserAbortError=aK;g0.NotFoundError=h0e;g0.ConflictError=m0e;g0.RateLimitError=b0e;g0.BadRequestError=u0e;g0.AuthenticationError=I0e;g0.InternalServerError=f0e;g0.PermissionDeniedError=d0e;g0.UnprocessableEntityError=p0e;g0.toFile=dIr;g0.Interactions=v0e;Msi=1024*1024*8;});function WIr(n,t){return{...n,...t}}function _Ft(n){let{prompt_id:t,...r}=n;return r}function bQ(n){return Array.isArray(n)?n.map(_Ft):n}var A0e=It(()=>{"use strict";Ci();});var PFt={};Qo(PFt,{DEFAULT_PROXY_CONFIG:()=>EIr,getActiveProxyServerUrl:()=>RW,getAvailableProxyServers:()=>yIr,getProxyServerInfo:()=>FIr,getProxyServers:()=>iK,hasAvailableProxyServer:()=>$He});function iK(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function RW(){let t=iK().find(r=>r.status==="active");if(!t)throw new Error("No active proxy server available. Please contact support.");return t.url}function yIr(){return iK().filter(t=>t.status==="active")}function $He(){return iK().some(t=>t.status==="active")}function FIr(n){return iK().find(r=>r.url===n)}var EIr,VB=It(()=>{"use strict";EIr={serverUrl:RW(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import*as Cc from"fs";import*as XN from"path";import*as fQ from"os";function RIr(n){uo.configure(n)}function wIr(n){uo.setUserInfo(n)}function CIr(n){uo.setCliVersion(n)}async function YIr(){return await uo.getUserHeaders()}function xIr(){return uo.getStatus()}var lK,Vs,uo,Gw=It(()=>{"use strict";VB();lK=259200,Vs=class n{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){let t=this.cliVersion,r=process.platform,a=process.arch;return t.startsWith("VSCode-")?`DeepVCode/VSCode/${t.replace("VSCode-","")} (${r}; ${a})`:`DeepVCode/CLI/${t} (${r}; ${a})`}formatTimeRemaining(t){if(t<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(t/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),e=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${e}\u79D2`:s>0?`${s}\u5206\u949F${e}\u79D2`:`${e}\u79D2`}formatAbsoluteTime(t){return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=XN.join(fQ.homedir(),".deepv","user-info-dev.json"),this.jwtTokenFilePath=XN.join(fQ.homedir(),".deepv","jwt-token-dev.json"),this.usageStatsFilePath=XN.join(fQ.homedir(),".deepv","usage-stats-dev.json")):(this.userInfoFilePath=XN.join(fQ.homedir(),".deepv","user-info.json"),this.jwtTokenFilePath=XN.join(fQ.homedir(),".deepv","jwt-token.json"),this.usageStatsFilePath=XN.join(fQ.homedir(),".deepv","usage-stats.json")),this.cliVersion="1.0.303",this.config={proxyServerUrl:RW()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let t=Date.now(),r=this.jwtTokenData.expiresAt-t,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-lK*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${s}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}loadUserInfo(){try{if(Cc.existsSync(this.userInfoFilePath)){let t=Cc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(t);let r=a=>{if(!a||!a.includes("@"))return a;let[i,s]=a.split("@");return i.length<=2?a:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}}catch(t){console.warn("[Login Check] Failed to load user info from local file:",t),this.userInfo=null}}saveUserInfo(){try{let t=XN.dirname(this.userInfoFilePath);Cc.existsSync(t)||Cc.mkdirSync(t,{recursive:!0}),Cc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),console.log("[Login Check] User info saved to local file")}catch(t){console.error("[Login Check] Failed to save user info:",t)}}loadJwtToken(){try{if(Cc.existsSync(this.jwtTokenFilePath)){let t=Cc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(t);let r=Date.now();this.isTokenExpired()?this.jwtTokenData=null:this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required")}catch(t){console.warn("[Login Check] Failed to load access credential from local file:",t),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let t=XN.dirname(this.jwtTokenFilePath);Cc.existsSync(t)||Cc.mkdirSync(t,{recursive:!0}),Cc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),console.log("[Login Check] Access credential data saved to local file")}catch(t){console.error("[Login Check] Failed to save access credential:",t)}}loadUsageStats(){try{if(Cc.existsSync(this.usageStatsFilePath)){let t=Cc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(t)}}catch(t){console.warn("[Login Check] Failed to load usage stats from local file:",t),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let t=XN.dirname(this.usageStatsFilePath);Cc.existsSync(t)||Cc.mkdirSync(t,{recursive:!0}),Cc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),console.log("[Login Check] Usage stats saved to local file")}catch(t){console.error("[Login Check] Failed to save usage stats:",t)}}updateUsageStats(t){t<=0||(this.usageStats.totalCreditsConsumed+=t,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${t})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(t){this.config={...this.config,...t},t.userInfo&&(this.userInfo=t.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${t.userInfo.name}`)),t.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${t.proxyServerUrl}`),t.cliVersion&&(this.cliVersion=t.cliVersion,console.log(`[Login Check] CLI version set: ${t.cliVersion}`))}setUserInfo(t){this.userInfo=t,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${t.name} (${t.email||t.openId||"N/A"})`),this.triggerLoginSuccessCallbacks()}onLoginSuccess(t){this.onLoginSuccessCallbacks.push(t)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(t=>{try{t()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(t){this.cliVersion=t,console.log(`[Login Check] CLI version updated: ${t}`)}setJwtToken(t){let r=Date.now();this.jwtTokenData={accessToken:t,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(t){let a=Date.now()+t.expiresIn*1e3;this.jwtTokenData={accessToken:t.accessToken,refreshToken:t.refreshToken,expiresIn:t.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(t.expiresIn*1e3),s=this.formatAbsoluteTime(a),e=this.formatAbsoluteTime(a-lK*1e3),u=!!t.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${e}${u}`)}async getAccessToken(){if(!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let t=Date.now(),r=this.jwtTokenData.expiresAt-t,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-lK*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(e){return console.error("[Login Check] Credential renewal failed:",e),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(t=lK){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=t*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${t}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let t=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"DeepCode CLI ProxyAuthManager"},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!t.ok){if(t.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await t.text();throw new Error(`Credential refresh failed (${t.status}): ${u}`)}let r=await t.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let a=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),e=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-lK*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${e}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(t){throw console.error("[Login Check] Credential refresh error:",t),t}}clearTokens(){this.jwtTokenData=null;try{Cc.existsSync(this.jwtTokenFilePath)&&Cc.unlinkSync(this.jwtTokenFilePath)}catch(t){console.warn("[Login Check] Failed to delete access credential file:",t)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(){let t=await this.getAccessToken(),r=this.getCliVersion(),a=this.getUserAgent();return t?{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-Client-Version":r,"User-Agent":a}:{"X-Client-Version":r,"User-Agent":a}}getUserHeadersSync(){let t=this.getCliVersion(),r=this.getUserAgent();return this.jwtTokenData?.accessToken?{Authorization:`Bearer ${this.jwtTokenData.accessToken}`,"Content-Type":"application/json","X-Client-Version":t,"User-Agent":r}:{"X-Client-Version":t,"User-Agent":r}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Cc.existsSync(this.userInfoFilePath)&&Cc.unlinkSync(this.userInfoFilePath)}catch(t){console.warn("[Login Check] Failed to delete user info file:",t)}try{Cc.existsSync(this.jwtTokenFilePath)&&Cc.unlinkSync(this.jwtTokenFilePath)}catch(t){console.warn("[Login Check] Failed to delete access credential file:",t)}console.log("[Login Check] Authentication cleared")}},uo=Vs.getInstance()});import{promises as GQ}from"node:fs";import sK from"node:path";import VIr from"os";var i1,W0e,ar,rv=It(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(i1||(i1={}));W0e=class{config;logBuffer=[];constructor(t={}){if(this.config={level:i1.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...t},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=sK.join(VIr.homedir(),".deepv","logs",`deepv-${r}.log`)}}formatMessage(t,r,...a){let i=new Date().toISOString(),s=a.map(e=>typeof e=="object"?JSON.stringify(e,null,2):String(e)).join(" ");return`[${i}] [${t}] ${r} ${s}`.trim()}async writeToFile(t){if(!(!this.config.enableFile||!this.config.filePath))try{await GQ.mkdir(sK.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await GQ.appendFile(this.config.filePath,t+`
|
|
537
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(t),t.startsWith(":"))return null;let[r,a,i]=ZIr(t,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};jHe=class n extends Promise{constructor(t,r,a=NIr){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=t}_thenUnwrap(t){return new n(this.client,this.responsePromise,async(r,a)=>t(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){let[t,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,r){return this.parse().then(t,r)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}};MFt=Symbol("brand.privateNullableHeaders");nK=n=>{let t=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[s,e]of AIr(a)){let o=s.toLowerCase();i.has(o)||(t.delete(s),i.add(o)),e===null?(t.delete(s),r.add(o)):(t.append(s,e),r.delete(o))}}return{[MFt]:!0,values:t,nulls:r}};DHe=n=>{var t,r,a,i,s,e;if(typeof globalThis.process<"u")return(a=(r=(t=globalThis.process.env)===null||t===void 0?void 0:t[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(e=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,n))===null||e===void 0?void 0:e.trim()};N0e=class n{constructor(t){var r,a,i,s,e,o,u,{baseURL:d=DHe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:I=(r=DHe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=t,c=s0e(t,["baseURL","apiKey","apiVersion"]);let G=Object.assign(Object.assign({apiKey:I,apiVersion:h},c),{baseURL:d||"https://generativelanguage.googleapis.com"});this.baseURL=G.baseURL,this.timeout=(a=G.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=G.logger)!==null&&i!==void 0?i:console;let W="warn";this.logLevel=W,this.logLevel=(e=(s=kFt(G.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:kFt(DHe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&e!==void 0?e:W,this.fetchOptions=G.fetchOptions,this.maxRetries=(o=G.maxRetries)!==null&&o!==void 0?o:2,this.fetch=(u=G.fetch)!==null&&u!==void 0?u:aIr(),this.encoder=sIr,this._options=G,this.apiKey=I,this.apiVersion=h,this.clientAdapter=G.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:r}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){let r=nK([t.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return nK([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return nK([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new rf(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${EB}`}defaultIdempotencyKey(){return`stainless-node-retry-${Our()}`}makeStatusError(t,r,a,i){return af.generate(t,r,a,i)}buildURL(t,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,s=Mur(t)?new URL(t):new URL(i+(i.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),e=this.defaultQuery();return Pur(e)||(r=Object.assign(Object.assign({},e),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(s.search=this.stringifyQuery(r)),s.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){let r=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(t,{url:r,options:a}){}get(t,r){return this.methodRequest("get",t,r)}post(t,r){return this.methodRequest("post",t,r)}patch(t,r){return this.methodRequest("patch",t,r)}put(t,r){return this.methodRequest("put",t,r)}delete(t,r){return this.methodRequest("delete",t,r)}methodRequest(t,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:t,path:r},i)))}request(t,r=null){return new jHe(this,this.makeRequest(t,r,void 0))}async makeRequest(t,r,a){var i,s,e;let o=await t,u=(i=o.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=u),await this.prepareOptions(o);let{req:d,url:I,timeout:h}=await this.buildRequest(o,{retryCount:u-r});await this.prepareRequest(d,{url:I,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),G=a===void 0?"":`, retryOf: ${a}`,W=Date.now();if(Qb(this).debug(`[${c}] sending request`,mQ({retryOfRequestLogID:a,method:o.method,url:I,options:o,headers:d.headers})),!((s=o.signal)===null||s===void 0)&&s.aborted)throw new aK;let y=new AbortController,R=await this.fetchWithTimeout(I,d,h,y).catch(UHe),F=Date.now();if(R instanceof globalThis.Error){let A=`retrying, ${r} attempts remaining`;if(!((e=o.signal)===null||e===void 0)&&e.aborted)throw new aK;let E=OHe(R)||/timed? ?out/i.test(String(R)+("cause"in R?String(R.cause):""));if(r)return Qb(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${A}`),Qb(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${A})`,mQ({retryOfRequestLogID:a,url:I,durationMs:F-W,message:R.message})),this.retryRequest(o,r,a??c);throw Qb(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),Qb(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,mQ({retryOfRequestLogID:a,url:I,durationMs:F-W,message:R.message})),E?new c0e:new YB({cause:R})}let C=`[${c}${G}] ${d.method} ${I} ${R.ok?"succeeded":"failed"} with status ${R.status} in ${F-W}ms`;if(!R.ok){let A=await this.shouldRetry(R);if(r&&A){let m=`retrying, ${r} attempts remaining`;return await lIr(R.body),Qb(this).info(`${C} - ${m}`),Qb(this).debug(`[${c}] response error (${m})`,mQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,durationMs:F-W})),this.retryRequest(o,r,a??c,R.headers)}let E=A?"error; no more retries left":"error; not retryable";Qb(this).info(`${C} - ${E}`);let f=await R.text().catch(m=>UHe(m).message),g=qur(f),v=g?void 0:f;throw Qb(this).debug(`[${c}] response error (${E})`,mQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,message:v,durationMs:Date.now()-W})),this.makeStatusError(R.status,g,v,R.headers)}return Qb(this).info(C),Qb(this).debug(`[${c}] response start`,mQ({retryOfRequestLogID:a,url:R.url,status:R.status,headers:R.headers,durationMs:F-W})),{response:R,options:o,controller:y,requestLogID:c,retryOfRequestLogID:a,startTime:W}}async fetchWithTimeout(t,r,a,i){let s=r||{},{signal:e,method:o}=s,u=s0e(s,["signal","method"]);e&&e.addEventListener("abort",()=>i.abort());let d=setTimeout(()=>i.abort(),a),I=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},I?{duplex:"half"}:{}),{method:"GET"}),u);o&&(h.method=o.toUpperCase());try{return await this.fetch.call(void 0,t,h)}finally{clearTimeout(d)}}async shouldRetry(t){let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,r,a,i){var s;let e,o=i?.get("retry-after-ms");if(o){let d=parseFloat(o);Number.isNaN(d)||(e=d)}let u=i?.get("retry-after");if(u&&!e){let d=parseFloat(u);Number.isNaN(d)?e=Date.parse(u)-Date.now():e=d*1e3}if(!(e&&0<=e&&e<60*1e3)){let d=(s=t.maxRetries)!==null&&s!==void 0?s:this.maxRetries;e=this.calculateDefaultRetryTimeoutMillis(r,d)}return await $ur(e),this.makeRequest(t,r-1,a)}calculateDefaultRetryTimeoutMillis(t,r){let s=r-t,e=Math.min(.5*Math.pow(2,s),8),o=1-Math.random()*.25;return e*o*1e3}async buildRequest(t,{retryCount:r=0}={}){var a,i,s;let e=Object.assign({},t),{method:o,path:u,query:d,defaultBaseURL:I}=e,h=this.buildURL(u,d,I);"timeout"in e&&Kur("timeout",e.timeout),e.timeout=(a=e.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:G}=this.buildBody({options:e}),W=await this.buildHeaders({options:t,method:o,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:o,headers:W},e.signal&&{signal:e.signal}),globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"}),G&&{body:G}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=e.fetchOptions)!==null&&s!==void 0?s:{}),url:h,timeout:e.timeout}}async buildHeaders({options:t,method:r,bodyHeaders:a,retryCount:i}){let s={};this.idempotencyHeader&&r!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=t.idempotencyKey);let e=await this.authHeaders(t),o=nK([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),rIr()),this._options.defaultHeaders,a,t.headers,e]);return this.validateHeaders(o),o.values}buildBody({options:{body:t,headers:r}}){if(!t)return{bodyHeaders:void 0,body:void 0};let a=nK([r]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&a.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:iIr(t)}:this.encoder({body:t,headers:a})}};N0e.DEFAULT_TIMEOUT=6e4;g0=class extends N0e{constructor(){super(...arguments),this.interactions=new v0e(this)}};zFt=g0;g0.GeminiNextGenAPIClient=zFt;g0.GeminiNextGenAPIClientError=rf;g0.APIError=af;g0.APIConnectionError=YB;g0.APIConnectionTimeoutError=c0e;g0.APIUserAbortError=aK;g0.NotFoundError=h0e;g0.ConflictError=m0e;g0.RateLimitError=b0e;g0.BadRequestError=u0e;g0.AuthenticationError=I0e;g0.InternalServerError=f0e;g0.PermissionDeniedError=d0e;g0.UnprocessableEntityError=p0e;g0.toFile=dIr;g0.Interactions=v0e;Msi=1024*1024*8;});function WIr(n,t){return{...n,...t}}function _Ft(n){let{prompt_id:t,...r}=n;return r}function bQ(n){return Array.isArray(n)?n.map(_Ft):n}var A0e=It(()=>{"use strict";Ci();});var PFt={};Qo(PFt,{DEFAULT_PROXY_CONFIG:()=>EIr,getActiveProxyServerUrl:()=>RW,getAvailableProxyServers:()=>yIr,getProxyServerInfo:()=>FIr,getProxyServers:()=>iK,hasAvailableProxyServer:()=>$He});function iK(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function RW(){let t=iK().find(r=>r.status==="active");if(!t)throw new Error("No active proxy server available. Please contact support.");return t.url}function yIr(){return iK().filter(t=>t.status==="active")}function $He(){return iK().some(t=>t.status==="active")}function FIr(n){return iK().find(r=>r.url===n)}var EIr,VB=It(()=>{"use strict";EIr={serverUrl:RW(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import*as Cc from"fs";import*as XN from"path";import*as fQ from"os";function RIr(n){uo.configure(n)}function wIr(n){uo.setUserInfo(n)}function CIr(n){uo.setCliVersion(n)}async function YIr(){return await uo.getUserHeaders()}function xIr(){return uo.getStatus()}var lK,Vs,uo,Gw=It(()=>{"use strict";VB();lK=259200,Vs=class n{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){let t=this.cliVersion,r=process.platform,a=process.arch;return t.startsWith("VSCode-")?`DeepVCode/VSCode/${t.replace("VSCode-","")} (${r}; ${a})`:`DeepVCode/CLI/${t} (${r}; ${a})`}formatTimeRemaining(t){if(t<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(t/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),e=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${e}\u79D2`:s>0?`${s}\u5206\u949F${e}\u79D2`:`${e}\u79D2`}formatAbsoluteTime(t){return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=XN.join(fQ.homedir(),".deepv","user-info-dev.json"),this.jwtTokenFilePath=XN.join(fQ.homedir(),".deepv","jwt-token-dev.json"),this.usageStatsFilePath=XN.join(fQ.homedir(),".deepv","usage-stats-dev.json")):(this.userInfoFilePath=XN.join(fQ.homedir(),".deepv","user-info.json"),this.jwtTokenFilePath=XN.join(fQ.homedir(),".deepv","jwt-token.json"),this.usageStatsFilePath=XN.join(fQ.homedir(),".deepv","usage-stats.json")),this.cliVersion="1.0.304",this.config={proxyServerUrl:RW()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let t=Date.now(),r=this.jwtTokenData.expiresAt-t,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-lK*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${s}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}loadUserInfo(){try{if(Cc.existsSync(this.userInfoFilePath)){let t=Cc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(t);let r=a=>{if(!a||!a.includes("@"))return a;let[i,s]=a.split("@");return i.length<=2?a:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}}catch(t){console.warn("[Login Check] Failed to load user info from local file:",t),this.userInfo=null}}saveUserInfo(){try{let t=XN.dirname(this.userInfoFilePath);Cc.existsSync(t)||Cc.mkdirSync(t,{recursive:!0}),Cc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),console.log("[Login Check] User info saved to local file")}catch(t){console.error("[Login Check] Failed to save user info:",t)}}loadJwtToken(){try{if(Cc.existsSync(this.jwtTokenFilePath)){let t=Cc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(t);let r=Date.now();this.isTokenExpired()?this.jwtTokenData=null:this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required")}catch(t){console.warn("[Login Check] Failed to load access credential from local file:",t),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let t=XN.dirname(this.jwtTokenFilePath);Cc.existsSync(t)||Cc.mkdirSync(t,{recursive:!0}),Cc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),console.log("[Login Check] Access credential data saved to local file")}catch(t){console.error("[Login Check] Failed to save access credential:",t)}}loadUsageStats(){try{if(Cc.existsSync(this.usageStatsFilePath)){let t=Cc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(t)}}catch(t){console.warn("[Login Check] Failed to load usage stats from local file:",t),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let t=XN.dirname(this.usageStatsFilePath);Cc.existsSync(t)||Cc.mkdirSync(t,{recursive:!0}),Cc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),console.log("[Login Check] Usage stats saved to local file")}catch(t){console.error("[Login Check] Failed to save usage stats:",t)}}updateUsageStats(t){t<=0||(this.usageStats.totalCreditsConsumed+=t,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${t})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(t){this.config={...this.config,...t},t.userInfo&&(this.userInfo=t.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${t.userInfo.name}`)),t.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${t.proxyServerUrl}`),t.cliVersion&&(this.cliVersion=t.cliVersion,console.log(`[Login Check] CLI version set: ${t.cliVersion}`))}setUserInfo(t){this.userInfo=t,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${t.name} (${t.email||t.openId||"N/A"})`),this.triggerLoginSuccessCallbacks()}onLoginSuccess(t){this.onLoginSuccessCallbacks.push(t)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(t=>{try{t()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(t){this.cliVersion=t,console.log(`[Login Check] CLI version updated: ${t}`)}setJwtToken(t){let r=Date.now();this.jwtTokenData={accessToken:t,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(t){let a=Date.now()+t.expiresIn*1e3;this.jwtTokenData={accessToken:t.accessToken,refreshToken:t.refreshToken,expiresIn:t.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(t.expiresIn*1e3),s=this.formatAbsoluteTime(a),e=this.formatAbsoluteTime(a-lK*1e3),u=!!t.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${e}${u}`)}async getAccessToken(){if(!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let t=Date.now(),r=this.jwtTokenData.expiresAt-t,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-lK*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(e){return console.error("[Login Check] Credential renewal failed:",e),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(t=lK){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=t*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${t}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let t=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"DeepCode CLI ProxyAuthManager"},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!t.ok){if(t.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await t.text();throw new Error(`Credential refresh failed (${t.status}): ${u}`)}let r=await t.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let a=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),e=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-lK*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${e}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(t){throw console.error("[Login Check] Credential refresh error:",t),t}}clearTokens(){this.jwtTokenData=null;try{Cc.existsSync(this.jwtTokenFilePath)&&Cc.unlinkSync(this.jwtTokenFilePath)}catch(t){console.warn("[Login Check] Failed to delete access credential file:",t)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(){let t=await this.getAccessToken(),r=this.getCliVersion(),a=this.getUserAgent();return t?{Authorization:`Bearer ${t}`,"Content-Type":"application/json","X-Client-Version":r,"User-Agent":a}:{"X-Client-Version":r,"User-Agent":a}}getUserHeadersSync(){let t=this.getCliVersion(),r=this.getUserAgent();return this.jwtTokenData?.accessToken?{Authorization:`Bearer ${this.jwtTokenData.accessToken}`,"Content-Type":"application/json","X-Client-Version":t,"User-Agent":r}:{"X-Client-Version":t,"User-Agent":r}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Cc.existsSync(this.userInfoFilePath)&&Cc.unlinkSync(this.userInfoFilePath)}catch(t){console.warn("[Login Check] Failed to delete user info file:",t)}try{Cc.existsSync(this.jwtTokenFilePath)&&Cc.unlinkSync(this.jwtTokenFilePath)}catch(t){console.warn("[Login Check] Failed to delete access credential file:",t)}console.log("[Login Check] Authentication cleared")}},uo=Vs.getInstance()});import{promises as GQ}from"node:fs";import sK from"node:path";import VIr from"os";var i1,W0e,ar,rv=It(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(i1||(i1={}));W0e=class{config;logBuffer=[];constructor(t={}){if(this.config={level:i1.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...t},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=sK.join(VIr.homedir(),".deepv","logs",`deepv-${r}.log`)}}formatMessage(t,r,...a){let i=new Date().toISOString(),s=a.map(e=>typeof e=="object"?JSON.stringify(e,null,2):String(e)).join(" ");return`[${i}] [${t}] ${r} ${s}`.trim()}async writeToFile(t){if(!(!this.config.enableFile||!this.config.filePath))try{await GQ.mkdir(sK.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await GQ.appendFile(this.config.filePath,t+`
|
|
538
538
|
`,"utf-8")}catch(r){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",r)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await GQ.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let a=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${a}.log`);await GQ.rename(this.config.filePath,i),await this.cleanOldLogs()}}catch(t){t.code!=="ENOENT"&&console.error("\u65E5\u5FD7\u8F6E\u8F6C\u5931\u8D25:",t)}}async cleanOldLogs(){if(this.config.filePath)try{let t=sK.dirname(this.config.filePath),a=(await GQ.readdir(t)).filter(e=>e.startsWith("deepv-")&&e.endsWith(".log")).map(e=>({name:e,path:sK.join(t,e),time:GQ.stat(sK.join(t,e)).then(o=>o.mtime)})),i=await Promise.all(a.map(async e=>({...e,time:await e.time})));i.sort((e,o)=>o.time.getTime()-e.time.getTime());let s=i.slice(this.config.maxFiles||5);for(let e of s)await GQ.unlink(e.path)}catch(t){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",t)}}log(t,r,a,...i){if(t<this.config.level)return;let s=this.formatMessage(r,a,...i);this.config.enableConsole&&(t>=i1.ERROR?console.error:t>=i1.WARN?console.warn:t>=i1.INFO?console.log:console.debug)(s),this.config.enableFile&&this.writeToFile(s)}debug(t,...r){this.log(i1.DEBUG,"DEBUG",t,...r)}info(t,...r){this.log(i1.INFO,"INFO",t,...r)}warn(t,...r){this.log(i1.WARN,"WARN",t,...r)}error(t,...r){this.log(i1.ERROR,"ERROR",t,...r)}logApiRequest(t,r){this.debug("API\u8BF7\u6C42",{endpoint:t,timestamp:new Date().toISOString(),requestSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{requestData:r}:{}})}logApiResponse(t,r){this.debug("API\u54CD\u5E94",{endpoint:t,timestamp:new Date().toISOString(),responseSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{responseData:r}:{}})}},ar=new W0e({level:process.env.FILE_DEBUG==="1"?i1.DEBUG:i1.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function Xo(n){return n instanceof Error&&"code"in n}function cr(n){if(n instanceof Error)return n.message;try{return String(n)}catch{return"Failed to get error details"}}function eXe(n){if(n&&typeof n=="object"&&"response"in n){let r=QIr(n);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new F0e(r.error.message);case 401:return new BI(r.error.message);case 403:return new y0e(r.error.message);default:}}return n}function QIr(n){return typeof n.response?.data=="string"?JSON.parse(n.response?.data):n.response?.data}var y0e,BI,F0e,Yc=It(()=>{"use strict";y0e=class extends Error{},BI=class extends Error{},F0e=class extends Error{}});var Ha,jFt,Vd,wW=It(()=>{"use strict";(function(n){n.CHAT_CONVERSATION="chat_conversation",n.WEB_FETCH="web_fetch",n.WEB_SEARCH="web_search",n.CONTENT_SUMMARY="content_summary",n.JSON_GENERATION="json_generation",n.COMPRESSION="compression",n.SUB_AGENT="sub_agent",n.CODE_ASSIST="code_assist",n.EDIT_CORRECTION="edit_correction"})(Ha||(Ha={}));jFt={[Ha.CHAT_CONVERSATION]:"auto",[Ha.WEB_FETCH]:"gemini-2.5-flash",[Ha.WEB_SEARCH]:"gemini-2.5-flash",[Ha.CODE_ASSIST]:"auto",[Ha.CONTENT_SUMMARY]:"gemini-2.5-flash-lite",[Ha.EDIT_CORRECTION]:"gemini-2.5-flash-lite",[Ha.JSON_GENERATION]:"gemini-2.5-flash",[Ha.COMPRESSION]:"gemini-2.5-flash",[Ha.SUB_AGENT]:"auto"},Vd=class{static getModelForScene(t){if(t)return jFt[t]}static isClaudeModel(t){return t.includes("claude")||t.includes("anthropic")}static isGeminiModel(t){return t.includes("gemini")&&!this.isClaudeModel(t)}static getSceneDisplayName(t){return{[Ha.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[Ha.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[Ha.WEB_SEARCH]:"Web\u641C\u7D22",[Ha.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[Ha.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[Ha.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[Ha.JSON_GENERATION]:"JSON\u751F\u6210",[Ha.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[Ha.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406"}[t]||t}}});function B5(n){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="object"&&"message"in n.error}function lf(n){return typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string"}function kN(n){let t=r=>r.includes("Quota exceeded for quota metric 'Gemini")&&r.includes("Pro Requests'");if(typeof n=="string")return t(n);if(lf(n))return t(n.message);if(B5(n))return t(n.error.message);if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response&&r.response.data){if(typeof r.response.data=="string")return t(r.response.data);if(typeof r.response.data=="object"&&r.response.data!==null&&"error"in r.response.data){let a=r.response.data;return t(a.error?.message||"")}}}return!1}function LN(n){return typeof n=="string"?n.includes("Quota exceeded for quota metric"):lf(n)?n.message.includes("Quota exceeded for quota metric"):B5(n)?n.error.message.includes("Quota exceeded for quota metric"):!1}function sf(n){if(n&&typeof n=="object"&&"response"in n){let t=n;if(t.response?.status===402&&t.response.data){let r=t.response.data;if(r&&typeof r.error=="string"&&(r.error==="Quota limit exceeded"||r.error==="No quota configuration")&&typeof r.message=="string")return!0}if(t.response?.status===500&&t.response.data){let r=t.response.data;if(r&&typeof r.message=="string"&&r.message.includes("quota exceeded"))return!0}}if(n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"'))||n.message.includes("API request failed (500):")&&n.message.includes("quota exceeded")||n.message.includes("Stream API error (500):")&&n.message.includes("quota exceeded")))return!0;if(typeof n=="object"&&n!==null){let t=n;if(t.message&&typeof t.message=="string"&&(t.message.includes("API request failed (402):")&&(t.message.includes('"error":"Quota limit exceeded"')||t.message.includes('"error":"No quota configuration"'))||t.message.includes("API error (402):")&&(t.message.includes('"error":"Quota limit exceeded"')||t.message.includes('"error":"No quota configuration"'))||(t.message.includes("API request failed (500):")||t.message.includes("Stream API error (500):"))&&t.message.includes("quota exceeded"))||(t.error==="Quota limit exceeded"||t.error==="No quota configuration")&&typeof t.message=="string"||t.status===500&&typeof t.message=="string"&&t.message.includes("quota exceeded"))return!0}return typeof n=="string"?n.includes("Quota limit exceeded")||n.includes("No quota configuration")||n.includes("Daily token limit would be exceeded")||n.includes("Daily request limit exceeded")||n.includes("Daily cost limit would be exceeded")||n.includes("500")&&n.includes("quota exceeded"):!1}function oK(n){let t=null;if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response?.status===402&&r.response.data)t=r.response.data;else if(r.response?.status===500&&r.response.data){let a=r.response.data;a&&typeof a.message=="string"&&a.message.includes("quota exceeded")&&(t=a)}}else if(typeof n=="object"&&n!==null){let r=n;if(r.message&&typeof r.message=="string"&&(r.message.includes("API request failed (402):")||r.message.includes("API request failed (500):")||r.message.includes("Stream API error (500):"))&&(r.message.includes('"error":"Quota limit exceeded"')||r.message.includes('"error":"No quota configuration"')||r.message.includes("quota exceeded")))try{let a=r.message.match(/\{.*\}$/);a&&(t=JSON.parse(a[0]))}catch{}t||(t=n)}if(!t&&n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")||n.message.includes("API request failed (500):")||n.message.includes("Stream API error (500):"))&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"')||n.message.includes("quota exceeded")))try{let r=n.message.match(/\{.*\}$/);r&&(t=JSON.parse(r[0]))}catch{}return t?t.message&&t.message.includes("quota exceeded")?HIr(t):XIr(t):null}function HIr(n){let r=(()=>{try{let c=process.env,G=c.LC_ALL||c.LC_CTYPE||c.LANG||"";return G.toLowerCase().includes("zh")||G.toLowerCase().includes("chinese")}catch{return!1}})(),a="",i="",s="",e="",o=n.message||"",u=o.match(/Role:\s*([^,]+)/);u&&(a=u[1].trim());let d=o.match(/Limit:\s*([^,]+)/);d&&(i=d[1].trim());let I=o.match(/Used:\s*([^,]+)/);I&&(s=I[1].trim());let h=o.match(/Cycle:\s*([^,]+)/);if(h&&(e=h[1].trim()),r){let c=`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
539
539
|
`;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
|
|
540
540
|
`,a&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${a}
|
|
@@ -696,14 +696,14 @@ ${t.format(r)}`.trim())}};pCt.exports=rLe});var iLe=ve((vci,gCt)=>{"use strict";
|
|
|
696
696
|
LIMIT ?
|
|
697
697
|
)
|
|
698
698
|
`)}close(){this.#n.close()}get(t){RLe(t);let r=this.#o(t);return r?{body:r.body?Buffer.from(r.body.buffer,r.body.byteOffset,r.body.byteLength):void 0,statusCode:r.statusCode,statusMessage:r.statusMessage,headers:r.headers?JSON.parse(r.headers):void 0,etag:r.etag?r.etag:void 0,vary:r.vary?JSON.parse(r.vary):void 0,cacheControlDirectives:r.cacheControlDirectives?JSON.parse(r.cacheControlDirectives):void 0,cachedAt:r.cachedAt,staleAt:r.staleAt,deleteAt:r.deleteAt}:void 0}set(t,r){RLe(t);let a=this.#h(t),i=Array.isArray(r.body)?Buffer.concat(r.body):r.body,s=i?.byteLength;if(s&&s>this.#e)return;let e=this.#o(t,!0);e?this.#a.run(i,r.deleteAt,r.statusCode,r.statusMessage,r.headers?JSON.stringify(r.headers):null,r.etag?r.etag:null,r.cacheControlDirectives?JSON.stringify(r.cacheControlDirectives):null,r.cachedAt,r.staleAt,e.id):(this.#I(),this.#i.run(a,t.method,i,r.deleteAt,r.statusCode,r.statusMessage,r.headers?JSON.stringify(r.headers):null,r.etag?r.etag:null,r.cacheControlDirectives?JSON.stringify(r.cacheControlDirectives):null,r.vary?JSON.stringify(r.vary):null,r.cachedAt,r.staleAt))}createWriteStream(t,r){RLe(t),$1r(r);let a=0,i=[],s=this;return new q1r({decodeStrings:!0,write(e,o,u){a+=e.byteLength,a<s.#e?i.push(e):this.destroy(),u()},final(e){s.set(t,{...r,body:i}),e()}})}delete(t){if(typeof t!="object")throw new TypeError(`expected key to be object, got ${typeof t}`);this.#s.run(this.#h(t))}#I(){if(Number.isFinite(this.#t)&&this.size<=this.#t)return 0;{let t=this.#u.run(Date.now()).changes;if(t)return t}{let t=this.#d?.run(Math.max(Math.floor(this.#t*.1),1)).changes;if(t)return t}return 0}get size(){let{total:t}=this.#l.get();return t}#h(t){return`${t.origin}/${t.path}`}#o(t,r=!1){let a=this.#h(t),{headers:i,method:s}=t,e=this.#r.all(a,s);if(e.length===0)return;let o=Date.now();for(let u of e){if(o>=u.deleteAt&&!r)return;let d=!0;if(u.vary){let I=JSON.parse(u.vary);for(let h in I)if(!egr(i[h],I[h])){d=!1;break}}if(d)return u}}};function egr(n,t){return n==null&&t==null?!0:n==null&&t!=null||n!=null&&t==null?!1:Array.isArray(n)&&Array.isArray(t)?n.length!==t.length?!1:n.every((r,a)=>r===t[a]):n===t}});var kQ=ve((Dci,VYt)=>{"use strict";var{kConstruct:tgr}=Po(),{kEnumerableProperty:IJ}=ki(),{iteratorMixin:ngr,isValidHeaderName:tq,isValidHeaderValue:RYt}=o1(),{webidl:rs}=lm(),CLe=vt("node:assert"),Lhe=vt("node:util");function EYt(n){return n===10||n===13||n===9||n===32}function wYt(n){let t=0,r=n.length;for(;r>t&&EYt(n.charCodeAt(r-1));)--r;for(;r>t&&EYt(n.charCodeAt(t));)++t;return t===0&&r===n.length?n:n.substring(t,r)}function CYt(n,t){if(Array.isArray(t))for(let r=0;r<t.length;++r){let a=t[r];if(a.length!==2)throw rs.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${a.length}.`});YLe(n,a[0],a[1])}else if(typeof t=="object"&&t!==null){let r=Object.keys(t);for(let a=0;a<r.length;++a)YLe(n,r[a],t[r[a]])}else throw rs.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function YLe(n,t,r){if(r=wYt(r),tq(t)){if(!RYt(r))throw rs.errors.invalidArgument({prefix:"Headers.append",value:r,type:"header value"})}else throw rs.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header name"});if(xYt(n)==="immutable")throw new TypeError("immutable");return Bhe(n).append(t,r,!1)}function rgr(n){let t=Bhe(n);if(!t)return[];if(t.sortedMap)return t.sortedMap;let r=[],a=t.toSortedArray(),i=t.cookies;if(i===null||i.length===1)return t.sortedMap=a;for(let s=0;s<a.length;++s){let{0:e,1:o}=a[s];if(e==="set-cookie")for(let u=0;u<i.length;++u)r.push([e,i[u]]);else r.push([e,o])}return t.sortedMap=r}function YYt(n,t){return n[0]<t[0]?-1:1}var She=class n{cookies=null;sortedMap;headersMap;constructor(t){t instanceof n?(this.headersMap=new Map(t.headersMap),this.sortedMap=t.sortedMap,this.cookies=t.cookies===null?null:[...t.cookies]):(this.headersMap=new Map(t),this.sortedMap=null)}contains(t,r){return this.headersMap.has(r?t:t.toLowerCase())}clear(){this.headersMap.clear(),this.sortedMap=null,this.cookies=null}append(t,r,a){this.sortedMap=null;let i=a?t:t.toLowerCase(),s=this.headersMap.get(i);if(s){let e=i==="cookie"?"; ":", ";this.headersMap.set(i,{name:s.name,value:`${s.value}${e}${r}`})}else this.headersMap.set(i,{name:t,value:r});i==="set-cookie"&&(this.cookies??=[]).push(r)}set(t,r,a){this.sortedMap=null;let i=a?t:t.toLowerCase();i==="set-cookie"&&(this.cookies=[r]),this.headersMap.set(i,{name:t,value:r})}delete(t,r){this.sortedMap=null,r||(t=t.toLowerCase()),t==="set-cookie"&&(this.cookies=null),this.headersMap.delete(t)}get(t,r){return this.headersMap.get(r?t:t.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:t,1:{value:r}}of this.headersMap)yield[t,r]}get entries(){let t={};if(this.headersMap.size!==0)for(let{name:r,value:a}of this.headersMap.values())t[r]=a;return t}rawValues(){return this.headersMap.values()}get entriesList(){let t=[];if(this.headersMap.size!==0)for(let{0:r,1:{name:a,value:i}}of this.headersMap)if(r==="set-cookie")for(let s of this.cookies)t.push([a,s]);else t.push([a,i]);return t}toSortedArray(){let t=this.headersMap.size,r=new Array(t);if(t<=32){if(t===0)return r;let a=this.headersMap[Symbol.iterator](),i=a.next().value;r[0]=[i[0],i[1].value],CLe(i[1].value!==null);for(let s=1,e=0,o=0,u=0,d=0,I,h;s<t;++s){for(h=a.next().value,I=r[s]=[h[0],h[1].value],CLe(I[1]!==null),u=0,o=s;u<o;)d=u+(o-u>>1),r[d][0]<=I[0]?u=d+1:o=d;if(s!==d){for(e=s;e>u;)r[e]=r[--e];r[u]=I}}if(!a.next().done)throw new TypeError("Unreachable");return r}else{let a=0;for(let{0:i,1:{value:s}}of this.headersMap)r[a++]=[i,s],CLe(s!==null);return r.sort(YYt)}}},ON=class n{#e;#t;constructor(t=void 0){rs.util.markAsUncloneable(this),t!==tgr&&(this.#t=new She,this.#e="none",t!==void 0&&(t=rs.converters.HeadersInit(t,"Headers constructor","init"),CYt(this,t)))}append(t,r){rs.brandCheck(this,n),rs.argumentLengthCheck(arguments,2,"Headers.append");let a="Headers.append";return t=rs.converters.ByteString(t,a,"name"),r=rs.converters.ByteString(r,a,"value"),YLe(this,t,r)}delete(t){if(rs.brandCheck(this,n),rs.argumentLengthCheck(arguments,1,"Headers.delete"),t=rs.converters.ByteString(t,"Headers.delete","name"),!tq(t))throw rs.errors.invalidArgument({prefix:"Headers.delete",value:t,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.contains(t,!1)&&this.#t.delete(t,!1)}get(t){rs.brandCheck(this,n),rs.argumentLengthCheck(arguments,1,"Headers.get");let r="Headers.get";if(t=rs.converters.ByteString(t,r,"name"),!tq(t))throw rs.errors.invalidArgument({prefix:r,value:t,type:"header name"});return this.#t.get(t,!1)}has(t){rs.brandCheck(this,n),rs.argumentLengthCheck(arguments,1,"Headers.has");let r="Headers.has";if(t=rs.converters.ByteString(t,r,"name"),!tq(t))throw rs.errors.invalidArgument({prefix:r,value:t,type:"header name"});return this.#t.contains(t,!1)}set(t,r){rs.brandCheck(this,n),rs.argumentLengthCheck(arguments,2,"Headers.set");let a="Headers.set";if(t=rs.converters.ByteString(t,a,"name"),r=rs.converters.ByteString(r,a,"value"),r=wYt(r),tq(t)){if(!RYt(r))throw rs.errors.invalidArgument({prefix:a,value:r,type:"header value"})}else throw rs.errors.invalidArgument({prefix:a,value:t,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(t,r,!1)}getSetCookie(){rs.brandCheck(this,n);let t=this.#t.cookies;return t?[...t]:[]}[Lhe.inspect.custom](t,r){return r.depth??=t,`Headers ${Lhe.formatWithOptions(r,this.#t.entries)}`}static getHeadersGuard(t){return t.#e}static setHeadersGuard(t,r){t.#e=r}static getHeadersList(t){return t.#t}static setHeadersList(t,r){t.#t=r}},{getHeadersGuard:xYt,setHeadersGuard:agr,getHeadersList:Bhe,setHeadersList:igr}=ON;Reflect.deleteProperty(ON,"getHeadersGuard");Reflect.deleteProperty(ON,"setHeadersGuard");Reflect.deleteProperty(ON,"getHeadersList");Reflect.deleteProperty(ON,"setHeadersList");ngr("Headers",ON,rgr,0,1);Object.defineProperties(ON.prototype,{append:IJ,delete:IJ,get:IJ,has:IJ,set:IJ,getSetCookie:IJ,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Lhe.inspect.custom]:{enumerable:!1}});rs.converters.HeadersInit=function(n,t,r){if(rs.util.Type(n)===rs.util.Types.OBJECT){let a=Reflect.get(n,Symbol.iterator);if(!Lhe.types.isProxy(n)&&a===ON.prototype.entries)try{return Bhe(n).entriesList}catch{}return typeof a=="function"?rs.converters["sequence<sequence<ByteString>>"](n,t,r,a.bind(n)):rs.converters["record<ByteString, ByteString>"](n,t,r)}throw rs.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};VYt.exports={fill:CYt,compareHeaderName:YYt,Headers:ON,HeadersList:She,getHeadersGuard:xYt,setHeadersGuard:agr,setHeadersList:igr,getHeadersList:Bhe}});var rq=ve((Oci,UYt)=>{"use strict";var{Headers:SYt,HeadersList:QYt,fill:lgr,getHeadersGuard:sgr,setHeadersGuard:BYt,setHeadersList:JYt}=kQ(),{extractBody:HYt,cloneBody:ogr,mixinBody:cgr,streamRegistry:TYt,bodyUnusable:ugr}=UB(),DYt=ki(),XYt=vt("node:util"),{kEnumerableProperty:d1}=DYt,{isValidReasonPhrase:Igr,isCancelled:dgr,isAborted:hgr,isErrorLike:mgr,environmentSettingsObject:pgr}=o1(),{redirectStatusSet:bgr,nullBodyStatus:fgr}=mK(),{webidl:kl}=lm(),{URLSerializer:kYt}=lv(),{kConstruct:The}=Po(),xLe=vt("node:assert"),{isomorphicEncode:Ggr,serializeJavascriptValueToJSONString:ggr}=T5(),vgr=new TextEncoder("utf-8"),h1=class n{#e;#t;static error(){return nq(Dhe(),"immutable")}static json(t,r=void 0){kl.argumentLengthCheck(arguments,1,"Response.json"),r!==null&&(r=kl.converters.ResponseInit(r));let a=vgr.encode(ggr(t)),i=HYt(a),s=nq(dJ({}),"response");return LYt(s,r,{body:i[0],type:"application/json"}),s}static redirect(t,r=302){kl.argumentLengthCheck(arguments,1,"Response.redirect"),t=kl.converters.USVString(t),r=kl.converters["unsigned short"](r);let a;try{a=new URL(t,pgr.settingsObject.baseUrl)}catch(e){throw new TypeError(`Failed to parse URL from ${t}`,{cause:e})}if(!bgr.has(r))throw new RangeError(`Invalid status code ${r}`);let i=nq(dJ({}),"immutable");i.#t.status=r;let s=Ggr(kYt(a));return i.#t.headersList.append("location",s,!0),i}constructor(t=null,r=void 0){if(kl.util.markAsUncloneable(this),t===The)return;t!==null&&(t=kl.converters.BodyInit(t,"Response","body")),r=kl.converters.ResponseInit(r),this.#t=dJ({}),this.#e=new SYt(The),BYt(this.#e,"response"),JYt(this.#e,this.#t.headersList);let a=null;if(t!=null){let[i,s]=HYt(t);a={body:i,type:s}}LYt(this,r,a)}get type(){return kl.brandCheck(this,n),this.#t.type}get url(){kl.brandCheck(this,n);let t=this.#t.urlList,r=t[t.length-1]??null;return r===null?"":kYt(r,!0)}get redirected(){return kl.brandCheck(this,n),this.#t.urlList.length>1}get status(){return kl.brandCheck(this,n),this.#t.status}get ok(){return kl.brandCheck(this,n),this.#t.status>=200&&this.#t.status<=299}get statusText(){return kl.brandCheck(this,n),this.#t.statusText}get headers(){return kl.brandCheck(this,n),this.#e}get body(){return kl.brandCheck(this,n),this.#t.body?this.#t.body.stream:null}get bodyUsed(){return kl.brandCheck(this,n),!!this.#t.body&&DYt.isDisturbed(this.#t.body.stream)}clone(){if(kl.brandCheck(this,n),ugr(this.#t))throw kl.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let t=VLe(this.#t);return this.#t.body?.stream&&TYt.register(this,new WeakRef(this.#t.body.stream)),nq(t,sgr(this.#e))}[XYt.inspect.custom](t,r){r.depth===null&&(r.depth=2),r.colors??=!0;let a={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${XYt.formatWithOptions(r,a)}`}static getResponseHeaders(t){return t.#e}static setResponseHeaders(t,r){t.#e=r}static getResponseState(t){return t.#t}static setResponseState(t,r){t.#t=r}},{getResponseHeaders:Zgr,setResponseHeaders:Ngr,getResponseState:LQ,setResponseState:Agr}=h1;Reflect.deleteProperty(h1,"getResponseHeaders");Reflect.deleteProperty(h1,"setResponseHeaders");Reflect.deleteProperty(h1,"getResponseState");Reflect.deleteProperty(h1,"setResponseState");cgr(h1,LQ);Object.defineProperties(h1.prototype,{type:d1,url:d1,status:d1,ok:d1,redirected:d1,statusText:d1,headers:d1,clone:d1,body:d1,bodyUsed:d1,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(h1,{json:d1,redirect:d1,error:d1});function VLe(n){if(n.internalResponse)return OYt(VLe(n.internalResponse),n.type);let t=dJ({...n,body:null});return n.body!=null&&(t.body=ogr(n.body)),t}function dJ(n){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...n,headersList:n?.headersList?new QYt(n?.headersList):new QYt,urlList:n?.urlList?[...n.urlList]:[]}}function Dhe(n){let t=mgr(n);return dJ({type:"error",status:0,error:t?n:new Error(n&&String(n)),aborted:n&&n.name==="AbortError"})}function Wgr(n){return n.type==="error"&&n.status===0}function Jhe(n,t){return t={internalResponse:n,...t},new Proxy(n,{get(r,a){return a in t?t[a]:r[a]},set(r,a,i){return xLe(!(a in t)),r[a]=i,!0}})}function OYt(n,t){if(t==="basic")return Jhe(n,{type:"basic",headersList:n.headersList});if(t==="cors")return Jhe(n,{type:"cors",headersList:n.headersList});if(t==="opaque")return Jhe(n,{type:"opaque",urlList:[],status:0,statusText:"",body:null});if(t==="opaqueredirect")return Jhe(n,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});xLe(!1)}function ygr(n,t=null){return xLe(dgr(n)),hgr(n)?Dhe(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:t})):Dhe(Object.assign(new DOMException("Request was cancelled."),{cause:t}))}function LYt(n,t,r){if(t.status!==null&&(t.status<200||t.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in t&&t.statusText!=null&&!Igr(String(t.statusText)))throw new TypeError("Invalid statusText");if("status"in t&&t.status!=null&&(LQ(n).status=t.status),"statusText"in t&&t.statusText!=null&&(LQ(n).statusText=t.statusText),"headers"in t&&t.headers!=null&&lgr(Zgr(n),t.headers),r){if(fgr.includes(n.status))throw kl.errors.exception({header:"Response constructor",message:`Invalid response status code ${n.status}`});LQ(n).body=r.body,r.type!=null&&!LQ(n).headersList.contains("content-type",!0)&&LQ(n).headersList.append("content-type",r.type,!0)}}function nq(n,t){let r=new h1(The);Agr(r,n);let a=new SYt(The);return Ngr(r,a),JYt(a,n.headersList),BYt(a,t),n.body?.stream&&TYt.register(r,new WeakRef(n.body.stream)),r}kl.converters.XMLHttpRequestBodyInit=function(n,t,r){return typeof n=="string"?kl.converters.USVString(n,t,r):kl.is.Blob(n)||kl.is.BufferSource(n)||kl.is.FormData(n)||kl.is.URLSearchParams(n)?n:kl.converters.DOMString(n,t,r)};kl.converters.BodyInit=function(n,t,r){return kl.is.ReadableStream(n)||n?.[Symbol.asyncIterator]?n:kl.converters.XMLHttpRequestBodyInit(n,t,r)};kl.converters.ResponseInit=kl.dictionaryConverter([{key:"status",converter:kl.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:kl.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:kl.converters.HeadersInit}]);kl.is.Response=kl.util.MakeTypeAssertion(h1);UYt.exports={isNetworkError:Wgr,makeNetworkError:Dhe,makeResponse:dJ,makeAppropriateNetworkError:ygr,filterResponse:OYt,Response:h1,cloneResponse:VLe,fromInnerResponse:nq,getResponseState:LQ}});var hJ=ve((Uci,ixt)=>{"use strict";var{extractBody:Fgr,mixinBody:Egr,cloneBody:Rgr,bodyUnusable:MYt}=UB(),{Headers:qYt,fill:wgr,HeadersList:Mhe,setHeadersGuard:QLe,getHeadersGuard:Cgr,setHeadersList:$Yt,getHeadersList:zYt}=kQ(),Uhe=ki(),_Yt=vt("node:util"),{isValidHTTPToken:Ygr,sameOrigin:PYt,environmentSettingsObject:Ohe}=o1(),{forbiddenMethodsSet:xgr,corsSafeListedMethodsSet:Vgr,referrerPolicy:Qgr,requestRedirect:Hgr,requestMode:Xgr,requestCredentials:kgr,requestCache:Lgr,requestDuplex:Sgr}=mK(),{kEnumerableProperty:Hd,normalizedMethodRecordsBase:Bgr,normalizedMethodRecords:Jgr}=Uhe,{webidl:ja}=lm(),{URLSerializer:Tgr}=lv(),{kConstruct:zhe}=Po(),Dgr=vt("node:assert"),{getMaxListeners:ext,setMaxListeners:Ogr,defaultMaxListeners:Ugr}=vt("node:events"),Mgr=Symbol("abortController"),txt=new FinalizationRegistry(({signal:n,abort:t})=>{n.removeEventListener("abort",t)}),_he=new WeakMap,HLe;try{HLe=ext(new AbortController().signal)>0}catch{HLe=!1}function jYt(n){return t;function t(){let r=n.deref();if(r!==void 0){txt.unregister(t),this.removeEventListener("abort",t),r.abort(this.reason);let a=_he.get(r.signal);if(a!==void 0){if(a.size!==0){for(let i of a){let s=i.deref();s!==void 0&&s.abort(this.reason)}a.clear()}_he.delete(r.signal)}}}}var KYt=!1,mf=class n{#e;#t;#n;#r;constructor(t,r=void 0){if(ja.util.markAsUncloneable(this),t===zhe)return;ja.argumentLengthCheck(arguments,1,"Request constructor"),t=ja.converters.RequestInfo(t),r=ja.converters.RequestInit(r);let i=null,s=null,e=Ohe.settingsObject.baseUrl,o=null;if(typeof t=="string"){this.#t=r.dispatcher;let F;try{F=new URL(t,e)}catch(C){throw new TypeError("Failed to parse URL from "+t,{cause:C})}if(F.username||F.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+t);i=Phe({urlList:[F]}),s="cors"}else Dgr(ja.is.Request(t)),i=t.#r,o=t.#e,this.#t=r.dispatcher||t.#t;let u=Ohe.settingsObject.origin,d="client";if(i.window?.constructor?.name==="EnvironmentSettingsObject"&&PYt(i.window,u)&&(d=i.window),r.window!=null)throw new TypeError(`'window' option '${d}' must be null`);"window"in r&&(d="no-window"),i=Phe({method:i.method,headersList:i.headersList,unsafeRequest:i.unsafeRequest,client:Ohe.settingsObject,window:d,priority:i.priority,origin:i.origin,referrer:i.referrer,referrerPolicy:i.referrerPolicy,mode:i.mode,credentials:i.credentials,cache:i.cache,redirect:i.redirect,integrity:i.integrity,keepalive:i.keepalive,reloadNavigation:i.reloadNavigation,historyNavigation:i.historyNavigation,urlList:[...i.urlList]});let I=Object.keys(r).length!==0;if(I&&(i.mode==="navigate"&&(i.mode="same-origin"),i.reloadNavigation=!1,i.historyNavigation=!1,i.origin="client",i.referrer="client",i.referrerPolicy="",i.url=i.urlList[i.urlList.length-1],i.urlList=[i.url]),r.referrer!==void 0){let F=r.referrer;if(F==="")i.referrer="no-referrer";else{let C;try{C=new URL(F,e)}catch(A){throw new TypeError(`Referrer "${F}" is not a valid URL.`,{cause:A})}C.protocol==="about:"&&C.hostname==="client"||u&&!PYt(C,Ohe.settingsObject.baseUrl)?i.referrer="client":i.referrer=C}}r.referrerPolicy!==void 0&&(i.referrerPolicy=r.referrerPolicy);let h;if(r.mode!==void 0?h=r.mode:h=s,h==="navigate")throw ja.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(h!=null&&(i.mode=h),r.credentials!==void 0&&(i.credentials=r.credentials),r.cache!==void 0&&(i.cache=r.cache),i.cache==="only-if-cached"&&i.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(r.redirect!==void 0&&(i.redirect=r.redirect),r.integrity!=null&&(i.integrity=String(r.integrity)),r.keepalive!==void 0&&(i.keepalive=!!r.keepalive),r.method!==void 0){let F=r.method,C=Jgr[F];if(C!==void 0)i.method=C;else{if(!Ygr(F))throw new TypeError(`'${F}' is not a valid HTTP method.`);let A=F.toUpperCase();if(xgr.has(A))throw new TypeError(`'${F}' HTTP method is unsupported.`);F=Bgr[A]??F,i.method=F}!KYt&&i.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),KYt=!0)}r.signal!==void 0&&(o=r.signal),this.#r=i;let c=new AbortController;if(this.#e=c.signal,o!=null)if(o.aborted)c.abort(o.reason);else{this[Mgr]=c;let F=new WeakRef(c),C=jYt(F);HLe&&ext(o)===Ugr&&Ogr(1500,o),Uhe.addAbortListener(o,C),txt.register(c,{signal:o,abort:C},C)}if(this.#n=new qYt(zhe),$Yt(this.#n,i.headersList),QLe(this.#n,"request"),h==="no-cors"){if(!Vgr.has(i.method))throw new TypeError(`'${i.method} is unsupported in no-cors mode.`);QLe(this.#n,"request-no-cors")}if(I){let F=zYt(this.#n),C=r.headers!==void 0?r.headers:new Mhe(F);if(F.clear(),C instanceof Mhe){for(let{name:A,value:E}of C.rawValues())F.append(A,E,!1);F.cookies=C.cookies}else wgr(this.#n,C)}let G=ja.is.Request(t)?t.#r.body:null;if((r.body!=null||G!=null)&&(i.method==="GET"||i.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let W=null;if(r.body!=null){let[F,C]=Fgr(r.body,i.keepalive);W=F,C&&!zYt(this.#n).contains("content-type",!0)&&this.#n.append("content-type",C,!0)}let y=W??G;if(y!=null&&y.source==null){if(W!=null&&r.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(i.mode!=="same-origin"&&i.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');i.useCORSPreflightFlag=!0}let R=y;if(W==null&&G!=null){if(MYt(t.#r))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let F=new TransformStream;G.stream.pipeThrough(F),R={source:G.source,length:G.length,stream:F.readable}}this.#r.body=R}get method(){return ja.brandCheck(this,n),this.#r.method}get url(){return ja.brandCheck(this,n),Tgr(this.#r.url)}get headers(){return ja.brandCheck(this,n),this.#n}get destination(){return ja.brandCheck(this,n),this.#r.destination}get referrer(){return ja.brandCheck(this,n),this.#r.referrer==="no-referrer"?"":this.#r.referrer==="client"?"about:client":this.#r.referrer.toString()}get referrerPolicy(){return ja.brandCheck(this,n),this.#r.referrerPolicy}get mode(){return ja.brandCheck(this,n),this.#r.mode}get credentials(){return ja.brandCheck(this,n),this.#r.credentials}get cache(){return ja.brandCheck(this,n),this.#r.cache}get redirect(){return ja.brandCheck(this,n),this.#r.redirect}get integrity(){return ja.brandCheck(this,n),this.#r.integrity}get keepalive(){return ja.brandCheck(this,n),this.#r.keepalive}get isReloadNavigation(){return ja.brandCheck(this,n),this.#r.reloadNavigation}get isHistoryNavigation(){return ja.brandCheck(this,n),this.#r.historyNavigation}get signal(){return ja.brandCheck(this,n),this.#e}get body(){return ja.brandCheck(this,n),this.#r.body?this.#r.body.stream:null}get bodyUsed(){return ja.brandCheck(this,n),!!this.#r.body&&Uhe.isDisturbed(this.#r.body.stream)}get duplex(){return ja.brandCheck(this,n),"half"}clone(){if(ja.brandCheck(this,n),MYt(this.#r))throw new TypeError("unusable");let t=rxt(this.#r),r=new AbortController;if(this.signal.aborted)r.abort(this.signal.reason);else{let a=_he.get(this.signal);a===void 0&&(a=new Set,_he.set(this.signal,a));let i=new WeakRef(r);a.add(i),Uhe.addAbortListener(r.signal,jYt(i))}return axt(t,this.#t,r.signal,Cgr(this.#n))}[_Yt.inspect.custom](t,r){r.depth===null&&(r.depth=2),r.colors??=!0;let a={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${_Yt.formatWithOptions(r,a)}`}static setRequestSignal(t,r){return t.#e=r,t}static getRequestDispatcher(t){return t.#t}static setRequestDispatcher(t,r){t.#t=r}static setRequestHeaders(t,r){t.#n=r}static getRequestState(t){return t.#r}static setRequestState(t,r){t.#r=r}},{setRequestSignal:zgr,getRequestDispatcher:_gr,setRequestDispatcher:Pgr,setRequestHeaders:jgr,getRequestState:nxt,setRequestState:Kgr}=mf;Reflect.deleteProperty(mf,"setRequestSignal");Reflect.deleteProperty(mf,"getRequestDispatcher");Reflect.deleteProperty(mf,"setRequestDispatcher");Reflect.deleteProperty(mf,"setRequestHeaders");Reflect.deleteProperty(mf,"getRequestState");Reflect.deleteProperty(mf,"setRequestState");Egr(mf,nxt);function Phe(n){return{method:n.method??"GET",localURLsOnly:n.localURLsOnly??!1,unsafeRequest:n.unsafeRequest??!1,body:n.body??null,client:n.client??null,reservedClient:n.reservedClient??null,replacesClientId:n.replacesClientId??"",window:n.window??"client",keepalive:n.keepalive??!1,serviceWorkers:n.serviceWorkers??"all",initiator:n.initiator??"",destination:n.destination??"",priority:n.priority??null,origin:n.origin??"client",policyContainer:n.policyContainer??"client",referrer:n.referrer??"client",referrerPolicy:n.referrerPolicy??"",mode:n.mode??"no-cors",useCORSPreflightFlag:n.useCORSPreflightFlag??!1,credentials:n.credentials??"same-origin",useCredentials:n.useCredentials??!1,cache:n.cache??"default",redirect:n.redirect??"follow",integrity:n.integrity??"",cryptoGraphicsNonceMetadata:n.cryptoGraphicsNonceMetadata??"",parserMetadata:n.parserMetadata??"",reloadNavigation:n.reloadNavigation??!1,historyNavigation:n.historyNavigation??!1,userActivation:n.userActivation??!1,taintedOrigin:n.taintedOrigin??!1,redirectCount:n.redirectCount??0,responseTainting:n.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:n.preventNoCacheCacheControlHeaderModification??!1,done:n.done??!1,timingAllowFailed:n.timingAllowFailed??!1,urlList:n.urlList,url:n.urlList[0],headersList:n.headersList?new Mhe(n.headersList):new Mhe}}function rxt(n){let t=Phe({...n,body:null});return n.body!=null&&(t.body=Rgr(n.body)),t}function axt(n,t,r,a){let i=new mf(zhe);Kgr(i,n),Pgr(i,t),zgr(i,r);let s=new qYt(zhe);return jgr(i,s),$Yt(s,n.headersList),QLe(s,a),i}Object.defineProperties(mf.prototype,{method:Hd,url:Hd,headers:Hd,redirect:Hd,clone:Hd,signal:Hd,duplex:Hd,destination:Hd,body:Hd,bodyUsed:Hd,isHistoryNavigation:Hd,isReloadNavigation:Hd,keepalive:Hd,integrity:Hd,cache:Hd,credentials:Hd,attribute:Hd,referrerPolicy:Hd,referrer:Hd,mode:Hd,[Symbol.toStringTag]:{value:"Request",configurable:!0}});ja.is.Request=ja.util.MakeTypeAssertion(mf);ja.converters.RequestInfo=function(n){return typeof n=="string"?ja.converters.USVString(n):ja.is.Request(n)?n:ja.converters.USVString(n)};ja.converters.RequestInit=ja.dictionaryConverter([{key:"method",converter:ja.converters.ByteString},{key:"headers",converter:ja.converters.HeadersInit},{key:"body",converter:ja.nullableConverter(ja.converters.BodyInit)},{key:"referrer",converter:ja.converters.USVString},{key:"referrerPolicy",converter:ja.converters.DOMString,allowedValues:Qgr},{key:"mode",converter:ja.converters.DOMString,allowedValues:Xgr},{key:"credentials",converter:ja.converters.DOMString,allowedValues:kgr},{key:"cache",converter:ja.converters.DOMString,allowedValues:Lgr},{key:"redirect",converter:ja.converters.DOMString,allowedValues:Hgr},{key:"integrity",converter:ja.converters.DOMString},{key:"keepalive",converter:ja.converters.boolean},{key:"signal",converter:ja.nullableConverter(n=>ja.converters.AbortSignal(n,"RequestInit","signal"))},{key:"window",converter:ja.converters.any},{key:"duplex",converter:ja.converters.DOMString,allowedValues:Sgr},{key:"dispatcher",converter:ja.converters.any},{key:"priority",converter:ja.converters.DOMString,allowedValues:["high","low","auto"],defaultValue:()=>"auto"}]);ixt.exports={Request:mf,makeRequest:Phe,fromInnerRequest:axt,cloneRequest:rxt,getRequestDispatcher:_gr,getRequestState:nxt}});var hxt=ve((Mci,dxt)=>{"use strict";var qgr=vt("node:assert"),{runtimeFeatures:sxt}=D5(),SQ=new Map([["sha256",0],["sha384",1],["sha512",2]]),XLe;if(sxt.has("crypto")){XLe=vt("node:crypto");let n=XLe.getHashes();n.length===0&&SQ.clear();for(let t of SQ.keys())n.includes(t)===!1&&SQ.delete(t)}else SQ.clear();var lxt=Map.prototype.get.bind(SQ),kLe=Map.prototype.has.bind(SQ),$gr=sxt.has("crypto")===!1||SQ.size===0?()=>!0:(n,t)=>{let r=cxt(t);if(r.length===0)return!0;let a=oxt(r);for(let i of a){let s=i.alg,e=i.val,o=uxt(s,n);if(Ixt(o,e))return!0}return!1};function oxt(n){let t=[],r=null;for(let a of n){if(qgr(kLe(a.alg),"Invalid SRI hash algorithm token"),t.length===0){t.push(a),r=a;continue}let i=r.alg,s=lxt(i),e=a.alg,o=lxt(e);o<s||(o>s?(r=a,t[0]=a,t.length=1):t.push(a))}return t}function cxt(n){let t=[];for(let r of n.split(" ")){let i=r.split("?",1)[0],s="",e=[i.slice(0,6),i.slice(7)],o=e[0];if(!kLe(o))continue;e[1]&&(s=e[1]);let u={alg:o,val:s};t.push(u)}return t}var uxt=(n,t)=>XLe.hash(n,t,"base64");function Ixt(n,t){let r=n.length;r!==0&&n[r-1]==="="&&(r-=1),r!==0&&n[r-1]==="="&&(r-=1);let a=t.length;if(a!==0&&t[a-1]==="="&&(a-=1),a!==0&&t[a-1]==="="&&(a-=1),r!==a)return!1;for(let i=0;i<r;++i)if(!(n[i]===t[i]||n[i]==="+"&&t[i]==="-"||n[i]==="/"&&t[i]==="_"))return!1;return!0}dxt.exports={applyAlgorithmToBytes:uxt,bytesMatch:$gr,caseSensitiveMatch:Ixt,isValidSRIHashAlgorithm:kLe,getStrongestMetadata:oxt,parseMetadata:cxt}});var iq=ve((zci,Ext)=>{"use strict";var{makeNetworkError:Lo,makeAppropriateNetworkError:jhe,filterResponse:LLe,makeResponse:Khe,fromInnerResponse:evr,getResponseState:tvr}=rq(),{HeadersList:mxt}=kQ(),{Request:nvr,cloneRequest:rvr,getRequestDispatcher:avr,getRequestState:ivr}=hJ(),UN=vt("node:zlib"),{makePolicyContainer:lvr,clonePolicyContainer:svr,requestBadPort:ovr,TAOCheck:cvr,appendRequestOriginHeader:uvr,responseLocationURL:Ivr,requestCurrentURL:DW,setRequestReferrerPolicyOnRedirect:dvr,tryUpgradeRequestToAPotentiallyTrustworthyURL:hvr,createOpaqueTimingInfo:DLe,appendFetchMetadata:mvr,corsCheck:pvr,crossOriginResourcePolicyCheck:bvr,determineRequestsReferrer:fvr,coarsenedSharedCurrentTime:aq,sameOrigin:TLe,isCancelled:BQ,isAborted:pxt,isErrorLike:Gvr,fullyReadBody:gvr,readableStreamClose:vvr,urlIsLocal:Zvr,urlIsHttpHttpsScheme:tme,urlHasHttpsScheme:Nvr,clampAndCoarsenConnectionTimingInfo:Avr,simpleRangeHeaderValue:Wvr,buildContentRange:yvr,createInflate:Fvr,extractMimeType:Evr}=o1(),JQ=vt("node:assert"),{safelyExtractBody:OLe,extractBody:bxt}=UB(),{redirectStatusSet:gxt,nullBodyStatus:vxt,safeMethodsSet:Rvr,requestBodyHeader:wvr,subresourceSet:Cvr}=mK(),Yvr=vt("node:events"),{Readable:xvr,pipeline:Vvr,finished:Qvr,isErrored:Hvr,isReadable:qhe}=vt("node:stream"),{addAbortListener:Xvr,bufferToLowerCasedHeaderName:fxt}=ki(),{dataURLProcessor:kvr,serializeAMimeType:Lvr,minimizeSupportedMimeType:Svr}=lv(),{getGlobalDispatcher:Bvr}=Hhe(),{webidl:ULe}=lm(),{STATUS_CODES:Jvr}=vt("node:http"),{bytesMatch:Tvr}=hxt(),{createDeferredPromise:Dvr}=vK(),{isomorphicEncode:$he}=T5(),{runtimeFeatures:Ovr}=D5(),Uvr=Ovr.has("zstd"),Mvr=["GET","HEAD"],zvr=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",SLe,eme=class extends Yvr{constructor(t){super(),this.dispatcher=t,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(t){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(t),this.emit("terminated",t))}abort(t){this.state==="ongoing"&&(this.state="aborted",t||(t=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=t,this.connection?.destroy(t),this.emit("terminated",t))}};function _vr(n){Zxt(n,"fetch")}function Pvr(n,t=void 0){ULe.argumentLengthCheck(arguments,1,"globalThis.fetch");let r=Dvr(),a;try{a=new nvr(n,t)}catch(I){return r.reject(I),r.promise}let i=ivr(a);if(a.signal.aborted)return BLe(r,i,null,a.signal.reason),r.promise;i.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(i.serviceWorkers="none");let e=null,o=!1,u=null;return Xvr(a.signal,()=>{o=!0,JQ(u!=null),u.abort(a.signal.reason);let I=e?.deref();BLe(r,i,I,a.signal.reason)}),u=Axt({request:i,processResponseEndOfBody:_vr,processResponse:I=>{if(!o){if(I.aborted){BLe(r,i,e,u.serializedAbortReason);return}if(I.type==="error"){r.reject(new TypeError("fetch failed",{cause:I.error}));return}e=new WeakRef(evr(I,"immutable")),r.resolve(e.deref()),r=null}},dispatcher:avr(a)}),r.promise}function Zxt(n,t="other"){if(n.type==="error"&&n.aborted||!n.urlList?.length)return;let r=n.urlList[0],a=n.timingInfo,i=n.cacheState;tme(r)&&a!==null&&(n.timingAllowPassed||(a=DLe({startTime:a.startTime}),i=""),a.endTime=aq(),n.timingInfo=a,Nxt(a,r.href,t,globalThis,i,"",n.status))}var Nxt=performance.markResourceTiming;function BLe(n,t,r,a){if(n&&n.reject(a),t.body?.stream!=null&&qhe(t.body.stream)&&t.body.stream.cancel(a).catch(s=>{if(s.code!=="ERR_INVALID_STATE")throw s}),r==null)return;let i=tvr(r);i.body?.stream!=null&&qhe(i.body.stream)&&i.body.stream.cancel(a).catch(s=>{if(s.code!=="ERR_INVALID_STATE")throw s})}function Axt({request:n,processRequestBodyChunkLength:t,processRequestEndOfBody:r,processResponse:a,processResponseEndOfBody:i,processResponseConsumeBody:s,useParallelQueue:e=!1,dispatcher:o=Bvr()}){JQ(o);let u=null,d=!1;n.client!=null&&(u=n.client.globalObject,d=n.client.crossOriginIsolatedCapability);let I=aq(d),h=DLe({startTime:I}),c={controller:new eme(o),request:n,timingInfo:h,processRequestBodyChunkLength:t,processRequestEndOfBody:r,processResponse:a,processResponseConsumeBody:s,processResponseEndOfBody:i,taskDestination:u,crossOriginIsolatedCapability:d};return JQ(!n.body||n.body.stream),n.window==="client"&&(n.window=n.client?.globalObject?.constructor?.name==="Window"?n.client:"no-window"),n.origin==="client"&&(n.origin=n.client.origin),n.policyContainer==="client"&&(n.client!=null?n.policyContainer=svr(n.client.policyContainer):n.policyContainer=lvr()),n.headersList.contains("accept",!0)||n.headersList.append("accept","*/*",!0),n.headersList.contains("accept-language",!0)||n.headersList.append("accept-language","*",!0),n.priority,Cvr.has(n.destination),Wxt(c,!1),c.controller}async function Wxt(n,t){try{let r=n.request,a=null;if(r.localURLsOnly&&!Zvr(DW(r))&&(a=Lo("local URLs only")),hvr(r),ovr(r)==="blocked"&&(a=Lo("bad port")),r.referrerPolicy===""&&(r.referrerPolicy=r.policyContainer.referrerPolicy),r.referrer!=="no-referrer"&&(r.referrer=fvr(r)),a===null){let s=DW(r);TLe(s,r.url)&&r.responseTainting==="basic"||s.protocol==="data:"||r.mode==="navigate"||r.mode==="websocket"?(r.responseTainting="basic",a=await Gxt(n)):r.mode==="same-origin"?a=Lo('request mode cannot be "same-origin"'):r.mode==="no-cors"?r.redirect!=="follow"?a=Lo('redirect mode cannot be "follow" for "no-cors" request'):(r.responseTainting="opaque",a=await Gxt(n)):tme(DW(r))?(r.responseTainting="cors",a=await yxt(n)):a=Lo("URL scheme must be a HTTP(S) scheme")}if(t)return a;a.status!==0&&!a.internalResponse&&(r.responseTainting,r.responseTainting==="basic"?a=LLe(a,"basic"):r.responseTainting==="cors"?a=LLe(a,"cors"):r.responseTainting==="opaque"?a=LLe(a,"opaque"):JQ(!1));let i=a.status===0?a:a.internalResponse;if(i.urlList.length===0&&i.urlList.push(...r.urlList),r.timingAllowFailed||(a.timingAllowPassed=!0),a.type==="opaque"&&i.status===206&&i.rangeRequested&&!r.headers.contains("range",!0)&&(a=i=Lo()),a.status!==0&&(r.method==="HEAD"||r.method==="CONNECT"||vxt.includes(i.status))&&(i.body=null,n.controller.dump=!0),r.integrity){let s=o=>JLe(n,Lo(o));if(r.responseTainting==="opaque"||a.body==null){s(a.error);return}let e=o=>{if(!Tvr(o,r.integrity)){s("integrity mismatch");return}a.body=OLe(o)[0],JLe(n,a)};gvr(a.body,e,s)}else JLe(n,a)}catch(r){n.controller.terminate(r)}}function Gxt(n){if(BQ(n)&&n.request.redirectCount===0)return Promise.resolve(jhe(n));let{request:t}=n,{protocol:r}=DW(t);switch(r){case"about:":return Promise.resolve(Lo("about scheme is not supported"));case"blob:":{SLe||(SLe=vt("node:buffer").resolveObjectURL);let a=DW(t);if(a.search.length!==0)return Promise.resolve(Lo("NetworkError when attempting to fetch resource."));let i=SLe(a.toString());if(t.method!=="GET"||!ULe.is.Blob(i))return Promise.resolve(Lo("invalid method"));let s=Khe(),e=i.size,o=$he(`${e}`),u=i.type;if(t.headersList.contains("range",!0)){s.rangeRequested=!0;let d=t.headersList.get("range",!0),I=Wvr(d,!0);if(I==="failure")return Promise.resolve(Lo("failed to fetch the data URL"));let{rangeStartValue:h,rangeEndValue:c}=I;if(h===null)h=e-c,c=h+c-1;else{if(h>=e)return Promise.resolve(Lo("Range start is greater than the blob's size."));(c===null||c>=e)&&(c=e-1)}let G=i.slice(h,c+1,u),W=bxt(G);s.body=W[0];let y=$he(`${G.size}`),R=yvr(h,c,e);s.status=206,s.statusText="Partial Content",s.headersList.set("content-length",y,!0),s.headersList.set("content-type",u,!0),s.headersList.set("content-range",R,!0)}else{let d=bxt(i);s.statusText="OK",s.body=d[0],s.headersList.set("content-length",o,!0),s.headersList.set("content-type",u,!0)}return Promise.resolve(s)}case"data:":{let a=DW(t),i=kvr(a);if(i==="failure")return Promise.resolve(Lo("failed to fetch the data URL"));let s=Lvr(i.mimeType);return Promise.resolve(Khe({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:s}]],body:OLe(i.body)[0]}))}case"file:":return Promise.resolve(Lo("not implemented... yet..."));case"http:":case"https:":return yxt(n).catch(a=>Lo(a));default:return Promise.resolve(Lo("unknown scheme"))}}function jvr(n,t){n.request.done=!0,n.processResponseDone!=null&&queueMicrotask(()=>n.processResponseDone(t))}function JLe(n,t){let r=n.timingInfo,a=()=>{let s=Date.now();n.request.destination==="document"&&(n.controller.fullTimingInfo=r),n.controller.reportTimingSteps=()=>{if(!tme(n.request.url))return;r.endTime=s;let o=t.cacheState,u=t.bodyInfo;t.timingAllowPassed||(r=DLe(r),o="");let d=0;if(n.request.mode!=="navigator"||!t.hasCrossOriginRedirects){d=t.status;let I=Evr(t.headersList);I!=="failure"&&(u.contentType=Svr(I))}n.request.initiatorType!=null&&Nxt(r,n.request.url.href,n.request.initiatorType,globalThis,o,u,d)};let e=()=>{n.request.done=!0,n.processResponseEndOfBody!=null&&queueMicrotask(()=>n.processResponseEndOfBody(t)),n.request.initiatorType!=null&&n.controller.reportTimingSteps()};queueMicrotask(()=>e())};n.processResponse!=null&&queueMicrotask(()=>{n.processResponse(t),n.processResponse=null});let i=t.type==="error"?t:t.internalResponse??t;i.body==null?a():Qvr(i.body.stream,()=>{a()})}async function yxt(n){let t=n.request,r=null,a=null,i=n.timingInfo;if(t.serviceWorkers,r===null){if(t.redirect==="follow"&&(t.serviceWorkers="none"),a=r=await Fxt(n),t.responseTainting==="cors"&&pvr(t,r)==="failure")return Lo("cors failure");cvr(t,r)==="failure"&&(t.timingAllowFailed=!0)}return(t.responseTainting==="opaque"||r.type==="opaque")&&bvr(t.origin,t.client,t.destination,a)==="blocked"?Lo("blocked"):(gxt.has(a.status)&&(t.redirect!=="manual"&&n.controller.connection.destroy(void 0,!1),t.redirect==="error"?r=Lo("unexpected redirect"):t.redirect==="manual"?r=a:t.redirect==="follow"?r=await Kvr(n,r):JQ(!1)),r.timingInfo=i,r)}function Kvr(n,t){let r=n.request,a=t.internalResponse?t.internalResponse:t,i;try{if(i=Ivr(a,DW(r).hash),i==null)return t}catch(e){return Promise.resolve(Lo(e))}if(!tme(i))return Promise.resolve(Lo("URL scheme must be a HTTP(S) scheme"));if(r.redirectCount===20)return Promise.resolve(Lo("redirect count exceeded"));if(r.redirectCount+=1,r.mode==="cors"&&(i.username||i.password)&&!TLe(r,i))return Promise.resolve(Lo('cross origin not allowed for request mode "cors"'));if(r.responseTainting==="cors"&&(i.username||i.password))return Promise.resolve(Lo('URL cannot contain credentials for request mode "cors"'));if(a.status!==303&&r.body!=null&&r.body.source==null)return Promise.resolve(Lo());if([301,302].includes(a.status)&&r.method==="POST"||a.status===303&&!Mvr.includes(r.method)){r.method="GET",r.body=null;for(let e of wvr)r.headersList.delete(e)}TLe(DW(r),i)||(r.headersList.delete("authorization",!0),r.headersList.delete("proxy-authorization",!0),r.headersList.delete("cookie",!0),r.headersList.delete("host",!0)),r.body!=null&&(JQ(r.body.source!=null),r.body=OLe(r.body.source)[0]);let s=n.timingInfo;return s.redirectEndTime=s.postRedirectStartTime=aq(n.crossOriginIsolatedCapability),s.redirectStartTime===0&&(s.redirectStartTime=s.startTime),r.urlList.push(i),dvr(r,a),Wxt(n,!0)}async function Fxt(n,t=!1,r=!1){let a=n.request,i=null,s=null,e=null,o=null,u=!1;a.window==="no-window"&&a.redirect==="error"?(i=n,s=a):(s=rvr(a),i={...n},i.request=s);let d=a.credentials==="include"||a.credentials==="same-origin"&&a.responseTainting==="basic",I=s.body?s.body.length:null,h=null;if(s.body==null&&["POST","PUT"].includes(s.method)&&(h="0"),I!=null&&(h=$he(`${I}`)),h!=null&&s.headersList.append("content-length",h,!0),I!=null&&s.keepalive,ULe.is.URL(s.referrer)&&s.headersList.append("referer",$he(s.referrer.href),!0),uvr(s),mvr(s),s.headersList.contains("user-agent",!0)||s.headersList.append("user-agent",zvr,!0),s.cache==="default"&&(s.headersList.contains("if-modified-since",!0)||s.headersList.contains("if-none-match",!0)||s.headersList.contains("if-unmodified-since",!0)||s.headersList.contains("if-match",!0)||s.headersList.contains("if-range",!0))&&(s.cache="no-store"),s.cache==="no-cache"&&!s.preventNoCacheCacheControlHeaderModification&&!s.headersList.contains("cache-control",!0)&&s.headersList.append("cache-control","max-age=0",!0),(s.cache==="no-store"||s.cache==="reload")&&(s.headersList.contains("pragma",!0)||s.headersList.append("pragma","no-cache",!0),s.headersList.contains("cache-control",!0)||s.headersList.append("cache-control","no-cache",!0)),s.headersList.contains("range",!0)&&s.headersList.append("accept-encoding","identity",!0),s.headersList.contains("accept-encoding",!0)||(Nvr(DW(s))?s.headersList.append("accept-encoding","br, gzip, deflate",!0):s.headersList.append("accept-encoding","gzip, deflate",!0)),s.headersList.delete("host",!0),o==null&&(s.cache="no-store"),s.cache!=="no-store"&&s.cache,e==null){if(s.cache==="only-if-cached")return Lo("only if cached");let c=await qvr(i,d,r);!Rvr.has(s.method)&&c.status>=200&&c.status<=399,u&&c.status,e==null&&(e=c)}if(e.urlList=[...s.urlList],s.headersList.contains("range",!0)&&(e.rangeRequested=!0),e.requestIncludesCredentials=d,e.status===407)return a.window==="no-window"?Lo():BQ(n)?jhe(n):Lo("proxy authentication required");if(e.status===421&&!r&&(a.body==null||a.body.source!=null)){if(BQ(n))return jhe(n);n.controller.connection.destroy(),e=await Fxt(n,t,!0)}return e}async function qvr(n,t=!1,r=!1){JQ(!n.controller.connection||n.controller.connection.destroyed),n.controller.connection={abort:null,destroyed:!1,destroy(W,y=!0){this.destroyed||(this.destroyed=!0,y&&this.abort?.(W??new DOMException("The operation was aborted.","AbortError")))}};let a=n.request,i=null,s=n.timingInfo;null==null&&(a.cache="no-store");let o=r?"yes":"no";a.mode;let u=null;if(a.body==null&&n.processRequestEndOfBody)queueMicrotask(()=>n.processRequestEndOfBody());else if(a.body!=null){let W=async function*(F){BQ(n)||(yield F,n.processRequestBodyChunkLength?.(F.byteLength))},y=()=>{BQ(n)||n.processRequestEndOfBody&&n.processRequestEndOfBody()},R=F=>{BQ(n)||(F.name==="AbortError"?n.controller.abort():n.controller.terminate(F))};u=(async function*(){try{for await(let F of a.body.stream)yield*W(F);y()}catch(F){R(F)}})()}try{let{body:W,status:y,statusText:R,headersList:F,socket:C}=await G({body:u});if(C)i=Khe({status:y,statusText:R,headersList:F,socket:C});else{let A=W[Symbol.asyncIterator]();n.controller.next=()=>A.next(),i=Khe({status:y,statusText:R,headersList:F})}}catch(W){return W.name==="AbortError"?(n.controller.connection.destroy(),jhe(n,W)):Lo(W)}let d=()=>n.controller.resume(),I=W=>{BQ(n)||n.controller.abort(W)},h=new ReadableStream({start(W){n.controller.controller=W},pull:d,cancel:I,type:"bytes"});i.body={stream:h,source:null,length:null},n.controller.resume||n.controller.on("terminated",c),n.controller.resume=async()=>{for(;;){let W,y;try{let{done:F,value:C}=await n.controller.next();if(pxt(n))break;W=F?void 0:C}catch(F){n.controller.ended&&!s.encodedBodySize?W=void 0:(W=F,y=!0)}if(W===void 0){vvr(n.controller.controller),jvr(n,i);return}if(s.decodedBodySize+=W?.byteLength??0,y){n.controller.terminate(W);return}let R=new Uint8Array(W);if(R.byteLength&&n.controller.controller.enqueue(R),Hvr(h)){n.controller.terminate();return}if(n.controller.controller.desiredSize<=0)return}};function c(W){pxt(n)?(i.aborted=!0,qhe(h)&&n.controller.controller.error(n.controller.serializedAbortReason)):qhe(h)&&n.controller.controller.error(new TypeError("terminated",{cause:Gvr(W)?W:void 0})),n.controller.connection.destroy()}return i;function G({body:W}){let y=DW(a),R=n.controller.dispatcher;return new Promise((F,C)=>R.dispatch({path:y.pathname+y.search,origin:y.origin,method:a.method,body:R.isMockActive?a.body&&(a.body.source||a.body.stream):W,headers:a.headersList.entries,maxRedirections:0,upgrade:a.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(A){let{connection:E}=n.controller;s.finalConnectionTimingInfo=Avr(void 0,s.postRedirectStartTime,n.crossOriginIsolatedCapability),E.destroyed?A(new DOMException("The operation was aborted.","AbortError")):(n.controller.on("terminated",A),this.abort=E.abort=A),s.finalNetworkRequestStartTime=aq(n.crossOriginIsolatedCapability)},onResponseStarted(){s.finalNetworkResponseStartTime=aq(n.crossOriginIsolatedCapability)},onHeaders(A,E,f,g){if(A<200)return!1;let v=new mxt;for(let Z=0;Z<E.length;Z+=2)v.append(fxt(E[Z]),E[Z+1].toString("latin1"),!0);let N=v.get("location",!0);this.body=new xvr({read:f});let m=N&&a.redirect==="follow"&&gxt.has(A),p=[];if(a.method!=="HEAD"&&a.method!=="CONNECT"&&!vxt.includes(A)&&!m){let Z=v.get("content-encoding",!0),Y=Z?Z.toLowerCase().split(","):[],S=5;if(Y.length>S)return C(new Error(`too many content-encodings in response: ${Y.length}, maximum allowed is ${S}`)),!0;for(let H=Y.length-1;H>=0;--H){let L=Y[H].trim();if(L==="x-gzip"||L==="gzip")p.push(UN.createGunzip({flush:UN.constants.Z_SYNC_FLUSH,finishFlush:UN.constants.Z_SYNC_FLUSH}));else if(L==="deflate")p.push(Fvr({flush:UN.constants.Z_SYNC_FLUSH,finishFlush:UN.constants.Z_SYNC_FLUSH}));else if(L==="br")p.push(UN.createBrotliDecompress({flush:UN.constants.BROTLI_OPERATION_FLUSH,finishFlush:UN.constants.BROTLI_OPERATION_FLUSH}));else if(L==="zstd"&&Uvr)p.push(UN.createZstdDecompress({flush:UN.constants.ZSTD_e_continue,finishFlush:UN.constants.ZSTD_e_end}));else{p.length=0;break}}}let b=this.onError.bind(this);return F({status:A,statusText:g,headersList:v,body:p.length?Vvr(this.body,...p,Z=>{Z&&this.onError(Z)}).on("error",b):this.body.on("error",b)}),!0},onData(A){if(n.controller.dump)return;let E=A;return s.encodedBodySize+=E.byteLength,this.body.push(E)},onComplete(){this.abort&&n.controller.off("terminated",this.abort),n.controller.ended=!0,this.body.push(null)},onError(A){this.abort&&n.controller.off("terminated",this.abort),this.body?.destroy(A),n.controller.terminate(A),C(A)},onUpgrade(A,E,f){if(f.session!=null&&A!==200||f.session==null&&A!==101)return!1;let g=new mxt;for(let v=0;v<E.length;v+=2)g.append(fxt(E[v]),E[v+1].toString("latin1"),!0);return F({status:A,statusText:Jvr[A],headersList:g,socket:f}),!0}}))}}Ext.exports={fetch:Pvr,Fetch:eme,fetching:Axt,finalizeAndReportTiming:Zxt}});var Cxt=ve((_ci,wxt)=>{"use strict";var $vr=vt("node:assert"),{URLSerializer:Rxt}=lv(),{isValidHeaderName:eZr}=o1();function tZr(n,t,r=!1){let a=Rxt(n,r),i=Rxt(t,r);return a===i}function nZr(n){$vr(n!==null);let t=[];for(let r of n.split(","))r=r.trim(),eZr(r)&&t.push(r);return t}wxt.exports={urlEquals:tZr,getFieldValues:nZr}});var Vxt=ve((Pci,xxt)=>{"use strict";var MLe=vt("node:assert"),{kConstruct:rZr}=Po(),{urlEquals:aZr,getFieldValues:zLe}=Cxt(),{kEnumerableProperty:TQ,isDisturbed:iZr}=ki(),{webidl:Ea}=lm(),{cloneResponse:lZr,fromInnerResponse:sZr,getResponseState:oZr}=rq(),{Request:lq,fromInnerRequest:cZr,getRequestState:OW}=hJ(),{fetching:uZr}=iq(),{urlIsHttpHttpsScheme:nme,readAllBytes:IZr}=o1(),{createDeferredPromise:mJ}=vK(),rme=class n{#e;constructor(){arguments[0]!==rZr&&Ea.illegalConstructor(),Ea.util.markAsUncloneable(this),this.#e=arguments[1]}async match(t,r={}){Ea.brandCheck(this,n);let a="Cache.match";Ea.argumentLengthCheck(arguments,1,a),t=Ea.converters.RequestInfo(t),r=Ea.converters.CacheQueryOptions(r,a,"options");let i=this.#a(t,r,1);if(i.length!==0)return i[0]}async matchAll(t=void 0,r={}){Ea.brandCheck(this,n);let a="Cache.matchAll";return t!==void 0&&(t=Ea.converters.RequestInfo(t)),r=Ea.converters.CacheQueryOptions(r,a,"options"),this.#a(t,r)}async add(t){Ea.brandCheck(this,n),Ea.argumentLengthCheck(arguments,1,"Cache.add"),t=Ea.converters.RequestInfo(t);let a=[t];return await this.addAll(a)}async addAll(t){Ea.brandCheck(this,n);let r="Cache.addAll";Ea.argumentLengthCheck(arguments,1,r);let a=[],i=[];for(let c of t){if(c===void 0)throw Ea.errors.conversionFailed({prefix:r,argument:"Argument 1",types:["undefined is not allowed"]});if(c=Ea.converters.RequestInfo(c),typeof c=="string")continue;let G=OW(c);if(!nme(G.url)||G.method!=="GET")throw Ea.errors.exception({header:r,message:"Expected http/s scheme when method is not GET."})}let s=[];for(let c of t){let G=OW(new lq(c));if(!nme(G.url))throw Ea.errors.exception({header:r,message:"Expected http/s scheme."});G.initiator="fetch",G.destination="subresource",i.push(G);let W=mJ();s.push(uZr({request:G,processResponse(y){if(y.type==="error"||y.status===206||y.status<200||y.status>299)W.reject(Ea.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(y.headersList.contains("vary")){let R=zLe(y.headersList.get("vary"));for(let F of R)if(F==="*"){W.reject(Ea.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let C of s)C.abort();return}}},processResponseEndOfBody(y){if(y.aborted){W.reject(new DOMException("aborted","AbortError"));return}W.resolve(y)}})),a.push(W.promise)}let o=await Promise.all(a),u=[],d=0;for(let c of o){let G={type:"put",request:i[d],response:c};u.push(G),d++}let I=mJ(),h=null;try{this.#t(u)}catch(c){h=c}return queueMicrotask(()=>{h===null?I.resolve(void 0):I.reject(h)}),I.promise}async put(t,r){Ea.brandCheck(this,n);let a="Cache.put";Ea.argumentLengthCheck(arguments,2,a),t=Ea.converters.RequestInfo(t),r=Ea.converters.Response(r,a,"response");let i=null;if(Ea.is.Request(t)?i=OW(t):i=OW(new lq(t)),!nme(i.url)||i.method!=="GET")throw Ea.errors.exception({header:a,message:"Expected an http/s scheme when method is not GET"});let s=oZr(r);if(s.status===206)throw Ea.errors.exception({header:a,message:"Got 206 status"});if(s.headersList.contains("vary")){let G=zLe(s.headersList.get("vary"));for(let W of G)if(W==="*")throw Ea.errors.exception({header:a,message:"Got * vary field value"})}if(s.body&&(iZr(s.body.stream)||s.body.stream.locked))throw Ea.errors.exception({header:a,message:"Response body is locked or disturbed"});let e=lZr(s),o=mJ();if(s.body!=null){let W=s.body.stream.getReader();IZr(W,o.resolve,o.reject)}else o.resolve(void 0);let u=[],d={type:"put",request:i,response:e};u.push(d);let I=await o.promise;e.body!=null&&(e.body.source=I);let h=mJ(),c=null;try{this.#t(u)}catch(G){c=G}return queueMicrotask(()=>{c===null?h.resolve():h.reject(c)}),h.promise}async delete(t,r={}){Ea.brandCheck(this,n);let a="Cache.delete";Ea.argumentLengthCheck(arguments,1,a),t=Ea.converters.RequestInfo(t),r=Ea.converters.CacheQueryOptions(r,a,"options");let i=null;if(Ea.is.Request(t)){if(i=OW(t),i.method!=="GET"&&!r.ignoreMethod)return!1}else MLe(typeof t=="string"),i=OW(new lq(t));let s=[],e={type:"delete",request:i,options:r};s.push(e);let o=mJ(),u=null,d;try{d=this.#t(s)}catch(I){u=I}return queueMicrotask(()=>{u===null?o.resolve(!!d?.length):o.reject(u)}),o.promise}async keys(t=void 0,r={}){Ea.brandCheck(this,n);let a="Cache.keys";t!==void 0&&(t=Ea.converters.RequestInfo(t)),r=Ea.converters.CacheQueryOptions(r,a,"options");let i=null;if(t!==void 0)if(Ea.is.Request(t)){if(i=OW(t),i.method!=="GET"&&!r.ignoreMethod)return[]}else typeof t=="string"&&(i=OW(new lq(t)));let s=mJ(),e=[];if(t===void 0)for(let o of this.#e)e.push(o[0]);else{let o=this.#n(i,r);for(let u of o)e.push(u[0])}return queueMicrotask(()=>{let o=[];for(let u of e){let d=cZr(u,void 0,new AbortController().signal,"immutable");o.push(d)}s.resolve(Object.freeze(o))}),s.promise}#t(t){let r=this.#e,a=[...r],i=[],s=[];try{for(let e of t){if(e.type!=="delete"&&e.type!=="put")throw Ea.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(e.type==="delete"&&e.response!=null)throw Ea.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#n(e.request,e.options,i).length)throw new DOMException("???","InvalidStateError");let o;if(e.type==="delete"){if(o=this.#n(e.request,e.options),o.length===0)return[];for(let u of o){let d=r.indexOf(u);MLe(d!==-1),r.splice(d,1)}}else if(e.type==="put"){if(e.response==null)throw Ea.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let u=e.request;if(!nme(u.url))throw Ea.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(u.method!=="GET")throw Ea.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(e.options!=null)throw Ea.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});o=this.#n(e.request);for(let d of o){let I=r.indexOf(d);MLe(I!==-1),r.splice(I,1)}r.push([e.request,e.response]),i.push([e.request,e.response])}s.push([e.request,e.response])}return s}catch(e){throw this.#e.length=0,this.#e=a,e}}#n(t,r,a){let i=[],s=a??this.#e;for(let e of s){let[o,u]=e;this.#r(t,o,u,r)&&i.push(e)}return i}#r(t,r,a=null,i){let s=new URL(t.url),e=new URL(r.url);if(i?.ignoreSearch&&(e.search="",s.search=""),!aZr(s,e,!0))return!1;if(a==null||i?.ignoreVary||!a.headersList.contains("vary"))return!0;let o=zLe(a.headersList.get("vary"));for(let u of o){if(u==="*")return!1;let d=r.headersList.get(u),I=t.headersList.get(u);if(d!==I)return!1}return!0}#a(t,r,a=1/0){let i=null;if(t!==void 0)if(Ea.is.Request(t)){if(i=OW(t),i.method!=="GET"&&!r.ignoreMethod)return[]}else typeof t=="string"&&(i=OW(new lq(t)));let s=[];if(t===void 0)for(let o of this.#e)s.push(o[1]);else{let o=this.#n(i,r);for(let u of o)s.push(u[1])}let e=[];for(let o of s){let u=sZr(o,"immutable");if(e.push(u.clone()),e.length>=a)break}return Object.freeze(e)}};Object.defineProperties(rme.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:TQ,matchAll:TQ,add:TQ,addAll:TQ,put:TQ,delete:TQ,keys:TQ});var Yxt=[{key:"ignoreSearch",converter:Ea.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:Ea.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:Ea.converters.boolean,defaultValue:()=>!1}];Ea.converters.CacheQueryOptions=Ea.dictionaryConverter(Yxt);Ea.converters.MultiCacheQueryOptions=Ea.dictionaryConverter([...Yxt,{key:"cacheName",converter:Ea.converters.DOMString}]);Ea.converters.Response=Ea.interfaceConverter(Ea.is.Response,"Response");Ea.converters["sequence<RequestInfo>"]=Ea.sequenceConverter(Ea.converters.RequestInfo);xxt.exports={Cache:rme}});var Hxt=ve((jci,Qxt)=>{"use strict";var{Cache:ame}=Vxt(),{webidl:hp}=lm(),{kEnumerableProperty:sq}=ki(),{kConstruct:oq}=Po(),ime=class n{#e=new Map;constructor(){arguments[0]!==oq&&hp.illegalConstructor(),hp.util.markAsUncloneable(this)}async match(t,r={}){if(hp.brandCheck(this,n),hp.argumentLengthCheck(arguments,1,"CacheStorage.match"),t=hp.converters.RequestInfo(t),r=hp.converters.MultiCacheQueryOptions(r),r.cacheName!=null){if(this.#e.has(r.cacheName)){let a=this.#e.get(r.cacheName);return await new ame(oq,a).match(t,r)}}else for(let a of this.#e.values()){let s=await new ame(oq,a).match(t,r);if(s!==void 0)return s}}async has(t){hp.brandCheck(this,n);let r="CacheStorage.has";return hp.argumentLengthCheck(arguments,1,r),t=hp.converters.DOMString(t,r,"cacheName"),this.#e.has(t)}async open(t){hp.brandCheck(this,n);let r="CacheStorage.open";if(hp.argumentLengthCheck(arguments,1,r),t=hp.converters.DOMString(t,r,"cacheName"),this.#e.has(t)){let i=this.#e.get(t);return new ame(oq,i)}let a=[];return this.#e.set(t,a),new ame(oq,a)}async delete(t){hp.brandCheck(this,n);let r="CacheStorage.delete";return hp.argumentLengthCheck(arguments,1,r),t=hp.converters.DOMString(t,r,"cacheName"),this.#e.delete(t)}async keys(){return hp.brandCheck(this,n),[...this.#e.keys()]}};Object.defineProperties(ime.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:sq,has:sq,open:sq,delete:sq,keys:sq});Qxt.exports={CacheStorage:ime}});var kxt=ve((Kci,Xxt)=>{"use strict";Xxt.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var _Le=ve((qci,Txt)=>{"use strict";function dZr(n){for(let t=0;t<n.length;++t){let r=n.charCodeAt(t);if(r>=0&&r<=8||r>=10&&r<=31||r===127)return!0}return!1}function Lxt(n){for(let t=0;t<n.length;++t){let r=n.charCodeAt(t);if(r<33||r>126||r===34||r===40||r===41||r===60||r===62||r===64||r===44||r===59||r===58||r===92||r===47||r===91||r===93||r===63||r===61||r===123||r===125)throw new Error("Invalid cookie name")}}function Sxt(n){let t=n.length,r=0;if(n[0]==='"'){if(t===1||n[t-1]!=='"')throw new Error("Invalid cookie value");--t,++r}for(;r<t;){let a=n.charCodeAt(r++);if(a<33||a>126||a===34||a===44||a===59||a===92)throw new Error("Invalid cookie value")}}function Bxt(n){for(let t=0;t<n.length;++t){let r=n.charCodeAt(t);if(r<32||r===127||r===59)throw new Error("Invalid cookie path")}}function hZr(n){if(n.startsWith("-")||n.endsWith(".")||n.endsWith("-"))throw new Error("Invalid cookie domain")}var mZr=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],pZr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],lme=Array(61).fill(0).map((n,t)=>t.toString().padStart(2,"0"));function Jxt(n){return typeof n=="number"&&(n=new Date(n)),`${mZr[n.getUTCDay()]}, ${lme[n.getUTCDate()]} ${pZr[n.getUTCMonth()]} ${n.getUTCFullYear()} ${lme[n.getUTCHours()]}:${lme[n.getUTCMinutes()]}:${lme[n.getUTCSeconds()]} GMT`}function bZr(n){if(n<0)throw new Error("Invalid cookie max-age")}function fZr(n){if(n.name.length===0)return null;Lxt(n.name),Sxt(n.value);let t=[`${n.name}=${n.value}`];n.name.startsWith("__Secure-")&&(n.secure=!0),n.name.startsWith("__Host-")&&(n.secure=!0,n.domain=null,n.path="/"),n.secure&&t.push("Secure"),n.httpOnly&&t.push("HttpOnly"),typeof n.maxAge=="number"&&(bZr(n.maxAge),t.push(`Max-Age=${n.maxAge}`)),n.domain&&(hZr(n.domain),t.push(`Domain=${n.domain}`)),n.path&&(Bxt(n.path),t.push(`Path=${n.path}`)),n.expires&&n.expires.toString()!=="Invalid Date"&&t.push(`Expires=${Jxt(n.expires)}`),n.sameSite&&t.push(`SameSite=${n.sameSite}`);for(let r of n.unparsed){if(!r.includes("="))throw new Error("Invalid unparsed");let[a,...i]=r.split("=");t.push(`${a.trim()}=${i.join("=")}`)}return t.join("; ")}Txt.exports={isCTLExcludingHtab:dZr,validateCookieName:Lxt,validateCookiePath:Bxt,validateCookieValue:Sxt,toIMFDate:Jxt,stringify:fZr}});var Oxt=ve(($ci,Dxt)=>{"use strict";var{collectASequenceOfCodePointsFast:sme}=T5(),{maxNameValuePairSize:GZr,maxAttributeValueSize:gZr}=kxt(),{isCTLExcludingHtab:vZr}=_Le(),ZZr=vt("node:assert"),{unescape:NZr}=vt("node:querystring");function AZr(n){if(vZr(n))return null;let t="",r="",a="",i="";if(n.includes(";")){let s={position:0};t=sme(";",n,s),r=n.slice(s.position)}else t=n;if(!t.includes("="))i=t;else{let s={position:0};a=sme("=",t,s),i=t.slice(s.position+1)}return a=a.trim(),i=i.trim(),a.length+i.length>GZr?null:{name:a,value:NZr(i),...pJ(r)}}function pJ(n,t={}){if(n.length===0)return t;ZZr(n[0]===";"),n=n.slice(1);let r="";n.includes(";")?(r=sme(";",n,{position:0}),n=n.slice(r.length)):(r=n,n="");let a="",i="";if(r.includes("=")){let e={position:0};a=sme("=",r,e),i=r.slice(e.position+1)}else a=r;if(a=a.trim(),i=i.trim(),i.length>gZr)return pJ(n,t);let s=a.toLowerCase();if(s==="expires"){let e=new Date(i);t.expires=e}else if(s==="max-age"){let e=i.charCodeAt(0);if((e<48||e>57)&&i[0]!=="-"||!/^\d+$/.test(i))return pJ(n,t);let o=Number(i);t.maxAge=o}else if(s==="domain"){let e=i;e[0]==="."&&(e=e.slice(1)),e=e.toLowerCase(),t.domain=e}else if(s==="path"){let e="";i.length===0||i[0]!=="/"?e="/":e=i,t.path=e}else if(s==="secure")t.secure=!0;else if(s==="httponly")t.httpOnly=!0;else if(s==="samesite"){let e="Default",o=i.toLowerCase();o.includes("none")&&(e="None"),o.includes("strict")&&(e="Strict"),o.includes("lax")&&(e="Lax"),t.sameSite=e}else t.unparsed??=[],t.unparsed.push(`${a}=${i}`);return pJ(n,t)}Dxt.exports={parseSetCookie:AZr,parseUnparsedAttributes:pJ}});var _xt=ve((eui,zxt)=>{"use strict";var{parseSetCookie:Uxt}=Oxt(),{stringify:WZr}=_Le(),{webidl:vs}=lm(),{Headers:yZr}=kQ(),ome=vs.brandCheckMultiple([yZr,globalThis.Headers].filter(Boolean));function FZr(n){vs.argumentLengthCheck(arguments,1,"getCookies"),ome(n);let t=n.get("cookie"),r={};if(!t)return r;for(let a of t.split(";")){let[i,...s]=a.split("=");r[i.trim()]=s.join("=")}return r}function EZr(n,t,r){ome(n);let a="deleteCookie";vs.argumentLengthCheck(arguments,2,a),t=vs.converters.DOMString(t,a,"name"),r=vs.converters.DeleteCookieAttributes(r),Mxt(n,{name:t,value:"",expires:new Date(0),...r})}function RZr(n){vs.argumentLengthCheck(arguments,1,"getSetCookies"),ome(n);let t=n.getSetCookie();return t?t.map(r=>Uxt(r)):[]}function wZr(n){return n=vs.converters.DOMString(n),Uxt(n)}function Mxt(n,t){vs.argumentLengthCheck(arguments,2,"setCookie"),ome(n),t=vs.converters.Cookie(t);let r=WZr(t);r&&n.append("set-cookie",r,!0)}vs.converters.DeleteCookieAttributes=vs.dictionaryConverter([{converter:vs.nullableConverter(vs.converters.DOMString),key:"path",defaultValue:()=>null},{converter:vs.nullableConverter(vs.converters.DOMString),key:"domain",defaultValue:()=>null}]);vs.converters.Cookie=vs.dictionaryConverter([{converter:vs.converters.DOMString,key:"name"},{converter:vs.converters.DOMString,key:"value"},{converter:vs.nullableConverter(n=>typeof n=="number"?vs.converters["unsigned long long"](n):new Date(n)),key:"expires",defaultValue:()=>null},{converter:vs.nullableConverter(vs.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:vs.nullableConverter(vs.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:vs.nullableConverter(vs.converters.DOMString),key:"path",defaultValue:()=>null},{converter:vs.nullableConverter(vs.converters.boolean),key:"secure",defaultValue:()=>null},{converter:vs.nullableConverter(vs.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:vs.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:vs.sequenceConverter(vs.converters.DOMString),key:"unparsed",defaultValue:()=>[]}]);zxt.exports={getCookies:FZr,deleteCookie:EZr,getSetCookies:RZr,setCookie:Mxt,parseCookie:wZr}});var Ime=ve((tui,jxt)=>{"use strict";var{webidl:xa}=lm(),{kEnumerableProperty:pf}=ki(),{kConstruct:Pxt}=Po(),bJ=class n extends Event{#e;constructor(t,r={}){if(t===Pxt){super(arguments[1],arguments[2]),xa.util.markAsUncloneable(this);return}let a="MessageEvent constructor";xa.argumentLengthCheck(arguments,1,a),t=xa.converters.DOMString(t,a,"type"),r=xa.converters.MessageEventInit(r,a,"eventInitDict"),super(t,r),this.#e=r,xa.util.markAsUncloneable(this)}get data(){return xa.brandCheck(this,n),this.#e.data}get origin(){return xa.brandCheck(this,n),this.#e.origin}get lastEventId(){return xa.brandCheck(this,n),this.#e.lastEventId}get source(){return xa.brandCheck(this,n),this.#e.source}get ports(){return xa.brandCheck(this,n),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(t,r=!1,a=!1,i=null,s="",e="",o=null,u=[]){return xa.brandCheck(this,n),xa.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new n(t,{bubbles:r,cancelable:a,data:i,origin:s,lastEventId:e,source:o,ports:u})}static createFastMessageEvent(t,r){let a=new n(Pxt,t,r);return a.#e=r,a.#e.data??=null,a.#e.origin??="",a.#e.lastEventId??="",a.#e.source??=null,a.#e.ports??=[],a}},{createFastMessageEvent:CZr}=bJ;delete bJ.createFastMessageEvent;var cme=class n extends Event{#e;constructor(t,r={}){let a="CloseEvent constructor";xa.argumentLengthCheck(arguments,1,a),t=xa.converters.DOMString(t,a,"type"),r=xa.converters.CloseEventInit(r),super(t,r),this.#e=r,xa.util.markAsUncloneable(this)}get wasClean(){return xa.brandCheck(this,n),this.#e.wasClean}get code(){return xa.brandCheck(this,n),this.#e.code}get reason(){return xa.brandCheck(this,n),this.#e.reason}},ume=class n extends Event{#e;constructor(t,r){let a="ErrorEvent constructor";xa.argumentLengthCheck(arguments,1,a),super(t,r),xa.util.markAsUncloneable(this),t=xa.converters.DOMString(t,a,"type"),r=xa.converters.ErrorEventInit(r??{}),this.#e=r}get message(){return xa.brandCheck(this,n),this.#e.message}get filename(){return xa.brandCheck(this,n),this.#e.filename}get lineno(){return xa.brandCheck(this,n),this.#e.lineno}get colno(){return xa.brandCheck(this,n),this.#e.colno}get error(){return xa.brandCheck(this,n),this.#e.error}};Object.defineProperties(bJ.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:pf,origin:pf,lastEventId:pf,source:pf,ports:pf,initMessageEvent:pf});Object.defineProperties(cme.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:pf,code:pf,wasClean:pf});Object.defineProperties(ume.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:pf,filename:pf,lineno:pf,colno:pf,error:pf});xa.converters.MessagePort=xa.interfaceConverter(xa.is.MessagePort,"MessagePort");xa.converters["sequence<MessagePort>"]=xa.sequenceConverter(xa.converters.MessagePort);var PLe=[{key:"bubbles",converter:xa.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:xa.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:xa.converters.boolean,defaultValue:()=>!1}];xa.converters.MessageEventInit=xa.dictionaryConverter([...PLe,{key:"data",converter:xa.converters.any,defaultValue:()=>null},{key:"origin",converter:xa.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:xa.converters.DOMString,defaultValue:()=>""},{key:"source",converter:xa.nullableConverter(xa.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:xa.converters["sequence<MessagePort>"],defaultValue:()=>[]}]);xa.converters.CloseEventInit=xa.dictionaryConverter([...PLe,{key:"wasClean",converter:xa.converters.boolean,defaultValue:()=>!1},{key:"code",converter:xa.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:xa.converters.USVString,defaultValue:()=>""}]);xa.converters.ErrorEventInit=xa.dictionaryConverter([...PLe,{key:"message",converter:xa.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:xa.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:xa.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:xa.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:xa.converters.any}]);jxt.exports={MessageEvent:bJ,CloseEvent:cme,ErrorEvent:ume,createFastMessageEvent:CZr}});var Xw=ve((nui,Kxt)=>{"use strict";var YZr="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",xZr={enumerable:!0,writable:!1,configurable:!1},VZr={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},QZr={SENT:1,RECEIVED:2},HZr={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},XZr=65535,kZr={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},LZr=Buffer.allocUnsafe(0),SZr={text:1,typedArray:2,arrayBuffer:3,blob:4};Kxt.exports={uid:YZr,sentCloseFrameState:QZr,staticPropertyDescriptors:xZr,states:VZr,opcodes:HZr,maxUnsigned16Bit:XZr,parserStates:kZr,emptyBuffer:LZr,sendHints:SZr}});var DQ=ve((rui,nVt)=>{"use strict";var{states:dme,opcodes:fJ}=Xw(),{isUtf8:BZr}=vt("node:buffer"),{removeHTTPWhitespace:qxt}=lv(),{collectASequenceOfCodePointsFast:JZr}=T5();function TZr(n){return n===dme.CONNECTING}function DZr(n){return n===dme.OPEN}function OZr(n){return n===dme.CLOSING}function UZr(n){return n===dme.CLOSED}function MZr(n,t,r=(i,s)=>new Event(i,s),a={}){let i=r(n,a);t.dispatchEvent(i)}function zZr(n,t,r){n.onMessage(t,r)}function _Zr(n){return n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer}function PZr(n){if(n.length===0)return!1;for(let t=0;t<n.length;++t){let r=n.charCodeAt(t);if(r<33||r>126||r===34||r===40||r===41||r===44||r===47||r===58||r===59||r===60||r===61||r===62||r===63||r===64||r===91||r===92||r===93||r===123||r===125)return!1}return!0}function jZr(n){return n>=1e3&&n<1015?n!==1004&&n!==1005&&n!==1006:n>=3e3&&n<=4999}function $xt(n){return n===fJ.CLOSE||n===fJ.PING||n===fJ.PONG}function eVt(n){return n===fJ.CONTINUATION}function tVt(n){return n===fJ.TEXT||n===fJ.BINARY}function KZr(n){return tVt(n)||eVt(n)||$xt(n)}function qZr(n){let t={position:0},r=new Map;for(;t.position<n.length;){let a=JZr(";",n,t),[i,s=""]=a.split("=",2);r.set(qxt(i,!0,!1),qxt(s,!1,!0)),t.position++}return r}function $Zr(n){for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(r<48||r>57)return!1}return!0}function eNr(n,t){let r;try{r=new URL(n,t)}catch(a){throw new DOMException(a,"SyntaxError")}if(r.protocol==="http:"?r.protocol="ws:":r.protocol==="https:"&&(r.protocol="wss:"),r.protocol!=="ws:"&&r.protocol!=="wss:")throw new DOMException("expected a ws: or wss: url","SyntaxError");if(r.hash.length||r.href.endsWith("#"))throw new DOMException("hash","SyntaxError");return r}function tNr(n,t){if(n!==null&&n!==1e3&&(n<3e3||n>4999))throw new DOMException("invalid code","InvalidAccessError");if(t!==null){let r=Buffer.byteLength(t);if(r>123)throw new DOMException(`Reason must be less than 123 bytes; received ${r}`,"SyntaxError")}}var nNr=(()=>{if(typeof process.versions.icu=="string"){let n=new TextDecoder("utf-8",{fatal:!0});return n.decode.bind(n)}return function(n){if(BZr(n))return n.toString("utf-8");throw new TypeError("Invalid utf-8 received.")}})();nVt.exports={isConnecting:TZr,isEstablished:DZr,isClosing:OZr,isClosed:UZr,fireEvent:MZr,isValidSubprotocol:PZr,isValidStatusCode:jZr,websocketMessageReceived:zZr,utf8Decode:nNr,isControlFrame:$xt,isContinuationFrame:eVt,isTextBinaryFrame:tVt,isValidOpcode:KZr,parseExtensions:qZr,isValidClientWindowBits:$Zr,toArrayBuffer:_Zr,getURLRecord:eNr,validateCloseCodeAndReason:tNr}});var gJ=ve((aui,aVt)=>{"use strict";var{runtimeFeatures:rNr}=D5(),{maxUnsigned16Bit:rVt,opcodes:aNr}=Xw(),hme=8*1024,cq=null,GJ=hme,iNr=rNr.has("crypto")?vt("node:crypto").randomFillSync:function(t,r,a){for(let i=0;i<t.length;++i)t[i]=Math.random()*255|0;return t};function jLe(){return GJ===hme&&(GJ=0,iNr(cq??=Buffer.allocUnsafeSlow(hme),0,hme)),[cq[GJ++],cq[GJ++],cq[GJ++],cq[GJ++]]}var KLe=class{constructor(t){this.frameData=t}createFrame(t){let r=this.frameData,a=jLe(),i=r?.byteLength??0,s=i,e=6;i>rVt?(e+=8,s=127):i>125&&(e+=2,s=126);let o=Buffer.allocUnsafe(i+e);o[0]=o[1]=0,o[0]|=128,o[0]=(o[0]&240)+t;o[e-4]=a[0],o[e-3]=a[1],o[e-2]=a[2],o[e-1]=a[3],o[1]=s,s===126?o.writeUInt16BE(i,2):s===127&&(o[2]=o[3]=0,o.writeUIntBE(i,4,6)),o[1]|=128;for(let u=0;u<i;++u)o[e+u]=r[u]^a[u&3];return o}static createFastTextFrame(t){let r=jLe(),a=t.length;for(let o=0;o<a;++o)t[o]^=r[o&3];let i=a,s=6;a>rVt?(s+=8,i=127):a>125&&(s+=2,i=126);let e=Buffer.allocUnsafeSlow(s);return e[0]=128|aNr.TEXT,e[1]=i|128,e[s-4]=r[0],e[s-3]=r[1],e[s-2]=r[2],e[s-1]=r[3],i===126?e.writeUInt16BE(a,2):i===127&&(e[2]=e[3]=0,e.writeUIntBE(a,4,6)),[e,t]}};aVt.exports={WebsocketFrameSend:KLe,generateMask:jLe}});var mme=ve((iui,uVt)=>{"use strict";var{uid:lNr,states:qLe,sentCloseFrameState:$Le,emptyBuffer:iVt,opcodes:sNr}=Xw(),{parseExtensions:oNr,isClosed:cNr,isClosing:uNr,isEstablished:oVt,isConnecting:INr,validateCloseCodeAndReason:dNr}=DQ(),{makeRequest:hNr}=hJ(),{fetching:mNr}=iq(),{Headers:pNr,getHeadersList:bNr}=kQ(),{getDecodeSplit:fNr}=o1(),{WebsocketFrameSend:GNr}=gJ(),gNr=vt("node:assert"),{runtimeFeatures:vNr}=D5(),lVt=vNr.has("crypto")?vt("node:crypto"):null,sVt=!1;function ZNr(n,t,r,a,i){let s=n;s.protocol=n.protocol==="ws:"?"http:":"https:";let e=hNr({urlList:[s],client:r,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(i.headers){let I=bNr(new pNr(i.headers));e.headersList=I}let o=lVt.randomBytes(16).toString("base64");e.headersList.append("sec-websocket-key",o,!0),e.headersList.append("sec-websocket-version","13",!0);for(let I of t)e.headersList.append("sec-websocket-protocol",I,!0);return e.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits",!0),mNr({request:e,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(I){if(I.type==="error"||I.status!==101){if(I.socket?.session==null){UW(a,1002,"Received network error or non-101 status code.",I.error);return}if(I.status!==200){UW(a,1002,"Received network error or non-200 status code.",I.error);return}}if(sVt===!1&&I.socket?.session!=null&&(process.emitWarning("WebSocket over HTTP2 is experimental, and subject to change.","ExperimentalWarning"),sVt=!0),t.length!==0&&!I.headersList.get("Sec-WebSocket-Protocol")){UW(a,1002,"Server did not respond with sent protocols.");return}if(I.socket.session==null&&I.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){UW(a,1002,'Server did not set Upgrade header to "websocket".');return}if(I.socket.session==null&&I.headersList.get("Connection")?.toLowerCase()!=="upgrade"){UW(a,1002,'Server did not set Connection header to "upgrade".');return}let h=I.headersList.get("Sec-WebSocket-Accept"),c=lVt.hash("sha1",o+lNr,"base64");if(h!==c){UW(a,1002,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let G=I.headersList.get("Sec-WebSocket-Extensions"),W;if(G!==null&&(W=oNr(G),!W.has("permessage-deflate"))){UW(a,1002,"Sec-WebSocket-Extensions header does not match.");return}let y=I.headersList.get("Sec-WebSocket-Protocol");if(y!==null&&!fNr("sec-websocket-protocol",e.headersList).includes(y)){UW(a,1002,"Protocol was not set in the opening handshake.");return}I.socket.on("data",a.onSocketData),I.socket.on("close",a.onSocketClose),I.socket.on("error",a.onSocketError),a.wasEverConnected=!0,a.onConnectionEstablished(I,W)}})}function cVt(n,t,r,a=!1){if(t??=null,r??="",a&&dNr(t,r),!(cNr(n.readyState)||uNr(n.readyState)))if(!oVt(n.readyState))UW(n),n.readyState=qLe.CLOSING;else if(!n.closeState.has($Le.SENT)&&!n.closeState.has($Le.RECEIVED)){let i=new GNr;r.length!==0&&t===null&&(t=1e3),gNr(t===null||Number.isInteger(t)),t===null&&r.length===0?i.frameData=iVt:t!==null&&r===null?(i.frameData=Buffer.allocUnsafe(2),i.frameData.writeUInt16BE(t,0)):t!==null&&r!==null?(i.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(r)),i.frameData.writeUInt16BE(t,0),i.frameData.write(r,2,"utf-8")):i.frameData=iVt,n.socket.write(i.createFrame(sNr.CLOSE)),n.closeState.add($Le.SENT),n.readyState=qLe.CLOSING}else n.readyState=qLe.CLOSING}function UW(n,t,r,a){oVt(n.readyState)&&cVt(n,t,r,!1),n.controller.abort(),INr(n.readyState)?n.onSocketClose():n.socket?.destroyed===!1&&n.socket.destroy()}uVt.exports={establishWebSocketConnection:ZNr,failWebsocketConnection:UW,closeWebSocketConnection:cVt}});var dVt=ve((lui,IVt)=>{"use strict";var{createInflateRaw:NNr,Z_DEFAULT_WINDOWBITS:ANr}=vt("node:zlib"),{isValidClientWindowBits:WNr}=DQ(),yNr=Buffer.from([0,0,255,255]),pme=Symbol("kBuffer"),bme=Symbol("kLength"),eSe=class{#e;#t={};constructor(t){this.#t.serverNoContextTakeover=t.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=t.get("server_max_window_bits")}decompress(t,r,a){if(!this.#e){let i=ANr;if(this.#t.serverMaxWindowBits){if(!WNr(this.#t.serverMaxWindowBits)){a(new Error("Invalid server_max_window_bits"));return}i=Number.parseInt(this.#t.serverMaxWindowBits)}this.#e=NNr({windowBits:i}),this.#e[pme]=[],this.#e[bme]=0,this.#e.on("data",s=>{this.#e[pme].push(s),this.#e[bme]+=s.length}),this.#e.on("error",s=>{this.#e=null,a(s)})}this.#e.write(t),r&&this.#e.write(yNr),this.#e.flush(()=>{let i=Buffer.concat(this.#e[pme],this.#e[bme]);this.#e[pme].length=0,this.#e[bme]=0,a(null,i)})}};IVt.exports={PerMessageDeflate:eSe}});var rSe=ve((sui,fVt)=>{"use strict";var{Writable:FNr}=vt("node:stream"),ENr=vt("node:assert"),{parserStates:bf,opcodes:vJ,states:RNr,emptyBuffer:hVt,sentCloseFrameState:uq}=Xw(),{isValidStatusCode:wNr,isValidOpcode:CNr,websocketMessageReceived:mVt,utf8Decode:YNr,isControlFrame:pVt,isTextBinaryFrame:tSe,isContinuationFrame:xNr}=DQ(),{failWebsocketConnection:m1}=mme(),{WebsocketFrameSend:bVt}=gJ(),{PerMessageDeflate:VNr}=dVt(),nSe=class extends FNr{#e=[];#t=0;#n=0;#r=!1;#a=bf.INFO;#i={};#u=[];#s;#l;constructor(t,r){super(),this.#l=t,this.#s=r??new Map,this.#s.has("permessage-deflate")&&this.#s.set("permessage-deflate",new VNr(r))}_write(t,r,a){this.#e.push(t),this.#n+=t.length,this.#r=!0,this.run(a)}run(t){for(;this.#r;)if(this.#a===bf.INFO){if(this.#n<2)return t();let r=this.consume(2),a=(r[0]&128)!==0,i=r[0]&15,s=(r[1]&128)===128,e=!a&&i!==vJ.CONTINUATION,o=r[1]&127,u=r[0]&64,d=r[0]&32,I=r[0]&16;if(!CNr(i))return m1(this.#l,1002,"Invalid opcode received"),t();if(s)return m1(this.#l,1002,"Frame cannot be masked"),t();if(u!==0&&!this.#s.has("permessage-deflate")){m1(this.#l,1002,"Expected RSV1 to be clear.");return}if(d!==0||I!==0){m1(this.#l,1002,"RSV1, RSV2, RSV3 must be clear");return}if(e&&!tSe(i)){m1(this.#l,1002,"Invalid frame type was fragmented.");return}if(tSe(i)&&this.#u.length>0){m1(this.#l,1002,"Expected continuation frame");return}if(this.#i.fragmented&&e){m1(this.#l,1002,"Fragmented frame exceeded 125 bytes.");return}if((o>125||e)&&pVt(i)){m1(this.#l,1002,"Control frame either too large or fragmented");return}if(xNr(i)&&this.#u.length===0&&!this.#i.compressed){m1(this.#l,1002,"Unexpected continuation frame");return}o<=125?(this.#i.payloadLength=o,this.#a=bf.READ_DATA):o===126?this.#a=bf.PAYLOADLENGTH_16:o===127&&(this.#a=bf.PAYLOADLENGTH_64),tSe(i)&&(this.#i.binaryType=i,this.#i.compressed=u!==0),this.#i.opcode=i,this.#i.masked=s,this.#i.fin=a,this.#i.fragmented=e}else if(this.#a===bf.PAYLOADLENGTH_16){if(this.#n<2)return t();let r=this.consume(2);this.#i.payloadLength=r.readUInt16BE(0),this.#a=bf.READ_DATA}else if(this.#a===bf.PAYLOADLENGTH_64){if(this.#n<8)return t();let r=this.consume(8),a=r.readUInt32BE(0);if(a>2**31-1){m1(this.#l,1009,"Received payload length > 2^31 bytes.");return}let i=r.readUInt32BE(4);this.#i.payloadLength=(a<<8)+i,this.#a=bf.READ_DATA}else if(this.#a===bf.READ_DATA){if(this.#n<this.#i.payloadLength)return t();let r=this.consume(this.#i.payloadLength);if(pVt(this.#i.opcode))this.#r=this.parseControlFrame(r),this.#a=bf.INFO;else if(!this.#i.compressed)this.writeFragments(r),!this.#i.fragmented&&this.#i.fin&&mVt(this.#l,this.#i.binaryType,this.consumeFragments()),this.#a=bf.INFO;else{this.#s.get("permessage-deflate").decompress(r,this.#i.fin,(a,i)=>{if(a){m1(this.#l,1007,a.message);return}if(this.writeFragments(i),!this.#i.fin){this.#a=bf.INFO,this.#r=!0,this.run(t);return}mVt(this.#l,this.#i.binaryType,this.consumeFragments()),this.#r=!0,this.#a=bf.INFO,this.run(t)}),this.#r=!1;break}}}consume(t){if(t>this.#n)throw new Error("Called consume() before buffers satiated.");if(t===0)return hVt;this.#n-=t;let r=this.#e[0];if(r.length>t)return this.#e[0]=r.subarray(t,r.length),r.subarray(0,t);if(r.length===t)return this.#e.shift();{let a=0,i=Buffer.allocUnsafeSlow(t);for(;a!==t;){let s=this.#e[0],e=s.length;if(e+a===t){i.set(this.#e.shift(),a);break}else if(e+a>t){i.set(s.subarray(0,t-a),a),this.#e[0]=s.subarray(t-a);break}else i.set(this.#e.shift(),a),a+=e}return i}}writeFragments(t){this.#t+=t.length,this.#u.push(t)}consumeFragments(){let t=this.#u;if(t.length===1)return this.#t=0,t.shift();let r=0,a=Buffer.allocUnsafeSlow(this.#t);for(let i=0;i<t.length;++i){let s=t[i];a.set(s,r),r+=s.length}return this.#u=[],this.#t=0,a}parseCloseBody(t){ENr(t.length!==1);let r;if(t.length>=2&&(r=t.readUInt16BE(0)),r!==void 0&&!wNr(r))return{code:1002,reason:"Invalid status code",error:!0};let a=t.subarray(2);a[0]===239&&a[1]===187&&a[2]===191&&(a=a.subarray(3));try{a=YNr(a)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:r,reason:a,error:!1}}parseControlFrame(t){let{opcode:r,payloadLength:a}=this.#i;if(r===vJ.CLOSE){if(a===1)return m1(this.#l,1002,"Received close frame with a 1-byte body."),!1;if(this.#i.closeInfo=this.parseCloseBody(t),this.#i.closeInfo.error){let{code:i,reason:s}=this.#i.closeInfo;return m1(this.#l,i,s),!1}if(!this.#l.closeState.has(uq.SENT)&&!this.#l.closeState.has(uq.RECEIVED)){let i=hVt;this.#i.closeInfo.code&&(i=Buffer.allocUnsafe(2),i.writeUInt16BE(this.#i.closeInfo.code,0));let s=new bVt(i);this.#l.socket.write(s.createFrame(vJ.CLOSE)),this.#l.closeState.add(uq.SENT)}return this.#l.readyState=RNr.CLOSING,this.#l.closeState.add(uq.RECEIVED),!1}else if(r===vJ.PING){if(!this.#l.closeState.has(uq.RECEIVED)){let i=new bVt(t);this.#l.socket.write(i.createFrame(vJ.PONG)),this.#l.onPing(t)}}else r===vJ.PONG&&this.#l.onPong(t);return!0}get closingInfo(){return this.#i.closeInfo}};fVt.exports={ByteParser:nSe}});var ZVt=ve((oui,vVt)=>{"use strict";var{WebsocketFrameSend:gVt}=gJ(),{opcodes:GVt,sendHints:OQ}=Xw(),QNr=Bke(),iSe=class{#e=new QNr;#t=!1;#n;constructor(t){this.#n=t}add(t,r,a){if(a!==OQ.blob){if(this.#t){let s={promise:null,callback:r,frame:aSe(t,a)};this.#e.push(s)}else if(a===OQ.text){let{0:s,1:e}=gVt.createFastTextFrame(t);this.#n.cork(),this.#n.write(s),this.#n.write(e,r),this.#n.uncork()}else this.#n.write(aSe(t,a),r);return}let i={promise:t.arrayBuffer().then(s=>{i.promise=null,i.frame=aSe(s,a)}),callback:r,frame:null};this.#e.push(i),this.#t||this.#r()}async#r(){this.#t=!0;let t=this.#e;for(;!t.isEmpty();){let r=t.shift();r.promise!==null&&await r.promise,this.#n.write(r.frame,r.callback),r.callback=r.frame=null}this.#t=!1}};function aSe(n,t){return new gVt(HNr(n,t)).createFrame(t===OQ.text?GVt.TEXT:GVt.BINARY)}function HNr(n,t){switch(t){case OQ.text:case OQ.typedArray:return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);case OQ.arrayBuffer:case OQ.blob:return new Uint8Array(n)}}vVt.exports={SendQueue:iSe}});var EVt=ve((cui,FVt)=>{"use strict";var{isArrayBuffer:XNr}=vt("node:util/types"),{webidl:Xa}=lm(),{URLSerializer:kNr}=lv(),{environmentSettingsObject:NVt}=o1(),{staticPropertyDescriptors:kw,states:P5,sentCloseFrameState:lSe,sendHints:fme,opcodes:sSe}=Xw(),{isConnecting:LNr,isEstablished:AVt,isClosing:WVt,isClosed:SNr,isValidSubprotocol:BNr,fireEvent:Gme,utf8Decode:JNr,toArrayBuffer:TNr,getURLRecord:DNr}=DQ(),{establishWebSocketConnection:ONr,closeWebSocketConnection:UNr,failWebsocketConnection:yVt}=mme(),{ByteParser:MNr}=rSe(),{kEnumerableProperty:pv}=ki(),{getGlobalDispatcher:zNr}=Hhe(),{ErrorEvent:_Nr,CloseEvent:PNr,createFastMessageEvent:jNr}=Ime(),{SendQueue:KNr}=ZVt(),{WebsocketFrameSend:qNr}=gJ(),{channels:MW}=vw(),kb=class n extends EventTarget{#e={open:null,error:null,close:null,message:null};#t=0;#n="";#r="";#a;#i={onConnectionEstablished:(t,r)=>this.#d(t,r),onMessage:(t,r)=>this.#I(t,r),onParserError:t=>yVt(this.#i,null,t.message),onParserDrain:()=>this.#h(),onSocketData:t=>{this.#l.write(t)||this.#i.socket.pause()},onSocketError:t=>{this.#i.readyState=P5.CLOSING,MW.socketError.hasSubscribers&&MW.socketError.publish(t),this.#i.socket.destroy()},onSocketClose:()=>this.#o(),onPing:t=>{MW.ping.hasSubscribers&&MW.ping.publish({payload:t,websocket:this})},onPong:t=>{MW.pong.hasSubscribers&&MW.pong.publish({payload:t,websocket:this})},readyState:P5.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#u;#s;#l;constructor(t,r=[]){super(),Xa.util.markAsUncloneable(this);let a="WebSocket constructor";Xa.argumentLengthCheck(arguments,1,a);let i=Xa.converters["DOMString or sequence<DOMString> or WebSocketInit"](r,a,"options");t=Xa.converters.USVString(t),r=i.protocols;let s=NVt.settingsObject.baseUrl,e=DNr(t,s);if(typeof r=="string"&&(r=[r]),r.length!==new Set(r.map(u=>u.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(r.length>0&&!r.every(u=>BNr(u)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this.#u=new URL(e.href);let o=NVt.settingsObject;this.#i.controller=ONr(e,r,o,this.#i,i),this.#i.readyState=n.CONNECTING,this.#s="blob"}close(t=void 0,r=void 0){Xa.brandCheck(this,n),t!==void 0&&(t=Xa.converters["unsigned short"](t,"WebSocket.close","code",Xa.attributes.Clamp)),r!==void 0&&(r=Xa.converters.USVString(r)),t??=null,r??="",UNr(this.#i,t,r,!0)}send(t){Xa.brandCheck(this,n);let r="WebSocket.send";if(Xa.argumentLengthCheck(arguments,1,r),t=Xa.converters.WebSocketSendData(t,r,"data"),LNr(this.#i.readyState))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!AVt(this.#i.readyState)||WVt(this.#i.readyState)))if(typeof t=="string"){let a=Buffer.from(t);this.#t+=a.byteLength,this.#a.add(a,()=>{this.#t-=a.byteLength},fme.text)}else XNr(t)?(this.#t+=t.byteLength,this.#a.add(t,()=>{this.#t-=t.byteLength},fme.arrayBuffer)):ArrayBuffer.isView(t)?(this.#t+=t.byteLength,this.#a.add(t,()=>{this.#t-=t.byteLength},fme.typedArray)):Xa.is.Blob(t)&&(this.#t+=t.size,this.#a.add(t,()=>{this.#t-=t.size},fme.blob))}get readyState(){return Xa.brandCheck(this,n),this.#i.readyState}get bufferedAmount(){return Xa.brandCheck(this,n),this.#t}get url(){return Xa.brandCheck(this,n),kNr(this.#u)}get extensions(){return Xa.brandCheck(this,n),this.#r}get protocol(){return Xa.brandCheck(this,n),this.#n}get onopen(){return Xa.brandCheck(this,n),this.#e.open}set onopen(t){Xa.brandCheck(this,n),this.#e.open&&this.removeEventListener("open",this.#e.open);let r=Xa.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("open",r),this.#e.open=t):this.#e.open=null}get onerror(){return Xa.brandCheck(this,n),this.#e.error}set onerror(t){Xa.brandCheck(this,n),this.#e.error&&this.removeEventListener("error",this.#e.error);let r=Xa.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("error",r),this.#e.error=t):this.#e.error=null}get onclose(){return Xa.brandCheck(this,n),this.#e.close}set onclose(t){Xa.brandCheck(this,n),this.#e.close&&this.removeEventListener("close",this.#e.close);let r=Xa.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("close",r),this.#e.close=t):this.#e.close=null}get onmessage(){return Xa.brandCheck(this,n),this.#e.message}set onmessage(t){Xa.brandCheck(this,n),this.#e.message&&this.removeEventListener("message",this.#e.message);let r=Xa.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("message",r),this.#e.message=t):this.#e.message=null}get binaryType(){return Xa.brandCheck(this,n),this.#s}set binaryType(t){Xa.brandCheck(this,n),t!=="blob"&&t!=="arraybuffer"?this.#s="blob":this.#s=t}#d(t,r){this.#i.socket=t.socket;let a=new MNr(this.#i,r);a.on("drain",()=>this.#i.onParserDrain()),a.on("error",e=>this.#i.onParserError(e)),this.#l=a,this.#a=new KNr(t.socket),this.#i.readyState=P5.OPEN;let i=t.headersList.get("sec-websocket-extensions");i!==null&&(this.#r=i);let s=t.headersList.get("sec-websocket-protocol");if(s!==null&&(this.#n=s),Gme("open",this),MW.open.hasSubscribers){let e=t.headersList.entries;MW.open.publish({address:t.socket.address(),protocol:this.#n,extensions:this.#r,websocket:this,handshakeResponse:{status:t.status,statusText:t.statusText,headers:e}})}}#I(t,r){if(this.#i.readyState!==P5.OPEN)return;let a;if(t===sSe.TEXT)try{a=JNr(r)}catch{yVt(this.#i,1007,"Received invalid UTF-8 in text frame.");return}else t===sSe.BINARY&&(this.#s==="blob"?a=new Blob([r]):a=TNr(r));Gme("message",this,jNr,{origin:this.#u.origin,data:a})}#h(){this.#i.socket.resume()}#o(){let t=this.#i.closeState.has(lSe.SENT)&&this.#i.closeState.has(lSe.RECEIVED),r=1005,a="",i=this.#l?.closingInfo;i&&!i.error&&(r=i.code??1005,a=i.reason),this.#i.readyState=P5.CLOSED,this.#i.closeState.has(lSe.RECEIVED)||(r=1006,Gme("error",this,(s,e)=>new _Nr(s,e),{error:new TypeError(a)})),Gme("close",this,(s,e)=>new PNr(s,e),{wasClean:t,code:r,reason:a}),MW.close.hasSubscribers&&MW.close.publish({websocket:this,code:r,reason:a})}static ping(t,r){if(Buffer.isBuffer(r)){if(r.length>125)throw new TypeError("A PING frame cannot have a body larger than 125 bytes.")}else if(r!==void 0)throw new TypeError("Expected buffer payload");let a=t.#i.readyState;if(AVt(a)&&!WVt(a)&&!SNr(a)){let i=new qNr(r);t.#i.socket.write(i.createFrame(sSe.PING))}}},{ping:$Nr}=kb;Reflect.deleteProperty(kb,"ping");kb.CONNECTING=kb.prototype.CONNECTING=P5.CONNECTING;kb.OPEN=kb.prototype.OPEN=P5.OPEN;kb.CLOSING=kb.prototype.CLOSING=P5.CLOSING;kb.CLOSED=kb.prototype.CLOSED=P5.CLOSED;Object.defineProperties(kb.prototype,{CONNECTING:kw,OPEN:kw,CLOSING:kw,CLOSED:kw,url:pv,readyState:pv,bufferedAmount:pv,onopen:pv,onerror:pv,onclose:pv,close:pv,onmessage:pv,binaryType:pv,send:pv,extensions:pv,protocol:pv,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(kb,{CONNECTING:kw,OPEN:kw,CLOSING:kw,CLOSED:kw});Xa.converters["sequence<DOMString>"]=Xa.sequenceConverter(Xa.converters.DOMString);Xa.converters["DOMString or sequence<DOMString>"]=function(n,t,r){return Xa.util.Type(n)===Xa.util.Types.OBJECT&&Symbol.iterator in n?Xa.converters["sequence<DOMString>"](n):Xa.converters.DOMString(n,t,r)};Xa.converters.WebSocketInit=Xa.dictionaryConverter([{key:"protocols",converter:Xa.converters["DOMString or sequence<DOMString>"],defaultValue:()=>[]},{key:"dispatcher",converter:Xa.converters.any,defaultValue:()=>zNr()},{key:"headers",converter:Xa.nullableConverter(Xa.converters.HeadersInit)}]);Xa.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(n){return Xa.util.Type(n)===Xa.util.Types.OBJECT&&!(Symbol.iterator in n)?Xa.converters.WebSocketInit(n):{protocols:Xa.converters["DOMString or sequence<DOMString>"](n)}};Xa.converters.WebSocketSendData=function(n){return Xa.util.Type(n)===Xa.util.Types.OBJECT&&(Xa.is.Blob(n)||Xa.is.BufferSource(n))?n:Xa.converters.USVString(n)};FVt.exports={WebSocket:kb,ping:$Nr}});var oSe=ve((uui,CVt)=>{"use strict";var{webidl:gme}=lm(),{validateCloseCodeAndReason:eAr}=DQ(),{kConstruct:RVt}=Po(),{kEnumerableProperty:wVt}=ki();function tAr(){class n extends DOMException{get reason(){return""}}return new n().reason!==void 0?DOMException:new Proxy(DOMException,{construct(t,r,a){let i=Reflect.construct(t,r,t);return Object.setPrototypeOf(i,a.prototype),i}})}var UQ=class n extends tAr(){#e;#t;constructor(t="",r=void 0){if(t=gme.converters.DOMString(t,"WebSocketError","message"),super(t,"WebSocketError"),r===RVt)return;r!==null&&(r=gme.converters.WebSocketCloseInfo(r));let a=r.closeCode??null,i=r.reason??"";eAr(a,i),i.length!==0&&a===null&&(a=1e3),this.#e=a,this.#t=i}get closeCode(){return this.#e}get reason(){return this.#t}static createUnvalidatedWebSocketError(t,r,a){let i=new n(t,RVt);return i.#e=r,i.#t=a,i}},{createUnvalidatedWebSocketError:nAr}=UQ;delete UQ.createUnvalidatedWebSocketError;Object.defineProperties(UQ.prototype,{closeCode:wVt,reason:wVt,[Symbol.toStringTag]:{value:"WebSocketError",writable:!1,enumerable:!1,configurable:!0}});gme.is.WebSocketError=gme.util.MakeTypeAssertion(UQ);CVt.exports={WebSocketError:UQ,createUnvalidatedWebSocketError:nAr}});var HVt=ve((Iui,QVt)=>{"use strict";var{createDeferredPromise:cSe}=vK(),{environmentSettingsObject:YVt}=o1(),{states:ZJ,opcodes:vme,sentCloseFrameState:NJ}=Xw(),{webidl:pI}=lm(),{getURLRecord:rAr,isValidSubprotocol:aAr,isEstablished:iAr,utf8Decode:lAr}=DQ(),{establishWebSocketConnection:sAr,failWebsocketConnection:uSe,closeWebSocketConnection:ISe}=mme(),{channels:xVt}=vw(),{WebsocketFrameSend:oAr}=gJ(),{ByteParser:cAr}=rSe(),{WebSocketError:uAr,createUnvalidatedWebSocketError:IAr}=oSe(),{kEnumerableProperty:Zme}=ki(),{utf8DecodeBytes:dAr}=pK(),VVt=!1,Nme=class{#e;#t;#n;#r;#a;#i;#u=!1;#s={onConnectionEstablished:(t,r)=>this.#I(t,r),onMessage:(t,r)=>this.#h(t,r),onParserError:t=>uSe(this.#s,null,t.message),onParserDrain:()=>this.#s.socket.resume(),onSocketData:t=>{this.#l.write(t)||this.#s.socket.pause()},onSocketError:t=>{this.#s.readyState=ZJ.CLOSING,xVt.socketError.hasSubscribers&&xVt.socketError.publish(t),this.#s.socket.destroy()},onSocketClose:()=>this.#o(),onPing:()=>{},onPong:()=>{},readyState:ZJ.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#l;constructor(t,r=void 0){VVt||(process.emitWarning("WebSocketStream is experimental! Expect it to change at any time.",{code:"UNDICI-WSS"}),VVt=!0),pI.argumentLengthCheck(arguments,1,"WebSocket"),t=pI.converters.USVString(t),r!==null&&(r=pI.converters.WebSocketStreamOptions(r));let a=YVt.settingsObject.baseUrl,i=rAr(t,a),s=r.protocols;if(s.length!==new Set(s.map(o=>o.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(s.length>0&&!s.every(o=>aAr(o)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(this.#e=i.toString(),this.#t=cSe(),this.#n=cSe(),r.signal!=null){let o=r.signal;if(o.aborted){this.#t.reject(o.reason),this.#n.reject(o.reason);return}o.addEventListener("abort",()=>{iAr(this.#s.readyState)||(uSe(this.#s),this.#s.readyState=ZJ.CLOSING,this.#t.reject(o.reason),this.#n.reject(o.reason),this.#u=!0)},{once:!0})}let e=YVt.settingsObject;this.#s.controller=sAr(i,s,e,this.#s,r)}get url(){return this.#e.toString()}get opened(){return this.#t.promise}get closed(){return this.#n.promise}close(t=void 0){t!==null&&(t=pI.converters.WebSocketCloseInfo(t));let r=t.closeCode??null,a=t.reason;ISe(this.#s,r,a,!0)}#d(t){t=pI.converters.WebSocketStreamWrite(t);let r=cSe(),a=null,i=null;if(pI.is.BufferSource(t))a=new Uint8Array(ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t.slice()),i=vme.BINARY;else{let s;try{s=pI.converters.DOMString(t)}catch(e){return r.reject(e),r.promise}a=new TextEncoder().encode(s),i=vme.TEXT}if(!this.#s.closeState.has(NJ.SENT)&&!this.#s.closeState.has(NJ.RECEIVED)){let s=new oAr(a);this.#s.socket.write(s.createFrame(i),()=>{r.resolve(void 0)})}return r.promise}#I(t,r){this.#s.socket=t.socket;let a=new cAr(this.#s,r);a.on("drain",()=>this.#s.onParserDrain()),a.on("error",u=>this.#s.onParserError(u)),this.#l=a,this.#s.readyState=ZJ.OPEN;let i=r??"",s=t.headersList.get("sec-websocket-protocol")??"",e=new ReadableStream({start:u=>{this.#a=u},pull(u){let d;for(;u.desiredSize>0&&(d=t.socket.read())!==null;)u.enqueue(d)},cancel:u=>this.#f(u)}),o=new WritableStream({write:u=>this.#d(u),close:()=>ISe(this.#s,null,null),abort:u=>this.#m(u)});this.#r=e,this.#i=o,this.#t.resolve({extensions:i,protocol:s,readable:e,writable:o})}#h(t,r){if(this.#s.readyState!==ZJ.OPEN)return;let a;if(t===vme.TEXT)try{a=lAr(r)}catch{uSe(this.#s,"Received invalid UTF-8 in text frame.");return}else t===vme.BINARY&&(a=new Uint8Array(r.buffer,r.byteOffset,r.byteLength));this.#a.enqueue(a)}#o(){let t=this.#s.closeState.has(NJ.SENT)&&this.#s.closeState.has(NJ.RECEIVED);if(this.#s.readyState=ZJ.CLOSED,this.#u)return;this.#s.wasEverConnected||this.#t.reject(new uAr("Socket never opened"));let r=this.#l.closingInfo,a=r?.code??1005;!this.#s.closeState.has(NJ.SENT)&&!this.#s.closeState.has(NJ.RECEIVED)&&(a=1006);let i=r?.reason==null?"":dAr(Buffer.from(r.reason));if(t)this.#a.close(),this.#i.locked||this.#i.abort(new DOMException("A closed WebSocketStream cannot be written to","InvalidStateError")),this.#n.resolve({closeCode:a,reason:i});else{let s=IAr("unclean close",a,i);this.#a.error(s),this.#i.abort(s),this.#n.reject(s)}}#m(t){let r=null,a="";pI.is.WebSocketError(t)&&(r=t.closeCode,a=t.reason),ISe(this.#s,r,a)}#f(t){this.#m(t)}};Object.defineProperties(Nme.prototype,{url:Zme,opened:Zme,closed:Zme,close:Zme,[Symbol.toStringTag]:{value:"WebSocketStream",writable:!1,enumerable:!1,configurable:!0}});pI.converters.WebSocketStreamOptions=pI.dictionaryConverter([{key:"protocols",converter:pI.sequenceConverter(pI.converters.USVString),defaultValue:()=>[]},{key:"signal",converter:pI.nullableConverter(pI.converters.AbortSignal),defaultValue:()=>null}]);pI.converters.WebSocketCloseInfo=pI.dictionaryConverter([{key:"closeCode",converter:n=>pI.converters["unsigned short"](n,pI.attributes.EnforceRange)},{key:"reason",converter:pI.converters.USVString,defaultValue:()=>""}]);pI.converters.WebSocketStreamWrite=function(n){return typeof n=="string"?pI.converters.USVString(n):pI.converters.BufferSource(n)};QVt.exports={WebSocketStream:Nme}});var kVt=ve((dui,XVt)=>{"use strict";function hAr(n){return n.indexOf("\0")===-1}function mAr(n){if(n.length===0)return!1;for(let t=0;t<n.length;t++)if(n.charCodeAt(t)<48||n.charCodeAt(t)>57)return!1;return!0}XVt.exports={isValidLastEventId:hAr,isASCIINumber:mAr}});var JVt=ve((hui,BVt)=>{"use strict";var{Transform:pAr}=vt("node:stream"),{isASCIINumber:LVt,isValidLastEventId:SVt}=kVt(),j5=[239,187,191],dSe=10,Ame=13,bAr=58,fAr=32,hSe=class extends pAr{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(t={}){t.readableObjectMode=!0,super(t),this.state=t.eventSourceSettings||{},t.push&&(this.push=t.push)}_transform(t,r,a){if(t.length===0){a();return}if(this.buffer?this.buffer=Buffer.concat([this.buffer,t]):this.buffer=t,this.checkBOM)switch(this.buffer.length){case 1:if(this.buffer[0]===j5[0]){a();return}this.checkBOM=!1,a();return;case 2:if(this.buffer[0]===j5[0]&&this.buffer[1]===j5[1]){a();return}this.checkBOM=!1;break;case 3:if(this.buffer[0]===j5[0]&&this.buffer[1]===j5[1]&&this.buffer[2]===j5[2]){this.buffer=Buffer.alloc(0),this.checkBOM=!1,a();return}this.checkBOM=!1;break;default:this.buffer[0]===j5[0]&&this.buffer[1]===j5[1]&&this.buffer[2]===j5[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1;break}for(;this.pos<this.buffer.length;){if(this.eventEndCheck){if(this.crlfCheck){if(this.buffer[this.pos]===dSe){this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.crlfCheck=!1;continue}this.crlfCheck=!1}if(this.buffer[this.pos]===dSe||this.buffer[this.pos]===Ame){this.buffer[this.pos]===Ame&&(this.crlfCheck=!0),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,(this.event.data!==void 0||this.event.event||this.event.id!==void 0||this.event.retry)&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(this.buffer[this.pos]===dSe||this.buffer[this.pos]===Ame){this.buffer[this.pos]===Ame&&(this.crlfCheck=!0),this.parseLine(this.buffer.subarray(0,this.pos),this.event),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.eventEndCheck=!0;continue}this.pos++}a()}parseLine(t,r){if(t.length===0)return;let a=t.indexOf(bAr);if(a===0)return;let i="",s="";if(a!==-1){i=t.subarray(0,a).toString("utf8");let e=a+1;t[e]===fAr&&++e,s=t.subarray(e).toString("utf8")}else i=t.toString("utf8"),s="";switch(i){case"data":r[i]===void 0?r[i]=s:r[i]+=`
|
|
699
|
-
${s}`;break;case"retry":LVt(s)&&(r[i]=s);break;case"id":SVt(s)&&(r[i]=s);break;case"event":s.length>0&&(r[i]=s);break}}processEvent(t){t.retry&&LVt(t.retry)&&(this.state.reconnectionTime=parseInt(t.retry,10)),t.id!==void 0&&SVt(t.id)&&(this.state.lastEventId=t.id),t.data!==void 0&&this.push({type:t.event||"message",options:{data:t.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};BVt.exports={EventSourceStream:hSe}});var PVt=ve((mui,_Vt)=>{"use strict";var{pipeline:GAr}=vt("node:stream"),{fetching:gAr}=iq(),{makeRequest:vAr}=hJ(),{webidl:Lb}=lm(),{EventSourceStream:ZAr}=JVt(),{parseMIMEType:NAr}=lv(),{createFastMessageEvent:AAr}=Ime(),{isNetworkError:TVt}=rq(),{kEnumerableProperty:MQ}=ki(),{environmentSettingsObject:DVt}=o1(),OVt=!1,UVt=3e3,Iq=0,MVt=1,dq=2,WAr="anonymous",yAr="use-credentials",AJ=class n extends EventTarget{#e={open:null,error:null,message:null};#t;#n=!1;#r=Iq;#a=null;#i=null;#u;#s;constructor(t,r={}){super(),Lb.util.markAsUncloneable(this);let a="EventSource constructor";Lb.argumentLengthCheck(arguments,1,a),OVt||(OVt=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),t=Lb.converters.USVString(t),r=Lb.converters.EventSourceInitDict(r,a,"eventSourceInitDict"),this.#u=r.node.dispatcher||r.dispatcher,this.#s={lastEventId:"",reconnectionTime:r.node.reconnectionTime};let i=DVt,s;try{s=new URL(t,i.settingsObject.baseUrl),this.#s.origin=s.origin}catch(u){throw new DOMException(u,"SyntaxError")}this.#t=s.href;let e=WAr;r.withCredentials===!0&&(e=yAr,this.#n=!0);let o={redirect:"follow",keepalive:!0,mode:"cors",credentials:e==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};o.client=DVt.settingsObject,o.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],o.cache="no-store",o.initiator="other",o.urlList=[new URL(this.#t)],this.#a=vAr(o),this.#l()}get readyState(){return this.#r}get url(){return this.#t}get withCredentials(){return this.#n}#l(){if(this.#r===dq)return;this.#r=Iq;let t={request:this.#a,dispatcher:this.#u},r=a=>{if(!TVt(a))return this.#d()};t.processResponseEndOfBody=r,t.processResponse=a=>{if(TVt(a))if(a.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#d();return}let i=a.headersList.get("content-type",!0),s=i!==null?NAr(i):"failure",e=s!=="failure"&&s.essence==="text/event-stream";if(a.status!==200||e===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#r=MVt,this.dispatchEvent(new Event("open")),this.#s.origin=a.urlList[a.urlList.length-1].origin;let o=new ZAr({eventSourceSettings:this.#s,push:u=>{this.dispatchEvent(AAr(u.type,u.options))}});GAr(a.body.stream,o,u=>{u?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#i=gAr(t)}#d(){this.#r!==dq&&(this.#r=Iq,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#r===Iq&&(this.#s.lastEventId.length&&this.#a.headersList.set("last-event-id",this.#s.lastEventId,!0),this.#l())},this.#s.reconnectionTime)?.unref())}close(){Lb.brandCheck(this,n),this.#r!==dq&&(this.#r=dq,this.#i.abort(),this.#a=null)}get onopen(){return this.#e.open}set onopen(t){this.#e.open&&this.removeEventListener("open",this.#e.open);let r=Lb.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("open",r),this.#e.open=t):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(t){this.#e.message&&this.removeEventListener("message",this.#e.message);let r=Lb.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("message",r),this.#e.message=t):this.#e.message=null}get onerror(){return this.#e.error}set onerror(t){this.#e.error&&this.removeEventListener("error",this.#e.error);let r=Lb.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("error",r),this.#e.error=t):this.#e.error=null}},zVt={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Iq,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:MVt,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:dq,writable:!1}};Object.defineProperties(AJ,zVt);Object.defineProperties(AJ.prototype,zVt);Object.defineProperties(AJ.prototype,{close:MQ,onerror:MQ,onmessage:MQ,onopen:MQ,readyState:MQ,url:MQ,withCredentials:MQ});Lb.converters.EventSourceInitDict=Lb.dictionaryConverter([{key:"withCredentials",converter:Lb.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:Lb.converters.any},{key:"node",converter:Lb.dictionaryConverter([{key:"reconnectionTime",converter:Lb.converters["unsigned long"],defaultValue:()=>UVt},{key:"dispatcher",converter:Lb.converters.any}]),defaultValue:()=>({})}]);_Vt.exports={EventSource:AJ,defaultReconnectionTime:UVt}});var mq=ve((pui,ra)=>{"use strict";var FAr=Cw(),jVt=dK(),EAr=KB(),RAr=p4t(),wAr=g4t(),CAr=CQ(),YAr=o6e(),xAr=D4t(),VAr=P4t(),QAr=q4t(),KVt=el(),yme=ki(),{InvalidArgumentError:Wme}=KVt,WJ=Vwt(),HAr=JB(),XAr=M6e(),{MockCallHistory:kAr,MockCallHistoryLog:LAr}=P6e(),SAr=aLe(),BAr=$6e(),JAr=YCt(),TAr=C6e(),DAr=ghe(),{getGlobalDispatcher:qVt,setGlobalDispatcher:OAr}=Hhe(),UAr=oJ(),MAr=dLe();Object.assign(jVt.prototype,WJ);ra.exports.Dispatcher=jVt;ra.exports.Client=FAr;ra.exports.Pool=EAr;ra.exports.BalancedPool=RAr;ra.exports.RoundRobinPool=wAr;ra.exports.Agent=CAr;ra.exports.ProxyAgent=YAr;ra.exports.EnvHttpProxyAgent=xAr;ra.exports.RetryAgent=VAr;ra.exports.H2CClient=QAr;ra.exports.RetryHandler=DAr;ra.exports.DecoratorHandler=UAr;ra.exports.RedirectHandler=MAr;ra.exports.interceptors={redirect:TCt(),responseError:OCt(),retry:MCt(),dump:_Ct(),dns:jCt(),cache:hYt(),decompress:GYt(),deduplicate:AYt()};ra.exports.cacheStores={MemoryCacheStore:ZLe()};var zAr=FYt();ra.exports.cacheStores.SqliteCacheStore=zAr;ra.exports.buildConnector=HAr;ra.exports.errors=KVt;ra.exports.util={parseHeaders:yme.parseHeaders,headerNameToString:yme.headerNameToString};function hq(n){return(t,r,a)=>{if(typeof r=="function"&&(a=r,r=null),!t||typeof t!="string"&&typeof t!="object"&&!(t instanceof URL))throw new Wme("invalid url");if(r!=null&&typeof r!="object")throw new Wme("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new Wme("invalid opts.path");let e=r.path;r.path.startsWith("/")||(e=`/${e}`),t=new URL(yme.parseOrigin(t).origin+e)}else r||(r=typeof t=="object"?t:{}),t=yme.parseURL(t);let{agent:i,dispatcher:s=qVt()}=r;if(i)throw new Wme("unsupported opts.agent. Did you mean opts.client?");return n.call(s,{...r,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:r.method||(r.body?"PUT":"GET")},a)}}ra.exports.setGlobalDispatcher=OAr;ra.exports.getGlobalDispatcher=qVt;var _Ar=iq().fetch;ra.exports.fetch=function(t,r=void 0){return _Ar(t,r).catch(a=>{throw a&&typeof a=="object"&&Error.captureStackTrace(a),a})};ra.exports.Headers=kQ().Headers;ra.exports.Response=rq().Response;ra.exports.Request=hJ().Request;ra.exports.FormData=M0e().FormData;var{setGlobalOrigin:PAr,getGlobalOrigin:jAr}=$Xe();ra.exports.setGlobalOrigin=PAr;ra.exports.getGlobalOrigin=jAr;var{CacheStorage:KAr}=Hxt(),{kConstruct:qAr}=Po();ra.exports.caches=new KAr(qAr);var{deleteCookie:$Ar,getCookies:e3r,getSetCookies:t3r,setCookie:n3r,parseCookie:r3r}=_xt();ra.exports.deleteCookie=$Ar;ra.exports.getCookies=e3r;ra.exports.getSetCookies=t3r;ra.exports.setCookie=n3r;ra.exports.parseCookie=r3r;var{parseMIMEType:a3r,serializeAMimeType:i3r}=lv();ra.exports.parseMIMEType=a3r;ra.exports.serializeAMimeType=i3r;var{CloseEvent:l3r,ErrorEvent:s3r,MessageEvent:o3r}=Ime(),{WebSocket:c3r,ping:u3r}=EVt();ra.exports.WebSocket=c3r;ra.exports.CloseEvent=l3r;ra.exports.ErrorEvent=s3r;ra.exports.MessageEvent=o3r;ra.exports.ping=u3r;ra.exports.WebSocketStream=HVt().WebSocketStream;ra.exports.WebSocketError=oSe().WebSocketError;ra.exports.request=hq(WJ.request);ra.exports.stream=hq(WJ.stream);ra.exports.pipeline=hq(WJ.pipeline);ra.exports.connect=hq(WJ.connect);ra.exports.upgrade=hq(WJ.upgrade);ra.exports.MockClient=XAr;ra.exports.MockCallHistory=kAr;ra.exports.MockCallHistoryLog=LAr;ra.exports.MockPool=BAr;ra.exports.MockAgent=SAr;ra.exports.SnapshotAgent=JAr;ra.exports.mockErrors=TAr;var{EventSource:I3r}=PVt();ra.exports.EventSource=I3r;function d3r(){globalThis.fetch=ra.exports.fetch,globalThis.Headers=ra.exports.Headers,globalThis.Response=ra.exports.Response,globalThis.Request=ra.exports.Request,globalThis.FormData=ra.exports.FormData,globalThis.WebSocket=ra.exports.WebSocket,globalThis.CloseEvent=ra.exports.CloseEvent,globalThis.ErrorEvent=ra.exports.ErrorEvent,globalThis.MessageEvent=ra.exports.MessageEvent,globalThis.EventSource=ra.exports.EventSource}ra.exports.install=d3r});function h3r(n){return`${n.provider}|${n.baseUrl}|${n.modelId}`}function zW(n){let r=(a=>{let i=0;for(let s=0;s<a.length;s++){let e=a.charCodeAt(s);i=(i<<5)-i+e,i=i&i}return Math.abs(i).toString(36).substring(0,6)})(n.baseUrl);return`custom:${n.provider}:${n.modelId}@${r}`}function m3r(n){return`custom:${n}`}function p3r(n){if(!as(n))return null;let t=n.replace("custom:","");return t.startsWith("openai:")?"openai":t.startsWith("anthropic:")?"anthropic":null}function yJ(n){let t=[];return(!n.displayName||typeof n.displayName!="string")&&t.push("displayName is required and must be a string"),["openai","anthropic"].includes(n.provider)||t.push("provider must be one of: openai, anthropic"),(!n.baseUrl||typeof n.baseUrl!="string")&&t.push("baseUrl is required and must be a string"),(!n.apiKey||typeof n.apiKey!="string")&&t.push("apiKey is required and must be a string"),(!n.modelId||typeof n.modelId!="string")&&t.push("modelId is required and must be a string"),n.maxTokens!==void 0&&(typeof n.maxTokens!="number"||n.maxTokens<=0)&&t.push("maxTokens must be a positive number if specified"),n.timeout!==void 0&&(typeof n.timeout!="number"||n.timeout<=0)&&t.push("timeout must be a positive number if specified"),t}function as(n){return n.startsWith("custom:")}var zQ=It(()=>{"use strict";});function ff(n){!n||Object.getOwnPropertyDescriptor(n,"functionCalls")||Object.defineProperty(n,"functionCalls",{get:function(){let a=this.candidates?.[0]?.content?.parts||this.parts;if(!a||!Array.isArray(a))return;let i=a.filter(s=>s&&s.functionCall).map(s=>s.functionCall);return i.length>0?i:void 0},enumerable:!1,configurable:!0})}function Lw(n){let t=/\$\{([^}]+)\}|\$(\w+)/g;return n.replace(t,(r,a,i)=>{let s=a||i;return process.env[s]||r})}function mSe(n){if(!n||n==="null"||n==="undefined")return{};if(typeof n=="object")return n;let t=n.trim();if(t==="{}"||t==="")return{};try{return JSON.parse(t)}catch{}if(t.startsWith("{")&&!t.endsWith("}")){let a=b3r(t);if(a)try{return JSON.parse(a)}catch{}}if(t.startsWith("[")&&!t.endsWith("]")){let a=t.lastIndexOf(",");if(a>0){let i=t.substring(0,a)+"]";try{return JSON.parse(i)}catch{}}try{return JSON.parse(t+"]")}catch{}}let r=t.match(/^(\{[\s\S]*\}|\[[\s\S]*\])/);if(r)try{return JSON.parse(r[1])}catch{}try{let a=t.replace(/([^\\])\\([^"\\/bfnrtu])/g,"$1\\\\$2").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r");return JSON.parse(a)}catch{}return console.error("[CustomModel] Failed to parse tool arguments after all repair attempts"),console.error(`[CustomModel] Original string (first 500 chars): ${n.substring(0,500)}`),{__parseError:!0,__rawArgs:n,__errorMessage:`Failed to parse tool arguments as JSON. Raw value: ${n.substring(0,200)}${n.length>200?"...":""}`}}function b3r(n){let t=0,r=0,a=!1,i=!1,s=-1,e=-1;for(let u=0;u<n.length;u++){let d=n[u];if(i){i=!1;continue}if(d==="\\"){i=!0;continue}if(d==='"'&&!i){a=!a;continue}if(!a)switch(d){case"{":t++;break;case"}":t--,t===0&&(s=u);break;case"[":r++;break;case"]":r--;break;case",":t===1&&r===0&&(e=u);break}}if(s>0&&t===0)return n.substring(0,s+1);if(e>0){let d=n.substring(0,e);for(let I=0;I<t;I++)d+="}";for(let I=0;I<r;I++)d+="]";return d}let o=[/^(.*"[^"]*"\s*:\s*"[^"]*")\s*,?\s*"[^"]*"\s*:\s*"?[^"}]*$/,/^(.*"[^"]*"\s*:\s*\d+)\s*,?\s*"[^"]*"\s*:\s*"?[^"}]*$/,/^(.*"[^"]*"\s*:\s*(?:true|false|null))\s*,?\s*"[^"]*"\s*:\s*"?[^"}]*$/];for(let u of o){let d=n.match(u);if(d&&d[1])return d[1]+"}"}if(t>0){let u=n;a&&(u+='"');for(let d=0;d<t;d++)u+="}";return u}return null}function Fme(n,t,r){let a=new Error(t);if(a.status=n,r){let i=r.headers.get("retry-after");i&&(a.response={headers:{"retry-after":i}})}return a}function Eme(n){let t=HB(n);return t===429?(console.warn("[CustomModel] Rate limited (429), will retry with backoff..."),!0):t&&t>=500&&t<600?(console.warn(`[CustomModel] Server error (${t}), will retry...`),!0):n.message.includes("429")?(console.warn("[CustomModel] Rate limit detected in message, will retry..."),!0):!1}async function f3r(n,t,r){let a=Lw(n.baseUrl).replace(/\/+$/,""),i=Lw(n.apiKey),s=`${a}/chat/completions`,e={model:n.modelId,messages:FJ.contentsToMessages(t.contents),tools:FJ.toolsToOpenAITools(t.config?.tools),stream:!1};return Hb(async()=>{let o=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`,...n.headers},body:JSON.stringify(e),signal:r});if(!o.ok){let y=await o.text();throw Fme(o.status,`OpenAI API error (${o.status}): ${y}`,o)}let u=await o.json(),d=u.choices[0],I=d.message,h=[];if(I.content&&h.push({text:I.content}),I.tool_calls)for(let y of I.tool_calls)y.type==="function"&&h.push({functionCall:{name:y.function.name,args:mSe(y.function.arguments),id:y.id}});let c=u.usage?.prompt_tokens_details?.cached_tokens||0,G=u.usage?.prompt_tokens||0,W={candidates:[{content:{role:Pr.MODEL,parts:h.length?h:[{text:""}]},finishReason:FJ.mapFinishReason(d.finish_reason),index:0}],usageMetadata:{promptTokenCount:G,candidatesTokenCount:u.usage?.completion_tokens||0,totalTokenCount:u.usage?.total_tokens||0,...c>0&&{cacheReadInputTokens:c},uncachedInputTokens:G-c}};return ff(W),W},{shouldRetry:Eme})}function $Vt(){return!0}async function G3r(n,t,r){let a=Lw(n.baseUrl).replace(/\/+$/,""),i=Lw(n.apiKey),{messages:s,system:e}=EJ.contentsToAnthropic(t.contents),o={model:n.modelId,messages:s,tools:EJ.toolsToAnthropicTools(t.config?.tools),max_tokens:n.maxTokens||4096};if(e&&e.length>0&&(o.system=e),n.enableThinking!==void 0?n.enableThinking:$Vt()){let d=n.maxTokens||32e3;o.thinking={type:"enabled",budget_tokens:Math.min(d-1,31999)},o.max_tokens=Math.max(d,32e3)}return Hb(async()=>{let d=await fetch(`${a}/v1/messages`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i,"anthropic-version":"2023-06-01",...n.headers},body:JSON.stringify(o),signal:r});if(!d.ok){let C=await d.text();throw Fme(d.status,`Anthropic error (${d.status}): ${C}`,d)}let I=await d.json(),h=I.content.map(C=>C.type==="text"?{text:C.text}:C.type==="tool_use"?{functionCall:{name:C.name,args:C.input,id:C.id}}:C.type==="thinking"?{reasoning:C.thinking}:null).filter(Boolean),c=I.usage?.input_tokens||0,G=I.usage?.cache_creation_input_tokens||0,W=I.usage?.cache_read_input_tokens||0,y=c+G+W,R=I.usage?.output_tokens||0,F={candidates:[{content:{role:Pr.MODEL,parts:h.length?h:[{text:""}]},finishReason:EJ.mapFinishReason(I.stop_reason),index:0}],usageMetadata:{promptTokenCount:y,candidatesTokenCount:R,totalTokenCount:y+R,...G&&{cacheCreationInputTokens:G},...W!=null&&{cacheReadInputTokens:W},uncachedInputTokens:c}};return ff(F),F},{shouldRetry:Eme})}async function*g3r(n,t,r){let a=Lw(n.baseUrl).replace(/\/+$/,""),i=Lw(n.apiKey),s={model:n.modelId,messages:FJ.contentsToMessages(t.contents),tools:FJ.toolsToOpenAITools(t.config?.tools),stream:!0,stream_options:{include_usage:!0}},o=(await Hb(async()=>{let c=await fetch(`${a}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`,...n.headers},body:JSON.stringify(s),signal:r});if(!c.ok){let G=await c.text();throw Fme(c.status,`OpenAI Stream error (${c.status}): ${G}`,c)}return c},{shouldRetry:Eme})).body?.getReader();if(!o)throw new Error("No response body");let u=new TextDecoder,d="",I=new Map,h=function*(){if(I.size===0)return;let c=Array.from(I.values()).map(y=>({functionCall:{name:y.name||"unknown_tool",args:mSe(y.args),id:y.id||`call_${Date.now()}`}})),G={role:Pr.MODEL,parts:c},W={candidates:[{content:G,finishReason:gs.STOP,index:0}]};ff(W),ff(G),yield W,I.clear()};try{let c=!1;for(;;){let{done:G,value:W}=await o.read();G&&(c=!0),G?d+=u.decode(void 0,{stream:!1}):d+=u.decode(W,{stream:!0});let y=d.split(`
|
|
700
|
-
`);d=y.pop()||"";for(let R of y){let F=R.trim();if(!F||!F.startsWith("data: "))continue;let C=F.slice(6);if(C==="[DONE]"){yield*h(),c=!0;break}try{let A=JSON.parse(C),E=A.choices?.[0];if(E){let f=E.delta;if(f?.content){let g={role:Pr.MODEL,parts:[{text:f.content}]},v={candidates:[{content:g,index:0}]};ff(v),ff(g),yield v}if(f?.tool_calls)for(let g of f.tool_calls){let v=g.index??0,N=I.get(v);N||(N={id:"",name:"",args:""},I.set(v,N)),g.id&&(N.id=g.id),g.function?.name&&(N.name=g.function.name),g.function?.arguments&&(N.args+=g.function.arguments)}}if(A.usage){let f=A.usage.prompt_tokens_details?.cached_tokens||0,g=A.usage.prompt_tokens||0;yield{candidates:[],usageMetadata:{promptTokenCount:g,candidatesTokenCount:A.usage.completion_tokens||0,totalTokenCount:A.usage.total_tokens||0,...f>0&&{cacheReadInputTokens:f},uncachedInputTokens:g-f}}}}catch{}}if(c){yield*h();break}}}finally{o.releaseLock()}}async function*v3r(n,t,r){let a=Lw(n.baseUrl).replace(/\/+$/,""),i=Lw(n.apiKey),{messages:s,system:e}=EJ.contentsToAnthropic(t.contents),o={model:n.modelId,messages:s,tools:EJ.toolsToAnthropicTools(t.config?.tools),max_tokens:n.maxTokens||4096,stream:!0};if(e&&e.length>0&&(o.system=e),n.enableThinking!==void 0?n.enableThinking:$Vt()){let A=n.maxTokens||32e3;o.thinking={type:"enabled",budget_tokens:Math.min(A-1,31999)},o.max_tokens=Math.max(A,32e3)}let I=(await Hb(async()=>{let A=await fetch(`${a}/v1/messages`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i,"anthropic-version":"2023-06-01",...n.headers},body:JSON.stringify(o),signal:r});if(!A.ok){let E=await A.text();throw Fme(A.status,`Anthropic Stream error (${A.status}): ${E}`,A)}return A},{shouldRetry:Eme})).body?.getReader();if(!I)throw new Error("No response body");let h=new TextDecoder,c="",G=new Map,W=new Map,y=0,R=0,F=0,C=0;try{for(;;){let{done:A,value:E}=await I.read();if(A)break;c+=h.decode(E,{stream:!0});let f=c.split(`
|
|
701
|
-
`);c=f.pop()||"";for(let g of f){let v=g.trim();if(!v||!v.startsWith("data: "))continue;let N=v.slice(6);try{let m=JSON.parse(N),p=m.index??0;if(m.type==="content_block_start")m.content_block?.type==="tool_use"?G.set(p,{id:m.content_block.id,name:m.content_block.name,args:""}):m.content_block?.type==="thinking"&&W.set(p,m.content_block.thinking||"");else if(m.type==="content_block_delta"){if(m.delta?.type==="text_delta"){let b={role:Pr.MODEL,parts:[{text:m.delta.text}]},Z={candidates:[{content:b,index:0}]};ff(Z),ff(b),yield Z}else if(m.delta?.type==="input_json_delta"){let b=G.get(p);b&&(b.args+=m.delta.partial_json)}else if(m.delta?.type==="thinking_delta"){let b=m.delta.thinking||"";if(b){let Y={role:Pr.MODEL,parts:[{reasoning:b}]},S={candidates:[{content:Y,index:0}]};ff(S),ff(Y),yield S}let Z=W.get(p)||"";W.set(p,Z+b)}}else if(m.type==="content_block_stop"){let b=G.get(p);if(b){let Z={role:Pr.MODEL,parts:[{functionCall:{name:b.name,args:mSe(b.args),id:b.id}}]},Y={candidates:[{content:Z,index:0}]};ff(Y),ff(Z),yield Y,G.delete(p)}W.has(p)&&W.delete(p)}else if(m.type==="message_delta"){m.usage?.output_tokens!=null&&(R=m.usage.output_tokens),m.usage?.input_tokens!=null&&m.usage.input_tokens>0&&(y=m.usage.input_tokens),m.usage?.cache_creation_input_tokens!=null&&m.usage.cache_creation_input_tokens>0&&(F=m.usage.cache_creation_input_tokens),m.usage?.cache_read_input_tokens!=null&&m.usage.cache_read_input_tokens>0&&(C=m.usage.cache_read_input_tokens);let b=y+F+C,Z={role:Pr.MODEL,parts:[]},Y={candidates:[{content:Z,finishReason:EJ.mapFinishReason(m.delta?.stop_reason),index:0}],usageMetadata:{promptTokenCount:b,candidatesTokenCount:R,totalTokenCount:b+R,...F!=null&&{cacheCreationInputTokens:F},...C!=null&&{cacheReadInputTokens:C},uncachedInputTokens:y}};ff(Y),ff(Z),yield Y}else if(m.type==="message_start"&&m.message?.usage){let b=m.message.usage;y=b.input_tokens||0,R=b.output_tokens||0,F=b.cache_creation_input_tokens||0,C=b.cache_read_input_tokens||0}}catch{}}}}finally{I.releaseLock()}}async function*eQt(n,t,r){if(console.log(`[CustomModel] Stream call: ${n.displayName} (${n.provider})`),n.provider==="openai")yield*g3r(n,t,r);else if(n.provider==="anthropic")yield*v3r(n,t,r);else throw new Error(`Unsupported custom model provider for streaming: ${n.provider}`)}async function pSe(n,t,r){if(console.log(`[CustomModel] Unary call: ${n.displayName} (${n.provider})`),n.provider==="openai")return f3r(n,t,r);if(n.provider==="anthropic")return G3r(n,t,r);throw new Error(`Unsupported custom model provider: ${n.provider}`)}var FJ,EJ,bSe=It(()=>{"use strict";Ci();av();XB();FJ={partToOpenAIContent(n){if(n.text)return{type:"text",text:n.text};if(n.inlineData){let{mimeType:t,data:r}=n.inlineData;return{type:"image_url",image_url:{url:`data:${t};base64,${r}`}}}return null},contentsToMessages(n){return n.map(t=>{let r=t.parts||[];if(r.some(i=>i.functionCall))return{role:t.role===Pr.MODEL?"assistant":"user",content:null,tool_calls:r.filter(i=>i.functionCall).map((i,s)=>({id:i.functionCall.id||`call_${Date.now()}_${s}`,type:"function",function:{name:i.functionCall.name,arguments:typeof i.functionCall.args=="string"?i.functionCall.args:JSON.stringify(i.functionCall.args||{})}}))};if(r.some(i=>i.functionResponse))return r.filter(s=>s.functionResponse).map(s=>({role:"tool",tool_call_id:s.functionResponse.id||`call_${s.functionResponse.name}`,content:typeof s.functionResponse.response=="string"?s.functionResponse.response:JSON.stringify(s.functionResponse.response||{})}));if(r.some(i=>i.inlineData)){let i=r.map(s=>FJ.partToOpenAIContent(s)).filter(Boolean);return{role:t.role===Pr.MODEL?"assistant":"user",content:i}}return{role:t.role===Pr.MODEL?"assistant":"user",content:r.map(i=>i.text||"").join(`
|
|
699
|
+
${s}`;break;case"retry":LVt(s)&&(r[i]=s);break;case"id":SVt(s)&&(r[i]=s);break;case"event":s.length>0&&(r[i]=s);break}}processEvent(t){t.retry&&LVt(t.retry)&&(this.state.reconnectionTime=parseInt(t.retry,10)),t.id!==void 0&&SVt(t.id)&&(this.state.lastEventId=t.id),t.data!==void 0&&this.push({type:t.event||"message",options:{data:t.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};BVt.exports={EventSourceStream:hSe}});var PVt=ve((mui,_Vt)=>{"use strict";var{pipeline:GAr}=vt("node:stream"),{fetching:gAr}=iq(),{makeRequest:vAr}=hJ(),{webidl:Lb}=lm(),{EventSourceStream:ZAr}=JVt(),{parseMIMEType:NAr}=lv(),{createFastMessageEvent:AAr}=Ime(),{isNetworkError:TVt}=rq(),{kEnumerableProperty:MQ}=ki(),{environmentSettingsObject:DVt}=o1(),OVt=!1,UVt=3e3,Iq=0,MVt=1,dq=2,WAr="anonymous",yAr="use-credentials",AJ=class n extends EventTarget{#e={open:null,error:null,message:null};#t;#n=!1;#r=Iq;#a=null;#i=null;#u;#s;constructor(t,r={}){super(),Lb.util.markAsUncloneable(this);let a="EventSource constructor";Lb.argumentLengthCheck(arguments,1,a),OVt||(OVt=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),t=Lb.converters.USVString(t),r=Lb.converters.EventSourceInitDict(r,a,"eventSourceInitDict"),this.#u=r.node.dispatcher||r.dispatcher,this.#s={lastEventId:"",reconnectionTime:r.node.reconnectionTime};let i=DVt,s;try{s=new URL(t,i.settingsObject.baseUrl),this.#s.origin=s.origin}catch(u){throw new DOMException(u,"SyntaxError")}this.#t=s.href;let e=WAr;r.withCredentials===!0&&(e=yAr,this.#n=!0);let o={redirect:"follow",keepalive:!0,mode:"cors",credentials:e==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};o.client=DVt.settingsObject,o.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],o.cache="no-store",o.initiator="other",o.urlList=[new URL(this.#t)],this.#a=vAr(o),this.#l()}get readyState(){return this.#r}get url(){return this.#t}get withCredentials(){return this.#n}#l(){if(this.#r===dq)return;this.#r=Iq;let t={request:this.#a,dispatcher:this.#u},r=a=>{if(!TVt(a))return this.#d()};t.processResponseEndOfBody=r,t.processResponse=a=>{if(TVt(a))if(a.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#d();return}let i=a.headersList.get("content-type",!0),s=i!==null?NAr(i):"failure",e=s!=="failure"&&s.essence==="text/event-stream";if(a.status!==200||e===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#r=MVt,this.dispatchEvent(new Event("open")),this.#s.origin=a.urlList[a.urlList.length-1].origin;let o=new ZAr({eventSourceSettings:this.#s,push:u=>{this.dispatchEvent(AAr(u.type,u.options))}});GAr(a.body.stream,o,u=>{u?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#i=gAr(t)}#d(){this.#r!==dq&&(this.#r=Iq,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#r===Iq&&(this.#s.lastEventId.length&&this.#a.headersList.set("last-event-id",this.#s.lastEventId,!0),this.#l())},this.#s.reconnectionTime)?.unref())}close(){Lb.brandCheck(this,n),this.#r!==dq&&(this.#r=dq,this.#i.abort(),this.#a=null)}get onopen(){return this.#e.open}set onopen(t){this.#e.open&&this.removeEventListener("open",this.#e.open);let r=Lb.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("open",r),this.#e.open=t):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(t){this.#e.message&&this.removeEventListener("message",this.#e.message);let r=Lb.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("message",r),this.#e.message=t):this.#e.message=null}get onerror(){return this.#e.error}set onerror(t){this.#e.error&&this.removeEventListener("error",this.#e.error);let r=Lb.converters.EventHandlerNonNull(t);r!==null?(this.addEventListener("error",r),this.#e.error=t):this.#e.error=null}},zVt={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Iq,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:MVt,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:dq,writable:!1}};Object.defineProperties(AJ,zVt);Object.defineProperties(AJ.prototype,zVt);Object.defineProperties(AJ.prototype,{close:MQ,onerror:MQ,onmessage:MQ,onopen:MQ,readyState:MQ,url:MQ,withCredentials:MQ});Lb.converters.EventSourceInitDict=Lb.dictionaryConverter([{key:"withCredentials",converter:Lb.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:Lb.converters.any},{key:"node",converter:Lb.dictionaryConverter([{key:"reconnectionTime",converter:Lb.converters["unsigned long"],defaultValue:()=>UVt},{key:"dispatcher",converter:Lb.converters.any}]),defaultValue:()=>({})}]);_Vt.exports={EventSource:AJ,defaultReconnectionTime:UVt}});var mq=ve((pui,ra)=>{"use strict";var FAr=Cw(),jVt=dK(),EAr=KB(),RAr=p4t(),wAr=g4t(),CAr=CQ(),YAr=o6e(),xAr=D4t(),VAr=P4t(),QAr=q4t(),KVt=el(),yme=ki(),{InvalidArgumentError:Wme}=KVt,WJ=Vwt(),HAr=JB(),XAr=M6e(),{MockCallHistory:kAr,MockCallHistoryLog:LAr}=P6e(),SAr=aLe(),BAr=$6e(),JAr=YCt(),TAr=C6e(),DAr=ghe(),{getGlobalDispatcher:qVt,setGlobalDispatcher:OAr}=Hhe(),UAr=oJ(),MAr=dLe();Object.assign(jVt.prototype,WJ);ra.exports.Dispatcher=jVt;ra.exports.Client=FAr;ra.exports.Pool=EAr;ra.exports.BalancedPool=RAr;ra.exports.RoundRobinPool=wAr;ra.exports.Agent=CAr;ra.exports.ProxyAgent=YAr;ra.exports.EnvHttpProxyAgent=xAr;ra.exports.RetryAgent=VAr;ra.exports.H2CClient=QAr;ra.exports.RetryHandler=DAr;ra.exports.DecoratorHandler=UAr;ra.exports.RedirectHandler=MAr;ra.exports.interceptors={redirect:TCt(),responseError:OCt(),retry:MCt(),dump:_Ct(),dns:jCt(),cache:hYt(),decompress:GYt(),deduplicate:AYt()};ra.exports.cacheStores={MemoryCacheStore:ZLe()};var zAr=FYt();ra.exports.cacheStores.SqliteCacheStore=zAr;ra.exports.buildConnector=HAr;ra.exports.errors=KVt;ra.exports.util={parseHeaders:yme.parseHeaders,headerNameToString:yme.headerNameToString};function hq(n){return(t,r,a)=>{if(typeof r=="function"&&(a=r,r=null),!t||typeof t!="string"&&typeof t!="object"&&!(t instanceof URL))throw new Wme("invalid url");if(r!=null&&typeof r!="object")throw new Wme("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new Wme("invalid opts.path");let e=r.path;r.path.startsWith("/")||(e=`/${e}`),t=new URL(yme.parseOrigin(t).origin+e)}else r||(r=typeof t=="object"?t:{}),t=yme.parseURL(t);let{agent:i,dispatcher:s=qVt()}=r;if(i)throw new Wme("unsupported opts.agent. Did you mean opts.client?");return n.call(s,{...r,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:r.method||(r.body?"PUT":"GET")},a)}}ra.exports.setGlobalDispatcher=OAr;ra.exports.getGlobalDispatcher=qVt;var _Ar=iq().fetch;ra.exports.fetch=function(t,r=void 0){return _Ar(t,r).catch(a=>{throw a&&typeof a=="object"&&Error.captureStackTrace(a),a})};ra.exports.Headers=kQ().Headers;ra.exports.Response=rq().Response;ra.exports.Request=hJ().Request;ra.exports.FormData=M0e().FormData;var{setGlobalOrigin:PAr,getGlobalOrigin:jAr}=$Xe();ra.exports.setGlobalOrigin=PAr;ra.exports.getGlobalOrigin=jAr;var{CacheStorage:KAr}=Hxt(),{kConstruct:qAr}=Po();ra.exports.caches=new KAr(qAr);var{deleteCookie:$Ar,getCookies:e3r,getSetCookies:t3r,setCookie:n3r,parseCookie:r3r}=_xt();ra.exports.deleteCookie=$Ar;ra.exports.getCookies=e3r;ra.exports.getSetCookies=t3r;ra.exports.setCookie=n3r;ra.exports.parseCookie=r3r;var{parseMIMEType:a3r,serializeAMimeType:i3r}=lv();ra.exports.parseMIMEType=a3r;ra.exports.serializeAMimeType=i3r;var{CloseEvent:l3r,ErrorEvent:s3r,MessageEvent:o3r}=Ime(),{WebSocket:c3r,ping:u3r}=EVt();ra.exports.WebSocket=c3r;ra.exports.CloseEvent=l3r;ra.exports.ErrorEvent=s3r;ra.exports.MessageEvent=o3r;ra.exports.ping=u3r;ra.exports.WebSocketStream=HVt().WebSocketStream;ra.exports.WebSocketError=oSe().WebSocketError;ra.exports.request=hq(WJ.request);ra.exports.stream=hq(WJ.stream);ra.exports.pipeline=hq(WJ.pipeline);ra.exports.connect=hq(WJ.connect);ra.exports.upgrade=hq(WJ.upgrade);ra.exports.MockClient=XAr;ra.exports.MockCallHistory=kAr;ra.exports.MockCallHistoryLog=LAr;ra.exports.MockPool=BAr;ra.exports.MockAgent=SAr;ra.exports.SnapshotAgent=JAr;ra.exports.mockErrors=TAr;var{EventSource:I3r}=PVt();ra.exports.EventSource=I3r;function d3r(){globalThis.fetch=ra.exports.fetch,globalThis.Headers=ra.exports.Headers,globalThis.Response=ra.exports.Response,globalThis.Request=ra.exports.Request,globalThis.FormData=ra.exports.FormData,globalThis.WebSocket=ra.exports.WebSocket,globalThis.CloseEvent=ra.exports.CloseEvent,globalThis.ErrorEvent=ra.exports.ErrorEvent,globalThis.MessageEvent=ra.exports.MessageEvent,globalThis.EventSource=ra.exports.EventSource}ra.exports.install=d3r});function h3r(n){return`${n.provider}|${n.baseUrl}|${n.modelId}`}function zW(n){let r=(a=>{let i=0;for(let s=0;s<a.length;s++){let e=a.charCodeAt(s);i=(i<<5)-i+e,i=i&i}return Math.abs(i).toString(36).substring(0,6)})(n.baseUrl);return`custom:${n.provider}:${n.modelId}@${r}`}function m3r(n){return`custom:${n}`}function p3r(n){if(!as(n))return null;let t=n.replace("custom:","");return t.startsWith("openai:")?"openai":t.startsWith("anthropic:")?"anthropic":null}function yJ(n){let t=[];return(!n.displayName||typeof n.displayName!="string")&&t.push("displayName is required and must be a string"),["openai","anthropic"].includes(n.provider)||t.push("provider must be one of: openai, anthropic"),(!n.baseUrl||typeof n.baseUrl!="string")&&t.push("baseUrl is required and must be a string"),(!n.apiKey||typeof n.apiKey!="string")&&t.push("apiKey is required and must be a string"),(!n.modelId||typeof n.modelId!="string")&&t.push("modelId is required and must be a string"),n.maxTokens!==void 0&&(typeof n.maxTokens!="number"||n.maxTokens<=0)&&t.push("maxTokens must be a positive number if specified"),n.timeout!==void 0&&(typeof n.timeout!="number"||n.timeout<=0)&&t.push("timeout must be a positive number if specified"),t}function as(n){return n.startsWith("custom:")}var zQ=It(()=>{"use strict";});function ff(n){!n||Object.getOwnPropertyDescriptor(n,"functionCalls")||Object.defineProperty(n,"functionCalls",{get:function(){let a=this.candidates?.[0]?.content?.parts||this.parts;if(!a||!Array.isArray(a))return;let i=a.filter(s=>s&&s.functionCall).map(s=>s.functionCall);return i.length>0?i:void 0},enumerable:!1,configurable:!0})}function Lw(n){let t=/\$\{([^}]+)\}|\$(\w+)/g;return n.replace(t,(r,a,i)=>{let s=a||i;return process.env[s]||r})}function mSe(n){if(!n||n==="null"||n==="undefined")return{};if(typeof n=="object")return n;let t=n.trim();if(t==="{}"||t==="")return{};try{return JSON.parse(t)}catch{}if(t.startsWith("{")&&!t.endsWith("}")){let a=b3r(t);if(a)try{return JSON.parse(a)}catch{}}if(t.startsWith("[")&&!t.endsWith("]")){let a=t.lastIndexOf(",");if(a>0){let i=t.substring(0,a)+"]";try{return JSON.parse(i)}catch{}}try{return JSON.parse(t+"]")}catch{}}let r=t.match(/^(\{[\s\S]*\}|\[[\s\S]*\])/);if(r)try{return JSON.parse(r[1])}catch{}try{let a=t.replace(/([^\\])\\([^"\\/bfnrtu])/g,"$1\\\\$2").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r");return JSON.parse(a)}catch{}return console.error("[CustomModel] Failed to parse tool arguments after all repair attempts"),console.error(`[CustomModel] Original string (first 500 chars): ${n.substring(0,500)}`),{__parseError:!0,__rawArgs:n,__errorMessage:`Failed to parse tool arguments as JSON. Raw value: ${n.substring(0,200)}${n.length>200?"...":""}`}}function b3r(n){let t=0,r=0,a=!1,i=!1,s=-1,e=-1;for(let u=0;u<n.length;u++){let d=n[u];if(i){i=!1;continue}if(d==="\\"){i=!0;continue}if(d==='"'&&!i){a=!a;continue}if(!a)switch(d){case"{":t++;break;case"}":t--,t===0&&(s=u);break;case"[":r++;break;case"]":r--;break;case",":t===1&&r===0&&(e=u);break}}if(s>0&&t===0)return n.substring(0,s+1);if(e>0){let d=n.substring(0,e);for(let I=0;I<t;I++)d+="}";for(let I=0;I<r;I++)d+="]";return d}let o=[/^(.*"[^"]*"\s*:\s*"[^"]*")\s*,?\s*"[^"]*"\s*:\s*"?[^"}]*$/,/^(.*"[^"]*"\s*:\s*\d+)\s*,?\s*"[^"]*"\s*:\s*"?[^"}]*$/,/^(.*"[^"]*"\s*:\s*(?:true|false|null))\s*,?\s*"[^"]*"\s*:\s*"?[^"}]*$/];for(let u of o){let d=n.match(u);if(d&&d[1])return d[1]+"}"}if(t>0){let u=n;a&&(u+='"');for(let d=0;d<t;d++)u+="}";return u}return null}function Fme(n,t,r){let a=new Error(t);if(a.status=n,r){let i=r.headers.get("retry-after");i&&(a.response={headers:{"retry-after":i}})}return a}function Eme(n){let t=HB(n);return t===429?(console.warn("[CustomModel] Rate limited (429), will retry with backoff..."),!0):t&&t>=500&&t<600?(console.warn(`[CustomModel] Server error (${t}), will retry...`),!0):n.message.includes("429")?(console.warn("[CustomModel] Rate limit detected in message, will retry..."),!0):!1}async function f3r(n,t,r){let a=Lw(n.baseUrl).replace(/\/+$/,""),i=Lw(n.apiKey),s=`${a}/chat/completions`,e={model:n.modelId,messages:FJ.contentsToMessages(t.contents),tools:FJ.toolsToOpenAITools(t.config?.tools),stream:!1};return Hb(async()=>{let o=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`,...n.headers},body:JSON.stringify(e),signal:r});if(!o.ok){let y=await o.text();throw Fme(o.status,`OpenAI API error (${o.status}): ${y}`,o)}let u=await o.json(),d=u.choices[0],I=d.message,h=[];if(I.content&&h.push({text:I.content}),I.tool_calls)for(let y of I.tool_calls)y.type==="function"&&h.push({functionCall:{name:y.function.name?.trim()||y.function.name,args:mSe(y.function.arguments),id:y.id}});let c=u.usage?.prompt_tokens_details?.cached_tokens||0,G=u.usage?.prompt_tokens||0,W={candidates:[{content:{role:Pr.MODEL,parts:h.length?h:[{text:""}]},finishReason:FJ.mapFinishReason(d.finish_reason),index:0}],usageMetadata:{promptTokenCount:G,candidatesTokenCount:u.usage?.completion_tokens||0,totalTokenCount:u.usage?.total_tokens||0,...c>0&&{cacheReadInputTokens:c},uncachedInputTokens:G-c}};return ff(W),W},{shouldRetry:Eme})}function $Vt(){return!0}async function G3r(n,t,r){let a=Lw(n.baseUrl).replace(/\/+$/,""),i=Lw(n.apiKey),{messages:s,system:e}=EJ.contentsToAnthropic(t.contents),o={model:n.modelId,messages:s,tools:EJ.toolsToAnthropicTools(t.config?.tools),max_tokens:n.maxTokens||4096};if(e&&e.length>0&&(o.system=e),n.enableThinking!==void 0?n.enableThinking:$Vt()){let d=n.maxTokens||32e3;o.thinking={type:"enabled",budget_tokens:Math.min(d-1,31999)},o.max_tokens=Math.max(d,32e3)}return Hb(async()=>{let d=await fetch(`${a}/v1/messages`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i,"anthropic-version":"2023-06-01",...n.headers},body:JSON.stringify(o),signal:r});if(!d.ok){let C=await d.text();throw Fme(d.status,`Anthropic error (${d.status}): ${C}`,d)}let I=await d.json(),h=I.content.map(C=>C.type==="text"?{text:C.text}:C.type==="tool_use"?{functionCall:{name:C.name?.trim()||C.name,args:C.input,id:C.id}}:C.type==="thinking"?{reasoning:C.thinking}:null).filter(Boolean),c=I.usage?.input_tokens||0,G=I.usage?.cache_creation_input_tokens||0,W=I.usage?.cache_read_input_tokens||0,y=c+G+W,R=I.usage?.output_tokens||0,F={candidates:[{content:{role:Pr.MODEL,parts:h.length?h:[{text:""}]},finishReason:EJ.mapFinishReason(I.stop_reason),index:0}],usageMetadata:{promptTokenCount:y,candidatesTokenCount:R,totalTokenCount:y+R,...G&&{cacheCreationInputTokens:G},...W!=null&&{cacheReadInputTokens:W},uncachedInputTokens:c}};return ff(F),F},{shouldRetry:Eme})}async function*g3r(n,t,r){let a=Lw(n.baseUrl).replace(/\/+$/,""),i=Lw(n.apiKey),s={model:n.modelId,messages:FJ.contentsToMessages(t.contents),tools:FJ.toolsToOpenAITools(t.config?.tools),stream:!0,stream_options:{include_usage:!0}},o=(await Hb(async()=>{let c=await fetch(`${a}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`,...n.headers},body:JSON.stringify(s),signal:r});if(!c.ok){let G=await c.text();throw Fme(c.status,`OpenAI Stream error (${c.status}): ${G}`,c)}return c},{shouldRetry:Eme})).body?.getReader();if(!o)throw new Error("No response body");let u=new TextDecoder,d="",I=new Map,h=function*(){if(I.size===0)return;let c=Array.from(I.values()).map(y=>({functionCall:{name:y.name||"unknown_tool",args:mSe(y.args),id:y.id||`call_${Date.now()}`}})),G={role:Pr.MODEL,parts:c},W={candidates:[{content:G,finishReason:gs.STOP,index:0}]};ff(W),ff(G),yield W,I.clear()};try{let c=!1;for(;;){let{done:G,value:W}=await o.read();G&&(c=!0),G?d+=u.decode(void 0,{stream:!1}):d+=u.decode(W,{stream:!0});let y=d.split(`
|
|
700
|
+
`);d=y.pop()||"";for(let R of y){let F=R.trim();if(!F||!F.startsWith("data: "))continue;let C=F.slice(6);if(C==="[DONE]"){yield*h(),c=!0;break}try{let A=JSON.parse(C),E=A.choices?.[0];if(E){let f=E.delta;if(f?.content){let g={role:Pr.MODEL,parts:[{text:f.content}]},v={candidates:[{content:g,index:0}]};ff(v),ff(g),yield v}if(f?.tool_calls)for(let g of f.tool_calls){let v=g.index??0,N=I.get(v);N||(N={id:"",name:"",args:""},I.set(v,N)),g.id&&(N.id=g.id),g.function?.name&&(N.name=g.function.name.trim()),g.function?.arguments&&(N.args+=g.function.arguments)}}if(A.usage){let f=A.usage.prompt_tokens_details?.cached_tokens||0,g=A.usage.prompt_tokens||0;yield{candidates:[],usageMetadata:{promptTokenCount:g,candidatesTokenCount:A.usage.completion_tokens||0,totalTokenCount:A.usage.total_tokens||0,...f>0&&{cacheReadInputTokens:f},uncachedInputTokens:g-f}}}}catch{}}if(c){yield*h();break}}}finally{o.releaseLock()}}async function*v3r(n,t,r){let a=Lw(n.baseUrl).replace(/\/+$/,""),i=Lw(n.apiKey),{messages:s,system:e}=EJ.contentsToAnthropic(t.contents),o={model:n.modelId,messages:s,tools:EJ.toolsToAnthropicTools(t.config?.tools),max_tokens:n.maxTokens||4096,stream:!0};if(e&&e.length>0&&(o.system=e),n.enableThinking!==void 0?n.enableThinking:$Vt()){let A=n.maxTokens||32e3;o.thinking={type:"enabled",budget_tokens:Math.min(A-1,31999)},o.max_tokens=Math.max(A,32e3)}let I=(await Hb(async()=>{let A=await fetch(`${a}/v1/messages`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i,"anthropic-version":"2023-06-01",...n.headers},body:JSON.stringify(o),signal:r});if(!A.ok){let E=await A.text();throw Fme(A.status,`Anthropic Stream error (${A.status}): ${E}`,A)}return A},{shouldRetry:Eme})).body?.getReader();if(!I)throw new Error("No response body");let h=new TextDecoder,c="",G=new Map,W=new Map,y=0,R=0,F=0,C=0;try{for(;;){let{done:A,value:E}=await I.read();if(A)break;c+=h.decode(E,{stream:!0});let f=c.split(`
|
|
701
|
+
`);c=f.pop()||"";for(let g of f){let v=g.trim();if(!v||!v.startsWith("data: "))continue;let N=v.slice(6);try{let m=JSON.parse(N),p=m.index??0;if(m.type==="content_block_start")m.content_block?.type==="tool_use"?G.set(p,{id:m.content_block.id,name:m.content_block.name?.trim()||m.content_block.name,args:""}):m.content_block?.type==="thinking"&&W.set(p,m.content_block.thinking||"");else if(m.type==="content_block_delta"){if(m.delta?.type==="text_delta"){let b={role:Pr.MODEL,parts:[{text:m.delta.text}]},Z={candidates:[{content:b,index:0}]};ff(Z),ff(b),yield Z}else if(m.delta?.type==="input_json_delta"){let b=G.get(p);b&&(b.args+=m.delta.partial_json)}else if(m.delta?.type==="thinking_delta"){let b=m.delta.thinking||"";if(b){let Y={role:Pr.MODEL,parts:[{reasoning:b}]},S={candidates:[{content:Y,index:0}]};ff(S),ff(Y),yield S}let Z=W.get(p)||"";W.set(p,Z+b)}}else if(m.type==="content_block_stop"){let b=G.get(p);if(b){let Z={role:Pr.MODEL,parts:[{functionCall:{name:b.name,args:mSe(b.args),id:b.id}}]},Y={candidates:[{content:Z,index:0}]};ff(Y),ff(Z),yield Y,G.delete(p)}W.has(p)&&W.delete(p)}else if(m.type==="message_delta"){m.usage?.output_tokens!=null&&(R=m.usage.output_tokens),m.usage?.input_tokens!=null&&m.usage.input_tokens>0&&(y=m.usage.input_tokens),m.usage?.cache_creation_input_tokens!=null&&m.usage.cache_creation_input_tokens>0&&(F=m.usage.cache_creation_input_tokens),m.usage?.cache_read_input_tokens!=null&&m.usage.cache_read_input_tokens>0&&(C=m.usage.cache_read_input_tokens);let b=y+F+C,Z={role:Pr.MODEL,parts:[]},Y={candidates:[{content:Z,finishReason:EJ.mapFinishReason(m.delta?.stop_reason),index:0}],usageMetadata:{promptTokenCount:b,candidatesTokenCount:R,totalTokenCount:b+R,...F!=null&&{cacheCreationInputTokens:F},...C!=null&&{cacheReadInputTokens:C},uncachedInputTokens:y}};ff(Y),ff(Z),yield Y}else if(m.type==="message_start"&&m.message?.usage){let b=m.message.usage;y=b.input_tokens||0,R=b.output_tokens||0,F=b.cache_creation_input_tokens||0,C=b.cache_read_input_tokens||0}}catch{}}}}finally{I.releaseLock()}}async function*eQt(n,t,r){if(console.log(`[CustomModel] Stream call: ${n.displayName} (${n.provider})`),n.provider==="openai")yield*g3r(n,t,r);else if(n.provider==="anthropic")yield*v3r(n,t,r);else throw new Error(`Unsupported custom model provider for streaming: ${n.provider}`)}async function pSe(n,t,r){if(console.log(`[CustomModel] Unary call: ${n.displayName} (${n.provider})`),n.provider==="openai")return f3r(n,t,r);if(n.provider==="anthropic")return G3r(n,t,r);throw new Error(`Unsupported custom model provider: ${n.provider}`)}var FJ,EJ,bSe=It(()=>{"use strict";Ci();av();XB();FJ={partToOpenAIContent(n){if(n.text)return{type:"text",text:n.text};if(n.inlineData){let{mimeType:t,data:r}=n.inlineData;return{type:"image_url",image_url:{url:`data:${t};base64,${r}`}}}return null},contentsToMessages(n){return n.map(t=>{let r=t.parts||[];if(r.some(i=>i.functionCall))return{role:t.role===Pr.MODEL?"assistant":"user",content:null,tool_calls:r.filter(i=>i.functionCall).map((i,s)=>({id:i.functionCall.id||`call_${Date.now()}_${s}`,type:"function",function:{name:i.functionCall.name,arguments:typeof i.functionCall.args=="string"?i.functionCall.args:JSON.stringify(i.functionCall.args||{})}}))};if(r.some(i=>i.functionResponse))return r.filter(s=>s.functionResponse).map(s=>({role:"tool",tool_call_id:s.functionResponse.id||`call_${s.functionResponse.name}`,content:typeof s.functionResponse.response=="string"?s.functionResponse.response:JSON.stringify(s.functionResponse.response||{})}));if(r.some(i=>i.inlineData)){let i=r.map(s=>FJ.partToOpenAIContent(s)).filter(Boolean);return{role:t.role===Pr.MODEL?"assistant":"user",content:i}}return{role:t.role===Pr.MODEL?"assistant":"user",content:r.map(i=>i.text||"").join(`
|
|
702
702
|
`)}}).flat()},toolsToOpenAITools(n){if(!(!n||n.length===0))return n.flatMap(t=>t.functionDeclarations&&Array.isArray(t.functionDeclarations)?t.functionDeclarations.map(r=>({type:"function",function:{name:r.name,description:r.description,parameters:r.parameters}})):[{type:"function",function:{name:t.name,description:t.description,parameters:t.parameters}}])},mapFinishReason(n){switch(n){case"stop":return gs.STOP;case"length":return gs.MAX_TOKENS;case"content_filter":return gs.SAFETY;case"tool_calls":return gs.STOP;default:return gs.OTHER}}},EJ={contentsToAnthropic(n){let t=[],r=[];for(let i of n){let s=i.parts||[];if(i.role==="system"){for(let u of s)if(u.text){let d={type:"text",text:u.text};d.cache_control=u.cache_control||{type:"ephemeral"},r.push(d)}continue}let e=i.role===Pr.MODEL?"assistant":"user",o=[];for(let u of s){if(u.text){let d={type:"text",text:u.text};u.cache_control&&(d.cache_control=u.cache_control),o.push(d)}u.inlineData&&o.push({type:"image",source:{type:"base64",media_type:u.inlineData.mimeType,data:u.inlineData.data}}),u.functionCall&&o.push({type:"tool_use",id:u.functionCall.id||`toolu_${Date.now()}_${Math.random().toString(36).slice(2)}`,name:u.functionCall.name,input:u.functionCall.args||{}}),u.functionResponse&&o.push({type:"tool_result",tool_use_id:u.functionResponse.id||`toolu_${u.functionResponse.name}`,content:typeof u.functionResponse.response=="string"?u.functionResponse.response:JSON.stringify(u.functionResponse.response||{})})}o.length>0&&t.push({role:e,content:o})}t.length>0&&t[0].role==="assistant"&&t.unshift({role:"user",content:"..."});let a=[];for(let i of t){let s=a[a.length-1];if(s&&s.role===i.role){let e=Array.isArray(s.content)?s.content:[{type:"text",text:s.content}],o=Array.isArray(i.content)?i.content:[{type:"text",text:i.content}];s.content=[...e,...o]}else a.push(i)}for(let i=a.length-1;i>=0;i--)if(a[i].role==="user"&&Array.isArray(a[i].content)){let s=a[i].content;for(let e=s.length-1;e>=0;e--)if(s[e].type==="text"&&!s[e].cache_control){s[e].cache_control={type:"ephemeral"};break}break}return{messages:a,system:r.length>0?r:void 0}},toolsToAnthropicTools(n){if(!n||n.length===0)return;let t=(r,a=!1)=>{if(!r||typeof r!="object")return r;let i={},s=["type","properties","required","items","enum","description","default","minimum","maximum","exclusiveMinimum","exclusiveMaximum","minLength","maxLength","pattern","format","minItems","maxItems","uniqueItems","additionalProperties","anyOf","oneOf","allOf","not"];for(let e of s)if(r[e]!==void 0)if(e==="type"&&typeof r[e]=="string")i[e]=r[e].toLowerCase();else if(["minimum","maximum","exclusiveMinimum","exclusiveMaximum","minLength","maxLength","minItems","maxItems"].includes(e)){let o=parseFloat(r[e]);isNaN(o)||(i[e]=o)}else if(e==="properties"&&typeof r[e]=="object"){i[e]={};for(let o in r[e])i[e][o]=t(r[e][o],!1)}else e==="items"?i[e]=t(r[e],!1):i[e]=r[e];return i};return n.flatMap(r=>(r.functionDeclarations||[r]).map(i=>{let s=t(i.parameters||{},!0);return{name:i.name,description:i.description||"",input_schema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:s.properties||{},...s.required&&{required:s.required},additionalProperties:!1}}}))},mapFinishReason(n){switch(n){case"end_turn":return gs.STOP;case"max_tokens":return gs.MAX_TOKENS;case"tool_use":return gs.STOP;default:return gs.OTHER}}}});function Z3r(n){let t=n.toLowerCase();return!!(t.includes("claude")||t.includes("gemini")||t.includes("kimi")||t.includes("moonshot")||t.includes("gpt")||t.includes("qwen")||t.includes("grok")||t.includes("glm")||t.includes("deepseek")||t.startsWith("minimax"))}var tQt,RJ,fSe=It(()=>{"use strict";A0e();Gw();VB();rv();Yc();wW();XB();QB();E0e();av();tQt=Qt(mq(),1);zQ();bSe();RJ=class{userTier;authHandler=null;config;constructor(t,r,a,i){this.config=i;let s=a||RW();uo.configure({proxyServerUrl:s}),this.authHandler=async()=>{throw console.log("\u{1F504} [DeepV Server] Authentication required, opening auth dialog..."),new BI("Authentication required - please re-authenticate")},process.env.DEBUG&&console.log(`[DeepV Server] Initialized with proxy server: ${s}`)}setUserInfo(t){uo.setUserInfo(t),process.env.DEBUG&&console.log(`[DeepV Server] User info configured: ${t.name}`)}async verifyFeishuAuth(){try{let t=uo.getUserInfo();return t?(process.env.DEBUG&&console.log(`[DeepV Server] User info found: ${t.name} (${t.email||t.openId||"N/A"})`),!0):(console.warn("[DeepV Server] No user info found, please login first"),!1)}catch(t){return console.error("[DeepV Server] Authentication check failed:",t),!1}}cleanContents(t){return Array.isArray(t)?t.filter(r=>!r.parts||r.parts.length===0?!1:r.parts.some(i=>i.text!==void 0?i.text.trim()!=="":!0)):t}async generateContent(t,r){try{let a=Vd.getModelForScene(r),i=this.config?.getModel(),s;if(i&&as(i)?(t.model&&as(t.model)?s=t.model:s=i,console.log(`[DeepV Server] User is using custom model, overriding scene model for ${r}: ${s}`)):s=t.model||a||i||"auto",as(s)&&this.config){let u=this.config.getCustomModelConfig(s);if(u)return console.log(`[DeepV Server] Using custom model: ${u.displayName}`),await pSe(u,t,t.config?.abortSignal);throw new Error(`Custom model configuration not found for: ${s}`)}process.env.DEBUG&&console.log(`[\u{1F3AF} Model Resolution] Using model: ${s} for scene: ${r}`);let e={model:s,contents:this.cleanContents(bQ(t.contents)),config:{...t.config,httpOptions:{...t.config?.httpOptions,headers:{...t.config?.httpOptions?.headers,"X-Scene-Type":r,"X-Scene-Display":Vd.getSceneDisplayName(r)}}}};ar.info(`[DeepV Server] Calling unified chat API with model: ${s}`);let o=await this.callUnifiedChatAPI("/v1/chat/messages",e,t.config?.abortSignal);return o.functionCalls&&o.functionCalls.length>0&&process.env.DEBUG&&console.log(`[DeepV Server] Model called ${o.functionCalls.length} tool(s): ${o.functionCalls.map(u=>u.name).join(", ")}`),ar.debug("[DeepV Server] Response received successfully",{model:s}),o}catch(a){return this.handleError(a)}}async callUnifiedChatAPI(t,r,a){return Hb(()=>this.executeUnifiedChatAPICall(t,r,a),{shouldRetry:i=>{if(sf(i)||i.message.includes("cancelled by user")||i.name==="AbortError"||i.message.includes("401")||i instanceof BI||i.message.includes("451")||i.message.includes("REGION_BLOCKED"))return!1;if(i.message.includes("429")||i.message.match(/5\d{2}/))return!0;let s=i.message.toLowerCase(),e=i?.cause?.code||i?.code;return!!(s.includes("terminated")||s.includes("socket hang up")||s.includes("connection closed")||s.includes("other side closed")||e&&["ECONNRESET","ECONNABORTED","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_SOCKET","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT"].includes(e)||i instanceof TypeError&&i.message.includes("fetch failed"))}})}async executeUnifiedChatAPICall(t,r,a){let i=await uo.getUserHeaders(),s=`${uo.getProxyServerUrl()}${t}`,e=new AbortController,o=null;if(a)if(a.aborted)e.abort();else{let I=()=>{console.log("[DeepV Server] Request cancelled by user"),e.abort()};a.addEventListener("abort",I),o=()=>a.removeEventListener("abort",I)}let u=setTimeout(()=>{console.warn('[DeepV Server] API fetch timeout - aborting connection layer after 300s. Try: check your network, or say "continue" to retry.'),e.abort()},3e5),d=Date.now();try{ar.debug("[DeepV Server] Making unified API call",{endpoint:t,url:s,model:r.model});let I=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",...i},body:JSON.stringify(r),signal:e.signal});clearTimeout(u);let h=setTimeout(()=>{console.warn('[DeepV Server] API data timeout - response.json() taking too long (>300s) in data layer. Try: check your network, say "continue" to retry, or try a different model.'),e.abort()},3e5);if(!I.ok){clearTimeout(h);let W=await I.text();if(I.status===401)throw console.error("[DeepV Server] 401 Unauthorized - triggering auth dialog"),this.authHandler&&await this.authHandler(),new BI("Authentication required - please re-authenticate");if(I.status===451)throw console.error("[DeepV Server] 451 Region Blocked - IMMEDIATE ABORT"),e.abort(),new Error(`REGION_BLOCKED_451: ${W}`);let y=new Error(`API request failed (${I.status}): ${W}`);y.status=I.status;let R=I.headers.get("retry-after");throw R&&(y.response={status:I.status,headers:{"retry-after":R}}),y}let c=await this.withTimeout(I.json(),3e5,'[DeepV Server] API response parsing timeout after 300s - JSON.parse() or streaming took too long. Try: check your network, say "continue" to retry, or try a different model.');clearTimeout(h),c.functionCalls||Object.defineProperty(c,"functionCalls",{get:function(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");let W=this.candidates?.[0]?.content?.parts?.filter(y=>y.functionCall).map(y=>y.functionCall).filter(y=>y!==void 0);if(W?.length!==0)return W},enumerable:!1,configurable:!0});let G=Date.now()-d;return ar.debug("[DeepV Server] API call completed",{endpoint:t,duration:`${G}ms`,status:I.status}),c}catch(I){let h=Date.now()-d;throw o&&o(),clearTimeout(u),I instanceof Error&&(I.message.includes("cancelled by user")||I.name==="AbortError")?(console.log("\u26A0\uFE0F \u4EFB\u52A1\u5DF2\u53D6\u6D88"),I):(I instanceof Error&&I.message.includes("timeout")?ar.warn("[DeepV Server] Request timeout",{endpoint:t,duration:`${h}ms`,reason:I.message}):I instanceof Error&&I.message.includes("abort")?ar.warn("[DeepV Server] Request aborted",{endpoint:t,duration:`${h}ms`,reason:I.message}):ar.error("[DeepV Server] API call failed",{endpoint:t,duration:`${h}ms`,error:I instanceof Error?I.message:I}),I)}finally{clearTimeout(u),o&&o()}}handleError(t){if(t instanceof Error&&(t.message.includes("cancelled by user")||t.name==="AbortError"))throw t;if(t instanceof TypeError&&(t.message.includes("fetch failed")||t.message.includes("ECONNREFUSED")||t.cause?.code==="ECONNREFUSED")?console.error("\u274C \u65E0\u6CD5\u8FDE\u63A5\u5230\u670D\u52A1\u5668\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u6216\u670D\u52A1\u5668\u72B6\u6001"):console.error("[DeepV Server] Error in generateContent:",t),t instanceof Error&&t.isAuthError){let a=new Error(`Authentication failed (401): ${t.message}
|
|
703
703
|
|
|
704
704
|
Please check your Feishu authentication token and try again.
|
|
705
705
|
If the problem persists, you may need to re-authenticate.`);throw a.isAuthError=!0,a.statusCode=401,a}throw t}async generateContentStream(t,r){let a=Vd.getModelForScene(r),i=this.config?.getModel(),s;if(i&&as(i)?(t.model&&as(t.model)?s=t.model:s=i,console.log(`[DeepV Server] (Stream) User is using custom model, overriding scene model for ${r}: ${s}`)):s=t.model||a||i||"auto",as(s)&&this.config){let o=this.config.getCustomModelConfig(s);if(o)return console.log("[DeepV Server] Custom model detected, using streaming mode"),eQt(o,t,t.config?.abortSignal)}return process.env.DEEPV_CLOUD_MODE==="true"?this._generateContent(t,r):Z3r(t.model)?this._generateContentStream(t,r):this._generateContent(t,r)}async _generateContent(t,r){let a=await this.generateContent(t,r);return(async function*(){yield a})()}async _generateContentStream(t,r){try{let a=Vd.getModelForScene(r),i=this.config?.getModel(),s;i&&as(i)?(t.model&&as(t.model)?s=t.model:s=i,console.log(`[DeepV Server] (_Stream) User is using custom model, overriding scene model for ${r}: ${s}`)):s=t.model||a||i||"auto",process.env.DEBUG&&console.log(`[\u{1F3AF} Model Resolution (Stream)] Using model: ${s} for scene: ${r}`);let e={model:s,contents:this.cleanContents(bQ(t.contents)),config:{...t.config,stream:!0,httpOptions:{...t.config?.httpOptions,headers:{...t.config?.httpOptions?.headers,"X-Scene-Type":r,"X-Scene-Display":Vd.getSceneDisplayName(r)}}}};ar.info(`[DeepV Server] Starting stream with model: ${s}`);let o=await this.callStreamAPI("/v1/chat/stream",e,t.config?.abortSignal);return this.createStreamGenerator(o,t.config?.abortSignal)}catch(a){return ar.error("[DeepV Server] Stream request failed",{error:a}),this.handleStreamError(a)}}async callStreamAPI(t,r,a){return Hb(()=>this.executeStreamAPICall(t,r,a),{shouldRetry:i=>{if(sf(i)||i.message.includes("cancelled by user")||i.name==="AbortError"||i.message.includes("401")||i instanceof BI||i.message.includes("451")||i.message.includes("REGION_BLOCKED"))return!1;if(i.message.includes("429")||i.message.match(/5\d{2}/))return!0;let s=i.message.toLowerCase(),e=i?.cause?.code||i?.code;return!!(s.includes("terminated")||s.includes("socket hang up")||s.includes("connection closed")||s.includes("other side closed")||e&&["ECONNRESET","ECONNABORTED","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_SOCKET","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT"].includes(e)||i instanceof TypeError&&i.message.includes("fetch failed"))}})}async executeStreamAPICall(t,r,a){let i=await uo.getUserHeaders(),s=`${uo.getProxyServerUrl()}${t}`;if(process.env.DEBUG){console.log("\u{1F50D} [DeepV Debug Stream] Proxy environment variables:"),console.log(" HTTP_PROXY:",process.env.HTTP_PROXY),console.log(" HTTPS_PROXY:",process.env.HTTPS_PROXY),console.log(" http_proxy:",process.env.http_proxy),console.log(" https_proxy:",process.env.https_proxy),console.log(" Target URL:",s);let d=(0,tQt.getGlobalDispatcher)();console.log("\u{1F50D} [DeepV Debug Stream] Global dispatcher:",d?.constructor?.name||"undefined"),d&&"uri"in d&&console.log(" Dispatcher URI:",d.uri)}let e=new AbortController,o=null;if(a)if(a.aborted)e.abort();else{let d=()=>{process.env.DEBUG&&console.log("[DeepV Server] Stream request cancelled by user"),e.abort()};a.addEventListener("abort",d),o=()=>a.removeEventListener("abort",d)}let u=Date.now();try{ar.debug("[DeepV Server] Making stream API call",{endpoint:t,url:s,model:r.model});let d=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...i},body:JSON.stringify(r),signal:e.signal});if(!d.ok){let h=await d.text();if(d.status===401)throw console.error("[DeepV Server] Stream 401 Unauthorized - triggering auth dialog"),this.authHandler&&await this.authHandler(),new BI("Authentication required - please re-authenticate");if(d.status===451)throw console.error("[DeepV Server] Stream 451 Region Blocked - IMMEDIATE ABORT"),e.abort(),new Error(`REGION_BLOCKED_451: ${h}`);let c=new Error(`Stream API error (${d.status}): ${h}`);throw c.status=d.status,c}let I=Date.now()-u;return ar.debug("[DeepV Server] Stream API call initiated",{endpoint:t,duration:`${I}ms`,status:d.status}),d}catch(d){let I=Date.now()-u;throw o&&o(),d instanceof Error&&(d.message.includes("cancelled by user")||d.name==="AbortError")?(console.log("\u26A0\uFE0F \u6D41\u5F0F\u4EFB\u52A1\u5DF2\u53D6\u6D88"),d):(d instanceof Error&&d.message.includes("abort")?ar.warn("[DeepV Server] Stream API aborted",{endpoint:t,duration:`${I}ms`,reason:d.message}):ar.error("[DeepV Server] Stream API call failed",{endpoint:t,duration:`${I}ms`,error:d instanceof Error?d.message:d}),d)}finally{o&&o()}}async*createStreamGenerator(t,r){let a=t.body?.getReader();if(!a)throw new Error("No stream reader available");let i=new TextDecoder,s="",e=0,o=null,u=()=>{console.log("[DeepV Server] Stream cancelled by user - releasing reader and stopping consumption");try{a.cancel()}catch{}},d;r&&!r.aborted&&(d=u,r.addEventListener("abort",d));try{for(;;){if(r?.aborted){console.log("[DeepV Server] Stream generation cancelled by user - exiting loop"),o&&console.log("[DeepV Server] Partial token consumption recorded:",{inputTokens:o.promptTokenCount||0,outputTokens:o.candidatesTokenCount||0,totalTokens:o.totalTokenCount||0,stoppedReason:"user_cancelled",bytesReceived:e});break}let I;try{I=await this.withTimeout(a.read(),3e5,"[DeepV Server] Stream read timeout after 300s (no data received in this chunk)")}catch(W){if(W instanceof Error&&(W.name==="AbortError"||W.message.includes("cancelled"))){console.log("[DeepV Server] Stream read cancelled - exiting");break}if(W instanceof TypeError){let y=W.message.toLowerCase(),R=W?.cause?.code||W?.code;if(y.includes("terminated")||y.includes("socket hang up")||y.includes("connection closed")||y.includes("other side closed")||R&&["ECONNRESET","ECONNABORTED","EPIPE","ETIMEDOUT","UND_ERR_SOCKET"].includes(R)){let C=new Error(`Stream interrupted: Connection was terminated mid-stream. This may be caused by server restart or network issues. Please retry your request. (Original: ${W.message})`);throw C.isStreamInterrupt=!0,C.isRetryable=!0,C.bytesReceived=e,console.warn(`\u26A0\uFE0F [DeepV Server] Stream connection interrupted after ${e} bytes. Cause: ${W.message}`),C}}throw W}let{done:h,value:c}=I;if(h)break;e+=c.length,s+=i.decode(c,{stream:!0});let G=s.split(`
|
|
706
|
-
`);s=G.pop()||"";for(let W of G)if(W.startsWith("data: ")){let y=W.slice(6);if(y==="[DONE]")return;try{let R=JSON.parse(y);if(R.type==="connection_established")continue;if(R.error)throw new Error(R.error);R.usageMetadata&&(o=R.usageMetadata);let F=this.convertStreamChunkToGenAI(R);F&&(yield F)}catch(R){ar.warn("[DeepV Server] Stream chunk parse error",{data:y.substring(0,100)+"...",error:R instanceof Error?R.message:R})}}}}finally{d&&r&&r.removeEventListener("abort",d);try{a.releaseLock()}catch{}}}convertStreamChunkToGenAI(t){if(!t.candidates||!Array.isArray(t.candidates)||t.candidates.length===0)return null;let r={candidates:t.candidates,usageMetadata:t.usageMetadata};if(r.candidates?.[0]?.content?.parts){for(let a of r.candidates[0].content.parts)if(a.functionCall&&!a.functionCall.id){let i=`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;console.log(`[DeepV Server] \u8865\u5168\u7F3A\u5931\u7684\u5DE5\u5177 ID (Chunk): ${a.functionCall.name} -> ${i}`),a.functionCall.id=i}}return r.functionCalls||Object.defineProperty(r,"functionCalls",{get:function(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");let a=this.candidates?.[0]?.content?.parts?.filter(i=>i.functionCall).map(i=>i.functionCall).filter(i=>i!==void 0);if(a?.length!==0)return a},enumerable:!1,configurable:!0}),r}mergeStreamContent(t,r){if(!t)return r;let a=t.candidates?.[0]?.content?.parts||[],i=r.candidates?.[0]?.content?.parts||[];if(i.length>0&&i[0].text){let s=a[a.length-1];s&&s.text&&!s.functionCall?s.text+=i[0].text:a.push(...i)}else if(i.length>0&&i[0].functionCall){let s=a[a.length-1],e=i[0];if(s&&s.functionCall){let o=s.functionCall,u=e.functionCall;u&&(u.name&&(o.name=u.name),u.id&&(o.id=u.id),u.args&&(typeof u.args=="string"&&typeof o.args=="string"?o.args+=u.args:typeof u.args=="object"&&u.args!==null?o.args={...typeof o.args=="object"?o.args:{},...u.args}:o.args=u.args))}else{let o={...e};if(o.functionCall&&!o.functionCall.id){let u=`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;console.log(`[DeepV Server] \u8865\u5168\u7F3A\u5931\u7684\u5DE5\u5177 ID: ${o.functionCall.name} -> ${u}`),o.functionCall.id=u}a.push(o)}}return r.usageMetadata&&(t.usageMetadata=r.usageMetadata),r.candidates?.[0]?.finishReason&&(t.candidates[0].finishReason=r.candidates[0].finishReason),t}buildUnifiedRequest(t,r){let a=Vd.getModelForScene(r),i=this.config?.getModel(),s;return i&&as(i)?t.model&&as(t.model)?s=t.model:s=i:s=t.model||a||"auto",{model:s,contents:t.contents,config:{...t.config,httpOptions:{...t.config?.httpOptions,headers:{...t.config?.httpOptions?.headers,"X-Scene-Type":r,"X-Scene-Display":Vd.getSceneDisplayName(r)}}}}}async*handleStreamError(t){this.handleError(t)}async countTokens(t){try{let r=t.model||this.config?.getModel()||"auto";if(as(r))return ar.debug("[DeepV Server] Custom model detected, token counting not supported"),{totalTokens:0};let a={model:r,contents:t.contents};(t.config?.systemInstruction||t.config?.tools)&&(a.config={},t.config.systemInstruction&&(a.config.systemInstruction=t.config.systemInstruction),t.config.tools&&(a.config.tools=t.config.tools));let i=await this.callUnifiedTokenCountAPI(a);return of.emitRealTimeToken({inputTokens:i.totalTokens||0,outputTokens:0,totalTokens:i.totalTokens||0,timestamp:Date.now()}),i}catch(r){let a=t.model||this.config?.getModel()||"auto";return as(a)?ar.debug("[DeepV Server] Token count not available for custom model, using fallback"):ar.error("[DeepV Server] Token count failed:",r),this.estimateTokensAsFailback(t)}}async callUnifiedTokenCountAPI(t){let r=await uo.getUserHeaders(),a=`${uo.getProxyServerUrl()}/v1/chat/count-tokens`;try{let i=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(t)});if(!i.ok){let e=await i.text();throw i.status===401?(console.error("[DeepV Server] Token count 401 Unauthorized"),this.authHandler&&await this.authHandler(),new BI("Authentication required - please re-authenticate")):new Error(`Token count API failed (${i.status}): ${e}`)}let s=await i.json();return ar.debug("[DeepV Server] Token count response",{totalTokens:s.totalTokens}),{totalTokens:s.totalTokens||0}}catch(i){throw ar.error("[DeepV Server] Token count API call failed:",i),i}}estimateTokensAsFailback(t){try{let r=Array.isArray(t.contents)?t.contents:[{role:Pr.USER,parts:[{text:t.contents}]}],a=0,i=0,s=0,e=0;for(let c of r)if(typeof c=="object"&&c&&"parts"in c&&Array.isArray(c.parts)){for(let G of c.parts)if(typeof G=="object"&&G&&"text"in G&&typeof G.text=="string")a+=G.text.length,e++;else if(typeof G=="object"&&G&&"functionCall"in G&&G.functionCall){let W=G.functionCall,y=`[Tool: ${W.name}]`+JSON.stringify(W.args||{});a+=y.length,i++}else if(typeof G=="object"&&G&&"functionResponse"in G&&G.functionResponse){let R=`[Tool Result: ${G.functionResponse.response?.output||"result"}]`;a+=R.length+20,s++}}else typeof c=="string"&&(a+=c.length,e++);let o=JSON.stringify(r),u=/[\u4e00-\u9fff]/.test(o),d=/```|function|class|import|export|\{|\}|\[|\]/.test(o),I=4;return u?I=2:d&&(I=3),{totalTokens:Math.ceil(a/I)}}catch(r){return console.error("[DeepV Server] Fallback estimation error:",r),{totalTokens:1e3}}}async embedContent(t){throw new Error("Claude models do not support embedding content")}withTimeout(t,r,a){let i=null,s=new Promise((e,o)=>{i=setTimeout(()=>{o(new Error(a))},r)});return Promise.race([t,s]).finally(()=>{i!==null&&clearTimeout(i)})}}});function GSe(n,t){let r=n.getModel()||"auto",a={authType:t,proxy:n?.getProxy()};return t===is.USE_PROXY_AUTH,a}async function gSe(n,t,r){let i={headers:{"User-Agent":`GeminiCLI/1.0.303 (${process.platform}; ${process.arch})`}};if(!0){let e=t.getCustomProxyServerUrl(),o;if(e)o=e,console.log(`[DeepX] Using custom proxy server: ${o}`);else{if(!$He())throw new Error("DeepV Code server is required for all models but is not available. Please start the DeepV Code server or use proxy authentication.");o=RW(),console.log(`[DeepX] Connecting to DeepV Code server: ${o}`)}let u=process.env.GOOGLE_CLOUD_LOCATION||"us-central1",d=process.env.GOOGLE_CLOUD_PROJECT||"default-project";return new RJ(u,d,o,t)}throw new Error(`Error creating contentGenerator: Unsupported authType: ${n.authType}`)}var is,Rme=It(()=>{"use strict";fSe();VB();(function(n){n.USE_PROXY_AUTH="proxy-auth"})(is||(is={}))});var wme,nQt=It(()=>{"use strict";wme=class{prompts=new Map;registerPrompt(t){if(this.prompts.has(t.name)){let r=`${t.serverName}_${t.name}`;console.warn(`Prompt with name "${t.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...t,name:r})}else this.prompts.set(t.name,t)}getAllPrompts(){return Array.from(this.prompts.values()).sort((t,r)=>t.name.localeCompare(r.name))}getPrompt(t){return this.prompts.get(t)}getPromptsByServer(t){let r=[];for(let a of this.prompts.values())a.serverName===t&&r.push(a);return r.sort((a,i)=>a.name.localeCompare(i.name))}removePromptsByServer(t){for(let[r,a]of this.prompts.entries())a.serverName===t&&this.prompts.delete(r)}}});function MN(n){let t={type:"subagent_update",data:n,timestamp:Date.now()};return JSON.stringify(t)}function rQt(n){let t={type:"text",data:n,timestamp:Date.now()};return JSON.stringify(t)}function Cme(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&t.type&&t.data!==void 0)return t}catch{}return{type:"text",data:n,timestamp:Date.now()}}function Yme(n){return n.type==="subagent_update"}function xme(n){return n.type==="text"}var vSe=It(()=>{"use strict";});var $r,Mr,ea,Ll=It(()=>{"use strict";vSe();$r=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;forceMarkdown;canUpdateOutput;allowSubAgentUse;constructor(t,r,a,i,s,e=!0,o=!1,u=!1,d=!0){this.name=t,this.displayName=r,this.description=a,this.icon=i,this.parameterSchema=s,this.isOutputMarkdown=e,this.forceMarkdown=o,this.canUpdateOutput=u,this.allowSubAgentUse=d}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(t){return null}getDescription(t){return JSON.stringify(t)}shouldConfirmExecute(t,r){return Promise.resolve(!1)}toolLocations(t){return[]}};(function(n){n.ProceedOnce="proceed_once",n.ProceedAlways="proceed_always",n.ProceedAlwaysServer="proceed_always_server",n.ProceedAlwaysTool="proceed_always_tool",n.ProceedAlwaysProject="proceed_always_project",n.ModifyWithEditor="modify_with_editor",n.Cancel="cancel"})(Mr||(Mr={}));(function(n){n.FileSearch="fileSearch",n.Folder="folder",n.Globe="globe",n.Hammer="hammer",n.LightBulb="lightBulb",n.Pencil="pencil",n.Regex="regex",n.Terminal="terminal",n.Clipboard="clipboard",n.Tasks="tasks",n.Wrench="wrench",n.Trash="trash",n.List="list",n.Info="info"})(ea||(ea={}))});var Sl,ZSe,ta,_W,pq=It(()=>{(function(n){n.assertEqual=i=>{};function t(i){}n.assertIs=t;function r(i){throw new Error}n.assertNever=r,n.arrayToEnum=i=>{let s={};for(let e of i)s[e]=e;return s},n.getValidEnumValues=i=>{let s=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),e={};for(let o of s)e[o]=i[o];return n.objectValues(e)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&s.push(e);return s},n.find=(i,s)=>{for(let e of i)if(s(e))return e},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function a(i,s=" | "){return i.map(e=>typeof e=="string"?`'${e}'`:e).join(s)}n.joinValues=a,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Sl||(Sl={}));(function(n){n.mergeShapes=(t,r)=>({...t,...r})})(ZSe||(ZSe={}));ta=Sl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_W=n=>{switch(typeof n){case"undefined":return ta.undefined;case"string":return ta.string;case"number":return Number.isNaN(n)?ta.nan:ta.number;case"boolean":return ta.boolean;case"function":return ta.function;case"bigint":return ta.bigint;case"symbol":return ta.symbol;case"object":return Array.isArray(n)?ta.array:n===null?ta.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?ta.promise:typeof Map<"u"&&n instanceof Map?ta.map:typeof Set<"u"&&n instanceof Set?ta.set:typeof Date<"u"&&n instanceof Date?ta.date:ta.object;default:return ta.unknown}}});var vr,N3r,Gf,Vme=It(()=>{pq();vr=Sl.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),N3r=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),Gf=class n extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(s){return s.message},a={_errors:[]},i=s=>{for(let e of s.issues)if(e.code==="invalid_union")e.unionErrors.map(i);else if(e.code==="invalid_return_type")i(e.returnTypeError);else if(e.code==="invalid_arguments")i(e.argumentsError);else if(e.path.length===0)a._errors.push(r(e));else{let o=a,u=0;for(;u<e.path.length;){let d=e.path[u];u===e.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(e))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return i(this),a}static assert(t){if(!(t instanceof n))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Sl.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},a=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];r[s]=r[s]||[],r[s].push(t(i))}else a.push(t(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};Gf.create=n=>new Gf(n)});var A3r,K5,NSe=It(()=>{Vme();pq();A3r=(n,t)=>{let r;switch(n.code){case vr.invalid_type:n.received===ta.undefined?r="Required":r=`Expected ${n.expected}, received ${n.received}`;break;case vr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(n.expected,Sl.jsonStringifyReplacer)}`;break;case vr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Sl.joinValues(n.keys,", ")}`;break;case vr.invalid_union:r="Invalid input";break;case vr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Sl.joinValues(n.options)}`;break;case vr.invalid_enum_value:r=`Invalid enum value. Expected ${Sl.joinValues(n.options)}, received '${n.received}'`;break;case vr.invalid_arguments:r="Invalid function arguments";break;case vr.invalid_return_type:r="Invalid function return type";break;case vr.invalid_date:r="Invalid date";break;case vr.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(r=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?r=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?r=`Invalid input: must end with "${n.validation.endsWith}"`:Sl.assertNever(n.validation):n.validation!=="regex"?r=`Invalid ${n.validation}`:r="Invalid";break;case vr.too_small:n.type==="array"?r=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?r=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?r=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?r=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?r=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:r="Invalid input";break;case vr.too_big:n.type==="array"?r=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?r=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?r=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?r=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?r=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:r="Invalid input";break;case vr.custom:r="Invalid input";break;case vr.invalid_intersection_types:r="Intersection results could not be merged";break;case vr.not_multiple_of:r=`Number must be a multiple of ${n.multipleOf}`;break;case vr.not_finite:r="Number must be finite";break;default:r=t.defaultError,Sl.assertNever(n)}return{message:r}},K5=A3r});function W3r(n){aQt=n}function wJ(){return aQt}var aQt,Qme=It(()=>{NSe();aQt=K5});function Tr(n,t){let r=wJ(),a=bq({issueData:t,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,r,r===K5?void 0:K5].filter(i=>!!i)});n.common.issues.push(a)}var bq,y3r,om,ti,_Q,mp,Hme,Xme,Sw,CJ,ASe=It(()=>{Qme();NSe();bq=n=>{let{data:t,path:r,errorMaps:a,issueData:i}=n,s=[...r,...i.path||[]],e={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",u=a.filter(d=>!!d).slice().reverse();for(let d of u)o=d(e,{data:t,defaultError:o}).message;return{...i,path:s,message:o}},y3r=[];om=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let i of r){if(i.status==="aborted")return ti;i.status==="dirty"&&t.dirty(),a.push(i.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let i of r){let s=await i.key,e=await i.value;a.push({key:s,value:e})}return n.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let i of r){let{key:s,value:e}=i;if(s.status==="aborted"||e.status==="aborted")return ti;s.status==="dirty"&&t.dirty(),e.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof e.value<"u"||i.alwaysSet)&&(a[s.value]=e.value)}return{status:t.value,value:a}}},ti=Object.freeze({status:"aborted"}),_Q=n=>({status:"dirty",value:n}),mp=n=>({status:"valid",value:n}),Hme=n=>n.status==="aborted",Xme=n=>n.status==="dirty",Sw=n=>n.status==="valid",CJ=n=>typeof Promise<"u"&&n instanceof Promise});var iQt=It(()=>{});var Na,lQt=It(()=>{(function(n){n.errToObj=t=>typeof t=="string"?{message:t}:t||{},n.toString=t=>typeof t=="string"?t:t?.message})(Na||(Na={}))});function _i(n){if(!n)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=n;if(t&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(e,o)=>{let{message:u}=n;return e.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??a??o.defaultError}:e.code!=="invalid_type"?{message:o.defaultError}:{message:u??r??o.defaultError}},description:i}}function uQt(n){let t="[0-5]\\d";n.precision?t=`${t}\\.\\d{${n.precision}}`:n.precision==null&&(t=`${t}(\\.\\d+)?`);let r=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function T3r(n){return new RegExp(`^${uQt(n)}$`)}function IQt(n){let t=`${cQt}T${uQt(n)}`,r=[];return r.push(n.local?"Z?":"Z"),n.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function D3r(n,t){return!!((t==="v4"||!t)&&H3r.test(n)||(t==="v6"||!t)&&k3r.test(n))}function O3r(n,t){if(!Y3r.test(n))return!1;try{let[r]=n.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function U3r(n,t){return!!((t==="v4"||!t)&&X3r.test(n)||(t==="v6"||!t)&&L3r.test(n))}function M3r(n,t){let r=(n.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(n.toFixed(i).replace(".","")),e=Number.parseInt(t.toFixed(i).replace(".",""));return s%e/10**i}function YJ(n){if(n instanceof gf){let t={};for(let r in n.shape){let a=n.shape[r];t[r]=bv.create(YJ(a))}return new gf({...n._def,shape:()=>t})}else return n instanceof eE?new eE({...n._def,type:YJ(n.element)}):n instanceof bv?bv.create(YJ(n.unwrap())):n instanceof jW?jW.create(YJ(n.unwrap())):n instanceof PW?PW.create(n.items.map(t=>YJ(t))):n}function ySe(n,t){let r=_W(n),a=_W(t);if(n===t)return{valid:!0,data:n};if(r===ta.object&&a===ta.object){let i=Sl.objectKeys(t),s=Sl.objectKeys(n).filter(o=>i.indexOf(o)!==-1),e={...n,...t};for(let o of s){let u=ySe(n[o],t[o]);if(!u.valid)return{valid:!1};e[o]=u.data}return{valid:!0,data:e}}else if(r===ta.array&&a===ta.array){if(n.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<n.length;s++){let e=n[s],o=t[s],u=ySe(e,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===ta.date&&a===ta.date&&+n==+t?{valid:!0,data:n}:{valid:!1}}function dQt(n,t){return new i9({values:n,typeName:si.ZodEnum,..._i(t)})}function oQt(n,t){let r=typeof n=="function"?n(t):typeof n=="string"?{message:n}:n;return typeof r=="string"?{message:r}:r}function hQt(n,t={},r){return n?Jw.create().superRefine((a,i)=>{let s=n(a);if(s instanceof Promise)return s.then(e=>{if(!e){let o=oQt(t,a),u=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:u})}});if(!s){let e=oQt(t,a),o=e.fatal??r??!0;i.addIssue({code:"custom",...e,fatal:o})}}):Jw.create()}var fv,sQt,ol,F3r,E3r,R3r,w3r,C3r,Y3r,x3r,V3r,Q3r,WSe,H3r,X3r,k3r,L3r,S3r,B3r,cQt,J3r,Bw,PQ,jQ,KQ,qQ,xJ,$Q,e9,Jw,$5,zN,VJ,eE,gf,t9,q5,kme,n9,PW,Lme,QJ,HJ,Sme,r9,a9,i9,l9,Tw,Gv,bv,jW,s9,o9,XJ,z3r,fq,Gq,c9,_3r,si,P3r,mQt,pQt,j3r,K3r,bQt,q3r,$3r,eWr,tWr,nWr,rWr,aWr,iWr,lWr,sWr,oWr,cWr,uWr,IWr,dWr,hWr,mWr,pWr,bWr,fWr,GWr,gWr,vWr,ZWr,NWr,AWr,WWr,yWr,FWr,EWr,RWr,wWr,CWr,YWr,fQt=It(()=>{Vme();Qme();lQt();ASe();pq();fv=class{constructor(t,r,a,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},sQt=(n,t)=>{if(Sw(t))return{success:!0,data:t.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Gf(n.common.issues);return this._error=r,this._error}}};ol=class{get description(){return this._def.description}_getType(t){return _W(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:_W(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new om,ctx:{common:t.parent.common,data:t.data,parsedType:_W(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(CJ(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_W(t)},i=this._parseSync({data:t,path:a.path,parent:a});return sQt(a,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_W(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return Sw(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(a=>Sw(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_W(t)},i=this._parse({data:t,path:a.path,parent:a}),s=await(CJ(i)?i:Promise.resolve(i));return sQt(a,s)}refine(t,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let e=t(i),o=()=>s.addIssue({code:vr.custom,...a(i)});return typeof Promise<"u"&&e instanceof Promise?e.then(u=>u?!0:(o(),!1)):e?!0:(o(),!1)})}refinement(t,r){return this._refinement((a,i)=>t(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(t){return new Gv({schema:this,typeName:si.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return bv.create(this,this._def)}nullable(){return jW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eE.create(this)}promise(){return Tw.create(this,this._def)}or(t){return t9.create([this,t],this._def)}and(t){return n9.create(this,t,this._def)}transform(t){return new Gv({..._i(this._def),schema:this,typeName:si.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new s9({..._i(this._def),innerType:this,defaultValue:r,typeName:si.ZodDefault})}brand(){return new fq({typeName:si.ZodBranded,type:this,..._i(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new o9({..._i(this._def),innerType:this,catchValue:r,typeName:si.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Gq.create(this,t)}readonly(){return c9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},F3r=/^c[^\s-]{8,}$/i,E3r=/^[0-9a-z]+$/,R3r=/^[0-9A-HJKMNP-TV-Z]{26}$/i,w3r=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,C3r=/^[a-z0-9_-]{21}$/i,Y3r=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,x3r=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,V3r=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Q3r="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",H3r=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,X3r=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,k3r=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,L3r=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,S3r=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B3r=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cQt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",J3r=new RegExp(`^${cQt}$`);Bw=class n extends ol{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ta.string){let s=this._getOrReturnCtx(t);return Tr(s,{code:vr.invalid_type,expected:ta.string,received:s.parsedType}),ti}let a=new om,i;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let e=t.data.length>s.value,o=t.data.length<s.value;(e||o)&&(i=this._getOrReturnCtx(t,i),e?Tr(i,{code:vr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&Tr(i,{code:vr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")V3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"email",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")WSe||(WSe=new RegExp(Q3r,"u")),WSe.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"emoji",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")w3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"uuid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")C3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"nanoid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")F3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"cuid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")E3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"cuid2",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")R3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"ulid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Tr(i,{validation:"url",code:vr.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"regex",code:vr.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?IQt(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?J3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?T3r(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?x3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"duration",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?D3r(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"ip",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?O3r(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"jwt",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?U3r(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"cidr",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?S3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"base64",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?B3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"base64url",code:vr.invalid_string,message:s.message}),a.dirty()):Sl.assertNever(s);return{status:a.value,value:t.data}}_regex(t,r,a){return this.refinement(i=>t.test(i),{validation:r,code:vr.invalid_string,...Na.errToObj(a)})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Na.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Na.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Na.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Na.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Na.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Na.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Na.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Na.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Na.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Na.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Na.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Na.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Na.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Na.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Na.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Na.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Na.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Na.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Na.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Na.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Na.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Na.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Na.errToObj(r)})}nonempty(t){return this.min(1,Na.errToObj(t))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Bw.create=n=>new Bw({checks:[],typeName:si.ZodString,coerce:n?.coerce??!1,..._i(n)});PQ=class n extends ol{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ta.number){let s=this._getOrReturnCtx(t);return Tr(s,{code:vr.invalid_type,expected:ta.number,received:s.parsedType}),ti}let a,i=new om;for(let s of this._def.checks)s.kind==="int"?Sl.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?M3r(t.data,s.value)!==0&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.not_finite,message:s.message}),i.dirty()):Sl.assertNever(s);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Na.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Na.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Na.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Na.toString(r))}setLimit(t,r,a,i){return new n({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:Na.toString(i)}]})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Na.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Na.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Na.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Na.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Na.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Na.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Na.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Na.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Na.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Sl.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(t===null||a.value<t)&&(t=a.value)}return Number.isFinite(r)&&Number.isFinite(t)}};PQ.create=n=>new PQ({checks:[],typeName:si.ZodNumber,coerce:n?.coerce||!1,..._i(n)});jQ=class n extends ol{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ta.bigint)return this._getInvalidInput(t);let a,i=new om;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Sl.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Tr(r,{code:vr.invalid_type,expected:ta.bigint,received:r.parsedType}),ti}gte(t,r){return this.setLimit("min",t,!0,Na.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Na.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Na.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Na.toString(r))}setLimit(t,r,a,i){return new n({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:Na.toString(i)}]})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Na.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Na.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Na.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Na.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Na.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};jQ.create=n=>new jQ({checks:[],typeName:si.ZodBigInt,coerce:n?.coerce??!1,..._i(n)});KQ=class extends ol{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ta.boolean){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.boolean,received:a.parsedType}),ti}return mp(t.data)}};KQ.create=n=>new KQ({typeName:si.ZodBoolean,coerce:n?.coerce||!1,..._i(n)});qQ=class n extends ol{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ta.date){let s=this._getOrReturnCtx(t);return Tr(s,{code:vr.invalid_type,expected:ta.date,received:s.parsedType}),ti}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return Tr(s,{code:vr.invalid_date}),ti}let a=new om,i;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):Sl.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Na.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Na.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};qQ.create=n=>new qQ({checks:[],coerce:n?.coerce||!1,typeName:si.ZodDate,..._i(n)});xJ=class extends ol{_parse(t){if(this._getType(t)!==ta.symbol){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.symbol,received:a.parsedType}),ti}return mp(t.data)}};xJ.create=n=>new xJ({typeName:si.ZodSymbol,..._i(n)});$Q=class extends ol{_parse(t){if(this._getType(t)!==ta.undefined){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.undefined,received:a.parsedType}),ti}return mp(t.data)}};$Q.create=n=>new $Q({typeName:si.ZodUndefined,..._i(n)});e9=class extends ol{_parse(t){if(this._getType(t)!==ta.null){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.null,received:a.parsedType}),ti}return mp(t.data)}};e9.create=n=>new e9({typeName:si.ZodNull,..._i(n)});Jw=class extends ol{constructor(){super(...arguments),this._any=!0}_parse(t){return mp(t.data)}};Jw.create=n=>new Jw({typeName:si.ZodAny,..._i(n)});$5=class extends ol{constructor(){super(...arguments),this._unknown=!0}_parse(t){return mp(t.data)}};$5.create=n=>new $5({typeName:si.ZodUnknown,..._i(n)});zN=class extends ol{_parse(t){let r=this._getOrReturnCtx(t);return Tr(r,{code:vr.invalid_type,expected:ta.never,received:r.parsedType}),ti}};zN.create=n=>new zN({typeName:si.ZodNever,..._i(n)});VJ=class extends ol{_parse(t){if(this._getType(t)!==ta.undefined){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.void,received:a.parsedType}),ti}return mp(t.data)}};VJ.create=n=>new VJ({typeName:si.ZodVoid,..._i(n)});eE=class n extends ol{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),i=this._def;if(r.parsedType!==ta.array)return Tr(r,{code:vr.invalid_type,expected:ta.array,received:r.parsedType}),ti;if(i.exactLength!==null){let e=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(e||o)&&(Tr(r,{code:e?vr.too_big:vr.too_small,minimum:o?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Tr(r,{code:vr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Tr(r,{code:vr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((e,o)=>i.type._parseAsync(new fv(r,e,r.path,o)))).then(e=>om.mergeArray(a,e));let s=[...r.data].map((e,o)=>i.type._parseSync(new fv(r,e,r.path,o)));return om.mergeArray(a,s)}get element(){return this._def.type}min(t,r){return new n({...this._def,minLength:{value:t,message:Na.toString(r)}})}max(t,r){return new n({...this._def,maxLength:{value:t,message:Na.toString(r)}})}length(t,r){return new n({...this._def,exactLength:{value:t,message:Na.toString(r)}})}nonempty(t){return this.min(1,t)}};eE.create=(n,t)=>new eE({type:n,minLength:null,maxLength:null,exactLength:null,typeName:si.ZodArray,..._i(t)});gf=class n extends ol{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Sl.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ta.object){let d=this._getOrReturnCtx(t);return Tr(d,{code:vr.invalid_type,expected:ta.object,received:d.parsedType}),ti}let{status:a,ctx:i}=this._processInputParams(t),{shape:s,keys:e}=this._getCached(),o=[];if(!(this._def.catchall instanceof zN&&this._def.unknownKeys==="strip"))for(let d in i.data)e.includes(d)||o.push(d);let u=[];for(let d of e){let I=s[d],h=i.data[d];u.push({key:{status:"valid",value:d},value:I._parse(new fv(i,h,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof zN){let d=this._def.unknownKeys;if(d==="passthrough")for(let I of o)u.push({key:{status:"valid",value:I},value:{status:"valid",value:i.data[I]}});else if(d==="strict")o.length>0&&(Tr(i,{code:vr.unrecognized_keys,keys:o}),a.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let I of o){let h=i.data[I];u.push({key:{status:"valid",value:I},value:d._parse(new fv(i,h,i.path,I)),alwaysSet:I in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let I of u){let h=await I.key,c=await I.value;d.push({key:h,value:c,alwaysSet:I.alwaysSet})}return d}).then(d=>om.mergeObjectSync(a,d)):om.mergeObjectSync(a,u)}get shape(){return this._def.shape()}strict(t){return Na.errToObj,new n({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:Na.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(t){return new n({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new n({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:si.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new n({...this._def,catchall:t})}pick(t){let r={};for(let a of Sl.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new n({...this._def,shape:()=>r})}omit(t){let r={};for(let a of Sl.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new n({...this._def,shape:()=>r})}deepPartial(){return YJ(this)}partial(t){let r={};for(let a of Sl.objectKeys(this.shape)){let i=this.shape[a];t&&!t[a]?r[a]=i:r[a]=i.optional()}return new n({...this._def,shape:()=>r})}required(t){let r={};for(let a of Sl.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let s=this.shape[a];for(;s instanceof bv;)s=s._def.innerType;r[a]=s}return new n({...this._def,shape:()=>r})}keyof(){return dQt(Sl.objectKeys(this.shape))}};gf.create=(n,t)=>new gf({shape:()=>n,unknownKeys:"strip",catchall:zN.create(),typeName:si.ZodObject,..._i(t)});gf.strictCreate=(n,t)=>new gf({shape:()=>n,unknownKeys:"strict",catchall:zN.create(),typeName:si.ZodObject,..._i(t)});gf.lazycreate=(n,t)=>new gf({shape:n,unknownKeys:"strip",catchall:zN.create(),typeName:si.ZodObject,..._i(t)});t9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;function i(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let e=s.map(o=>new Gf(o.ctx.common.issues));return Tr(r,{code:vr.invalid_union,unionErrors:e}),ti}if(r.common.async)return Promise.all(a.map(async s=>{let e={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:e}),ctx:e}})).then(i);{let s,e=[];for(let u of a){let d={...r,common:{...r.common,issues:[]},parent:null},I=u._parseSync({data:r.data,path:r.path,parent:d});if(I.status==="valid")return I;I.status==="dirty"&&!s&&(s={result:I,ctx:d}),d.common.issues.length&&e.push(d.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=e.map(u=>new Gf(u));return Tr(r,{code:vr.invalid_union,unionErrors:o}),ti}}get options(){return this._def.options}};t9.create=(n,t)=>new t9({options:n,typeName:si.ZodUnion,..._i(t)});q5=n=>n instanceof r9?q5(n.schema):n instanceof Gv?q5(n.innerType()):n instanceof a9?[n.value]:n instanceof i9?n.options:n instanceof l9?Sl.objectValues(n.enum):n instanceof s9?q5(n._def.innerType):n instanceof $Q?[void 0]:n instanceof e9?[null]:n instanceof bv?[void 0,...q5(n.unwrap())]:n instanceof jW?[null,...q5(n.unwrap())]:n instanceof fq||n instanceof c9?q5(n.unwrap()):n instanceof o9?q5(n._def.innerType):[],kme=class n extends ol{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ta.object)return Tr(r,{code:vr.invalid_type,expected:ta.object,received:r.parsedType}),ti;let a=this.discriminator,i=r.data[a],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Tr(r,{code:vr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ti)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let i=new Map;for(let s of r){let e=q5(s.shape[t]);if(!e.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of e){if(i.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);i.set(o,s)}}return new n({typeName:si.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,..._i(a)})}};n9=class extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=(s,e)=>{if(Hme(s)||Hme(e))return ti;let o=ySe(s.value,e.value);return o.valid?((Xme(s)||Xme(e))&&r.dirty(),{status:r.value,value:o.data}):(Tr(a,{code:vr.invalid_intersection_types}),ti)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,e])=>i(s,e)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};n9.create=(n,t,r)=>new n9({left:n,right:t,typeName:si.ZodIntersection,..._i(r)});PW=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ta.array)return Tr(a,{code:vr.invalid_type,expected:ta.array,received:a.parsedType}),ti;if(a.data.length<this._def.items.length)return Tr(a,{code:vr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ti;!this._def.rest&&a.data.length>this._def.items.length&&(Tr(a,{code:vr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...a.data].map((e,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new fv(a,e,a.path,o)):null}).filter(e=>!!e);return a.common.async?Promise.all(s).then(e=>om.mergeArray(r,e)):om.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new n({...this._def,rest:t})}};PW.create=(n,t)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new PW({items:n,typeName:si.ZodTuple,rest:null,..._i(t)})};Lme=class n extends ol{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ta.object)return Tr(a,{code:vr.invalid_type,expected:ta.object,received:a.parsedType}),ti;let i=[],s=this._def.keyType,e=this._def.valueType;for(let o in a.data)i.push({key:s._parse(new fv(a,o,a.path,o)),value:e._parse(new fv(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?om.mergeObjectAsync(r,i):om.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,a){return r instanceof ol?new n({keyType:t,valueType:r,typeName:si.ZodRecord,..._i(a)}):new n({keyType:Bw.create(),valueType:t,typeName:si.ZodRecord,..._i(r)})}},QJ=class extends ol{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ta.map)return Tr(a,{code:vr.invalid_type,expected:ta.map,received:a.parsedType}),ti;let i=this._def.keyType,s=this._def.valueType,e=[...a.data.entries()].map(([o,u],d)=>({key:i._parse(new fv(a,o,a.path,[d,"key"])),value:s._parse(new fv(a,u,a.path,[d,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of e){let d=await u.key,I=await u.value;if(d.status==="aborted"||I.status==="aborted")return ti;(d.status==="dirty"||I.status==="dirty")&&r.dirty(),o.set(d.value,I.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of e){let d=u.key,I=u.value;if(d.status==="aborted"||I.status==="aborted")return ti;(d.status==="dirty"||I.status==="dirty")&&r.dirty(),o.set(d.value,I.value)}return{status:r.value,value:o}}}};QJ.create=(n,t,r)=>new QJ({valueType:t,keyType:n,typeName:si.ZodMap,..._i(r)});HJ=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ta.set)return Tr(a,{code:vr.invalid_type,expected:ta.set,received:a.parsedType}),ti;let i=this._def;i.minSize!==null&&a.data.size<i.minSize.value&&(Tr(a,{code:vr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&a.data.size>i.maxSize.value&&(Tr(a,{code:vr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function e(u){let d=new Set;for(let I of u){if(I.status==="aborted")return ti;I.status==="dirty"&&r.dirty(),d.add(I.value)}return{status:r.value,value:d}}let o=[...a.data.values()].map((u,d)=>s._parse(new fv(a,u,a.path,d)));return a.common.async?Promise.all(o).then(u=>e(u)):e(o)}min(t,r){return new n({...this._def,minSize:{value:t,message:Na.toString(r)}})}max(t,r){return new n({...this._def,maxSize:{value:t,message:Na.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};HJ.create=(n,t)=>new HJ({valueType:n,minSize:null,maxSize:null,typeName:si.ZodSet,..._i(t)});Sme=class n extends ol{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ta.function)return Tr(r,{code:vr.invalid_type,expected:ta.function,received:r.parsedType}),ti;function a(o,u){return bq({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,wJ(),K5].filter(d=>!!d),issueData:{code:vr.invalid_arguments,argumentsError:u}})}function i(o,u){return bq({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,wJ(),K5].filter(d=>!!d),issueData:{code:vr.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},e=r.data;if(this._def.returns instanceof Tw){let o=this;return mp(async function(...u){let d=new Gf([]),I=await o._def.args.parseAsync(u,s).catch(G=>{throw d.addIssue(a(u,G)),d}),h=await Reflect.apply(e,this,I);return await o._def.returns._def.type.parseAsync(h,s).catch(G=>{throw d.addIssue(i(h,G)),d})})}else{let o=this;return mp(function(...u){let d=o._def.args.safeParse(u,s);if(!d.success)throw new Gf([a(u,d.error)]);let I=Reflect.apply(e,this,d.data),h=o._def.returns.safeParse(I,s);if(!h.success)throw new Gf([i(I,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new n({...this._def,args:PW.create(t).rest($5.create())})}returns(t){return new n({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new n({args:t||PW.create([]).rest($5.create()),returns:r||$5.create(),typeName:si.ZodFunction,..._i(a)})}},r9=class extends ol{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};r9.create=(n,t)=>new r9({getter:n,typeName:si.ZodLazy,..._i(t)});a9=class extends ol{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Tr(r,{received:r.data,code:vr.invalid_literal,expected:this._def.value}),ti}return{status:"valid",value:t.data}}get value(){return this._def.value}};a9.create=(n,t)=>new a9({value:n,typeName:si.ZodLiteral,..._i(t)});i9=class n extends ol{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),a=this._def.values;return Tr(r,{expected:Sl.joinValues(a),received:r.parsedType,code:vr.invalid_type}),ti}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return Tr(r,{received:r.data,code:vr.invalid_enum_value,options:a}),ti}return mp(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return n.create(t,{...this._def,...r})}exclude(t,r=this._def){return n.create(this.options.filter(a=>!t.includes(a)),{...this._def,...r})}};i9.create=dQt;l9=class extends ol{_parse(t){let r=Sl.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==ta.string&&a.parsedType!==ta.number){let i=Sl.objectValues(r);return Tr(a,{expected:Sl.joinValues(i),received:a.parsedType,code:vr.invalid_type}),ti}if(this._cache||(this._cache=new Set(Sl.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Sl.objectValues(r);return Tr(a,{received:a.data,code:vr.invalid_enum_value,options:i}),ti}return mp(t.data)}get enum(){return this._def.values}};l9.create=(n,t)=>new l9({values:n,typeName:si.ZodNativeEnum,..._i(t)});Tw=class extends ol{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ta.promise&&r.common.async===!1)return Tr(r,{code:vr.invalid_type,expected:ta.promise,received:r.parsedType}),ti;let a=r.parsedType===ta.promise?r.data:Promise.resolve(r.data);return mp(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Tw.create=(n,t)=>new Tw({type:n,typeName:si.ZodPromise,..._i(t)});Gv=class extends ol{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===si.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:e=>{Tr(a,e),e.fatal?r.abort():r.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let e=i.transform(a.data,s);if(a.common.async)return Promise.resolve(e).then(async o=>{if(r.value==="aborted")return ti;let u=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return u.status==="aborted"?ti:u.status==="dirty"?_Q(u.value):r.value==="dirty"?_Q(u.value):u});{if(r.value==="aborted")return ti;let o=this._def.schema._parseSync({data:e,path:a.path,parent:a});return o.status==="aborted"?ti:o.status==="dirty"?_Q(o.value):r.value==="dirty"?_Q(o.value):o}}if(i.type==="refinement"){let e=o=>{let u=i.refinement(o,s);if(a.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?ti:(o.status==="dirty"&&r.dirty(),e(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?ti:(o.status==="dirty"&&r.dirty(),e(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(a.common.async===!1){let e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Sw(e))return ti;let o=i.transform(e.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>Sw(e)?Promise.resolve(i.transform(e.value,s)).then(o=>({status:r.value,value:o})):ti);Sl.assertNever(i)}};Gv.create=(n,t,r)=>new Gv({schema:n,typeName:si.ZodEffects,effect:t,..._i(r)});Gv.createWithPreprocess=(n,t,r)=>new Gv({schema:t,effect:{type:"preprocess",transform:n},typeName:si.ZodEffects,..._i(r)});bv=class extends ol{_parse(t){return this._getType(t)===ta.undefined?mp(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};bv.create=(n,t)=>new bv({innerType:n,typeName:si.ZodOptional,..._i(t)});jW=class extends ol{_parse(t){return this._getType(t)===ta.null?mp(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};jW.create=(n,t)=>new jW({innerType:n,typeName:si.ZodNullable,..._i(t)});s9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===ta.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};s9.create=(n,t)=>new s9({innerType:n,typeName:si.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._i(t)});o9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return CJ(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Gf(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Gf(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};o9.create=(n,t)=>new o9({innerType:n,typeName:si.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._i(t)});XJ=class extends ol{_parse(t){if(this._getType(t)!==ta.nan){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.nan,received:a.parsedType}),ti}return{status:"valid",value:t.data}}};XJ.create=n=>new XJ({typeName:si.ZodNaN,..._i(n)});z3r=Symbol("zod_brand"),fq=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Gq=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ti:s.status==="dirty"?(r.dirty(),_Q(s.value)):this._def.out._parseAsync({data:s.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ti:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(t,r){return new n({in:t,out:r,typeName:si.ZodPipeline})}},c9=class extends ol{_parse(t){let r=this._def.innerType._parse(t),a=i=>(Sw(i)&&(i.value=Object.freeze(i.value)),i);return CJ(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};c9.create=(n,t)=>new c9({innerType:n,typeName:si.ZodReadonly,..._i(t)});_3r={object:gf.lazycreate};(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(si||(si={}));P3r=(n,t={message:`Input not instance of ${n.name}`})=>hQt(r=>r instanceof n,t),mQt=Bw.create,pQt=PQ.create,j3r=XJ.create,K3r=jQ.create,bQt=KQ.create,q3r=qQ.create,$3r=xJ.create,eWr=$Q.create,tWr=e9.create,nWr=Jw.create,rWr=$5.create,aWr=zN.create,iWr=VJ.create,lWr=eE.create,sWr=gf.create,oWr=gf.strictCreate,cWr=t9.create,uWr=kme.create,IWr=n9.create,dWr=PW.create,hWr=Lme.create,mWr=QJ.create,pWr=HJ.create,bWr=Sme.create,fWr=r9.create,GWr=a9.create,gWr=i9.create,vWr=l9.create,ZWr=Tw.create,NWr=Gv.create,AWr=bv.create,WWr=jW.create,yWr=Gv.createWithPreprocess,FWr=Gq.create,EWr=()=>mQt().optional(),RWr=()=>pQt().optional(),wWr=()=>bQt().optional(),CWr={string:(n=>Bw.create({...n,coerce:!0})),number:(n=>PQ.create({...n,coerce:!0})),boolean:(n=>KQ.create({...n,coerce:!0})),bigint:(n=>jQ.create({...n,coerce:!0})),date:(n=>qQ.create({...n,coerce:!0}))},YWr=ti});var Ku={};Qo(Ku,{BRAND:()=>z3r,DIRTY:()=>_Q,EMPTY_PATH:()=>y3r,INVALID:()=>ti,NEVER:()=>YWr,OK:()=>mp,ParseStatus:()=>om,Schema:()=>ol,ZodAny:()=>Jw,ZodArray:()=>eE,ZodBigInt:()=>jQ,ZodBoolean:()=>KQ,ZodBranded:()=>fq,ZodCatch:()=>o9,ZodDate:()=>qQ,ZodDefault:()=>s9,ZodDiscriminatedUnion:()=>kme,ZodEffects:()=>Gv,ZodEnum:()=>i9,ZodError:()=>Gf,ZodFirstPartyTypeKind:()=>si,ZodFunction:()=>Sme,ZodIntersection:()=>n9,ZodIssueCode:()=>vr,ZodLazy:()=>r9,ZodLiteral:()=>a9,ZodMap:()=>QJ,ZodNaN:()=>XJ,ZodNativeEnum:()=>l9,ZodNever:()=>zN,ZodNull:()=>e9,ZodNullable:()=>jW,ZodNumber:()=>PQ,ZodObject:()=>gf,ZodOptional:()=>bv,ZodParsedType:()=>ta,ZodPipeline:()=>Gq,ZodPromise:()=>Tw,ZodReadonly:()=>c9,ZodRecord:()=>Lme,ZodSchema:()=>ol,ZodSet:()=>HJ,ZodString:()=>Bw,ZodSymbol:()=>xJ,ZodTransformer:()=>Gv,ZodTuple:()=>PW,ZodType:()=>ol,ZodUndefined:()=>$Q,ZodUnion:()=>t9,ZodUnknown:()=>$5,ZodVoid:()=>VJ,addIssueToContext:()=>Tr,any:()=>nWr,array:()=>lWr,bigint:()=>K3r,boolean:()=>bQt,coerce:()=>CWr,custom:()=>hQt,date:()=>q3r,datetimeRegex:()=>IQt,defaultErrorMap:()=>K5,discriminatedUnion:()=>uWr,effect:()=>NWr,enum:()=>gWr,function:()=>bWr,getErrorMap:()=>wJ,getParsedType:()=>_W,instanceof:()=>P3r,intersection:()=>IWr,isAborted:()=>Hme,isAsync:()=>CJ,isDirty:()=>Xme,isValid:()=>Sw,late:()=>_3r,lazy:()=>fWr,literal:()=>GWr,makeIssue:()=>bq,map:()=>mWr,nan:()=>j3r,nativeEnum:()=>vWr,never:()=>aWr,null:()=>tWr,nullable:()=>WWr,number:()=>pQt,object:()=>sWr,objectUtil:()=>ZSe,oboolean:()=>wWr,onumber:()=>RWr,optional:()=>AWr,ostring:()=>EWr,pipeline:()=>FWr,preprocess:()=>yWr,promise:()=>ZWr,quotelessJson:()=>N3r,record:()=>hWr,set:()=>pWr,setErrorMap:()=>W3r,strictObject:()=>oWr,string:()=>mQt,symbol:()=>$3r,transformer:()=>NWr,tuple:()=>dWr,undefined:()=>eWr,union:()=>cWr,unknown:()=>rWr,util:()=>Sl,void:()=>iWr});var FSe=It(()=>{Qme();ASe();iQt();pq();fQt();Vme()});function Tn(n,t,r){function a(o,u){var d;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(d=o._zod).traits??(d.traits=new Set),o._zod.traits.add(n),t(o,u);for(let I in e.prototype)I in o||Object.defineProperty(o,I,{value:e.prototype[I].bind(o)});o._zod.constr=e,o._zod.def=u}let i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function e(o){var u;let d=r?.Parent?new s:this;a(d,o),(u=d._zod).deferred??(u.deferred=[]);for(let I of d._zod.deferred)I();return d}return Object.defineProperty(e,"init",{value:a}),Object.defineProperty(e,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(n)}),Object.defineProperty(e,"name",{value:n}),e}function p1(n){return n&&Object.assign(Bme,n),Bme}var ESe,xWr,tE,Bme,kJ=It(()=>{ESe=Object.freeze({status:"aborted"});xWr=Symbol("zod_brand"),tE=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Bme={}});var zs={};Qo(zs,{BIGINT_FORMAT_RANGES:()=>gQt,Class:()=>wSe,NUMBER_FORMAT_RANGES:()=>kSe,aborted:()=>I9,allowsEval:()=>QSe,assert:()=>kWr,assertEqual:()=>VWr,assertIs:()=>HWr,assertNever:()=>XWr,assertNotEqual:()=>QWr,assignProp:()=>VSe,cached:()=>vq,captureStackTrace:()=>Tme,cleanEnum:()=>jWr,cleanRegex:()=>Nq,clone:()=>_N,createTransparentProxy:()=>DWr,defineLazy:()=>xc,esc:()=>u9,escapeRegex:()=>Dw,extend:()=>MWr,finalizeIssue:()=>PN,floatSafeRemainder:()=>xSe,getElementAtPath:()=>LWr,getEnumValues:()=>CSe,getLengthableOrigin:()=>Aq,getParsedType:()=>TWr,getSizableOrigin:()=>vQt,isObject:()=>LJ,isPlainObject:()=>SJ,issue:()=>LSe,joinValues:()=>Jme,jsonStringifyReplacer:()=>YSe,merge:()=>zWr,normalizeParams:()=>ka,nullish:()=>Zq,numKeys:()=>JWr,omit:()=>UWr,optionalKeys:()=>XSe,partial:()=>_Wr,pick:()=>OWr,prefixIssues:()=>KW,primitiveTypes:()=>GQt,promiseAllObject:()=>SWr,propertyKeyTypes:()=>HSe,randomString:()=>BWr,required:()=>PWr,stringifyPrimitive:()=>Dme,unwrapMessage:()=>gq});function VWr(n){return n}function QWr(n){return n}function HWr(n){}function XWr(n){throw new Error}function kWr(n){}function CSe(n){let t=Object.values(n).filter(a=>typeof a=="number");return Object.entries(n).filter(([a,i])=>t.indexOf(+a)===-1).map(([a,i])=>i)}function Jme(n,t="|"){return n.map(r=>Dme(r)).join(t)}function YSe(n,t){return typeof t=="bigint"?t.toString():t}function vq(n){return{get value(){{let r=n();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Zq(n){return n==null}function Nq(n){let t=n.startsWith("^")?1:0,r=n.endsWith("$")?n.length-1:n.length;return n.slice(t,r)}function xSe(n,t){let r=(n.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(n.toFixed(i).replace(".","")),e=Number.parseInt(t.toFixed(i).replace(".",""));return s%e/10**i}function xc(n,t,r){Object.defineProperty(n,t,{get(){{let i=r();return n[t]=i,i}throw new Error("cached value already set")},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function VSe(n,t,r){Object.defineProperty(n,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function LWr(n,t){return t?t.reduce((r,a)=>r?.[a],n):n}function SWr(n){let t=Object.keys(n),r=t.map(a=>n[a]);return Promise.all(r).then(a=>{let i={};for(let s=0;s<t.length;s++)i[t[s]]=a[s];return i})}function BWr(n=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let a=0;a<n;a++)r+=t[Math.floor(Math.random()*t.length)];return r}function u9(n){return JSON.stringify(n)}function LJ(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function SJ(n){if(LJ(n)===!1)return!1;let t=n.constructor;if(t===void 0)return!0;let r=t.prototype;return!(LJ(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function JWr(n){let t=0;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&t++;return t}function Dw(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _N(n,t,r){let a=new n._zod.constr(t??n._zod.def);return(!t||r?.parent)&&(a._zod.parent=n),a}function ka(n){let t=n;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function DWr(n){let t;return new Proxy({},{get(r,a,i){return t??(t=n()),Reflect.get(t,a,i)},set(r,a,i,s){return t??(t=n()),Reflect.set(t,a,i,s)},has(r,a){return t??(t=n()),Reflect.has(t,a)},deleteProperty(r,a){return t??(t=n()),Reflect.deleteProperty(t,a)},ownKeys(r){return t??(t=n()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,a){return t??(t=n()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(r,a,i){return t??(t=n()),Reflect.defineProperty(t,a,i)}})}function Dme(n){return typeof n=="bigint"?n.toString()+"n":typeof n=="string"?`"${n}"`:`${n}`}function XSe(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}function OWr(n,t){let r={},a=n._zod.def;for(let i in t){if(!(i in a.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=a.shape[i])}return _N(n,{...n._zod.def,shape:r,checks:[]})}function UWr(n,t){let r={...n._zod.def.shape},a=n._zod.def;for(let i in t){if(!(i in a.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return _N(n,{...n._zod.def,shape:r,checks:[]})}function MWr(n,t){if(!SJ(t))throw new Error("Invalid input to extend: expected a plain object");let r={...n._zod.def,get shape(){let a={...n._zod.def.shape,...t};return VSe(this,"shape",a),a},checks:[]};return _N(n,r)}function zWr(n,t){return _N(n,{...n._zod.def,get shape(){let r={...n._zod.def.shape,...t._zod.def.shape};return VSe(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function _Wr(n,t,r){let a=t._zod.def.shape,i={...a};if(r)for(let s in r){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=n?new n({type:"optional",innerType:a[s]}):a[s])}else for(let s in a)i[s]=n?new n({type:"optional",innerType:a[s]}):a[s];return _N(t,{...t._zod.def,shape:i,checks:[]})}function PWr(n,t,r){let a=t._zod.def.shape,i={...a};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new n({type:"nonoptional",innerType:a[s]}))}else for(let s in a)i[s]=new n({type:"nonoptional",innerType:a[s]});return _N(t,{...t._zod.def,shape:i,checks:[]})}function I9(n,t=0){for(let r=t;r<n.issues.length;r++)if(n.issues[r]?.continue!==!0)return!0;return!1}function KW(n,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(n),r})}function gq(n){return typeof n=="string"?n:n?.message}function PN(n,t,r){let a={...n,path:n.path??[]};if(!n.message){let i=gq(n.inst?._zod.def?.error?.(n))??gq(t?.error?.(n))??gq(r.customError?.(n))??gq(r.localeError?.(n))??"Invalid input";a.message=i}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function vQt(n){return n instanceof Set?"set":n instanceof Map?"map":n instanceof File?"file":"unknown"}function Aq(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function LSe(...n){let[t,r,a]=n;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}function jWr(n){return Object.entries(n).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var Tme,QSe,TWr,HSe,GQt,kSe,gQt,wSe,nE=It(()=>{Tme=Error.captureStackTrace?Error.captureStackTrace:(...n)=>{};QSe=vq(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let n=Function;return new n(""),!0}catch{return!1}});TWr=n=>{let t=typeof n;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(n)?"array":n===null?"null":n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?"promise":typeof Map<"u"&&n instanceof Map?"map":typeof Set<"u"&&n instanceof Set?"set":typeof Date<"u"&&n instanceof Date?"date":typeof File<"u"&&n instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},HSe=new Set(["string","number","symbol"]),GQt=new Set(["string","number","bigint","boolean","symbol","undefined"]);kSe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},gQt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};wSe=class{constructor(...t){}}});function BSe(n,t=r=>r.message){let r={},a=[];for(let i of n.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):a.push(t(i));return{formErrors:a,fieldErrors:r}}function JSe(n,t){let r=t||function(s){return s.message},a={_errors:[]},i=s=>{for(let e of s.issues)if(e.code==="invalid_union"&&e.errors.length)e.errors.map(o=>i({issues:o}));else if(e.code==="invalid_key")i({issues:e.issues});else if(e.code==="invalid_element")i({issues:e.issues});else if(e.path.length===0)a._errors.push(r(e));else{let o=a,u=0;for(;u<e.path.length;){let d=e.path[u];u===e.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(e))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return i(n),a}var ZQt,Ome,SSe,TSe=It(()=>{kJ();nE();ZQt=(n,t)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:t,enumerable:!1}),Object.defineProperty(n,"message",{get(){return JSON.stringify(t,YSe,2)},enumerable:!0}),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Ome=Tn("$ZodError",ZQt),SSe=Tn("$ZodError",ZQt,{Parent:Error})});var NQt,AQt,DSe,Wq,OSe,Ume,USe=It(()=>{kJ();TSe();nE();NQt=n=>(t,r,a,i)=>{let s=a?Object.assign(a,{async:!1}):{async:!1},e=t._zod.run({value:r,issues:[]},s);if(e instanceof Promise)throw new tE;if(e.issues.length){let o=new(i?.Err??n)(e.issues.map(u=>PN(u,s,p1())));throw Tme(o,i?.callee),o}return e.value},AQt=n=>async(t,r,a,i)=>{let s=a?Object.assign(a,{async:!0}):{async:!0},e=t._zod.run({value:r,issues:[]},s);if(e instanceof Promise&&(e=await e),e.issues.length){let o=new(i?.Err??n)(e.issues.map(u=>PN(u,s,p1())));throw Tme(o,i?.callee),o}return e.value},DSe=n=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new tE;return s.issues.length?{success:!1,error:new(n??Ome)(s.issues.map(e=>PN(e,i,p1())))}:{success:!0,data:s.value}},Wq=DSe(SSe),OSe=n=>async(t,r,a)=>{let i=a?Object.assign(a,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(e=>PN(e,i,p1())))}:{success:!0,data:s.value}},Ume=OSe(SSe)});function VQt(){return new RegExp(qWr,"u")}function DQt(n){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${t}`:n.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${n.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function OQt(n){return new RegExp(`^${DQt(n)}$`)}function UQt(n){let t=DQt({precision:n.precision}),r=["Z"];n.local&&r.push(""),n.offset&&r.push("([+-]\\d{2}:\\d{2})");let a=`${t}(?:${r.join("|")})`;return new RegExp(`^${JQt}T(?:${a})$`)}var WQt,yQt,FQt,EQt,RQt,wQt,CQt,YQt,MSe,xQt,qWr,QQt,HQt,XQt,kQt,LQt,zSe,SQt,BQt,JQt,TQt,MQt,zQt,_Qt,PQt,jQt,KQt,qQt,$Qt,zme=It(()=>{WQt=/^[cC][^\s-]{8,}$/,yQt=/^[0-9a-z]+$/,FQt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,EQt=/^[0-9a-vA-V]{20}$/,RQt=/^[A-Za-z0-9]{27}$/,wQt=/^[a-zA-Z0-9_-]{21}$/,CQt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,YQt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,MSe=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,xQt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qWr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";QQt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,HQt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,XQt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,kQt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,LQt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zSe=/^[A-Za-z0-9_-]*$/,SQt=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,BQt=/^\+(?:[0-9]){6,14}[0-9]$/,JQt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",TQt=new RegExp(`^${JQt}$`);MQt=n=>{let t=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},zQt=/^\d+n?$/,_Qt=/^\d+$/,PQt=/^-?\d+(?:\.\d+)?/i,jQt=/true|false/i,KQt=/null/i,qQt=/^[^A-Z]*$/,$Qt=/^[^a-z]*$/});var pp,e9t,_Se,PSe,t9t,n9t,r9t,a9t,i9t,yq,l9t,s9t,o9t,c9t,u9t,I9t,d9t,_me=It(()=>{kJ();zme();nE();pp=Tn("$ZodCheck",(n,t)=>{var r;n._zod??(n._zod={}),n._zod.def=t,(r=n._zod).onattach??(r.onattach=[])}),e9t={number:"number",bigint:"bigint",object:"date"},_Se=Tn("$ZodCheckLessThan",(n,t)=>{pp.init(n,t);let r=e9t[typeof t.value];n._zod.onattach.push(a=>{let i=a._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),n._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),PSe=Tn("$ZodCheckGreaterThan",(n,t)=>{pp.init(n,t);let r=e9t[typeof t.value];n._zod.onattach.push(a=>{let i=a._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),n._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),t9t=Tn("$ZodCheckMultipleOf",(n,t)=>{pp.init(n,t),n._zod.onattach.push(r=>{var a;(a=r._zod.bag).multipleOf??(a.multipleOf=t.value)}),n._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):xSe(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:n,continue:!t.abort})}}),n9t=Tn("$ZodCheckNumberFormat",(n,t)=>{pp.init(n,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,s]=kSe[t.format];n._zod.onattach.push(e=>{let o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=s,r&&(o.pattern=_Qt)}),n._zod.check=e=>{let o=e.value;if(r){if(!Number.isInteger(o)){e.issues.push({expected:a,format:t.format,code:"invalid_type",input:o,inst:n});return}if(!Number.isSafeInteger(o)){o>0?e.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:a,continue:!t.abort}):e.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:a,continue:!t.abort});return}}o<i&&e.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),o>s&&e.issues.push({origin:"number",input:o,code:"too_big",maximum:s,inst:n})}}),r9t=Tn("$ZodCheckMaxLength",(n,t)=>{var r;pp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Zq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(a._zod.bag.maximum=t.maximum)}),n._zod.check=a=>{let i=a.value;if(i.length<=t.maximum)return;let e=Aq(i);a.issues.push({origin:e,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),a9t=Tn("$ZodCheckMinLength",(n,t)=>{var r;pp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Zq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(a._zod.bag.minimum=t.minimum)}),n._zod.check=a=>{let i=a.value;if(i.length>=t.minimum)return;let e=Aq(i);a.issues.push({origin:e,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),i9t=Tn("$ZodCheckLengthEquals",(n,t)=>{var r;pp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Zq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),n._zod.check=a=>{let i=a.value,s=i.length;if(s===t.length)return;let e=Aq(i),o=s>t.length;a.issues.push({origin:e,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:n,continue:!t.abort})}}),yq=Tn("$ZodCheckStringFormat",(n,t)=>{var r,a;pp.init(n,t),n._zod.onattach.push(i=>{let s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=n._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:n,continue:!t.abort})}):(a=n._zod).check??(a.check=()=>{})}),l9t=Tn("$ZodCheckRegex",(n,t)=>{yq.init(n,t),n._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:n,continue:!t.abort})}}),s9t=Tn("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=qQt),yq.init(n,t)}),o9t=Tn("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=$Qt),yq.init(n,t)}),c9t=Tn("$ZodCheckIncludes",(n,t)=>{pp.init(n,t);let r=Dw(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=a,n._zod.onattach.push(i=>{let s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(a)}),n._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:n,continue:!t.abort})}}),u9t=Tn("$ZodCheckStartsWith",(n,t)=>{pp.init(n,t);let r=new RegExp(`^${Dw(t.prefix)}.*`);t.pattern??(t.pattern=r),n._zod.onattach.push(a=>{let i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:n,continue:!t.abort})}}),I9t=Tn("$ZodCheckEndsWith",(n,t)=>{pp.init(n,t);let r=new RegExp(`.*${Dw(t.suffix)}$`);t.pattern??(t.pattern=r),n._zod.onattach.push(a=>{let i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:n,continue:!t.abort})}}),d9t=Tn("$ZodCheckOverwrite",(n,t)=>{pp.init(n,t),n._zod.check=r=>{r.value=t.tx(r.value)}})});var Pme,jSe=It(()=>{Pme=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let a=t.split(`
|
|
706
|
+
`);s=G.pop()||"";for(let W of G)if(W.startsWith("data: ")){let y=W.slice(6);if(y==="[DONE]")return;try{let R=JSON.parse(y);if(R.type==="connection_established")continue;if(R.error)throw new Error(R.error);R.usageMetadata&&(o=R.usageMetadata);let F=this.convertStreamChunkToGenAI(R);F&&(yield F)}catch(R){ar.warn("[DeepV Server] Stream chunk parse error",{data:y.substring(0,100)+"...",error:R instanceof Error?R.message:R})}}}}finally{d&&r&&r.removeEventListener("abort",d);try{a.releaseLock()}catch{}}}convertStreamChunkToGenAI(t){if(!t.candidates||!Array.isArray(t.candidates)||t.candidates.length===0)return null;let r={candidates:t.candidates,usageMetadata:t.usageMetadata};if(r.candidates?.[0]?.content?.parts){for(let a of r.candidates[0].content.parts)if(a.functionCall&&!a.functionCall.id){let i=`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;console.log(`[DeepV Server] \u8865\u5168\u7F3A\u5931\u7684\u5DE5\u5177 ID (Chunk): ${a.functionCall.name} -> ${i}`),a.functionCall.id=i}}return r.functionCalls||Object.defineProperty(r,"functionCalls",{get:function(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");let a=this.candidates?.[0]?.content?.parts?.filter(i=>i.functionCall).map(i=>i.functionCall).filter(i=>i!==void 0);if(a?.length!==0)return a},enumerable:!1,configurable:!0}),r}mergeStreamContent(t,r){if(!t)return r;let a=t.candidates?.[0]?.content?.parts||[],i=r.candidates?.[0]?.content?.parts||[];if(i.length>0&&i[0].text){let s=a[a.length-1];s&&s.text&&!s.functionCall?s.text+=i[0].text:a.push(...i)}else if(i.length>0&&i[0].functionCall){let s=a[a.length-1],e=i[0];if(s&&s.functionCall){let o=s.functionCall,u=e.functionCall;u&&(u.name&&(o.name=u.name.trim()),u.id&&(o.id=u.id),u.args&&(typeof u.args=="string"&&typeof o.args=="string"?o.args+=u.args:typeof u.args=="object"&&u.args!==null?o.args={...typeof o.args=="object"?o.args:{},...u.args}:o.args=u.args))}else{let o={...e};if(o.functionCall&&!o.functionCall.id){let u=`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;console.log(`[DeepV Server] \u8865\u5168\u7F3A\u5931\u7684\u5DE5\u5177 ID: ${o.functionCall.name} -> ${u}`),o.functionCall.id=u}a.push(o)}}return r.usageMetadata&&(t.usageMetadata=r.usageMetadata),r.candidates?.[0]?.finishReason&&(t.candidates[0].finishReason=r.candidates[0].finishReason),t}buildUnifiedRequest(t,r){let a=Vd.getModelForScene(r),i=this.config?.getModel(),s;return i&&as(i)?t.model&&as(t.model)?s=t.model:s=i:s=t.model||a||"auto",{model:s,contents:t.contents,config:{...t.config,httpOptions:{...t.config?.httpOptions,headers:{...t.config?.httpOptions?.headers,"X-Scene-Type":r,"X-Scene-Display":Vd.getSceneDisplayName(r)}}}}}async*handleStreamError(t){this.handleError(t)}async countTokens(t){try{let r=t.model||this.config?.getModel()||"auto";if(as(r))return ar.debug("[DeepV Server] Custom model detected, token counting not supported"),{totalTokens:0};let a={model:r,contents:t.contents};(t.config?.systemInstruction||t.config?.tools)&&(a.config={},t.config.systemInstruction&&(a.config.systemInstruction=t.config.systemInstruction),t.config.tools&&(a.config.tools=t.config.tools));let i=await this.callUnifiedTokenCountAPI(a);return of.emitRealTimeToken({inputTokens:i.totalTokens||0,outputTokens:0,totalTokens:i.totalTokens||0,timestamp:Date.now()}),i}catch(r){let a=t.model||this.config?.getModel()||"auto";return as(a)?ar.debug("[DeepV Server] Token count not available for custom model, using fallback"):ar.error("[DeepV Server] Token count failed:",r),this.estimateTokensAsFailback(t)}}async callUnifiedTokenCountAPI(t){let r=await uo.getUserHeaders(),a=`${uo.getProxyServerUrl()}/v1/chat/count-tokens`;try{let i=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(t)});if(!i.ok){let e=await i.text();throw i.status===401?(console.error("[DeepV Server] Token count 401 Unauthorized"),this.authHandler&&await this.authHandler(),new BI("Authentication required - please re-authenticate")):new Error(`Token count API failed (${i.status}): ${e}`)}let s=await i.json();return ar.debug("[DeepV Server] Token count response",{totalTokens:s.totalTokens}),{totalTokens:s.totalTokens||0}}catch(i){throw ar.error("[DeepV Server] Token count API call failed:",i),i}}estimateTokensAsFailback(t){try{let r=Array.isArray(t.contents)?t.contents:[{role:Pr.USER,parts:[{text:t.contents}]}],a=0,i=0,s=0,e=0;for(let c of r)if(typeof c=="object"&&c&&"parts"in c&&Array.isArray(c.parts)){for(let G of c.parts)if(typeof G=="object"&&G&&"text"in G&&typeof G.text=="string")a+=G.text.length,e++;else if(typeof G=="object"&&G&&"functionCall"in G&&G.functionCall){let W=G.functionCall,y=`[Tool: ${W.name}]`+JSON.stringify(W.args||{});a+=y.length,i++}else if(typeof G=="object"&&G&&"functionResponse"in G&&G.functionResponse){let R=`[Tool Result: ${G.functionResponse.response?.output||"result"}]`;a+=R.length+20,s++}}else typeof c=="string"&&(a+=c.length,e++);let o=JSON.stringify(r),u=/[\u4e00-\u9fff]/.test(o),d=/```|function|class|import|export|\{|\}|\[|\]/.test(o),I=4;return u?I=2:d&&(I=3),{totalTokens:Math.ceil(a/I)}}catch(r){return console.error("[DeepV Server] Fallback estimation error:",r),{totalTokens:1e3}}}async embedContent(t){throw new Error("Claude models do not support embedding content")}withTimeout(t,r,a){let i=null,s=new Promise((e,o)=>{i=setTimeout(()=>{o(new Error(a))},r)});return Promise.race([t,s]).finally(()=>{i!==null&&clearTimeout(i)})}}});function GSe(n,t){let r=n.getModel()||"auto",a={authType:t,proxy:n?.getProxy()};return t===is.USE_PROXY_AUTH,a}async function gSe(n,t,r){let i={headers:{"User-Agent":`GeminiCLI/1.0.304 (${process.platform}; ${process.arch})`}};if(!0){let e=t.getCustomProxyServerUrl(),o;if(e)o=e,console.log(`[DeepX] Using custom proxy server: ${o}`);else{if(!$He())throw new Error("DeepV Code server is required for all models but is not available. Please start the DeepV Code server or use proxy authentication.");o=RW(),console.log(`[DeepX] Connecting to DeepV Code server: ${o}`)}let u=process.env.GOOGLE_CLOUD_LOCATION||"us-central1",d=process.env.GOOGLE_CLOUD_PROJECT||"default-project";return new RJ(u,d,o,t)}throw new Error(`Error creating contentGenerator: Unsupported authType: ${n.authType}`)}var is,Rme=It(()=>{"use strict";fSe();VB();(function(n){n.USE_PROXY_AUTH="proxy-auth"})(is||(is={}))});var wme,nQt=It(()=>{"use strict";wme=class{prompts=new Map;registerPrompt(t){if(this.prompts.has(t.name)){let r=`${t.serverName}_${t.name}`;console.warn(`Prompt with name "${t.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...t,name:r})}else this.prompts.set(t.name,t)}getAllPrompts(){return Array.from(this.prompts.values()).sort((t,r)=>t.name.localeCompare(r.name))}getPrompt(t){return this.prompts.get(t)}getPromptsByServer(t){let r=[];for(let a of this.prompts.values())a.serverName===t&&r.push(a);return r.sort((a,i)=>a.name.localeCompare(i.name))}removePromptsByServer(t){for(let[r,a]of this.prompts.entries())a.serverName===t&&this.prompts.delete(r)}}});function MN(n){let t={type:"subagent_update",data:n,timestamp:Date.now()};return JSON.stringify(t)}function rQt(n){let t={type:"text",data:n,timestamp:Date.now()};return JSON.stringify(t)}function Cme(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&t.type&&t.data!==void 0)return t}catch{}return{type:"text",data:n,timestamp:Date.now()}}function Yme(n){return n.type==="subagent_update"}function xme(n){return n.type==="text"}var vSe=It(()=>{"use strict";});var $r,Mr,ea,Ll=It(()=>{"use strict";vSe();$r=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;forceMarkdown;canUpdateOutput;allowSubAgentUse;constructor(t,r,a,i,s,e=!0,o=!1,u=!1,d=!0){this.name=t,this.displayName=r,this.description=a,this.icon=i,this.parameterSchema=s,this.isOutputMarkdown=e,this.forceMarkdown=o,this.canUpdateOutput=u,this.allowSubAgentUse=d}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(t){return null}getDescription(t){return JSON.stringify(t)}shouldConfirmExecute(t,r){return Promise.resolve(!1)}toolLocations(t){return[]}};(function(n){n.ProceedOnce="proceed_once",n.ProceedAlways="proceed_always",n.ProceedAlwaysServer="proceed_always_server",n.ProceedAlwaysTool="proceed_always_tool",n.ProceedAlwaysProject="proceed_always_project",n.ModifyWithEditor="modify_with_editor",n.Cancel="cancel"})(Mr||(Mr={}));(function(n){n.FileSearch="fileSearch",n.Folder="folder",n.Globe="globe",n.Hammer="hammer",n.LightBulb="lightBulb",n.Pencil="pencil",n.Regex="regex",n.Terminal="terminal",n.Clipboard="clipboard",n.Tasks="tasks",n.Wrench="wrench",n.Trash="trash",n.List="list",n.Info="info"})(ea||(ea={}))});var Sl,ZSe,ta,_W,pq=It(()=>{(function(n){n.assertEqual=i=>{};function t(i){}n.assertIs=t;function r(i){throw new Error}n.assertNever=r,n.arrayToEnum=i=>{let s={};for(let e of i)s[e]=e;return s},n.getValidEnumValues=i=>{let s=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),e={};for(let o of s)e[o]=i[o];return n.objectValues(e)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&s.push(e);return s},n.find=(i,s)=>{for(let e of i)if(s(e))return e},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function a(i,s=" | "){return i.map(e=>typeof e=="string"?`'${e}'`:e).join(s)}n.joinValues=a,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Sl||(Sl={}));(function(n){n.mergeShapes=(t,r)=>({...t,...r})})(ZSe||(ZSe={}));ta=Sl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_W=n=>{switch(typeof n){case"undefined":return ta.undefined;case"string":return ta.string;case"number":return Number.isNaN(n)?ta.nan:ta.number;case"boolean":return ta.boolean;case"function":return ta.function;case"bigint":return ta.bigint;case"symbol":return ta.symbol;case"object":return Array.isArray(n)?ta.array:n===null?ta.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?ta.promise:typeof Map<"u"&&n instanceof Map?ta.map:typeof Set<"u"&&n instanceof Set?ta.set:typeof Date<"u"&&n instanceof Date?ta.date:ta.object;default:return ta.unknown}}});var vr,N3r,Gf,Vme=It(()=>{pq();vr=Sl.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),N3r=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),Gf=class n extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(s){return s.message},a={_errors:[]},i=s=>{for(let e of s.issues)if(e.code==="invalid_union")e.unionErrors.map(i);else if(e.code==="invalid_return_type")i(e.returnTypeError);else if(e.code==="invalid_arguments")i(e.argumentsError);else if(e.path.length===0)a._errors.push(r(e));else{let o=a,u=0;for(;u<e.path.length;){let d=e.path[u];u===e.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(e))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return i(this),a}static assert(t){if(!(t instanceof n))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Sl.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},a=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];r[s]=r[s]||[],r[s].push(t(i))}else a.push(t(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};Gf.create=n=>new Gf(n)});var A3r,K5,NSe=It(()=>{Vme();pq();A3r=(n,t)=>{let r;switch(n.code){case vr.invalid_type:n.received===ta.undefined?r="Required":r=`Expected ${n.expected}, received ${n.received}`;break;case vr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(n.expected,Sl.jsonStringifyReplacer)}`;break;case vr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Sl.joinValues(n.keys,", ")}`;break;case vr.invalid_union:r="Invalid input";break;case vr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Sl.joinValues(n.options)}`;break;case vr.invalid_enum_value:r=`Invalid enum value. Expected ${Sl.joinValues(n.options)}, received '${n.received}'`;break;case vr.invalid_arguments:r="Invalid function arguments";break;case vr.invalid_return_type:r="Invalid function return type";break;case vr.invalid_date:r="Invalid date";break;case vr.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(r=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?r=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?r=`Invalid input: must end with "${n.validation.endsWith}"`:Sl.assertNever(n.validation):n.validation!=="regex"?r=`Invalid ${n.validation}`:r="Invalid";break;case vr.too_small:n.type==="array"?r=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?r=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?r=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?r=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?r=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:r="Invalid input";break;case vr.too_big:n.type==="array"?r=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?r=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?r=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?r=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?r=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:r="Invalid input";break;case vr.custom:r="Invalid input";break;case vr.invalid_intersection_types:r="Intersection results could not be merged";break;case vr.not_multiple_of:r=`Number must be a multiple of ${n.multipleOf}`;break;case vr.not_finite:r="Number must be finite";break;default:r=t.defaultError,Sl.assertNever(n)}return{message:r}},K5=A3r});function W3r(n){aQt=n}function wJ(){return aQt}var aQt,Qme=It(()=>{NSe();aQt=K5});function Tr(n,t){let r=wJ(),a=bq({issueData:t,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,r,r===K5?void 0:K5].filter(i=>!!i)});n.common.issues.push(a)}var bq,y3r,om,ti,_Q,mp,Hme,Xme,Sw,CJ,ASe=It(()=>{Qme();NSe();bq=n=>{let{data:t,path:r,errorMaps:a,issueData:i}=n,s=[...r,...i.path||[]],e={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",u=a.filter(d=>!!d).slice().reverse();for(let d of u)o=d(e,{data:t,defaultError:o}).message;return{...i,path:s,message:o}},y3r=[];om=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let i of r){if(i.status==="aborted")return ti;i.status==="dirty"&&t.dirty(),a.push(i.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let i of r){let s=await i.key,e=await i.value;a.push({key:s,value:e})}return n.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let i of r){let{key:s,value:e}=i;if(s.status==="aborted"||e.status==="aborted")return ti;s.status==="dirty"&&t.dirty(),e.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof e.value<"u"||i.alwaysSet)&&(a[s.value]=e.value)}return{status:t.value,value:a}}},ti=Object.freeze({status:"aborted"}),_Q=n=>({status:"dirty",value:n}),mp=n=>({status:"valid",value:n}),Hme=n=>n.status==="aborted",Xme=n=>n.status==="dirty",Sw=n=>n.status==="valid",CJ=n=>typeof Promise<"u"&&n instanceof Promise});var iQt=It(()=>{});var Na,lQt=It(()=>{(function(n){n.errToObj=t=>typeof t=="string"?{message:t}:t||{},n.toString=t=>typeof t=="string"?t:t?.message})(Na||(Na={}))});function _i(n){if(!n)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=n;if(t&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(e,o)=>{let{message:u}=n;return e.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??a??o.defaultError}:e.code!=="invalid_type"?{message:o.defaultError}:{message:u??r??o.defaultError}},description:i}}function uQt(n){let t="[0-5]\\d";n.precision?t=`${t}\\.\\d{${n.precision}}`:n.precision==null&&(t=`${t}(\\.\\d+)?`);let r=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function T3r(n){return new RegExp(`^${uQt(n)}$`)}function IQt(n){let t=`${cQt}T${uQt(n)}`,r=[];return r.push(n.local?"Z?":"Z"),n.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function D3r(n,t){return!!((t==="v4"||!t)&&H3r.test(n)||(t==="v6"||!t)&&k3r.test(n))}function O3r(n,t){if(!Y3r.test(n))return!1;try{let[r]=n.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function U3r(n,t){return!!((t==="v4"||!t)&&X3r.test(n)||(t==="v6"||!t)&&L3r.test(n))}function M3r(n,t){let r=(n.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(n.toFixed(i).replace(".","")),e=Number.parseInt(t.toFixed(i).replace(".",""));return s%e/10**i}function YJ(n){if(n instanceof gf){let t={};for(let r in n.shape){let a=n.shape[r];t[r]=bv.create(YJ(a))}return new gf({...n._def,shape:()=>t})}else return n instanceof eE?new eE({...n._def,type:YJ(n.element)}):n instanceof bv?bv.create(YJ(n.unwrap())):n instanceof jW?jW.create(YJ(n.unwrap())):n instanceof PW?PW.create(n.items.map(t=>YJ(t))):n}function ySe(n,t){let r=_W(n),a=_W(t);if(n===t)return{valid:!0,data:n};if(r===ta.object&&a===ta.object){let i=Sl.objectKeys(t),s=Sl.objectKeys(n).filter(o=>i.indexOf(o)!==-1),e={...n,...t};for(let o of s){let u=ySe(n[o],t[o]);if(!u.valid)return{valid:!1};e[o]=u.data}return{valid:!0,data:e}}else if(r===ta.array&&a===ta.array){if(n.length!==t.length)return{valid:!1};let i=[];for(let s=0;s<n.length;s++){let e=n[s],o=t[s],u=ySe(e,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===ta.date&&a===ta.date&&+n==+t?{valid:!0,data:n}:{valid:!1}}function dQt(n,t){return new i9({values:n,typeName:si.ZodEnum,..._i(t)})}function oQt(n,t){let r=typeof n=="function"?n(t):typeof n=="string"?{message:n}:n;return typeof r=="string"?{message:r}:r}function hQt(n,t={},r){return n?Jw.create().superRefine((a,i)=>{let s=n(a);if(s instanceof Promise)return s.then(e=>{if(!e){let o=oQt(t,a),u=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:u})}});if(!s){let e=oQt(t,a),o=e.fatal??r??!0;i.addIssue({code:"custom",...e,fatal:o})}}):Jw.create()}var fv,sQt,ol,F3r,E3r,R3r,w3r,C3r,Y3r,x3r,V3r,Q3r,WSe,H3r,X3r,k3r,L3r,S3r,B3r,cQt,J3r,Bw,PQ,jQ,KQ,qQ,xJ,$Q,e9,Jw,$5,zN,VJ,eE,gf,t9,q5,kme,n9,PW,Lme,QJ,HJ,Sme,r9,a9,i9,l9,Tw,Gv,bv,jW,s9,o9,XJ,z3r,fq,Gq,c9,_3r,si,P3r,mQt,pQt,j3r,K3r,bQt,q3r,$3r,eWr,tWr,nWr,rWr,aWr,iWr,lWr,sWr,oWr,cWr,uWr,IWr,dWr,hWr,mWr,pWr,bWr,fWr,GWr,gWr,vWr,ZWr,NWr,AWr,WWr,yWr,FWr,EWr,RWr,wWr,CWr,YWr,fQt=It(()=>{Vme();Qme();lQt();ASe();pq();fv=class{constructor(t,r,a,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},sQt=(n,t)=>{if(Sw(t))return{success:!0,data:t.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Gf(n.common.issues);return this._error=r,this._error}}};ol=class{get description(){return this._def.description}_getType(t){return _W(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:_W(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new om,ctx:{common:t.parent.common,data:t.data,parsedType:_W(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(CJ(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_W(t)},i=this._parseSync({data:t,path:a.path,parent:a});return sQt(a,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_W(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return Sw(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(a=>Sw(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_W(t)},i=this._parse({data:t,path:a.path,parent:a}),s=await(CJ(i)?i:Promise.resolve(i));return sQt(a,s)}refine(t,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let e=t(i),o=()=>s.addIssue({code:vr.custom,...a(i)});return typeof Promise<"u"&&e instanceof Promise?e.then(u=>u?!0:(o(),!1)):e?!0:(o(),!1)})}refinement(t,r){return this._refinement((a,i)=>t(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(t){return new Gv({schema:this,typeName:si.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return bv.create(this,this._def)}nullable(){return jW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eE.create(this)}promise(){return Tw.create(this,this._def)}or(t){return t9.create([this,t],this._def)}and(t){return n9.create(this,t,this._def)}transform(t){return new Gv({..._i(this._def),schema:this,typeName:si.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new s9({..._i(this._def),innerType:this,defaultValue:r,typeName:si.ZodDefault})}brand(){return new fq({typeName:si.ZodBranded,type:this,..._i(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new o9({..._i(this._def),innerType:this,catchValue:r,typeName:si.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Gq.create(this,t)}readonly(){return c9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},F3r=/^c[^\s-]{8,}$/i,E3r=/^[0-9a-z]+$/,R3r=/^[0-9A-HJKMNP-TV-Z]{26}$/i,w3r=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,C3r=/^[a-z0-9_-]{21}$/i,Y3r=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,x3r=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,V3r=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Q3r="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",H3r=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,X3r=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,k3r=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,L3r=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,S3r=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B3r=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cQt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",J3r=new RegExp(`^${cQt}$`);Bw=class n extends ol{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ta.string){let s=this._getOrReturnCtx(t);return Tr(s,{code:vr.invalid_type,expected:ta.string,received:s.parsedType}),ti}let a=new om,i;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let e=t.data.length>s.value,o=t.data.length<s.value;(e||o)&&(i=this._getOrReturnCtx(t,i),e?Tr(i,{code:vr.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&Tr(i,{code:vr.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")V3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"email",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")WSe||(WSe=new RegExp(Q3r,"u")),WSe.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"emoji",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")w3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"uuid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")C3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"nanoid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")F3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"cuid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")E3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"cuid2",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")R3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"ulid",code:vr.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Tr(i,{validation:"url",code:vr.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"regex",code:vr.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?IQt(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?J3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?T3r(s).test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?x3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"duration",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?D3r(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"ip",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?O3r(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"jwt",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?U3r(t.data,s.version)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"cidr",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?S3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"base64",code:vr.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?B3r.test(t.data)||(i=this._getOrReturnCtx(t,i),Tr(i,{validation:"base64url",code:vr.invalid_string,message:s.message}),a.dirty()):Sl.assertNever(s);return{status:a.value,value:t.data}}_regex(t,r,a){return this.refinement(i=>t.test(i),{validation:r,code:vr.invalid_string,...Na.errToObj(a)})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Na.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Na.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Na.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Na.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Na.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Na.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Na.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Na.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Na.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Na.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Na.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Na.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Na.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Na.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Na.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Na.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Na.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Na.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Na.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Na.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Na.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Na.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Na.errToObj(r)})}nonempty(t){return this.min(1,Na.errToObj(t))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Bw.create=n=>new Bw({checks:[],typeName:si.ZodString,coerce:n?.coerce??!1,..._i(n)});PQ=class n extends ol{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ta.number){let s=this._getOrReturnCtx(t);return Tr(s,{code:vr.invalid_type,expected:ta.number,received:s.parsedType}),ti}let a,i=new om;for(let s of this._def.checks)s.kind==="int"?Sl.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?M3r(t.data,s.value)!==0&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.not_finite,message:s.message}),i.dirty()):Sl.assertNever(s);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Na.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Na.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Na.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Na.toString(r))}setLimit(t,r,a,i){return new n({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:Na.toString(i)}]})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Na.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Na.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Na.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Na.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Na.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Na.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Na.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Na.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Na.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Sl.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(t===null||a.value<t)&&(t=a.value)}return Number.isFinite(r)&&Number.isFinite(t)}};PQ.create=n=>new PQ({checks:[],typeName:si.ZodNumber,coerce:n?.coerce||!1,..._i(n)});jQ=class n extends ol{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ta.bigint)return this._getInvalidInput(t);let a,i=new om;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),Tr(a,{code:vr.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Sl.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Tr(r,{code:vr.invalid_type,expected:ta.bigint,received:r.parsedType}),ti}gte(t,r){return this.setLimit("min",t,!0,Na.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Na.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Na.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Na.toString(r))}setLimit(t,r,a,i){return new n({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:Na.toString(i)}]})}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Na.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Na.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Na.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Na.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Na.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};jQ.create=n=>new jQ({checks:[],typeName:si.ZodBigInt,coerce:n?.coerce??!1,..._i(n)});KQ=class extends ol{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ta.boolean){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.boolean,received:a.parsedType}),ti}return mp(t.data)}};KQ.create=n=>new KQ({typeName:si.ZodBoolean,coerce:n?.coerce||!1,..._i(n)});qQ=class n extends ol{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ta.date){let s=this._getOrReturnCtx(t);return Tr(s,{code:vr.invalid_type,expected:ta.date,received:s.parsedType}),ti}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return Tr(s,{code:vr.invalid_date}),ti}let a=new om,i;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),Tr(i,{code:vr.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):Sl.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new n({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Na.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Na.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};qQ.create=n=>new qQ({checks:[],coerce:n?.coerce||!1,typeName:si.ZodDate,..._i(n)});xJ=class extends ol{_parse(t){if(this._getType(t)!==ta.symbol){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.symbol,received:a.parsedType}),ti}return mp(t.data)}};xJ.create=n=>new xJ({typeName:si.ZodSymbol,..._i(n)});$Q=class extends ol{_parse(t){if(this._getType(t)!==ta.undefined){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.undefined,received:a.parsedType}),ti}return mp(t.data)}};$Q.create=n=>new $Q({typeName:si.ZodUndefined,..._i(n)});e9=class extends ol{_parse(t){if(this._getType(t)!==ta.null){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.null,received:a.parsedType}),ti}return mp(t.data)}};e9.create=n=>new e9({typeName:si.ZodNull,..._i(n)});Jw=class extends ol{constructor(){super(...arguments),this._any=!0}_parse(t){return mp(t.data)}};Jw.create=n=>new Jw({typeName:si.ZodAny,..._i(n)});$5=class extends ol{constructor(){super(...arguments),this._unknown=!0}_parse(t){return mp(t.data)}};$5.create=n=>new $5({typeName:si.ZodUnknown,..._i(n)});zN=class extends ol{_parse(t){let r=this._getOrReturnCtx(t);return Tr(r,{code:vr.invalid_type,expected:ta.never,received:r.parsedType}),ti}};zN.create=n=>new zN({typeName:si.ZodNever,..._i(n)});VJ=class extends ol{_parse(t){if(this._getType(t)!==ta.undefined){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.void,received:a.parsedType}),ti}return mp(t.data)}};VJ.create=n=>new VJ({typeName:si.ZodVoid,..._i(n)});eE=class n extends ol{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),i=this._def;if(r.parsedType!==ta.array)return Tr(r,{code:vr.invalid_type,expected:ta.array,received:r.parsedType}),ti;if(i.exactLength!==null){let e=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(e||o)&&(Tr(r,{code:e?vr.too_big:vr.too_small,minimum:o?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Tr(r,{code:vr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Tr(r,{code:vr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((e,o)=>i.type._parseAsync(new fv(r,e,r.path,o)))).then(e=>om.mergeArray(a,e));let s=[...r.data].map((e,o)=>i.type._parseSync(new fv(r,e,r.path,o)));return om.mergeArray(a,s)}get element(){return this._def.type}min(t,r){return new n({...this._def,minLength:{value:t,message:Na.toString(r)}})}max(t,r){return new n({...this._def,maxLength:{value:t,message:Na.toString(r)}})}length(t,r){return new n({...this._def,exactLength:{value:t,message:Na.toString(r)}})}nonempty(t){return this.min(1,t)}};eE.create=(n,t)=>new eE({type:n,minLength:null,maxLength:null,exactLength:null,typeName:si.ZodArray,..._i(t)});gf=class n extends ol{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Sl.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ta.object){let d=this._getOrReturnCtx(t);return Tr(d,{code:vr.invalid_type,expected:ta.object,received:d.parsedType}),ti}let{status:a,ctx:i}=this._processInputParams(t),{shape:s,keys:e}=this._getCached(),o=[];if(!(this._def.catchall instanceof zN&&this._def.unknownKeys==="strip"))for(let d in i.data)e.includes(d)||o.push(d);let u=[];for(let d of e){let I=s[d],h=i.data[d];u.push({key:{status:"valid",value:d},value:I._parse(new fv(i,h,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof zN){let d=this._def.unknownKeys;if(d==="passthrough")for(let I of o)u.push({key:{status:"valid",value:I},value:{status:"valid",value:i.data[I]}});else if(d==="strict")o.length>0&&(Tr(i,{code:vr.unrecognized_keys,keys:o}),a.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let I of o){let h=i.data[I];u.push({key:{status:"valid",value:I},value:d._parse(new fv(i,h,i.path,I)),alwaysSet:I in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let I of u){let h=await I.key,c=await I.value;d.push({key:h,value:c,alwaysSet:I.alwaysSet})}return d}).then(d=>om.mergeObjectSync(a,d)):om.mergeObjectSync(a,u)}get shape(){return this._def.shape()}strict(t){return Na.errToObj,new n({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:Na.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(t){return new n({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new n({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:si.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new n({...this._def,catchall:t})}pick(t){let r={};for(let a of Sl.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new n({...this._def,shape:()=>r})}omit(t){let r={};for(let a of Sl.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new n({...this._def,shape:()=>r})}deepPartial(){return YJ(this)}partial(t){let r={};for(let a of Sl.objectKeys(this.shape)){let i=this.shape[a];t&&!t[a]?r[a]=i:r[a]=i.optional()}return new n({...this._def,shape:()=>r})}required(t){let r={};for(let a of Sl.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let s=this.shape[a];for(;s instanceof bv;)s=s._def.innerType;r[a]=s}return new n({...this._def,shape:()=>r})}keyof(){return dQt(Sl.objectKeys(this.shape))}};gf.create=(n,t)=>new gf({shape:()=>n,unknownKeys:"strip",catchall:zN.create(),typeName:si.ZodObject,..._i(t)});gf.strictCreate=(n,t)=>new gf({shape:()=>n,unknownKeys:"strict",catchall:zN.create(),typeName:si.ZodObject,..._i(t)});gf.lazycreate=(n,t)=>new gf({shape:n,unknownKeys:"strip",catchall:zN.create(),typeName:si.ZodObject,..._i(t)});t9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;function i(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let e=s.map(o=>new Gf(o.ctx.common.issues));return Tr(r,{code:vr.invalid_union,unionErrors:e}),ti}if(r.common.async)return Promise.all(a.map(async s=>{let e={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:e}),ctx:e}})).then(i);{let s,e=[];for(let u of a){let d={...r,common:{...r.common,issues:[]},parent:null},I=u._parseSync({data:r.data,path:r.path,parent:d});if(I.status==="valid")return I;I.status==="dirty"&&!s&&(s={result:I,ctx:d}),d.common.issues.length&&e.push(d.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=e.map(u=>new Gf(u));return Tr(r,{code:vr.invalid_union,unionErrors:o}),ti}}get options(){return this._def.options}};t9.create=(n,t)=>new t9({options:n,typeName:si.ZodUnion,..._i(t)});q5=n=>n instanceof r9?q5(n.schema):n instanceof Gv?q5(n.innerType()):n instanceof a9?[n.value]:n instanceof i9?n.options:n instanceof l9?Sl.objectValues(n.enum):n instanceof s9?q5(n._def.innerType):n instanceof $Q?[void 0]:n instanceof e9?[null]:n instanceof bv?[void 0,...q5(n.unwrap())]:n instanceof jW?[null,...q5(n.unwrap())]:n instanceof fq||n instanceof c9?q5(n.unwrap()):n instanceof o9?q5(n._def.innerType):[],kme=class n extends ol{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ta.object)return Tr(r,{code:vr.invalid_type,expected:ta.object,received:r.parsedType}),ti;let a=this.discriminator,i=r.data[a],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Tr(r,{code:vr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ti)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let i=new Map;for(let s of r){let e=q5(s.shape[t]);if(!e.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of e){if(i.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);i.set(o,s)}}return new n({typeName:si.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,..._i(a)})}};n9=class extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=(s,e)=>{if(Hme(s)||Hme(e))return ti;let o=ySe(s.value,e.value);return o.valid?((Xme(s)||Xme(e))&&r.dirty(),{status:r.value,value:o.data}):(Tr(a,{code:vr.invalid_intersection_types}),ti)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,e])=>i(s,e)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};n9.create=(n,t,r)=>new n9({left:n,right:t,typeName:si.ZodIntersection,..._i(r)});PW=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ta.array)return Tr(a,{code:vr.invalid_type,expected:ta.array,received:a.parsedType}),ti;if(a.data.length<this._def.items.length)return Tr(a,{code:vr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ti;!this._def.rest&&a.data.length>this._def.items.length&&(Tr(a,{code:vr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...a.data].map((e,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new fv(a,e,a.path,o)):null}).filter(e=>!!e);return a.common.async?Promise.all(s).then(e=>om.mergeArray(r,e)):om.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new n({...this._def,rest:t})}};PW.create=(n,t)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new PW({items:n,typeName:si.ZodTuple,rest:null,..._i(t)})};Lme=class n extends ol{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ta.object)return Tr(a,{code:vr.invalid_type,expected:ta.object,received:a.parsedType}),ti;let i=[],s=this._def.keyType,e=this._def.valueType;for(let o in a.data)i.push({key:s._parse(new fv(a,o,a.path,o)),value:e._parse(new fv(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?om.mergeObjectAsync(r,i):om.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,a){return r instanceof ol?new n({keyType:t,valueType:r,typeName:si.ZodRecord,..._i(a)}):new n({keyType:Bw.create(),valueType:t,typeName:si.ZodRecord,..._i(r)})}},QJ=class extends ol{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ta.map)return Tr(a,{code:vr.invalid_type,expected:ta.map,received:a.parsedType}),ti;let i=this._def.keyType,s=this._def.valueType,e=[...a.data.entries()].map(([o,u],d)=>({key:i._parse(new fv(a,o,a.path,[d,"key"])),value:s._parse(new fv(a,u,a.path,[d,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of e){let d=await u.key,I=await u.value;if(d.status==="aborted"||I.status==="aborted")return ti;(d.status==="dirty"||I.status==="dirty")&&r.dirty(),o.set(d.value,I.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of e){let d=u.key,I=u.value;if(d.status==="aborted"||I.status==="aborted")return ti;(d.status==="dirty"||I.status==="dirty")&&r.dirty(),o.set(d.value,I.value)}return{status:r.value,value:o}}}};QJ.create=(n,t,r)=>new QJ({valueType:t,keyType:n,typeName:si.ZodMap,..._i(r)});HJ=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==ta.set)return Tr(a,{code:vr.invalid_type,expected:ta.set,received:a.parsedType}),ti;let i=this._def;i.minSize!==null&&a.data.size<i.minSize.value&&(Tr(a,{code:vr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&a.data.size>i.maxSize.value&&(Tr(a,{code:vr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function e(u){let d=new Set;for(let I of u){if(I.status==="aborted")return ti;I.status==="dirty"&&r.dirty(),d.add(I.value)}return{status:r.value,value:d}}let o=[...a.data.values()].map((u,d)=>s._parse(new fv(a,u,a.path,d)));return a.common.async?Promise.all(o).then(u=>e(u)):e(o)}min(t,r){return new n({...this._def,minSize:{value:t,message:Na.toString(r)}})}max(t,r){return new n({...this._def,maxSize:{value:t,message:Na.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};HJ.create=(n,t)=>new HJ({valueType:n,minSize:null,maxSize:null,typeName:si.ZodSet,..._i(t)});Sme=class n extends ol{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ta.function)return Tr(r,{code:vr.invalid_type,expected:ta.function,received:r.parsedType}),ti;function a(o,u){return bq({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,wJ(),K5].filter(d=>!!d),issueData:{code:vr.invalid_arguments,argumentsError:u}})}function i(o,u){return bq({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,wJ(),K5].filter(d=>!!d),issueData:{code:vr.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},e=r.data;if(this._def.returns instanceof Tw){let o=this;return mp(async function(...u){let d=new Gf([]),I=await o._def.args.parseAsync(u,s).catch(G=>{throw d.addIssue(a(u,G)),d}),h=await Reflect.apply(e,this,I);return await o._def.returns._def.type.parseAsync(h,s).catch(G=>{throw d.addIssue(i(h,G)),d})})}else{let o=this;return mp(function(...u){let d=o._def.args.safeParse(u,s);if(!d.success)throw new Gf([a(u,d.error)]);let I=Reflect.apply(e,this,d.data),h=o._def.returns.safeParse(I,s);if(!h.success)throw new Gf([i(I,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new n({...this._def,args:PW.create(t).rest($5.create())})}returns(t){return new n({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new n({args:t||PW.create([]).rest($5.create()),returns:r||$5.create(),typeName:si.ZodFunction,..._i(a)})}},r9=class extends ol{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};r9.create=(n,t)=>new r9({getter:n,typeName:si.ZodLazy,..._i(t)});a9=class extends ol{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Tr(r,{received:r.data,code:vr.invalid_literal,expected:this._def.value}),ti}return{status:"valid",value:t.data}}get value(){return this._def.value}};a9.create=(n,t)=>new a9({value:n,typeName:si.ZodLiteral,..._i(t)});i9=class n extends ol{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),a=this._def.values;return Tr(r,{expected:Sl.joinValues(a),received:r.parsedType,code:vr.invalid_type}),ti}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return Tr(r,{received:r.data,code:vr.invalid_enum_value,options:a}),ti}return mp(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return n.create(t,{...this._def,...r})}exclude(t,r=this._def){return n.create(this.options.filter(a=>!t.includes(a)),{...this._def,...r})}};i9.create=dQt;l9=class extends ol{_parse(t){let r=Sl.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==ta.string&&a.parsedType!==ta.number){let i=Sl.objectValues(r);return Tr(a,{expected:Sl.joinValues(i),received:a.parsedType,code:vr.invalid_type}),ti}if(this._cache||(this._cache=new Set(Sl.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Sl.objectValues(r);return Tr(a,{received:a.data,code:vr.invalid_enum_value,options:i}),ti}return mp(t.data)}get enum(){return this._def.values}};l9.create=(n,t)=>new l9({values:n,typeName:si.ZodNativeEnum,..._i(t)});Tw=class extends ol{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ta.promise&&r.common.async===!1)return Tr(r,{code:vr.invalid_type,expected:ta.promise,received:r.parsedType}),ti;let a=r.parsedType===ta.promise?r.data:Promise.resolve(r.data);return mp(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Tw.create=(n,t)=>new Tw({type:n,typeName:si.ZodPromise,..._i(t)});Gv=class extends ol{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===si.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:e=>{Tr(a,e),e.fatal?r.abort():r.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let e=i.transform(a.data,s);if(a.common.async)return Promise.resolve(e).then(async o=>{if(r.value==="aborted")return ti;let u=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return u.status==="aborted"?ti:u.status==="dirty"?_Q(u.value):r.value==="dirty"?_Q(u.value):u});{if(r.value==="aborted")return ti;let o=this._def.schema._parseSync({data:e,path:a.path,parent:a});return o.status==="aborted"?ti:o.status==="dirty"?_Q(o.value):r.value==="dirty"?_Q(o.value):o}}if(i.type==="refinement"){let e=o=>{let u=i.refinement(o,s);if(a.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?ti:(o.status==="dirty"&&r.dirty(),e(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?ti:(o.status==="dirty"&&r.dirty(),e(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(a.common.async===!1){let e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Sw(e))return ti;let o=i.transform(e.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>Sw(e)?Promise.resolve(i.transform(e.value,s)).then(o=>({status:r.value,value:o})):ti);Sl.assertNever(i)}};Gv.create=(n,t,r)=>new Gv({schema:n,typeName:si.ZodEffects,effect:t,..._i(r)});Gv.createWithPreprocess=(n,t,r)=>new Gv({schema:t,effect:{type:"preprocess",transform:n},typeName:si.ZodEffects,..._i(r)});bv=class extends ol{_parse(t){return this._getType(t)===ta.undefined?mp(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};bv.create=(n,t)=>new bv({innerType:n,typeName:si.ZodOptional,..._i(t)});jW=class extends ol{_parse(t){return this._getType(t)===ta.null?mp(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};jW.create=(n,t)=>new jW({innerType:n,typeName:si.ZodNullable,..._i(t)});s9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===ta.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};s9.create=(n,t)=>new s9({innerType:n,typeName:si.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._i(t)});o9=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return CJ(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Gf(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Gf(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};o9.create=(n,t)=>new o9({innerType:n,typeName:si.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._i(t)});XJ=class extends ol{_parse(t){if(this._getType(t)!==ta.nan){let a=this._getOrReturnCtx(t);return Tr(a,{code:vr.invalid_type,expected:ta.nan,received:a.parsedType}),ti}return{status:"valid",value:t.data}}};XJ.create=n=>new XJ({typeName:si.ZodNaN,..._i(n)});z3r=Symbol("zod_brand"),fq=class extends ol{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Gq=class n extends ol{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ti:s.status==="dirty"?(r.dirty(),_Q(s.value)):this._def.out._parseAsync({data:s.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ti:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(t,r){return new n({in:t,out:r,typeName:si.ZodPipeline})}},c9=class extends ol{_parse(t){let r=this._def.innerType._parse(t),a=i=>(Sw(i)&&(i.value=Object.freeze(i.value)),i);return CJ(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};c9.create=(n,t)=>new c9({innerType:n,typeName:si.ZodReadonly,..._i(t)});_3r={object:gf.lazycreate};(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(si||(si={}));P3r=(n,t={message:`Input not instance of ${n.name}`})=>hQt(r=>r instanceof n,t),mQt=Bw.create,pQt=PQ.create,j3r=XJ.create,K3r=jQ.create,bQt=KQ.create,q3r=qQ.create,$3r=xJ.create,eWr=$Q.create,tWr=e9.create,nWr=Jw.create,rWr=$5.create,aWr=zN.create,iWr=VJ.create,lWr=eE.create,sWr=gf.create,oWr=gf.strictCreate,cWr=t9.create,uWr=kme.create,IWr=n9.create,dWr=PW.create,hWr=Lme.create,mWr=QJ.create,pWr=HJ.create,bWr=Sme.create,fWr=r9.create,GWr=a9.create,gWr=i9.create,vWr=l9.create,ZWr=Tw.create,NWr=Gv.create,AWr=bv.create,WWr=jW.create,yWr=Gv.createWithPreprocess,FWr=Gq.create,EWr=()=>mQt().optional(),RWr=()=>pQt().optional(),wWr=()=>bQt().optional(),CWr={string:(n=>Bw.create({...n,coerce:!0})),number:(n=>PQ.create({...n,coerce:!0})),boolean:(n=>KQ.create({...n,coerce:!0})),bigint:(n=>jQ.create({...n,coerce:!0})),date:(n=>qQ.create({...n,coerce:!0}))},YWr=ti});var Ku={};Qo(Ku,{BRAND:()=>z3r,DIRTY:()=>_Q,EMPTY_PATH:()=>y3r,INVALID:()=>ti,NEVER:()=>YWr,OK:()=>mp,ParseStatus:()=>om,Schema:()=>ol,ZodAny:()=>Jw,ZodArray:()=>eE,ZodBigInt:()=>jQ,ZodBoolean:()=>KQ,ZodBranded:()=>fq,ZodCatch:()=>o9,ZodDate:()=>qQ,ZodDefault:()=>s9,ZodDiscriminatedUnion:()=>kme,ZodEffects:()=>Gv,ZodEnum:()=>i9,ZodError:()=>Gf,ZodFirstPartyTypeKind:()=>si,ZodFunction:()=>Sme,ZodIntersection:()=>n9,ZodIssueCode:()=>vr,ZodLazy:()=>r9,ZodLiteral:()=>a9,ZodMap:()=>QJ,ZodNaN:()=>XJ,ZodNativeEnum:()=>l9,ZodNever:()=>zN,ZodNull:()=>e9,ZodNullable:()=>jW,ZodNumber:()=>PQ,ZodObject:()=>gf,ZodOptional:()=>bv,ZodParsedType:()=>ta,ZodPipeline:()=>Gq,ZodPromise:()=>Tw,ZodReadonly:()=>c9,ZodRecord:()=>Lme,ZodSchema:()=>ol,ZodSet:()=>HJ,ZodString:()=>Bw,ZodSymbol:()=>xJ,ZodTransformer:()=>Gv,ZodTuple:()=>PW,ZodType:()=>ol,ZodUndefined:()=>$Q,ZodUnion:()=>t9,ZodUnknown:()=>$5,ZodVoid:()=>VJ,addIssueToContext:()=>Tr,any:()=>nWr,array:()=>lWr,bigint:()=>K3r,boolean:()=>bQt,coerce:()=>CWr,custom:()=>hQt,date:()=>q3r,datetimeRegex:()=>IQt,defaultErrorMap:()=>K5,discriminatedUnion:()=>uWr,effect:()=>NWr,enum:()=>gWr,function:()=>bWr,getErrorMap:()=>wJ,getParsedType:()=>_W,instanceof:()=>P3r,intersection:()=>IWr,isAborted:()=>Hme,isAsync:()=>CJ,isDirty:()=>Xme,isValid:()=>Sw,late:()=>_3r,lazy:()=>fWr,literal:()=>GWr,makeIssue:()=>bq,map:()=>mWr,nan:()=>j3r,nativeEnum:()=>vWr,never:()=>aWr,null:()=>tWr,nullable:()=>WWr,number:()=>pQt,object:()=>sWr,objectUtil:()=>ZSe,oboolean:()=>wWr,onumber:()=>RWr,optional:()=>AWr,ostring:()=>EWr,pipeline:()=>FWr,preprocess:()=>yWr,promise:()=>ZWr,quotelessJson:()=>N3r,record:()=>hWr,set:()=>pWr,setErrorMap:()=>W3r,strictObject:()=>oWr,string:()=>mQt,symbol:()=>$3r,transformer:()=>NWr,tuple:()=>dWr,undefined:()=>eWr,union:()=>cWr,unknown:()=>rWr,util:()=>Sl,void:()=>iWr});var FSe=It(()=>{Qme();ASe();iQt();pq();fQt();Vme()});function Tn(n,t,r){function a(o,u){var d;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(d=o._zod).traits??(d.traits=new Set),o._zod.traits.add(n),t(o,u);for(let I in e.prototype)I in o||Object.defineProperty(o,I,{value:e.prototype[I].bind(o)});o._zod.constr=e,o._zod.def=u}let i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function e(o){var u;let d=r?.Parent?new s:this;a(d,o),(u=d._zod).deferred??(u.deferred=[]);for(let I of d._zod.deferred)I();return d}return Object.defineProperty(e,"init",{value:a}),Object.defineProperty(e,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(n)}),Object.defineProperty(e,"name",{value:n}),e}function p1(n){return n&&Object.assign(Bme,n),Bme}var ESe,xWr,tE,Bme,kJ=It(()=>{ESe=Object.freeze({status:"aborted"});xWr=Symbol("zod_brand"),tE=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Bme={}});var zs={};Qo(zs,{BIGINT_FORMAT_RANGES:()=>gQt,Class:()=>wSe,NUMBER_FORMAT_RANGES:()=>kSe,aborted:()=>I9,allowsEval:()=>QSe,assert:()=>kWr,assertEqual:()=>VWr,assertIs:()=>HWr,assertNever:()=>XWr,assertNotEqual:()=>QWr,assignProp:()=>VSe,cached:()=>vq,captureStackTrace:()=>Tme,cleanEnum:()=>jWr,cleanRegex:()=>Nq,clone:()=>_N,createTransparentProxy:()=>DWr,defineLazy:()=>xc,esc:()=>u9,escapeRegex:()=>Dw,extend:()=>MWr,finalizeIssue:()=>PN,floatSafeRemainder:()=>xSe,getElementAtPath:()=>LWr,getEnumValues:()=>CSe,getLengthableOrigin:()=>Aq,getParsedType:()=>TWr,getSizableOrigin:()=>vQt,isObject:()=>LJ,isPlainObject:()=>SJ,issue:()=>LSe,joinValues:()=>Jme,jsonStringifyReplacer:()=>YSe,merge:()=>zWr,normalizeParams:()=>ka,nullish:()=>Zq,numKeys:()=>JWr,omit:()=>UWr,optionalKeys:()=>XSe,partial:()=>_Wr,pick:()=>OWr,prefixIssues:()=>KW,primitiveTypes:()=>GQt,promiseAllObject:()=>SWr,propertyKeyTypes:()=>HSe,randomString:()=>BWr,required:()=>PWr,stringifyPrimitive:()=>Dme,unwrapMessage:()=>gq});function VWr(n){return n}function QWr(n){return n}function HWr(n){}function XWr(n){throw new Error}function kWr(n){}function CSe(n){let t=Object.values(n).filter(a=>typeof a=="number");return Object.entries(n).filter(([a,i])=>t.indexOf(+a)===-1).map(([a,i])=>i)}function Jme(n,t="|"){return n.map(r=>Dme(r)).join(t)}function YSe(n,t){return typeof t=="bigint"?t.toString():t}function vq(n){return{get value(){{let r=n();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Zq(n){return n==null}function Nq(n){let t=n.startsWith("^")?1:0,r=n.endsWith("$")?n.length-1:n.length;return n.slice(t,r)}function xSe(n,t){let r=(n.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(n.toFixed(i).replace(".","")),e=Number.parseInt(t.toFixed(i).replace(".",""));return s%e/10**i}function xc(n,t,r){Object.defineProperty(n,t,{get(){{let i=r();return n[t]=i,i}throw new Error("cached value already set")},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function VSe(n,t,r){Object.defineProperty(n,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function LWr(n,t){return t?t.reduce((r,a)=>r?.[a],n):n}function SWr(n){let t=Object.keys(n),r=t.map(a=>n[a]);return Promise.all(r).then(a=>{let i={};for(let s=0;s<t.length;s++)i[t[s]]=a[s];return i})}function BWr(n=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let a=0;a<n;a++)r+=t[Math.floor(Math.random()*t.length)];return r}function u9(n){return JSON.stringify(n)}function LJ(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function SJ(n){if(LJ(n)===!1)return!1;let t=n.constructor;if(t===void 0)return!0;let r=t.prototype;return!(LJ(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function JWr(n){let t=0;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&t++;return t}function Dw(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _N(n,t,r){let a=new n._zod.constr(t??n._zod.def);return(!t||r?.parent)&&(a._zod.parent=n),a}function ka(n){let t=n;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function DWr(n){let t;return new Proxy({},{get(r,a,i){return t??(t=n()),Reflect.get(t,a,i)},set(r,a,i,s){return t??(t=n()),Reflect.set(t,a,i,s)},has(r,a){return t??(t=n()),Reflect.has(t,a)},deleteProperty(r,a){return t??(t=n()),Reflect.deleteProperty(t,a)},ownKeys(r){return t??(t=n()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,a){return t??(t=n()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(r,a,i){return t??(t=n()),Reflect.defineProperty(t,a,i)}})}function Dme(n){return typeof n=="bigint"?n.toString()+"n":typeof n=="string"?`"${n}"`:`${n}`}function XSe(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}function OWr(n,t){let r={},a=n._zod.def;for(let i in t){if(!(i in a.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=a.shape[i])}return _N(n,{...n._zod.def,shape:r,checks:[]})}function UWr(n,t){let r={...n._zod.def.shape},a=n._zod.def;for(let i in t){if(!(i in a.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return _N(n,{...n._zod.def,shape:r,checks:[]})}function MWr(n,t){if(!SJ(t))throw new Error("Invalid input to extend: expected a plain object");let r={...n._zod.def,get shape(){let a={...n._zod.def.shape,...t};return VSe(this,"shape",a),a},checks:[]};return _N(n,r)}function zWr(n,t){return _N(n,{...n._zod.def,get shape(){let r={...n._zod.def.shape,...t._zod.def.shape};return VSe(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function _Wr(n,t,r){let a=t._zod.def.shape,i={...a};if(r)for(let s in r){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=n?new n({type:"optional",innerType:a[s]}):a[s])}else for(let s in a)i[s]=n?new n({type:"optional",innerType:a[s]}):a[s];return _N(t,{...t._zod.def,shape:i,checks:[]})}function PWr(n,t,r){let a=t._zod.def.shape,i={...a};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new n({type:"nonoptional",innerType:a[s]}))}else for(let s in a)i[s]=new n({type:"nonoptional",innerType:a[s]});return _N(t,{...t._zod.def,shape:i,checks:[]})}function I9(n,t=0){for(let r=t;r<n.issues.length;r++)if(n.issues[r]?.continue!==!0)return!0;return!1}function KW(n,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(n),r})}function gq(n){return typeof n=="string"?n:n?.message}function PN(n,t,r){let a={...n,path:n.path??[]};if(!n.message){let i=gq(n.inst?._zod.def?.error?.(n))??gq(t?.error?.(n))??gq(r.customError?.(n))??gq(r.localeError?.(n))??"Invalid input";a.message=i}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function vQt(n){return n instanceof Set?"set":n instanceof Map?"map":n instanceof File?"file":"unknown"}function Aq(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function LSe(...n){let[t,r,a]=n;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}function jWr(n){return Object.entries(n).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var Tme,QSe,TWr,HSe,GQt,kSe,gQt,wSe,nE=It(()=>{Tme=Error.captureStackTrace?Error.captureStackTrace:(...n)=>{};QSe=vq(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let n=Function;return new n(""),!0}catch{return!1}});TWr=n=>{let t=typeof n;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(n)?"array":n===null?"null":n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?"promise":typeof Map<"u"&&n instanceof Map?"map":typeof Set<"u"&&n instanceof Set?"set":typeof Date<"u"&&n instanceof Date?"date":typeof File<"u"&&n instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},HSe=new Set(["string","number","symbol"]),GQt=new Set(["string","number","bigint","boolean","symbol","undefined"]);kSe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},gQt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};wSe=class{constructor(...t){}}});function BSe(n,t=r=>r.message){let r={},a=[];for(let i of n.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):a.push(t(i));return{formErrors:a,fieldErrors:r}}function JSe(n,t){let r=t||function(s){return s.message},a={_errors:[]},i=s=>{for(let e of s.issues)if(e.code==="invalid_union"&&e.errors.length)e.errors.map(o=>i({issues:o}));else if(e.code==="invalid_key")i({issues:e.issues});else if(e.code==="invalid_element")i({issues:e.issues});else if(e.path.length===0)a._errors.push(r(e));else{let o=a,u=0;for(;u<e.path.length;){let d=e.path[u];u===e.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(e))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return i(n),a}var ZQt,Ome,SSe,TSe=It(()=>{kJ();nE();ZQt=(n,t)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:t,enumerable:!1}),Object.defineProperty(n,"message",{get(){return JSON.stringify(t,YSe,2)},enumerable:!0}),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Ome=Tn("$ZodError",ZQt),SSe=Tn("$ZodError",ZQt,{Parent:Error})});var NQt,AQt,DSe,Wq,OSe,Ume,USe=It(()=>{kJ();TSe();nE();NQt=n=>(t,r,a,i)=>{let s=a?Object.assign(a,{async:!1}):{async:!1},e=t._zod.run({value:r,issues:[]},s);if(e instanceof Promise)throw new tE;if(e.issues.length){let o=new(i?.Err??n)(e.issues.map(u=>PN(u,s,p1())));throw Tme(o,i?.callee),o}return e.value},AQt=n=>async(t,r,a,i)=>{let s=a?Object.assign(a,{async:!0}):{async:!0},e=t._zod.run({value:r,issues:[]},s);if(e instanceof Promise&&(e=await e),e.issues.length){let o=new(i?.Err??n)(e.issues.map(u=>PN(u,s,p1())));throw Tme(o,i?.callee),o}return e.value},DSe=n=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new tE;return s.issues.length?{success:!1,error:new(n??Ome)(s.issues.map(e=>PN(e,i,p1())))}:{success:!0,data:s.value}},Wq=DSe(SSe),OSe=n=>async(t,r,a)=>{let i=a?Object.assign(a,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(e=>PN(e,i,p1())))}:{success:!0,data:s.value}},Ume=OSe(SSe)});function VQt(){return new RegExp(qWr,"u")}function DQt(n){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${t}`:n.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${n.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function OQt(n){return new RegExp(`^${DQt(n)}$`)}function UQt(n){let t=DQt({precision:n.precision}),r=["Z"];n.local&&r.push(""),n.offset&&r.push("([+-]\\d{2}:\\d{2})");let a=`${t}(?:${r.join("|")})`;return new RegExp(`^${JQt}T(?:${a})$`)}var WQt,yQt,FQt,EQt,RQt,wQt,CQt,YQt,MSe,xQt,qWr,QQt,HQt,XQt,kQt,LQt,zSe,SQt,BQt,JQt,TQt,MQt,zQt,_Qt,PQt,jQt,KQt,qQt,$Qt,zme=It(()=>{WQt=/^[cC][^\s-]{8,}$/,yQt=/^[0-9a-z]+$/,FQt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,EQt=/^[0-9a-vA-V]{20}$/,RQt=/^[A-Za-z0-9]{27}$/,wQt=/^[a-zA-Z0-9_-]{21}$/,CQt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,YQt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,MSe=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,xQt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qWr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";QQt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,HQt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,XQt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,kQt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,LQt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zSe=/^[A-Za-z0-9_-]*$/,SQt=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,BQt=/^\+(?:[0-9]){6,14}[0-9]$/,JQt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",TQt=new RegExp(`^${JQt}$`);MQt=n=>{let t=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},zQt=/^\d+n?$/,_Qt=/^\d+$/,PQt=/^-?\d+(?:\.\d+)?/i,jQt=/true|false/i,KQt=/null/i,qQt=/^[^A-Z]*$/,$Qt=/^[^a-z]*$/});var pp,e9t,_Se,PSe,t9t,n9t,r9t,a9t,i9t,yq,l9t,s9t,o9t,c9t,u9t,I9t,d9t,_me=It(()=>{kJ();zme();nE();pp=Tn("$ZodCheck",(n,t)=>{var r;n._zod??(n._zod={}),n._zod.def=t,(r=n._zod).onattach??(r.onattach=[])}),e9t={number:"number",bigint:"bigint",object:"date"},_Se=Tn("$ZodCheckLessThan",(n,t)=>{pp.init(n,t);let r=e9t[typeof t.value];n._zod.onattach.push(a=>{let i=a._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),n._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),PSe=Tn("$ZodCheckGreaterThan",(n,t)=>{pp.init(n,t);let r=e9t[typeof t.value];n._zod.onattach.push(a=>{let i=a._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),n._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),t9t=Tn("$ZodCheckMultipleOf",(n,t)=>{pp.init(n,t),n._zod.onattach.push(r=>{var a;(a=r._zod.bag).multipleOf??(a.multipleOf=t.value)}),n._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):xSe(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:n,continue:!t.abort})}}),n9t=Tn("$ZodCheckNumberFormat",(n,t)=>{pp.init(n,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,s]=kSe[t.format];n._zod.onattach.push(e=>{let o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=s,r&&(o.pattern=_Qt)}),n._zod.check=e=>{let o=e.value;if(r){if(!Number.isInteger(o)){e.issues.push({expected:a,format:t.format,code:"invalid_type",input:o,inst:n});return}if(!Number.isSafeInteger(o)){o>0?e.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:a,continue:!t.abort}):e.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:a,continue:!t.abort});return}}o<i&&e.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),o>s&&e.issues.push({origin:"number",input:o,code:"too_big",maximum:s,inst:n})}}),r9t=Tn("$ZodCheckMaxLength",(n,t)=>{var r;pp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Zq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(a._zod.bag.maximum=t.maximum)}),n._zod.check=a=>{let i=a.value;if(i.length<=t.maximum)return;let e=Aq(i);a.issues.push({origin:e,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),a9t=Tn("$ZodCheckMinLength",(n,t)=>{var r;pp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Zq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(a._zod.bag.minimum=t.minimum)}),n._zod.check=a=>{let i=a.value;if(i.length>=t.minimum)return;let e=Aq(i);a.issues.push({origin:e,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),i9t=Tn("$ZodCheckLengthEquals",(n,t)=>{var r;pp.init(n,t),(r=n._zod.def).when??(r.when=a=>{let i=a.value;return!Zq(i)&&i.length!==void 0}),n._zod.onattach.push(a=>{let i=a._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),n._zod.check=a=>{let i=a.value,s=i.length;if(s===t.length)return;let e=Aq(i),o=s>t.length;a.issues.push({origin:e,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:n,continue:!t.abort})}}),yq=Tn("$ZodCheckStringFormat",(n,t)=>{var r,a;pp.init(n,t),n._zod.onattach.push(i=>{let s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=n._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:n,continue:!t.abort})}):(a=n._zod).check??(a.check=()=>{})}),l9t=Tn("$ZodCheckRegex",(n,t)=>{yq.init(n,t),n._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:n,continue:!t.abort})}}),s9t=Tn("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=qQt),yq.init(n,t)}),o9t=Tn("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=$Qt),yq.init(n,t)}),c9t=Tn("$ZodCheckIncludes",(n,t)=>{pp.init(n,t);let r=Dw(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=a,n._zod.onattach.push(i=>{let s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(a)}),n._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:n,continue:!t.abort})}}),u9t=Tn("$ZodCheckStartsWith",(n,t)=>{pp.init(n,t);let r=new RegExp(`^${Dw(t.prefix)}.*`);t.pattern??(t.pattern=r),n._zod.onattach.push(a=>{let i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:n,continue:!t.abort})}}),I9t=Tn("$ZodCheckEndsWith",(n,t)=>{pp.init(n,t);let r=new RegExp(`.*${Dw(t.suffix)}$`);t.pattern??(t.pattern=r),n._zod.onattach.push(a=>{let i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:n,continue:!t.abort})}}),d9t=Tn("$ZodCheckOverwrite",(n,t)=>{pp.init(n,t),n._zod.check=r=>{r.value=t.tx(r.value)}})});var Pme,jSe=It(()=>{Pme=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let a=t.split(`
|
|
707
707
|
`).filter(e=>e),i=Math.min(...a.map(e=>e.length-e.trimStart().length)),s=a.map(e=>e.slice(i)).map(e=>" ".repeat(this.indent*2)+e);for(let e of s)this.content.push(e)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,i.join(`
|
|
708
708
|
`))}}});var m9t,KSe=It(()=>{m9t={major:4,minor:0,patch:0}});function D9t(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}function $Wr(n){if(!zSe.test(n))return!1;let t=n.replace(/[-_]/g,a=>a==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return D9t(r)}function eyr(n,t=null){try{let r=n.split(".");if(r.length!==3)return!1;let[a]=r;if(!a)return!1;let i=JSON.parse(atob(a));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}function p9t(n,t,r){n.issues.length&&t.issues.push(...KW(r,n.issues)),t.value[r]=n.value}function jme(n,t,r){n.issues.length&&t.issues.push(...KW(r,n.issues)),t.value[r]=n.value}function b9t(n,t,r,a){n.issues.length?a[r]===void 0?r in a?t.value[r]=void 0:t.value[r]=n.value:t.issues.push(...KW(r,n.issues)):n.value===void 0?r in a&&(t.value[r]=void 0):t.value[r]=n.value}function f9t(n,t,r,a){for(let i of n)if(i.issues.length===0)return t.value=i.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:n.map(i=>i.issues.map(s=>PN(s,a,p1())))}),t}function qSe(n,t){if(n===t)return{valid:!0,data:n};if(n instanceof Date&&t instanceof Date&&+n==+t)return{valid:!0,data:n};if(SJ(n)&&SJ(t)){let r=Object.keys(t),a=Object.keys(n).filter(s=>r.indexOf(s)!==-1),i={...n,...t};for(let s of a){let e=qSe(n[s],t[s]);if(!e.valid)return{valid:!1,mergeErrorPath:[s,...e.mergeErrorPath]};i[s]=e.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let a=0;a<n.length;a++){let i=n[a],s=t[a],e=qSe(i,s);if(!e.valid)return{valid:!1,mergeErrorPath:[a,...e.mergeErrorPath]};r.push(e.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function G9t(n,t,r){if(t.issues.length&&n.issues.push(...t.issues),r.issues.length&&n.issues.push(...r.issues),I9(n))return n;let a=qSe(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return n.value=a.data,n}function g9t(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}function v9t(n,t){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:t}),n}function Z9t(n,t,r){return I9(n)?n:t.out._zod.run({value:n.value,issues:n.issues},r)}function N9t(n){return n.value=Object.freeze(n.value),n}function A9t(n,t,r,a){if(!n){let i={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(i.params=a._zod.def.params),t.issues.push(LSe(i))}}var So,Kme,nu,W9t,y9t,F9t,E9t,R9t,w9t,C9t,Y9t,x9t,V9t,Q9t,H9t,X9t,k9t,L9t,S9t,B9t,J9t,T9t,O9t,U9t,M9t,z9t,$Se,_9t,P9t,j9t,K9t,q9t,$9t,eHt,tHt,nHt,rHt,eBe,aHt,iHt,lHt,sHt,oHt,cHt,uHt,IHt,dHt,hHt,mHt,pHt,bHt,fHt,GHt,gHt=It(()=>{_me();kJ();jSe();USe();zme();nE();KSe();nE();So=Tn("$ZodType",(n,t)=>{var r;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=m9t;let a=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&a.unshift(n);for(let i of a)for(let s of i._zod.onattach)s(n);if(a.length===0)(r=n._zod).deferred??(r.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{let i=(s,e,o)=>{let u=I9(s),d;for(let I of e){if(I._zod.def.when){if(!I._zod.def.when(s))continue}else if(u)continue;let h=s.issues.length,c=I._zod.check(s);if(c instanceof Promise&&o?.async===!1)throw new tE;if(d||c instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await c,s.issues.length!==h&&(u||(u=I9(s,h)))});else{if(s.issues.length===h)continue;u||(u=I9(s,h))}}return d?d.then(()=>s):s};n._zod.run=(s,e)=>{let o=n._zod.parse(s,e);if(o instanceof Promise){if(e.async===!1)throw new tE;return o.then(u=>i(u,a,e))}return i(o,a,e)}}n["~standard"]={validate:i=>{try{let s=Wq(n,i);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Ume(n,i).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Kme=Tn("$ZodString",(n,t)=>{So.init(n,t),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??MQt(n._zod.bag),n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),nu=Tn("$ZodStringFormat",(n,t)=>{yq.init(n,t),Kme.init(n,t)}),W9t=Tn("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=YQt),nu.init(n,t)}),y9t=Tn("$ZodUUID",(n,t)=>{if(t.version){let a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=MSe(a))}else t.pattern??(t.pattern=MSe());nu.init(n,t)}),F9t=Tn("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=xQt),nu.init(n,t)}),E9t=Tn("$ZodURL",(n,t)=>{nu.init(n,t),n._zod.check=r=>{try{let a=r.value,i=new URL(a),s=i.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:SQt.source,input:r.value,inst:n,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:n,continue:!t.abort})),!a.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:n,continue:!t.abort})}}}),R9t=Tn("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=VQt()),nu.init(n,t)}),w9t=Tn("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=wQt),nu.init(n,t)}),C9t=Tn("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=WQt),nu.init(n,t)}),Y9t=Tn("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=yQt),nu.init(n,t)}),x9t=Tn("$ZodULID",(n,t)=>{t.pattern??(t.pattern=FQt),nu.init(n,t)}),V9t=Tn("$ZodXID",(n,t)=>{t.pattern??(t.pattern=EQt),nu.init(n,t)}),Q9t=Tn("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=RQt),nu.init(n,t)}),H9t=Tn("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=UQt(t)),nu.init(n,t)}),X9t=Tn("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=TQt),nu.init(n,t)}),k9t=Tn("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=OQt(t)),nu.init(n,t)}),L9t=Tn("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=CQt),nu.init(n,t)}),S9t=Tn("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=QQt),nu.init(n,t),n._zod.onattach.push(r=>{let a=r._zod.bag;a.format="ipv4"})}),B9t=Tn("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=HQt),nu.init(n,t),n._zod.onattach.push(r=>{let a=r._zod.bag;a.format="ipv6"}),n._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:n,continue:!t.abort})}}}),J9t=Tn("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=XQt),nu.init(n,t)}),T9t=Tn("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=kQt),nu.init(n,t),n._zod.check=r=>{let[a,i]=r.value.split("/");try{if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${a}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:n,continue:!t.abort})}}});O9t=Tn("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=LQt),nu.init(n,t),n._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),n._zod.check=r=>{D9t(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:n,continue:!t.abort})}});U9t=Tn("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=zSe),nu.init(n,t),n._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),n._zod.check=r=>{$Wr(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:n,continue:!t.abort})}}),M9t=Tn("$ZodE164",(n,t)=>{t.pattern??(t.pattern=BQt),nu.init(n,t)});z9t=Tn("$ZodJWT",(n,t)=>{nu.init(n,t),n._zod.check=r=>{eyr(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:n,continue:!t.abort})}}),$Se=Tn("$ZodNumber",(n,t)=>{So.init(n,t),n._zod.pattern=n._zod.bag.pattern??PQt,n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),r}}),_9t=Tn("$ZodNumber",(n,t)=>{n9t.init(n,t),$Se.init(n,t)}),P9t=Tn("$ZodBoolean",(n,t)=>{So.init(n,t),n._zod.pattern=jQt,n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),r}}),j9t=Tn("$ZodBigInt",(n,t)=>{So.init(n,t),n._zod.pattern=zQt,n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:n}),r}}),K9t=Tn("$ZodNull",(n,t)=>{So.init(n,t),n._zod.pattern=KQt,n._zod.values=new Set([null]),n._zod.parse=(r,a)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:n}),r}}),q9t=Tn("$ZodAny",(n,t)=>{So.init(n,t),n._zod.parse=r=>r}),$9t=Tn("$ZodUnknown",(n,t)=>{So.init(n,t),n._zod.parse=r=>r}),eHt=Tn("$ZodNever",(n,t)=>{So.init(n,t),n._zod.parse=(r,a)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:n}),r)}),tHt=Tn("$ZodDate",(n,t)=>{So.init(n,t),n._zod.parse=(r,a)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,s=i instanceof Date;return s&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...s?{received:"Invalid Date"}:{},inst:n}),r}});nHt=Tn("$ZodArray",(n,t)=>{So.init(n,t),n._zod.parse=(r,a)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),r;r.value=Array(i.length);let s=[];for(let e=0;e<i.length;e++){let o=i[e],u=t.element._zod.run({value:o,issues:[]},a);u instanceof Promise?s.push(u.then(d=>p9t(d,r,e))):p9t(u,r,e)}return s.length?Promise.all(s).then(()=>r):r}});rHt=Tn("$ZodObject",(n,t)=>{So.init(n,t);let r=vq(()=>{let h=Object.keys(t.shape);for(let G of h)if(!(t.shape[G]instanceof So))throw new Error(`Invalid element at key "${G}": expected a Zod schema`);let c=XSe(t.shape);return{shape:t.shape,keys:h,keySet:new Set(h),numKeys:h.length,optionalKeys:new Set(c)}});xc(n._zod,"propValues",()=>{let h=t.shape,c={};for(let G in h){let W=h[G]._zod;if(W.values){c[G]??(c[G]=new Set);for(let y of W.values)c[G].add(y)}}return c});let a=h=>{let c=new Pme(["shape","payload","ctx"]),G=r.value,W=C=>{let A=u9(C);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};c.write("const input = payload.value;");let y=Object.create(null),R=0;for(let C of G.keys)y[C]=`key_${R++}`;c.write("const newResult = {}");for(let C of G.keys)if(G.optionalKeys.has(C)){let A=y[C];c.write(`const ${A} = ${W(C)};`);let E=u9(C);c.write(`
|
|
709
709
|
if (${A}.issues.length) {
|
|
@@ -2826,7 +2826,7 @@ return `+str.trim()+`;
|
|
|
2826
2826
|
`:n}});var HGn=ve((gDi,QGn)=>{"use strict";var hba=nie();QGn.exports=function(n,t){let r=hba(t);if(n.data==null&&(n.data={}),typeof r.excerpt=="function")return r.excerpt(n,r);let a=n.data.excerpt_separator||r.excerpt_separator;if(a==null&&(r.excerpt===!1||r.excerpt==null))return n;let i=typeof r.excerpt=="string"?r.excerpt:a||r.delimiters[0],s=n.content.indexOf(i);return s!==-1&&(n.excerpt=n.content.slice(0,s)),n}});var LGn=ve((vDi,kGn)=>{"use strict";var XGn=Pae(),mba=Nrt(),iU=PNe();kGn.exports=function(n){return XGn(n)!=="object"&&(n={content:n}),XGn(n.data)!=="object"&&(n.data={}),n.contents&&n.content==null&&(n.content=n.contents),iU.define(n,"orig",iU.toBuffer(n.content)),iU.define(n,"language",n.language||""),iU.define(n,"matter",n.matter||""),iU.define(n,"stringify",function(t,r){return r&&r.language&&(n.language=r.language),mba(n,t,r)}),n.content=iU.toString(n.content),n.isEmpty=!1,n.excerpt="",n}});var BGn=ve((ZDi,SGn)=>{"use strict";var pba=Zrt(),bba=nie();SGn.exports=function(n,t,r){let a=bba(r),i=pba(n,a);if(typeof i.parse!="function")throw new TypeError('expected "'+n+'.parse" to be a function');return i.parse(t,a)}});var jNe=ve((NDi,DGn)=>{"use strict";var fba=vt("fs"),Gba=H2n(),Art=nie(),gba=Nrt(),JGn=HGn(),vba=vrt(),Zba=LGn(),Nba=BGn(),TGn=PNe();function h2(n,t){if(n==="")return{data:{},content:n,excerpt:"",orig:n};let r=Zba(n),a=h2.cache[r.content];if(!t){if(a)return r=Object.assign({},a),r.orig=a.orig,r;h2.cache[r.content]=r}return Aba(r,t)}function Aba(n,t){let r=Art(t),a=r.delimiters[0],i=`
|
|
2827
2827
|
`+r.delimiters[1],s=n.content;r.language&&(n.language=r.language);let e=a.length;if(!TGn.startsWith(s,a,e))return JGn(n,r),n;if(s.charAt(e)===a.slice(-1))return n;s=s.slice(e);let o=s.length,u=h2.language(s,r);u.name&&(n.language=u.name,s=s.slice(u.raw.length));let d=s.indexOf(i);return d===-1&&(d=o),n.matter=s.slice(0,d),n.matter.replace(/^\s*#[^\n]+/gm,"").trim()===""?(n.isEmpty=!0,n.empty=n.content,n.data={}):n.data=Nba(n.language,n.matter,r),d===o?n.content="":(n.content=s.slice(d+i.length),n.content[0]==="\r"&&(n.content=n.content.slice(1)),n.content[0]===`
|
|
2828
2828
|
`&&(n.content=n.content.slice(1))),JGn(n,r),(r.sections===!0||typeof r.section=="function")&&Gba(n,r.section),n}h2.engines=vba;h2.stringify=function(n,t,r){return typeof n=="string"&&(n=h2(n,r)),gba(n,t,r)};h2.read=function(n,t){let r=fba.readFileSync(n,"utf8"),a=h2(r,t);return a.path=n,a};h2.test=function(n,t){return TGn.startsWith(n,Art(t).delimiters[0])};h2.language=function(n,t){let a=Art(t).delimiters[0];h2.test(n)&&(n=n.slice(a.length));let i=n.slice(0,n.search(/\r?\n/));return{raw:i,name:i?i.trim():""}};h2.cache={};h2.clearCache=function(){h2.cache={}};DGn.exports=h2});import OGn from"path";var UGn,MGn,lU,Wrt=It(()=>{"use strict";UGn=Qt(Uy(),1),MGn=Qt(jNe(),1);OO();lU=class{async parse(t,r,a,i){let s=await UGn.default.readFile(t,"utf-8"),e={},o=s;try{let h=(0,MGn.default)(s);e=h.data,o=h.content}catch{let c=this.parseFallback(s);e=c.data,o=c.content}let u=e.name;if(!u){let h=o.match(/^#\s+(.+)$/m);h?u=h[1].trim().toLowerCase().replace(/\s+/g,"-"):u=OGn.basename(t,".md")}let d=e.description||"";if(!d){let c=o.replace(/^#+.*$/mg,"").trim().split(/\r?\n\r?\n/)[0];c&&(d=c.replace(/\r?\n/g," ").substring(0,100).trim(),c.length>100&&(d+="..."))}return{id:`${a}:${u}`,type:r,name:u,description:d,version:e.version,author:e.author,source:RR.MARKETPLACE,location:{type:"file",path:t,relativePath:OGn.basename(t)},content:o,metadata:e,executable:!0,scripts:[],references:[],installed:!0,enabled:!0,loadLevel:DO.FULL,pluginId:a,marketplaceId:i,category:e.category,tags:e.tags}}parseFallback(t){let r=t.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);if(!r)return{data:{},content:t};let a=r[1],i=r[2],s={},e=a.split(/\r?\n/),o="",u="";for(let d of e){let I=d.match(/^([a-zA-Z0-9_-]+):\s*(.*)$/);I?(o&&(s[o]=u.trim()),o=I[1],u=I[2]):o&&(u+=`
|
|
2829
|
-
`+d)}return o&&(s[o]=u.trim()),{data:s,content:i}}}});import JY from"path";var TY,sU,zGn=It(()=>{"use strict";TY=Qt(Uy(),1);OO();Wrt();sU=class{markdownParser;constructor(){this.markdownParser=new lU}async parse(t,r,a,i,s){try{let e=await TY.default.stat(t);if(e.isFile()&&t.endsWith(".md")){let o=await this.markdownParser.parse(t,r,a,i);return o.location.relativePath=JY.relative(s,t),o}if(e.isDirectory()&&r===gc.SKILL){let o=JY.join(t,"SKILL.md");if(await TY.default.pathExists(o)){let u=await this.markdownParser.parse(o,r,a,i);u.location.type="directory",u.location.path=t,u.location.relativePath=JY.relative(s,t),u.name==="SKILL"&&(u.name=JY.basename(t),u.id=`${a}:${u.name}`);let d=JY.join(t,"scripts");if(await TY.default.pathExists(d)&&(await TY.default.stat(d)).isDirectory()){let c=await TY.default.readdir(d);for(let G of c){let W=JY.join(d,G);if((await TY.default.stat(W)).isFile()){let R="unknown",F=JY.extname(G).toLowerCase();F===".py"?R="python":F===".sh"||F===".bash"?R="bash":(F===".js"||F===".mjs"||F===".cjs")&&(R="node"),u.scripts.push({name:G,path:W,type:R})}}}let I=await TY.default.readdir(t);for(let h of I)h!=="SKILL.md"&&h.endsWith(".md")&&u.references.push(JY.join(t,h));return u}}return null}catch(e){return console.warn(`Failed to parse component at ${t}:`,e),null}}}});var yrt=It(()=>{"use strict";y2n();Wrt();zGn();});var _Gn=It(()=>{"use strict"});var KNe,PGn=It(()=>{"use strict";KNe=class{components=new Map;plugins=new Map;loaders=[];initialized=!1;constructor(){}async initialize(){this.initialized||(await this.refresh(),this.initialized=!0)}async refresh(){this.components.clear(),this.plugins.clear();let t=await Promise.all(this.loaders.map(async r=>{try{return"loadPlugins"in r?await r.loadPlugins():"load"in r?await r.load():[]}catch(a){return console.error("Failed to load from loader:",a),[]}}));for(let r of t)if(Array.isArray(r))for(let a of r)this.isPlugin(a)?this.registerPlugin(a):this.registerComponent(a)}async getComponents(t){this.initialized||await this.initialize();let r=Array.from(this.components.values());return t?r.filter(a=>{if(t.type&&!(Array.isArray(t.type)?t.type:[t.type]).includes(a.type)||t.source&&a.source!==t.source||t.marketplaceId&&a.marketplaceId!==t.marketplaceId||t.pluginId&&a.pluginId!==t.pluginId||t.enabled!==void 0&&a.enabled!==t.enabled)return!1;if(t.search){let i=t.search.toLowerCase();return a.name.toLowerCase().includes(i)||a.description.toLowerCase().includes(i)||a.id.toLowerCase().includes(i)}return t.tags&&t.tags.length>0?a.tags?t.tags.some(i=>a.tags.includes(i)):!1:!0}):r}async getPlugins(){return this.initialized||await this.initialize(),Array.from(this.plugins.values())}isPlugin(t){return"components"in t&&"structure"in t}registerPlugin(t){this.plugins.set(t.id,t);for(let r of t.components)this.registerComponent(r)}registerComponent(t){this.components.set(t.id,t)}}});var Frt={};Qo(Frt,{SettingsManager:()=>_p,SkillsPaths:()=>Ii,settingsManager:()=>qNe});import zy from"path";import Wba from"os";var uZ,Ii,_p,qNe,DX=It(()=>{"use strict";uZ=Qt(Uy(),1);QY();Ii=class n{static DEEPV_HOME=zy.join(Wba.homedir(),".deepv");static SKILLS_ROOT=zy.join(n.DEEPV_HOME,"skills");static MARKETPLACE_ROOT=zy.join(n.DEEPV_HOME,"marketplace");static PLUGIN_CACHE_ROOT=zy.join(n.SKILLS_ROOT,"cache");static SETTINGS_FILE=zy.join(n.SKILLS_ROOT,"settings.json");static INSTALLED_PLUGINS_FILE=zy.join(n.SKILLS_ROOT,"installed_plugins.json");static BACKUP_DIR=zy.join(n.SKILLS_ROOT,"backups");static getPluginCachePath(t,r,a){return zy.join(this.PLUGIN_CACHE_ROOT,t,r,a)}},_p=class{settingsCache=null;installedPluginsCache=null;backupRetention=10;constructor(){}async initialize(){try{await this.ensureDirectories(),await this.ensureConfigFiles(),await this.validateConfigs()}catch(t){throw new jl(`Failed to initialize Skills system: ${t instanceof Error?t.message:String(t)}`,va.UNKNOWN,{originalError:t})}}async ensureDirectories(){let t=[Ii.DEEPV_HOME,Ii.SKILLS_ROOT,Ii.MARKETPLACE_ROOT,Ii.PLUGIN_CACHE_ROOT,Ii.BACKUP_DIR];for(let r of t)await uZ.default.ensureDir(r)}async ensureConfigFiles(){await uZ.default.pathExists(Ii.SETTINGS_FILE)||await this.writeSettings(ENe),await uZ.default.pathExists(Ii.INSTALLED_PLUGINS_FILE)||await this.writeInstalledPlugins(RNe)}async validateConfigs(){let t=await this.readSettings();if(!t.enabledPlugins||!t.marketplaces)throw new jl("Invalid settings.json format",va.VALIDATION_FAILED);if(!(await this.readInstalledPlugins()).plugins)throw new jl("Invalid installed_plugins.json format",va.VALIDATION_FAILED)}async readSettings(){if(this.settingsCache)return this.settingsCache;try{let t=await uZ.default.readFile(Ii.SETTINGS_FILE,"utf-8"),r=JSON.parse(t);return this.settingsCache=r,r}catch(t){throw new jl(`Failed to read settings.json: ${t instanceof Error?t.message:String(t)}`,va.FILE_READ_FAILED,{path:Ii.SETTINGS_FILE,originalError:t})}}async writeSettings(t){try{await uZ.default.pathExists(Ii.SETTINGS_FILE)&&await this.backupSettings(),t.lastUpdated=new Date().toISOString(),await uZ.default.writeFile(Ii.SETTINGS_FILE,JSON.stringify(t,null,2),"utf-8"),this.settingsCache=t,await this.cleanupBackups()}catch(r){throw new jl(`Failed to write settings.json: ${r instanceof Error?r.message:String(r)}`,va.FILE_WRITE_FAILED,{path:Ii.SETTINGS_FILE,originalError:r})}}async updateSettings(t){let r=await this.readSettings(),a=t(r);await this.writeSettings(a)}async enablePlugin(t){await this.updateSettings(r=>({...r,enabledPlugins:{...r.enabledPlugins,[t]:!0}}))}async disablePlugin(t){await this.updateSettings(r=>({...r,enabledPlugins:{...r.enabledPlugins,[t]:!1}}))}async isPluginEnabled(t){return(await this.readSettings()).enabledPlugins[t]??!1}async getEnabledPlugins(){let t=await this.readSettings();return Object.entries(t.enabledPlugins).filter(([,r])=>r).map(([r])=>r)}async addMarketplace(t){await this.updateSettings(r=>{if(r.marketplaces.some(i=>i.id===t.id))throw new jl(`Marketplace ${t.id} already exists`,va.ALREADY_EXISTS);return{...r,marketplaces:[...r.marketplaces,t]}})}async removeMarketplace(t){await this.updateSettings(r=>({...r,marketplaces:r.marketplaces.filter(a=>a.id!==t)}))}async updateMarketplace(t,r){await this.updateSettings(a=>({...a,marketplaces:a.marketplaces.map(i=>i.id===t?r(i):i)}))}async getMarketplaces(){return(await this.readSettings()).marketplaces}async readInstalledPlugins(){if(this.installedPluginsCache)return this.installedPluginsCache;try{let t=await uZ.default.readFile(Ii.INSTALLED_PLUGINS_FILE,"utf-8"),r=JSON.parse(t);return this.installedPluginsCache=r,r}catch(t){throw new jl(`Failed to read installed_plugins.json: ${t instanceof Error?t.message:String(t)}`,va.FILE_READ_FAILED,{path:Ii.INSTALLED_PLUGINS_FILE,originalError:t})}}async writeInstalledPlugins(t){try{t.lastUpdated=new Date().toISOString(),await uZ.default.writeFile(Ii.INSTALLED_PLUGINS_FILE,JSON.stringify(t,null,2),"utf-8"),this.installedPluginsCache=t}catch(r){throw new jl(`Failed to write installed_plugins.json: ${r instanceof Error?r.message:String(r)}`,va.FILE_WRITE_FAILED,{path:Ii.INSTALLED_PLUGINS_FILE,originalError:r})}}async addInstalledPlugin(t){let r=await this.readInstalledPlugins();if(r.plugins[t.id])throw new jl(`Plugin ${t.id} already installed`,va.PLUGIN_ALREADY_INSTALLED);r.plugins[t.id]=t,await this.writeInstalledPlugins(r)}async removeInstalledPlugin(t){let r=await this.readInstalledPlugins();delete r.plugins[t],await this.writeInstalledPlugins(r)}async removeInstalledPluginsByMarketplace(t){if(!t?.trim())throw new jl("Marketplace ID cannot be empty",va.INVALID_INPUT);let r=([u])=>!u.startsWith(`${t}:`);await this.updateSettings(u=>({...u,enabledPlugins:Object.fromEntries(Object.entries(u.enabledPlugins).filter(r))}));let a=await this.readInstalledPlugins(),i=Object.keys(a.plugins).length,s=Object.fromEntries(Object.entries(a.plugins).filter(r));await this.writeInstalledPlugins({...a,plugins:s});let e=Object.keys(s).length,o=i-e;o>0&&console.debug(`Removed ${o} plugin record(s) from marketplace: ${t}`)}async updateInstalledPlugin(t,r){let a=await this.readInstalledPlugins(),i=a.plugins[t];if(!i)throw new jl(`Plugin ${t} not found`,va.PLUGIN_NOT_FOUND);a.plugins[t]=r(i),await this.writeInstalledPlugins(a)}async getInstalledPlugin(t){return(await this.readInstalledPlugins()).plugins[t]??null}async getInstalledPlugins(){let t=await this.readInstalledPlugins();return Object.values(t.plugins)}async backupSettings(){let t=new Date().toISOString().replace(/:/g,"-"),r=zy.join(Ii.BACKUP_DIR,`settings-${t}.json`);await uZ.default.copy(Ii.SETTINGS_FILE,r)}async cleanupBackups(){try{let a=(await uZ.default.readdir(Ii.BACKUP_DIR)).filter(i=>i.startsWith("settings-")&&i.endsWith(".json")).sort().reverse().slice(this.backupRetention);for(let i of a)await uZ.default.remove(zy.join(Ii.BACKUP_DIR,i))}catch(t){console.warn(`Failed to cleanup backups: ${t}`)}}clearCache(){this.settingsCache=null,this.installedPluginsCache=null}async reload(){this.clearCache(),await this.readSettings(),await this.readInstalledPlugins()}},qNe=new _p});import Su from"path";import{spawnSync as yba}from"child_process";var Tc,oU,Ert=It(()=>{"use strict";Tc=Qt(Uy(),1);OO();DX();yrt();oU=class{settingsManager;componentParser;constructor(t){this.settingsManager=t,this.componentParser=new sU}async loadPlugins(){let t=[],r=await this.settingsManager.readInstalledPlugins(),a=new Set(Object.keys(r.plugins)),i=await this.settingsManager.getMarketplaces();for(let s of i){if(!s.enabled)continue;let e=s.source==="local"?s.location:Su.join(Ii.MARKETPLACE_ROOT,s.id);if(!await Tc.default.pathExists(e))continue;let o=Su.join(e,".claude-plugin","marketplace.json"),u=new Set,d=s.id==="claude-code"||s.id?.includes("claude-code");if(await Tc.default.pathExists(o))try{let h=await Tc.default.readJson(o);if(h.plugins&&Array.isArray(h.plugins))for(let c of h.plugins)try{let G=`${s.id}:${c.name}`;if(!d&&!a.has(G))continue;let W=await this.loadPluginFromManifest(s.id,e,c);W&&(t.push(W),u.add(W.id))}catch(G){console.warn(`Failed to load plugin ${c.name} from manifest:`,G)}}catch(h){console.warn(`Failed to read marketplace.json for ${s.id}:`,h)}let I=await this.discoverPluginDirs(e);for(let h of I){let c=Su.basename(h),G=`${s.id}:${c}`;if(!u.has(G)&&!(!d&&!a.has(G)))try{let W=await this.loadPluginFromDir(s.id,h);W&&t.push(W)}catch(W){console.warn(`Failed to load plugin from ${h}:`,W)}}}return t}async loadPlugin(t){return null}async loadPluginFromManifest(t,r,a){let i=`${t}:${a.name}`,s=a.source,e=r,o=await this.settingsManager.getInstalledPlugin(i);if(o?.installPath&&await Tc.default.pathExists(o.installPath))e=o.installPath;else if(this.isRemoteGitSource(s)){let c=a.version||"unknown",G=Ii.getPluginCachePath(t,a.name,c);if(await Tc.default.pathExists(G))e=G;else{let W=this.extractGitUrl(s);if(W)await this.clonePluginToCache(W,G,s),e=G;else return console.warn(`Cannot extract Git URL from source: ${JSON.stringify(s)}`),null}}else typeof s=="string"?s.startsWith("./")||s.startsWith("../")?e=Su.join(r,s):e=Su.join(r,s):e=Su.join(r,a.name);if(!await Tc.default.pathExists(e))return console.warn(`Plugin directory not found: ${e}`),null;let u=[],d=a.metadata?.pluginRoot||"",I=c=>{let G=d?Su.join(d,c):c;return Su.isAbsolute(G)?G:Su.join(e,G)};if(a.commands&&(Array.isArray(a.commands)||typeof a.commands=="string")){let c=Array.isArray(a.commands)?a.commands:[a.commands];for(let G of c){let W=typeof G=="string"?G:G?.path;if(!W||typeof W!="string"){console.warn(`Invalid command path in plugin ${i}:`,G);continue}let y=I(W),R=await this.componentParser.parse(y,gc.COMMAND,i,t,e);R&&u.push(R)}}if(a.agents&&(Array.isArray(a.agents)||typeof a.agents=="string")){let c=Array.isArray(a.agents)?a.agents:[a.agents];for(let G of c){let W=typeof G=="string"?G:G?.path;if(!W||typeof W!="string"){console.warn(`Invalid agent path in plugin ${i}:`,G);continue}let y=I(W),R=await this.componentParser.parse(y,gc.AGENT,i,t,e);R&&u.push(R)}}if(a.skills&&(Array.isArray(a.skills)||typeof a.skills=="string")){let c=Array.isArray(a.skills)?a.skills:[a.skills];for(let G of c){let W=typeof G=="string"?G:G?.path;if(!W||typeof W!="string"){console.warn(`Invalid skill path in plugin ${i}:`,G);continue}let y=I(W),R=await this.componentParser.parse(y,gc.SKILL,i,t,e);R&&u.push(R)}}if(a.strict!==!0){let c=[{name:"agents",type:gc.AGENT},{name:"commands",type:gc.COMMAND},{name:"skills",type:gc.SKILL},{name:".claude/agents",type:gc.AGENT},{name:".claude/commands",type:gc.COMMAND},{name:".claude/skills",type:gc.SKILL},{name:".cursor/commands",type:gc.COMMAND},{name:".roo/commands",type:gc.COMMAND}],G=[];for(let R of c)G.push(...await this.scanComponents(e,R.name,R.type,i,t));let W=new Set(u.map(R=>R.id)),y=0;for(let R of G)W.has(R.id)||(u.push(R),W.add(R.id),y++);process.env.DEBUG_SKILLS&&(console.log(`[MarketplaceLoader] Plugin ${i}:`),console.log(` - Explicit components: ${u.length-y}`),console.log(` - Auto-discovered: ${y}`),console.log(` - Total: ${u.length}`))}return{id:i,name:a.name,description:a.description||"",version:a.version||"unknown",author:a.author,source:RR.MARKETPLACE,location:{type:"directory",path:e},components:u,structure:{hasMarketplaceJson:!0,hasPluginJson:!1,hasClaudePluginDir:!1,directories:{agents:!!a.agents,commands:!!a.commands,skills:!!a.skills,hooks:!!a.hooks,scripts:!1},detectedFormat:"deepv-code"},installed:!0,enabled:!0,marketplace:{id:t,name:t},rawConfig:a}}async discoverPluginDirs(t){let r=[],a=await Tc.default.readdir(t,{withFileTypes:!0});for(let s of a)s.isDirectory()&&!s.name.startsWith(".")&&s.name!=="plugins"&&r.push(Su.join(t,s.name));let i=Su.join(t,"plugins");if(await Tc.default.pathExists(i)){let s=await Tc.default.readdir(i,{withFileTypes:!0});for(let e of s)e.isDirectory()&&!e.name.startsWith(".")&&r.push(Su.join(i,e.name))}return r}async loadPluginFromDir(t,r){let a=Su.basename(r),i=`${t}:${a}`,e=await new jO(r).analyze(),o={name:a,description:"",version:"unknown"};e.hasPluginJson?o=await Tc.default.readJson(Su.join(r,"plugin.json")):e.hasClaudePluginDir&&(o=await Tc.default.readJson(Su.join(r,".claude-plugin","plugin.json")));let u=[];if(e.directories.agents&&(await Tc.default.pathExists(Su.join(r,"agents"))&&u.push(...await this.scanComponents(r,"agents",gc.AGENT,i,t)),await Tc.default.pathExists(Su.join(r,".claude/agents"))&&u.push(...await this.scanComponents(r,".claude/agents",gc.AGENT,i,t))),e.directories.commands){let d=["commands",".claude/commands",".cursor/commands",".roo/commands"];for(let I of d)await Tc.default.pathExists(Su.join(r,I))&&u.push(...await this.scanComponents(r,I,gc.COMMAND,i,t))}if(e.directories.skills)await Tc.default.pathExists(Su.join(r,"skills"))&&u.push(...await this.scanComponents(r,"skills",gc.SKILL,i,t)),await Tc.default.pathExists(Su.join(r,".claude/skills"))&&u.push(...await this.scanComponents(r,".claude/skills",gc.SKILL,i,t));else{let d=await this.scanComponents(r,".",gc.SKILL,i,t);d.length>0&&u.push(...d)}return{id:i,name:o.name||a,description:o.description||"",version:o.version||"unknown",author:o.author,source:RR.MARKETPLACE,location:{type:"directory",path:r},components:u,structure:e,installed:!0,enabled:!0,marketplace:{id:t,name:t}}}async scanComponents(t,r,a,i,s){let e=Su.join(t,r),o=[];if(!await Tc.default.pathExists(e))return o;let u=await Tc.default.readdir(e,{withFileTypes:!0});for(let d of u){if(d.name.startsWith("."))continue;let I=Su.join(e,d.name),h=await this.componentParser.parse(I,a,i,s,t);h&&o.push(h)}return o}isRemoteGitSource(t){return typeof t=="string"?!1:typeof t=="object"&&t!==null?t.source==="github"||t.source==="git"||t.source==="url":!1}extractGitUrl(t){if(typeof t=="object"&&t!==null){if(t.source==="github")return`https://github.com/${t.repo}.git`;if(t.source==="git")return t.url;if(t.source==="url")return t.url}return null}async clonePluginToCache(t,r,a){try{console.log(`[MarketplaceLoader] Cloning plugin from ${t} to ${r}`),await Tc.default.ensureDir(Su.dirname(r));let i=["clone","--depth","1"];typeof a=="object"&&"ref"in a&&a.ref&&i.push("--branch",a.ref),i.push(t,r);let s=yba("git",i,{stdio:"pipe",encoding:"utf-8"});if(s.status!==0){let e=s.stderr||s.error?.message||"Unknown error";throw new Error(`Git clone failed: ${e}`)}if(typeof a=="object"&&"path"in a&&a.path){let e=Su.join(r,a.path);if(await Tc.default.pathExists(e)){let o=r+"_temp";await Tc.default.move(e,o),await Tc.default.remove(r),await Tc.default.move(o,r)}}console.log(`[MarketplaceLoader] Plugin cached successfully: ${r}`)}catch(i){throw console.error("[MarketplaceLoader] Failed to clone plugin to cache:",i),await Tc.default.pathExists(r)&&await Tc.default.remove(r),i}}}});var jGn=It(()=>{"use strict";_Gn();PGn();Ert();});var qGn={};Qo(qGn,{MarketplaceManager:()=>Pp,marketplaceManager:()=>$Ne});import Dc from"path";import{exec as Fba}from"child_process";import{promisify as Eba}from"util";var uu,KGn,Rba,Pp,$Ne,Rrt=It(()=>{"use strict";uu=Qt(Uy(),1);QY();DX();KGn=Eba(Fba),Rba=".claude-plugin/marketplace.json",Pp=class{settingsManager;constructor(t){this.settingsManager=t}async addGitMarketplace(t,r){try{let a=r||this.extractRepoName(t),i=Dc.join(Ii.MARKETPLACE_ROOT,a);if(await uu.default.pathExists(i))throw new zd(`Marketplace ${a} already exists`,va.ALREADY_EXISTS,{path:i});await this.cloneRepository(t,i);let s=await this.scanMarketplace(a,i,{source:o2.GIT,url:t}),e={id:a,name:s.name,source:o2.GIT,location:t,enabled:!0,addedAt:new Date().toISOString()};return await this.settingsManager.addMarketplace(e),s}catch(a){throw new zd(`Failed to add Git marketplace: ${a instanceof Error?a.message:String(a)}`,va.MARKETPLACE_CLONE_FAILED,{url:t,originalError:a})}}async addLocalMarketplace(t,r){try{if(!await uu.default.pathExists(t))throw new zd(`Local path does not exist: ${t}`,va.DIRECTORY_NOT_FOUND,{path:t});let a=r||Dc.basename(t),i=await this.scanMarketplace(a,t,{source:o2.LOCAL,path:t}),s={id:a,name:i.name,source:o2.LOCAL,location:t,enabled:!0,addedAt:new Date().toISOString()};return await this.settingsManager.addMarketplace(s),i}catch(a){throw new zd(`Failed to add local marketplace: ${a instanceof Error?a.message:String(a)}`,va.MARKETPLACE_PARSE_FAILED,{path:t,originalError:a})}}async removeMarketplace(t,r=!1){try{let i=(await this.settingsManager.getMarketplaces()).find(s=>s.id===t);if(!i)throw new zd(`Marketplace ${t} not found`,va.MARKETPLACE_NOT_FOUND);if(await this.settingsManager.removeInstalledPluginsByMarketplace(t),await this.settingsManager.removeMarketplace(t),!r&&i.source===o2.GIT){let s=Dc.join(Ii.MARKETPLACE_ROOT,t);await uu.default.remove(s)}}catch(a){throw new zd(`Failed to remove marketplace: ${a instanceof Error?a.message:String(a)}`,va.UNKNOWN,{marketplaceId:t,originalError:a})}}async updateMarketplace(t){try{let a=(await this.settingsManager.getMarketplaces()).find(e=>e.id===t);if(!a)throw new zd(`Marketplace ${t} not found`,va.MARKETPLACE_NOT_FOUND);if(a.source!==o2.GIT)throw new zd(`Cannot update local marketplace: ${t}`,va.INVALID_INPUT);let i=Dc.join(Ii.MARKETPLACE_ROOT,t);return await this.pullRepository(i),await this.scanMarketplace(t,i,{source:o2.GIT,url:a.location})}catch(r){throw new zd(`Failed to update marketplace: ${r instanceof Error?r.message:String(r)}`,va.MARKETPLACE_UPDATE_FAILED,{marketplaceId:t,originalError:r})}}async listMarketplaces(){let t=await this.settingsManager.getMarketplaces(),r=[];for(let a of t)try{let i=await this.getMarketplace(a.id);r.push(i)}catch(i){console.warn(`Failed to load marketplace ${a.id}:`,i)}return r}async getMarketplace(t){let a=(await this.settingsManager.getMarketplaces()).find(s=>s.id===t);if(!a)throw new zd(`Marketplace ${t} not found`,va.MARKETPLACE_NOT_FOUND);let i=a.source===o2.GIT?Dc.join(Ii.MARKETPLACE_ROOT,t):a.location;return this.scanMarketplace(t,i,{source:a.source,url:a.source===o2.GIT?a.location:void 0,path:a.source===o2.LOCAL?a.location:void 0})}async getPlugins(t){return(await this.getMarketplace(t)).plugins}async cloneRepository(t,r,a){try{await uu.default.ensureDir(Dc.dirname(r));let i=["clone","--depth","1","-c","core.askPass=true"];a&&i.push("--branch",a),i.push(t,r);let s=`git ${i.join(" ")}`,{stdout:e,stderr:o}=await KGn(s,{maxBuffer:10*1024*1024,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});if(o&&o.includes("fatal"))throw new Error(o)}catch(i){let s=i instanceof Error?i.message:String(i),e=`Git clone failed: ${s}`;throw s.includes("Repository not found")||s.includes("404")?e=`Repository not found: ${t}
|
|
2829
|
+
`+d)}return o&&(s[o]=u.trim()),{data:s,content:i}}}});import JY from"path";var TY,sU,zGn=It(()=>{"use strict";TY=Qt(Uy(),1);OO();Wrt();sU=class{markdownParser;constructor(){this.markdownParser=new lU}async parse(t,r,a,i,s){try{let e=await TY.default.stat(t);if(e.isFile()&&t.endsWith(".md")){let o=await this.markdownParser.parse(t,r,a,i);return o.location.relativePath=JY.relative(s,t),o}if(e.isDirectory()&&r===gc.SKILL){let o=JY.join(t,"SKILL.md");if(await TY.default.pathExists(o)){let u=await this.markdownParser.parse(o,r,a,i);u.location.type="directory",u.location.path=t,u.location.relativePath=JY.relative(s,t),u.name==="SKILL"&&(u.name=JY.basename(t),u.id=`${a}:${u.name}`);let d=JY.join(t,"scripts");if(await TY.default.pathExists(d)&&(await TY.default.stat(d)).isDirectory()){let c=await TY.default.readdir(d);for(let G of c){let W=JY.join(d,G);if((await TY.default.stat(W)).isFile()){let R="unknown",F=JY.extname(G).toLowerCase();F===".py"?R="python":F===".sh"||F===".bash"?R="bash":(F===".js"||F===".mjs"||F===".cjs")&&(R="node"),u.scripts.push({name:G,path:W,type:R})}}}let I=await TY.default.readdir(t);for(let h of I)h!=="SKILL.md"&&h.endsWith(".md")&&u.references.push(JY.join(t,h));return u}}return null}catch(e){return console.warn(`Failed to parse component at ${t}:`,e),null}}}});var yrt=It(()=>{"use strict";y2n();Wrt();zGn();});var _Gn=It(()=>{"use strict"});var KNe,PGn=It(()=>{"use strict";KNe=class{components=new Map;plugins=new Map;loaders=[];initialized=!1;constructor(){}async initialize(){this.initialized||(await this.refresh(),this.initialized=!0)}async refresh(){this.components.clear(),this.plugins.clear();let t=await Promise.all(this.loaders.map(async r=>{try{return"loadPlugins"in r?await r.loadPlugins():"load"in r?await r.load():[]}catch(a){return console.error("Failed to load from loader:",a),[]}}));for(let r of t)if(Array.isArray(r))for(let a of r)this.isPlugin(a)?this.registerPlugin(a):this.registerComponent(a)}async getComponents(t){this.initialized||await this.initialize();let r=Array.from(this.components.values());return t?r.filter(a=>{if(t.type&&!(Array.isArray(t.type)?t.type:[t.type]).includes(a.type)||t.source&&a.source!==t.source||t.marketplaceId&&a.marketplaceId!==t.marketplaceId||t.pluginId&&a.pluginId!==t.pluginId||t.enabled!==void 0&&a.enabled!==t.enabled)return!1;if(t.search){let i=t.search.toLowerCase();return a.name.toLowerCase().includes(i)||a.description.toLowerCase().includes(i)||a.id.toLowerCase().includes(i)}return t.tags&&t.tags.length>0?a.tags?t.tags.some(i=>a.tags.includes(i)):!1:!0}):r}async getPlugins(){return this.initialized||await this.initialize(),Array.from(this.plugins.values())}isPlugin(t){return"components"in t&&"structure"in t}registerPlugin(t){this.plugins.set(t.id,t);for(let r of t.components)this.registerComponent(r)}registerComponent(t){this.components.set(t.id,t)}}});var Frt={};Qo(Frt,{SettingsManager:()=>_p,SkillsPaths:()=>Ii,settingsManager:()=>qNe});import zy from"path";import Wba from"os";var uZ,Ii,_p,qNe,DX=It(()=>{"use strict";uZ=Qt(Uy(),1);QY();Ii=class n{static DEEPV_HOME=zy.join(Wba.homedir(),".deepv");static SKILLS_ROOT=zy.join(n.DEEPV_HOME,"skills");static MARKETPLACE_ROOT=zy.join(n.DEEPV_HOME,"marketplace");static PLUGIN_CACHE_ROOT=zy.join(n.SKILLS_ROOT,"cache");static SETTINGS_FILE=zy.join(n.SKILLS_ROOT,"settings.json");static INSTALLED_PLUGINS_FILE=zy.join(n.SKILLS_ROOT,"installed_plugins.json");static BACKUP_DIR=zy.join(n.SKILLS_ROOT,"backups");static getPluginCachePath(t,r,a){return zy.join(this.PLUGIN_CACHE_ROOT,t,r,a)}},_p=class{settingsCache=null;installedPluginsCache=null;backupRetention=10;constructor(){}async initialize(){try{await this.ensureDirectories(),await this.ensureConfigFiles(),await this.validateConfigs()}catch(t){throw new jl(`Failed to initialize Skills system: ${t instanceof Error?t.message:String(t)}`,va.UNKNOWN,{originalError:t})}}async ensureDirectories(){let t=[Ii.DEEPV_HOME,Ii.SKILLS_ROOT,Ii.MARKETPLACE_ROOT,Ii.PLUGIN_CACHE_ROOT,Ii.BACKUP_DIR];for(let r of t)await uZ.default.ensureDir(r)}async ensureConfigFiles(){await uZ.default.pathExists(Ii.SETTINGS_FILE)||await this.writeSettings(ENe),await uZ.default.pathExists(Ii.INSTALLED_PLUGINS_FILE)||await this.writeInstalledPlugins(RNe)}async validateConfigs(){let t=await this.readSettings();if(!t.enabledPlugins||!t.marketplaces)throw new jl("Invalid settings.json format",va.VALIDATION_FAILED);if(!(await this.readInstalledPlugins()).plugins)throw new jl("Invalid installed_plugins.json format",va.VALIDATION_FAILED)}async readSettings(){if(this.settingsCache)return this.settingsCache;try{let t=await uZ.default.readFile(Ii.SETTINGS_FILE,"utf-8"),r=JSON.parse(t);return this.settingsCache=r,r}catch(t){throw new jl(`Failed to read settings.json: ${t instanceof Error?t.message:String(t)}`,va.FILE_READ_FAILED,{path:Ii.SETTINGS_FILE,originalError:t})}}async writeSettings(t){try{await uZ.default.pathExists(Ii.SETTINGS_FILE)&&await this.backupSettings(),t.lastUpdated=new Date().toISOString(),await uZ.default.writeFile(Ii.SETTINGS_FILE,JSON.stringify(t,null,2),"utf-8"),this.settingsCache=t,await this.cleanupBackups()}catch(r){throw new jl(`Failed to write settings.json: ${r instanceof Error?r.message:String(r)}`,va.FILE_WRITE_FAILED,{path:Ii.SETTINGS_FILE,originalError:r})}}async updateSettings(t){let r=await this.readSettings(),a=t(r);await this.writeSettings(a)}async enablePlugin(t){await this.updateSettings(r=>({...r,enabledPlugins:{...r.enabledPlugins,[t]:!0}}))}async disablePlugin(t){await this.updateSettings(r=>({...r,enabledPlugins:{...r.enabledPlugins,[t]:!1}}))}async isPluginEnabled(t){return(await this.readSettings()).enabledPlugins[t]??!1}async getEnabledPlugins(){let t=await this.readSettings();return Object.entries(t.enabledPlugins).filter(([,r])=>r).map(([r])=>r)}async addMarketplace(t){await this.updateSettings(r=>{if(r.marketplaces.some(i=>i.id===t.id))throw new jl(`Marketplace ${t.id} already exists`,va.ALREADY_EXISTS);return{...r,marketplaces:[...r.marketplaces,t]}})}async removeMarketplace(t){await this.updateSettings(r=>({...r,marketplaces:r.marketplaces.filter(a=>a.id!==t)}))}async updateMarketplace(t,r){await this.updateSettings(a=>({...a,marketplaces:a.marketplaces.map(i=>i.id===t?r(i):i)}))}async getMarketplaces(){return(await this.readSettings()).marketplaces}async readInstalledPlugins(){if(this.installedPluginsCache)return this.installedPluginsCache;try{let t=await uZ.default.readFile(Ii.INSTALLED_PLUGINS_FILE,"utf-8"),r=JSON.parse(t);return this.installedPluginsCache=r,r}catch(t){throw new jl(`Failed to read installed_plugins.json: ${t instanceof Error?t.message:String(t)}`,va.FILE_READ_FAILED,{path:Ii.INSTALLED_PLUGINS_FILE,originalError:t})}}async writeInstalledPlugins(t){try{t.lastUpdated=new Date().toISOString(),await uZ.default.writeFile(Ii.INSTALLED_PLUGINS_FILE,JSON.stringify(t,null,2),"utf-8"),this.installedPluginsCache=t}catch(r){throw new jl(`Failed to write installed_plugins.json: ${r instanceof Error?r.message:String(r)}`,va.FILE_WRITE_FAILED,{path:Ii.INSTALLED_PLUGINS_FILE,originalError:r})}}async addInstalledPlugin(t){let r=await this.readInstalledPlugins();if(r.plugins[t.id])throw new jl(`Plugin ${t.id} already installed`,va.PLUGIN_ALREADY_INSTALLED);r.plugins[t.id]=t,await this.writeInstalledPlugins(r)}async removeInstalledPlugin(t){let r=await this.readInstalledPlugins();delete r.plugins[t],await this.writeInstalledPlugins(r)}async removeInstalledPluginsByMarketplace(t){if(!t?.trim())throw new jl("Marketplace ID cannot be empty",va.INVALID_INPUT);let r=([u])=>!u.startsWith(`${t}:`);await this.updateSettings(u=>({...u,enabledPlugins:Object.fromEntries(Object.entries(u.enabledPlugins).filter(r))}));let a=await this.readInstalledPlugins(),i=Object.keys(a.plugins).length,s=Object.fromEntries(Object.entries(a.plugins).filter(r));await this.writeInstalledPlugins({...a,plugins:s});let e=Object.keys(s).length,o=i-e;o>0&&console.debug(`Removed ${o} plugin record(s) from marketplace: ${t}`)}async updateInstalledPlugin(t,r){let a=await this.readInstalledPlugins(),i=a.plugins[t];if(!i)throw new jl(`Plugin ${t} not found`,va.PLUGIN_NOT_FOUND);a.plugins[t]=r(i),await this.writeInstalledPlugins(a)}async getInstalledPlugin(t){return(await this.readInstalledPlugins()).plugins[t]??null}async getInstalledPlugins(){let t=await this.readInstalledPlugins();return Object.values(t.plugins)}async backupSettings(){let t=new Date().toISOString().replace(/:/g,"-"),r=zy.join(Ii.BACKUP_DIR,`settings-${t}.json`);await uZ.default.copy(Ii.SETTINGS_FILE,r)}async cleanupBackups(){try{let a=(await uZ.default.readdir(Ii.BACKUP_DIR)).filter(i=>i.startsWith("settings-")&&i.endsWith(".json")).sort().reverse().slice(this.backupRetention);for(let i of a)await uZ.default.remove(zy.join(Ii.BACKUP_DIR,i))}catch(t){console.warn(`Failed to cleanup backups: ${t}`)}}clearCache(){this.settingsCache=null,this.installedPluginsCache=null}async reload(){this.clearCache(),await this.readSettings(),await this.readInstalledPlugins()}},qNe=new _p});import Su from"path";import{spawnSync as yba}from"child_process";var Tc,oU,Ert=It(()=>{"use strict";Tc=Qt(Uy(),1);OO();DX();yrt();oU=class{settingsManager;componentParser;constructor(t){this.settingsManager=t,this.componentParser=new sU}async loadPlugins(){let t=[],r=await this.settingsManager.readInstalledPlugins(),a=new Set(Object.keys(r.plugins)),i=await this.settingsManager.getMarketplaces();for(let s of i){if(!s.enabled)continue;let e=s.source==="local"?s.location:Su.join(Ii.MARKETPLACE_ROOT,s.id);if(!await Tc.default.pathExists(e))continue;let o=Su.join(e,".claude-plugin","marketplace.json"),u=new Set,d=s.id==="claude-code"||s.id?.includes("claude-code");if(await Tc.default.pathExists(o))try{let h=await Tc.default.readJson(o);if(h.plugins&&Array.isArray(h.plugins))for(let c of h.plugins)try{let G=`${s.id}:${c.name}`;if(!d&&!a.has(G))continue;let W=await this.loadPluginFromManifest(s.id,e,c);W&&(t.push(W),u.add(W.id))}catch(G){console.warn(`Failed to load plugin ${c.name} from manifest:`,G)}}catch(h){console.warn(`Failed to read marketplace.json for ${s.id}:`,h)}let I=await this.discoverPluginDirs(e);for(let h of I){let c=Su.basename(h),G=`${s.id}:${c}`;if(!u.has(G)&&!(!d&&!a.has(G)))try{let W=await this.loadPluginFromDir(s.id,h);W&&t.push(W)}catch(W){console.warn(`Failed to load plugin from ${h}:`,W)}}}return t}async loadPlugin(t){return null}async loadPluginFromManifest(t,r,a){let i=`${t}:${a.name}`,s=a.source,e=r,o=await this.settingsManager.getInstalledPlugin(i);if(o?.installPath&&await Tc.default.pathExists(o.installPath))e=o.installPath;else if(this.isRemoteGitSource(s)){let c=a.version||"unknown",G=Ii.getPluginCachePath(t,a.name,c);if(await Tc.default.pathExists(G))e=G;else{let W=this.extractGitUrl(s);if(W)await this.clonePluginToCache(W,G,s),e=G;else return console.warn(`Cannot extract Git URL from source: ${JSON.stringify(s)}`),null}}else typeof s=="string"?s.startsWith("./")||s.startsWith("../")?e=Su.join(r,s):e=Su.join(r,s):e=Su.join(r,a.name);if(!await Tc.default.pathExists(e))return console.warn(`Plugin directory not found: ${e}`),null;let u=[],d=a.metadata?.pluginRoot||"",I=c=>{let G=d?Su.join(d,c):c;return Su.isAbsolute(G)?G:Su.join(e,G)};if(a.commands&&(Array.isArray(a.commands)||typeof a.commands=="string")){let c=Array.isArray(a.commands)?a.commands:[a.commands];for(let G of c){let W=typeof G=="string"?G:G?.path;if(!W||typeof W!="string"){console.warn(`Invalid command path in plugin ${i}:`,G);continue}let y=I(W),R=await this.componentParser.parse(y,gc.COMMAND,i,t,e);R&&u.push(R)}}if(a.agents&&(Array.isArray(a.agents)||typeof a.agents=="string")){let c=Array.isArray(a.agents)?a.agents:[a.agents];for(let G of c){let W=typeof G=="string"?G:G?.path;if(!W||typeof W!="string"){console.warn(`Invalid agent path in plugin ${i}:`,G);continue}let y=I(W),R=await this.componentParser.parse(y,gc.AGENT,i,t,e);R&&u.push(R)}}if(a.skills&&(Array.isArray(a.skills)||typeof a.skills=="string")){let c=Array.isArray(a.skills)?a.skills:[a.skills];for(let G of c){let W=typeof G=="string"?G:G?.path;if(!W||typeof W!="string"){console.warn(`Invalid skill path in plugin ${i}:`,G);continue}let y=I(W),R=await this.componentParser.parse(y,gc.SKILL,i,t,e);R&&u.push(R)}}if(a.strict!==!1){let c=[{name:"agents",type:gc.AGENT},{name:"commands",type:gc.COMMAND},{name:"skills",type:gc.SKILL},{name:".claude/agents",type:gc.AGENT},{name:".claude/commands",type:gc.COMMAND},{name:".claude/skills",type:gc.SKILL},{name:".cursor/commands",type:gc.COMMAND},{name:".roo/commands",type:gc.COMMAND}],G=[];for(let R of c)G.push(...await this.scanComponents(e,R.name,R.type,i,t));let W=new Set(u.map(R=>R.id)),y=0;for(let R of G)W.has(R.id)||(u.push(R),W.add(R.id),y++);process.env.DEBUG_SKILLS&&(console.log(`[MarketplaceLoader] Plugin ${i}:`),console.log(` - Explicit components: ${u.length-y}`),console.log(` - Auto-discovered: ${y}`),console.log(` - Total: ${u.length}`))}return{id:i,name:a.name,description:a.description||"",version:a.version||"unknown",author:a.author,source:RR.MARKETPLACE,location:{type:"directory",path:e},components:u,structure:{hasMarketplaceJson:!0,hasPluginJson:!1,hasClaudePluginDir:!1,directories:{agents:!!a.agents,commands:!!a.commands,skills:!!a.skills,hooks:!!a.hooks,scripts:!1},detectedFormat:"deepv-code"},installed:!0,enabled:!0,marketplace:{id:t,name:t},rawConfig:a}}async discoverPluginDirs(t){let r=[],a=await Tc.default.readdir(t,{withFileTypes:!0});for(let s of a)s.isDirectory()&&!s.name.startsWith(".")&&s.name!=="plugins"&&r.push(Su.join(t,s.name));let i=Su.join(t,"plugins");if(await Tc.default.pathExists(i)){let s=await Tc.default.readdir(i,{withFileTypes:!0});for(let e of s)e.isDirectory()&&!e.name.startsWith(".")&&r.push(Su.join(i,e.name))}return r}async loadPluginFromDir(t,r){let a=Su.basename(r),i=`${t}:${a}`,e=await new jO(r).analyze(),o={name:a,description:"",version:"unknown"};e.hasPluginJson?o=await Tc.default.readJson(Su.join(r,"plugin.json")):e.hasClaudePluginDir&&(o=await Tc.default.readJson(Su.join(r,".claude-plugin","plugin.json")));let u=[];if(e.directories.agents&&(await Tc.default.pathExists(Su.join(r,"agents"))&&u.push(...await this.scanComponents(r,"agents",gc.AGENT,i,t)),await Tc.default.pathExists(Su.join(r,".claude/agents"))&&u.push(...await this.scanComponents(r,".claude/agents",gc.AGENT,i,t))),e.directories.commands){let d=["commands",".claude/commands",".cursor/commands",".roo/commands"];for(let I of d)await Tc.default.pathExists(Su.join(r,I))&&u.push(...await this.scanComponents(r,I,gc.COMMAND,i,t))}if(e.directories.skills)await Tc.default.pathExists(Su.join(r,"skills"))&&u.push(...await this.scanComponents(r,"skills",gc.SKILL,i,t)),await Tc.default.pathExists(Su.join(r,".claude/skills"))&&u.push(...await this.scanComponents(r,".claude/skills",gc.SKILL,i,t));else{let d=await this.scanComponents(r,".",gc.SKILL,i,t);d.length>0&&u.push(...d)}return{id:i,name:o.name||a,description:o.description||"",version:o.version||"unknown",author:o.author,source:RR.MARKETPLACE,location:{type:"directory",path:r},components:u,structure:e,installed:!0,enabled:!0,marketplace:{id:t,name:t}}}async scanComponents(t,r,a,i,s){let e=Su.join(t,r),o=[];if(!await Tc.default.pathExists(e))return o;let u=await Tc.default.readdir(e,{withFileTypes:!0});for(let d of u){if(d.name.startsWith("."))continue;let I=Su.join(e,d.name),h=await this.componentParser.parse(I,a,i,s,t);h&&o.push(h)}return o}isRemoteGitSource(t){return typeof t=="string"?!1:typeof t=="object"&&t!==null?t.source==="github"||t.source==="git"||t.source==="url":!1}extractGitUrl(t){if(typeof t=="object"&&t!==null){if(t.source==="github")return`https://github.com/${t.repo}.git`;if(t.source==="git")return t.url;if(t.source==="url")return t.url}return null}async clonePluginToCache(t,r,a){try{console.log(`[MarketplaceLoader] Cloning plugin from ${t} to ${r}`),await Tc.default.ensureDir(Su.dirname(r));let i=["clone","--depth","1"];typeof a=="object"&&"ref"in a&&a.ref&&i.push("--branch",a.ref),i.push(t,r);let s=yba("git",i,{stdio:"pipe",encoding:"utf-8"});if(s.status!==0){let e=s.stderr||s.error?.message||"Unknown error";throw new Error(`Git clone failed: ${e}`)}if(typeof a=="object"&&"path"in a&&a.path){let e=Su.join(r,a.path);if(await Tc.default.pathExists(e)){let o=r+"_temp";await Tc.default.move(e,o),await Tc.default.remove(r),await Tc.default.move(o,r)}}console.log(`[MarketplaceLoader] Plugin cached successfully: ${r}`)}catch(i){throw console.error("[MarketplaceLoader] Failed to clone plugin to cache:",i),await Tc.default.pathExists(r)&&await Tc.default.remove(r),i}}}});var jGn=It(()=>{"use strict";_Gn();PGn();Ert();});var qGn={};Qo(qGn,{MarketplaceManager:()=>Pp,marketplaceManager:()=>$Ne});import Dc from"path";import{exec as Fba}from"child_process";import{promisify as Eba}from"util";var uu,KGn,Rba,Pp,$Ne,Rrt=It(()=>{"use strict";uu=Qt(Uy(),1);QY();DX();KGn=Eba(Fba),Rba=".claude-plugin/marketplace.json",Pp=class{settingsManager;constructor(t){this.settingsManager=t}async addGitMarketplace(t,r){try{let a=r||this.extractRepoName(t),i=Dc.join(Ii.MARKETPLACE_ROOT,a);if(await uu.default.pathExists(i))throw new zd(`Marketplace ${a} already exists`,va.ALREADY_EXISTS,{path:i});await this.cloneRepository(t,i);let s=await this.scanMarketplace(a,i,{source:o2.GIT,url:t}),e={id:a,name:s.name,source:o2.GIT,location:t,enabled:!0,addedAt:new Date().toISOString()};return await this.settingsManager.addMarketplace(e),s}catch(a){throw new zd(`Failed to add Git marketplace: ${a instanceof Error?a.message:String(a)}`,va.MARKETPLACE_CLONE_FAILED,{url:t,originalError:a})}}async addLocalMarketplace(t,r){try{if(!await uu.default.pathExists(t))throw new zd(`Local path does not exist: ${t}`,va.DIRECTORY_NOT_FOUND,{path:t});let a=r||Dc.basename(t),i=await this.scanMarketplace(a,t,{source:o2.LOCAL,path:t}),s={id:a,name:i.name,source:o2.LOCAL,location:t,enabled:!0,addedAt:new Date().toISOString()};return await this.settingsManager.addMarketplace(s),i}catch(a){throw new zd(`Failed to add local marketplace: ${a instanceof Error?a.message:String(a)}`,va.MARKETPLACE_PARSE_FAILED,{path:t,originalError:a})}}async removeMarketplace(t,r=!1){try{let i=(await this.settingsManager.getMarketplaces()).find(s=>s.id===t);if(!i)throw new zd(`Marketplace ${t} not found`,va.MARKETPLACE_NOT_FOUND);if(await this.settingsManager.removeInstalledPluginsByMarketplace(t),await this.settingsManager.removeMarketplace(t),!r&&i.source===o2.GIT){let s=Dc.join(Ii.MARKETPLACE_ROOT,t);await uu.default.remove(s)}}catch(a){throw new zd(`Failed to remove marketplace: ${a instanceof Error?a.message:String(a)}`,va.UNKNOWN,{marketplaceId:t,originalError:a})}}async updateMarketplace(t){try{let a=(await this.settingsManager.getMarketplaces()).find(e=>e.id===t);if(!a)throw new zd(`Marketplace ${t} not found`,va.MARKETPLACE_NOT_FOUND);if(a.source!==o2.GIT)throw new zd(`Cannot update local marketplace: ${t}`,va.INVALID_INPUT);let i=Dc.join(Ii.MARKETPLACE_ROOT,t);return await this.pullRepository(i),await this.scanMarketplace(t,i,{source:o2.GIT,url:a.location})}catch(r){throw new zd(`Failed to update marketplace: ${r instanceof Error?r.message:String(r)}`,va.MARKETPLACE_UPDATE_FAILED,{marketplaceId:t,originalError:r})}}async listMarketplaces(){let t=await this.settingsManager.getMarketplaces(),r=[];for(let a of t)try{let i=await this.getMarketplace(a.id);r.push(i)}catch(i){console.warn(`Failed to load marketplace ${a.id}:`,i)}return r}async getMarketplace(t){let a=(await this.settingsManager.getMarketplaces()).find(s=>s.id===t);if(!a)throw new zd(`Marketplace ${t} not found`,va.MARKETPLACE_NOT_FOUND);let i=a.source===o2.GIT?Dc.join(Ii.MARKETPLACE_ROOT,t):a.location;return this.scanMarketplace(t,i,{source:a.source,url:a.source===o2.GIT?a.location:void 0,path:a.source===o2.LOCAL?a.location:void 0})}async getPlugins(t){return(await this.getMarketplace(t)).plugins}async cloneRepository(t,r,a){try{await uu.default.ensureDir(Dc.dirname(r));let i=["clone","--depth","1","-c","core.askPass=true"];a&&i.push("--branch",a),i.push(t,r);let s=`git ${i.join(" ")}`,{stdout:e,stderr:o}=await KGn(s,{maxBuffer:10*1024*1024,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});if(o&&o.includes("fatal"))throw new Error(o)}catch(i){let s=i instanceof Error?i.message:String(i),e=`Git clone failed: ${s}`;throw s.includes("Repository not found")||s.includes("404")?e=`Repository not found: ${t}
|
|
2830
2830
|
|
|
2831
2831
|
\u8BF7\u68C0\u67E5\uFF1A
|
|
2832
2832
|
1. \u4ED3\u5E93\u540D\u662F\u5426\u6B63\u786E
|
|
@@ -3084,7 +3084,7 @@ ${d}`,returnDisplay:`Executed ${e.length} tools. ${u} succeeded.`}}}});import*as
|
|
|
3084
3084
|
|
|
3085
3085
|
${r}${jy.sep}
|
|
3086
3086
|
${e.join(`
|
|
3087
|
-
`)}`}catch(s){return console.error(`Error getting folder structure for ${r}:`,s),`Error processing directory "${r}": ${cr(s)}`}}var Hba,pAe,Xba,Srt=It(()=>{"use strict";Yc();Ef();Hba=200,pAe="...",Xba=new Set(["node_modules",".git","dist"])});import{execSync as Lba}from"child_process";function E1n(){if(Brt)return Brt;let n=process.platform,t=process.env,r={platform:n};return n==="win32"?(r.shell=Sba(t),r.terminal=Bba(t)):n==="darwin"?(r.shell=F1n(t),r.terminal=Jba(t)):(r.shell=F1n(t),r.terminal=Tba(t)),Brt=r,r}function Sba(n){if(n.MSYSTEM||n.MINGW_PREFIX||n.MSYS2_PATH_TYPE)return"Git Bash (MSYS2)";if(n.WSL_DISTRO_NAME||n.WSLENV&&n.WSL_INTEROP)return`WSL (${n.WSL_DISTRO_NAME||"Unknown Distribution"})`;if(!!n.CYGWIN)return"Cygwin";try{let i=R1n(process.pid);if(i)return i}catch{}return n.PSEdition==="Core"?"PowerShell Core":n.__PSHOME||n.POWERSHELL_DISTRIBUTION_CHANNEL?"Windows PowerShell":"Command Prompt (CMD)"}function R1n(n,t=new Set,r=0){if(r>3||t.has(n))return null;t.add(n);try{let a=`wmic process where "ProcessId=${n}" get ParentProcessId,Name /format:value`,i=Lba(a,{encoding:"utf8",timeout:1e3,stdio:["pipe","pipe","pipe"]}),s=i.match(/ParentProcessId=(\d+)/),e=i.match(/Name=([^\r\n]+)/);if(!s?.[1]||!e?.[1])return null;let o=parseInt(s[1]),u=e[1].toLowerCase().trim();return u.includes("powershell.exe")?"Windows PowerShell":u.includes("pwsh.exe")?"PowerShell Core":u.includes("cmd.exe")?"Command Prompt (CMD)":u.includes("bash.exe")?"Git Bash":o>0&&o!==n?R1n(o,t,r+1):null}catch{return null}}function Bba(n){return n.WT_SESSION||n.WT_PROFILE_ID?"Windows Terminal":n.VSCODE_PID||n.TERM_PROGRAM==="vscode"?"VS Code Integrated Terminal":n.ConEmuPID||n.ConEmuWorkDir?"ConEmu":n.CMDER_ROOT?"Cmder":n.HYPER?"Hyper":n.TERMINAL_EMULATOR?.includes("JetBrains")?"JetBrains IDE Terminal":"Windows Console Host"}function F1n(n){let t=n.SHELL||"";return t.includes("bash")?"Bash":t.includes("zsh")?"Zsh":t.includes("fish")?"Fish":t.includes("tcsh")?"Tcsh":t.includes("csh")?"Csh":t.includes("sh")?"Sh":t||"Unknown Shell"}function Jba(n){return n.ITERM_SESSION_ID||n.TERM_PROGRAM==="iTerm.app"?"iTerm2":n.TERM_PROGRAM==="Apple_Terminal"?"Apple Terminal":n.VSCODE_PID||n.TERM_PROGRAM==="vscode"?"VS Code Integrated Terminal":n.HYPER?"Hyper":n.TERM_PROGRAM==="WarpTerminal"?"Warp":n.TERM_PROGRAM||"Unknown Terminal"}function Tba(n){return n.VSCODE_PID||n.TERM_PROGRAM==="vscode"?"VS Code Integrated Terminal":n.GNOME_TERMINAL_SERVICE||n.VTE_VERSION?"GNOME Terminal":n.KONSOLE_VERSION?"Konsole":n.TERMINATOR_UUID?"Terminator":n.TILIX_ID?"Tilix":n.KITTY_WINDOW_ID?"Kitty":n.ALACRITTY_SOCKET?"Alacritty":n.TERM||"Unknown Terminal"}function w1n(n){let t=[n.platform];return n.terminal&&t.push(`terminal: ${n.terminal}`),n.shell&&t.push(`shell: ${n.shell}`),n.version&&t.push(`version: ${n.version}`),t.join(", ")}var Brt,C1n=It(()=>{"use strict";Brt=null});import Y1n from"node:fs/promises";import Dba from"node:os";import Oba from"node:path";async function bAe(n,t,r,a="general",i=Dba.tmpdir()){let s=new Date().toISOString().replace(/[:.]/g,"-"),e=`gemini-client-error-${a}-${s}.json`,o=Oba.join(i,e),u;n instanceof Error?u={message:n.message,stack:n.stack}:typeof n=="object"&&n!==null&&"message"in n?u={message:String(n.message)}:u={message:String(n)};let d={error:u};r&&(d.context=r);let I;try{I=JSON.stringify(d,null,2)}catch(h){console.error(`${t} Could not stringify report content (likely due to context):`,h),console.error("Original error that triggered report generation:",n),r&&console.error("Original context could not be stringified or included in report.");try{I=JSON.stringify({error:u},null,2),await Y1n.writeFile(o,I),console.error(`${t} Partial report (excluding context) available at: ${o}`)}catch(c){console.error(`${t} Failed to write even a minimal error report:`,c)}return}try{await Y1n.writeFile(o,I),console.error(`${t} Full report available at: ${o}`)}catch(h){if(console.error(`${t} Additionally, failed to write detailed error report:`,h),console.error("Original error that triggered report generation:",n),r)try{console.error("Original context:",r)}catch{try{console.error("Original context (stringified, truncated):",JSON.stringify(r).substring(0,1e3))}catch{console.error("Original context could not be logged or stringified.")}}}}var Jrt=It(()=>{"use strict";});function oie(n,t){let r=ay(t),a=[],i=!0,s=!0,e;if(n.name||(a.push("Missing function name"),i=!1,s=!1),n.id||(a.push("Missing function call ID"),s=!1,r.needsFormatTolerance?(e||(e={...n}),e.id=`${n.name||"unknown"}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`):i=!1),n.args===void 0||n.args===null)r.needsFormatTolerance?(e||(e={...n}),e.args={}):(a.push("Missing or null function arguments"),i=!1);else if(typeof n.args!="object"&&(a.push("Function arguments must be an object"),i=!1,r.needsFormatTolerance)){e||(e={...n});try{typeof n.args=="string"?e.args=JSON.parse(n.args):e.args={value:n.args},i=!0,a.pop()}catch{e.args={},i=!0,a.pop()}}if(r.needsFormatTolerance&&n.args&&typeof n.args=="object"){let o=n.args,u=!1;if(n.name==="todo_write"&&o.todos&&(console.log("[FunctionCallValidator] Checking todo_write call..."),console.log("[FunctionCallValidator] args.todos:",JSON.stringify(o.todos)),Array.isArray(o.todos)&&o.todos.length>0&&(console.log("[FunctionCallValidator] todos is array, first item type:",typeof o.todos[0]),typeof o.todos[0]=="string"))){console.log("[FunctionCallValidator] Detected string array, converting to object array..."),e||(e={...n}),u||(e.args={...o},u=!0);let d=o.todos.map((I,h)=>{if(typeof I=="string")try{let c=JSON.parse(I);return console.log("[FunctionCallValidator] Parsed string to object:",c),c}catch{let c={id:`task_${h+1}`,content:I,status:"pending",priority:"medium"};return console.log("[FunctionCallValidator] Created default todo:",c),c}return I});e.args.todos=d,console.log("[FunctionCallValidator] Fixed todos:",JSON.stringify(d))}for(let[d,I]of Object.entries(o))I==null&&(e||(e={...n}),u||(e.args={...o},u=!0),d.toLowerCase().includes("path")||d.toLowerCase().includes("file")?e.args[d]="":d.toLowerCase().includes("count")||d.toLowerCase().includes("limit")?e.args[d]=10:(d.toLowerCase().includes("pattern")||d.toLowerCase().includes("query"),e.args[d]="")),typeof I=="string"&&(I.toLowerCase()==="true"||I.toLowerCase()==="false")&&(e||(e={...n}),u||(e.args={...o},u=!0),e.args[d]=I.toLowerCase()==="true"),typeof I=="string"&&/^\d+(\.\d+)?$/.test(I)&&["count","limit","offset","max","min","size","timeout"].some(c=>d.toLowerCase().includes(c))&&(e||(e={...n}),u||(e.args={...o},u=!0),e.args[d]=parseFloat(I))}return{isValid:i,isComplete:s,errors:a,fixedCall:e}}function fAe(n,t){return!n||n.length===0?!0:n.every(r=>{let a=oie(r,t);return a.isValid&&a.isComplete})}function GAe(n,t){return!n||n.length===0?[]:n.map(r=>oie(r,t).fixedCall||r)}function Trt(n,t){return ay(t).proneToIncompleteStream?n.some(a=>{if(!a.name&&!a.id)return!0;if(a.args&&typeof a.args=="object"){let i=JSON.stringify(a.args);if(i.includes('"":')||i.includes('""')||i.endsWith('":'))return!0}return!1}):!1}var Drt=It(()=>{"use strict";B$();});var pi,DY,gAe=It(()=>{"use strict";lae();Jrt();Yc();wW();Drt();(function(n){n.Content="content",n.ToolCallRequest="tool_call_request",n.ToolCallResponse="tool_call_response",n.ToolCallConfirmation="tool_call_confirmation",n.UserCancelled="user_cancelled",n.Error="error",n.ChatCompressed="chat_compressed",n.Thought="thought",n.Reasoning="reasoning",n.MaxSessionTurns="max_session_turns",n.Finished="finished",n.LoopDetected="loop_detected",n.TokenUsage="token_usage"})(pi||(pi={}));DY=class{chat;prompt_id;modelName;pendingToolCalls;debugResponses;config;constructor(t,r,a,i){this.chat=t,this.prompt_id=r,this.modelName=a,this.pendingToolCalls=[],this.debugResponses=[],this.config=i}getDebugResponses(){return this.debugResponses}async*run(t,r){try{if(this.config)try{let i=await this.config.getHookSystem().getEventHandler().fireBeforeModelEvent({model:this.modelName,contents:t});i?.finalOutput?.applyLLMRequestModifications&&(t=i.finalOutput.applyLLMRequestModifications(t))}catch(i){console.warn(`[Turn] BeforeModel hook execution failed: ${i}`)}if(this.config)try{await this.config.getHookSystem().getEventHandler().fireBeforeToolSelectionEvent({model:this.modelName,contents:t})}catch(i){console.warn(`[Turn] BeforeToolSelection hook execution failed: ${i}`)}let a=await this.chat.sendMessageStream({message:t,config:{abortSignal:r}},this.prompt_id,Ha.CHAT_CONVERSATION);for await(let i of a){if(r?.aborted){yield{type:pi.UserCancelled};return}this.debugResponses.push(i);let s=i.candidates?.[0]?.content?.parts?.[0];if(s?.thought){let d=s.text??"",I=d.match(/\*\*(.*?)\*\*/s),h=I?I[1].trim():"",c=d.replace(/\*\*(.*?)\*\*/s,"").trim(),G={subject:h,description:c};yield{type:pi.Thought,value:G};continue}if(s&&"reasoning"in s){let I={text:s.reasoning||""};yield{type:pi.Reasoning,value:I};continue}let e=AX(i);e&&(yield{type:pi.Content,value:e});let o=i.functionCalls??[];for(let d of o){let I=this.handlePendingFunctionCall(d);I&&(yield I)}let u=i.candidates?.[0]?.finishReason;if(u){let d;if(u==="MALFORMED_FUNCTION_CALL"){let I=i.functionCalls??[];if(I.length===0){let h=i.candidates?.[0]?.content?.parts??[];for(let c of h)c.functionCall&&I.push(c.functionCall)}if(I.length>0){let h=I[0];d=`Malformed function call detected.
|
|
3087
|
+
`)}`}catch(s){return console.error(`Error getting folder structure for ${r}:`,s),`Error processing directory "${r}": ${cr(s)}`}}var Hba,pAe,Xba,Srt=It(()=>{"use strict";Yc();Ef();Hba=200,pAe="...",Xba=new Set(["node_modules",".git","dist"])});import{execSync as Lba}from"child_process";function E1n(){if(Brt)return Brt;let n=process.platform,t=process.env,r={platform:n};return n==="win32"?(r.shell=Sba(t),r.terminal=Bba(t)):n==="darwin"?(r.shell=F1n(t),r.terminal=Jba(t)):(r.shell=F1n(t),r.terminal=Tba(t)),Brt=r,r}function Sba(n){if(n.MSYSTEM||n.MINGW_PREFIX||n.MSYS2_PATH_TYPE)return"Git Bash (MSYS2)";if(n.WSL_DISTRO_NAME||n.WSLENV&&n.WSL_INTEROP)return`WSL (${n.WSL_DISTRO_NAME||"Unknown Distribution"})`;if(!!n.CYGWIN)return"Cygwin";try{let i=R1n(process.pid);if(i)return i}catch{}return n.PSEdition==="Core"?"PowerShell Core":n.__PSHOME||n.POWERSHELL_DISTRIBUTION_CHANNEL?"Windows PowerShell":"Command Prompt (CMD)"}function R1n(n,t=new Set,r=0){if(r>3||t.has(n))return null;t.add(n);try{let a=`wmic process where "ProcessId=${n}" get ParentProcessId,Name /format:value`,i=Lba(a,{encoding:"utf8",timeout:1e3,stdio:["pipe","pipe","pipe"]}),s=i.match(/ParentProcessId=(\d+)/),e=i.match(/Name=([^\r\n]+)/);if(!s?.[1]||!e?.[1])return null;let o=parseInt(s[1]),u=e[1].toLowerCase().trim();return u.includes("powershell.exe")?"Windows PowerShell":u.includes("pwsh.exe")?"PowerShell Core":u.includes("cmd.exe")?"Command Prompt (CMD)":u.includes("bash.exe")?"Git Bash":o>0&&o!==n?R1n(o,t,r+1):null}catch{return null}}function Bba(n){return n.WT_SESSION||n.WT_PROFILE_ID?"Windows Terminal":n.VSCODE_PID||n.TERM_PROGRAM==="vscode"?"VS Code Integrated Terminal":n.ConEmuPID||n.ConEmuWorkDir?"ConEmu":n.CMDER_ROOT?"Cmder":n.HYPER?"Hyper":n.TERMINAL_EMULATOR?.includes("JetBrains")?"JetBrains IDE Terminal":"Windows Console Host"}function F1n(n){let t=n.SHELL||"";return t.includes("bash")?"Bash":t.includes("zsh")?"Zsh":t.includes("fish")?"Fish":t.includes("tcsh")?"Tcsh":t.includes("csh")?"Csh":t.includes("sh")?"Sh":t||"Unknown Shell"}function Jba(n){return n.ITERM_SESSION_ID||n.TERM_PROGRAM==="iTerm.app"?"iTerm2":n.TERM_PROGRAM==="Apple_Terminal"?"Apple Terminal":n.VSCODE_PID||n.TERM_PROGRAM==="vscode"?"VS Code Integrated Terminal":n.HYPER?"Hyper":n.TERM_PROGRAM==="WarpTerminal"?"Warp":n.TERM_PROGRAM||"Unknown Terminal"}function Tba(n){return n.VSCODE_PID||n.TERM_PROGRAM==="vscode"?"VS Code Integrated Terminal":n.GNOME_TERMINAL_SERVICE||n.VTE_VERSION?"GNOME Terminal":n.KONSOLE_VERSION?"Konsole":n.TERMINATOR_UUID?"Terminator":n.TILIX_ID?"Tilix":n.KITTY_WINDOW_ID?"Kitty":n.ALACRITTY_SOCKET?"Alacritty":n.TERM||"Unknown Terminal"}function w1n(n){let t=[n.platform];return n.terminal&&t.push(`terminal: ${n.terminal}`),n.shell&&t.push(`shell: ${n.shell}`),n.version&&t.push(`version: ${n.version}`),t.join(", ")}var Brt,C1n=It(()=>{"use strict";Brt=null});import Y1n from"node:fs/promises";import Dba from"node:os";import Oba from"node:path";async function bAe(n,t,r,a="general",i=Dba.tmpdir()){let s=new Date().toISOString().replace(/[:.]/g,"-"),e=`gemini-client-error-${a}-${s}.json`,o=Oba.join(i,e),u;n instanceof Error?u={message:n.message,stack:n.stack}:typeof n=="object"&&n!==null&&"message"in n?u={message:String(n.message)}:u={message:String(n)};let d={error:u};r&&(d.context=r);let I;try{I=JSON.stringify(d,null,2)}catch(h){console.error(`${t} Could not stringify report content (likely due to context):`,h),console.error("Original error that triggered report generation:",n),r&&console.error("Original context could not be stringified or included in report.");try{I=JSON.stringify({error:u},null,2),await Y1n.writeFile(o,I),console.error(`${t} Partial report (excluding context) available at: ${o}`)}catch(c){console.error(`${t} Failed to write even a minimal error report:`,c)}return}try{await Y1n.writeFile(o,I),console.error(`${t} Full report available at: ${o}`)}catch(h){if(console.error(`${t} Additionally, failed to write detailed error report:`,h),console.error("Original error that triggered report generation:",n),r)try{console.error("Original context:",r)}catch{try{console.error("Original context (stringified, truncated):",JSON.stringify(r).substring(0,1e3))}catch{console.error("Original context could not be logged or stringified.")}}}}var Jrt=It(()=>{"use strict";});function oie(n,t){let r=ay(t),a=[],i=!0,s=!0,e;if(n.name){let o=n.name.trim();o!==n.name&&(e||(e={...n}),e.name=o)}if(n.name?.trim()||(a.push("Missing function name"),i=!1,s=!1),n.id||(a.push("Missing function call ID"),s=!1,r.needsFormatTolerance?(e||(e={...n}),e.id=`${n.name||"unknown"}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`):i=!1),n.args===void 0||n.args===null)r.needsFormatTolerance?(e||(e={...n}),e.args={}):(a.push("Missing or null function arguments"),i=!1);else if(typeof n.args!="object"&&(a.push("Function arguments must be an object"),i=!1,r.needsFormatTolerance)){e||(e={...n});try{typeof n.args=="string"?e.args=JSON.parse(n.args):e.args={value:n.args},i=!0,a.pop()}catch{e.args={},i=!0,a.pop()}}if(r.needsFormatTolerance&&n.args&&typeof n.args=="object"){let o=n.args,u=!1;if(n.name==="todo_write"&&o.todos&&(console.log("[FunctionCallValidator] Checking todo_write call..."),console.log("[FunctionCallValidator] args.todos:",JSON.stringify(o.todos)),Array.isArray(o.todos)&&o.todos.length>0&&(console.log("[FunctionCallValidator] todos is array, first item type:",typeof o.todos[0]),typeof o.todos[0]=="string"))){console.log("[FunctionCallValidator] Detected string array, converting to object array..."),e||(e={...n}),u||(e.args={...o},u=!0);let d=o.todos.map((I,h)=>{if(typeof I=="string")try{let c=JSON.parse(I);return console.log("[FunctionCallValidator] Parsed string to object:",c),c}catch{let c={id:`task_${h+1}`,content:I,status:"pending",priority:"medium"};return console.log("[FunctionCallValidator] Created default todo:",c),c}return I});e.args.todos=d,console.log("[FunctionCallValidator] Fixed todos:",JSON.stringify(d))}for(let[d,I]of Object.entries(o))I==null&&(e||(e={...n}),u||(e.args={...o},u=!0),d.toLowerCase().includes("path")||d.toLowerCase().includes("file")?e.args[d]="":d.toLowerCase().includes("count")||d.toLowerCase().includes("limit")?e.args[d]=10:(d.toLowerCase().includes("pattern")||d.toLowerCase().includes("query"),e.args[d]="")),typeof I=="string"&&(I.toLowerCase()==="true"||I.toLowerCase()==="false")&&(e||(e={...n}),u||(e.args={...o},u=!0),e.args[d]=I.toLowerCase()==="true"),typeof I=="string"&&/^\d+(\.\d+)?$/.test(I)&&["count","limit","offset","max","min","size","timeout"].some(c=>d.toLowerCase().includes(c))&&(e||(e={...n}),u||(e.args={...o},u=!0),e.args[d]=parseFloat(I))}return{isValid:i,isComplete:s,errors:a,fixedCall:e}}function fAe(n,t){return!n||n.length===0?!0:n.every(r=>{let a=oie(r,t);return a.isValid&&a.isComplete})}function GAe(n,t){return!n||n.length===0?[]:n.map(r=>oie(r,t).fixedCall||r)}function Trt(n,t){return ay(t).proneToIncompleteStream?n.some(a=>{if(!a.name&&!a.id)return!0;if(a.args&&typeof a.args=="object"){let i=JSON.stringify(a.args);if(i.includes('"":')||i.includes('""')||i.endsWith('":'))return!0}return!1}):!1}var Drt=It(()=>{"use strict";B$();});var pi,DY,gAe=It(()=>{"use strict";lae();Jrt();Yc();wW();Drt();(function(n){n.Content="content",n.ToolCallRequest="tool_call_request",n.ToolCallResponse="tool_call_response",n.ToolCallConfirmation="tool_call_confirmation",n.UserCancelled="user_cancelled",n.Error="error",n.ChatCompressed="chat_compressed",n.Thought="thought",n.Reasoning="reasoning",n.MaxSessionTurns="max_session_turns",n.Finished="finished",n.LoopDetected="loop_detected",n.TokenUsage="token_usage"})(pi||(pi={}));DY=class{chat;prompt_id;modelName;pendingToolCalls;debugResponses;config;constructor(t,r,a,i){this.chat=t,this.prompt_id=r,this.modelName=a,this.pendingToolCalls=[],this.debugResponses=[],this.config=i}getDebugResponses(){return this.debugResponses}async*run(t,r){try{if(this.config)try{let i=await this.config.getHookSystem().getEventHandler().fireBeforeModelEvent({model:this.modelName,contents:t});i?.finalOutput?.applyLLMRequestModifications&&(t=i.finalOutput.applyLLMRequestModifications(t))}catch(i){console.warn(`[Turn] BeforeModel hook execution failed: ${i}`)}if(this.config)try{await this.config.getHookSystem().getEventHandler().fireBeforeToolSelectionEvent({model:this.modelName,contents:t})}catch(i){console.warn(`[Turn] BeforeToolSelection hook execution failed: ${i}`)}let a=await this.chat.sendMessageStream({message:t,config:{abortSignal:r}},this.prompt_id,Ha.CHAT_CONVERSATION);for await(let i of a){if(r?.aborted){yield{type:pi.UserCancelled};return}this.debugResponses.push(i);let s=i.candidates?.[0]?.content?.parts?.[0];if(s?.thought){let d=s.text??"",I=d.match(/\*\*(.*?)\*\*/s),h=I?I[1].trim():"",c=d.replace(/\*\*(.*?)\*\*/s,"").trim(),G={subject:h,description:c};yield{type:pi.Thought,value:G};continue}if(s&&"reasoning"in s){let I={text:s.reasoning||""};yield{type:pi.Reasoning,value:I};continue}let e=AX(i);e&&(yield{type:pi.Content,value:e});let o=i.functionCalls??[];for(let d of o){let I=this.handlePendingFunctionCall(d);I&&(yield I)}let u=i.candidates?.[0]?.finishReason;if(u){let d;if(u==="MALFORMED_FUNCTION_CALL"){let I=i.functionCalls??[];if(I.length===0){let h=i.candidates?.[0]?.content?.parts??[];for(let c of h)c.functionCall&&I.push(c.functionCall)}if(I.length>0){let h=I[0];d=`Malformed function call detected.
|
|
3088
3088
|
|
|
3089
3089
|
Function: ${h.name||"unknown"}
|
|
3090
3090
|
|
|
@@ -3122,7 +3122,7 @@ ${t}`;return Object.assign(new Error(r),n,{stack:i})}var Ait=class extends pga.E
|
|
|
3122
3122
|
To resolve the conflict:`,(0,AFe.getConflictResolutionRecipe)(s,t))),a=i):oYn.diag.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
|
|
3123
3123
|
`,`Details:
|
|
3124
3124
|
`,(0,AFe.getIncompatibilityDetails)(s,t),`To resolve the conflict:
|
|
3125
|
-
`,(0,AFe.getConflictResolutionRecipe)(s,t))}return a}};WFe.MetricStorageRegistry=fut});var uYn=ve(yFe=>{"use strict";Object.defineProperty(yFe,"__esModule",{value:!0});yFe.MultiMetricStorage=void 0;var Gut=class{constructor(t){this._backingStorages=t}record(t,r,a,i){this._backingStorages.forEach(s=>{s.record(t,r,a,i)})}};yFe.MultiMetricStorage=Gut});var dYn=ve(YM=>{"use strict";Object.defineProperty(YM,"__esModule",{value:!0});YM.BatchObservableResultImpl=YM.ObservableResultImpl=void 0;var CM=(Qr(),dr(kr)),IYn=Xle(),rRa=bFe(),gut=class{constructor(t,r){this._instrumentName=t,this._valueType=r,this._buffer=new IYn.AttributeHashMap}observe(t,r={}){if(typeof t!="number"){CM.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===CM.ValueType.INT&&!Number.isInteger(t)&&(CM.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}};YM.ObservableResultImpl=gut;var vut=class{constructor(){this._buffer=new Map}observe(t,r,a={}){if(!(0,rRa.isObservableInstrument)(t))return;let i=this._buffer.get(t);if(i==null&&(i=new IYn.AttributeHashMap,this._buffer.set(t,i)),typeof r!="number"){CM.diag.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===CM.ValueType.INT&&!Number.isInteger(r)&&(CM.diag.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||i.set(a,r)}};YM.BatchObservableResultImpl=vut});var pYn=ve(FFe=>{"use strict";Object.defineProperty(FFe,"__esModule",{value:!0});FFe.ObservableRegistry=void 0;var aRa=(Qr(),dr(kr)),hYn=bFe(),mYn=dYn(),kle=GF(),Zut=class{constructor(){this._callbacks=[],this._batchCallbacks=[]}addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){let a=this._findCallback(t,r);a<0||this._callbacks.splice(a,1)}addBatchCallback(t,r){let a=new Set(r.filter(hYn.isObservableInstrument));if(a.size===0){aRa.diag.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,a)>=0||this._batchCallbacks.push({callback:t,instruments:a})}removeBatchCallback(t,r){let a=new Set(r.filter(hYn.isObservableInstrument)),i=this._findBatchCallback(t,a);i<0||this._batchCallbacks.splice(i,1)}async observe(t,r){let a=this._observeCallbacks(t,r),i=this._observeBatchCallbacks(t,r);return(await(0,kle.PromiseAllSettled)([...a,...i])).filter(kle.isPromiseAllSettledRejectionResult).map(o=>o.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:a,instrument:i})=>{let s=new mYn.ObservableResultImpl(i._descriptor.name,i._descriptor.valueType),e=Promise.resolve(a(s));r!=null&&(e=(0,kle.callWithTimeout)(e,r)),await e,i._metricStorages.forEach(o=>{o.record(s._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:a,instruments:i})=>{let s=new mYn.BatchObservableResultImpl,e=Promise.resolve(a(s));r!=null&&(e=(0,kle.callWithTimeout)(e,r)),await e,i.forEach(o=>{let u=s._buffer.get(o);u!=null&&o._metricStorages.forEach(d=>{d.record(u,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(a=>a.callback===t&&a.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(a=>a.callback===t&&(0,kle.setEquals)(a.instruments,r))}};FFe.ObservableRegistry=Zut});var bYn=ve(EFe=>{"use strict";Object.defineProperty(EFe,"__esModule",{value:!0});EFe.SyncMetricStorage=void 0;var iRa=cut(),lRa=hut(),sRa=put(),Nut=class extends iRa.MetricStorage{constructor(t,r,a,i){super(t),this._attributesProcessor=a,this._deltaMetricStorage=new lRa.DeltaMetricProcessor(r),this._temporalMetricStorage=new sRa.TemporalMetricProcessor(r,i)}record(t,r,a,i){r=this._attributesProcessor.process(r,a),this._deltaMetricStorage.record(t,r,a,i)}collect(t,r){let a=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,a,r)}};EFe.SyncMetricStorage=Nut});var Wut=ve(vx=>{"use strict";Object.defineProperty(vx,"__esModule",{value:!0});vx.FilteringAttributesProcessor=vx.NoopAttributesProcessor=vx.AttributesProcessor=void 0;var Lle=class{static Noop(){return oRa}};vx.AttributesProcessor=Lle;var RFe=class extends Lle{process(t,r){return t}};vx.NoopAttributesProcessor=RFe;var Aut=class extends Lle{constructor(t){super(),this._allowedAttributeNames=t}process(t,r){let a={};return Object.keys(t).filter(i=>this._allowedAttributeNames.includes(i)).forEach(i=>a[i]=t[i]),a}};vx.FilteringAttributesProcessor=Aut;var oRa=new RFe});var fYn=ve(wFe=>{"use strict";Object.defineProperty(wFe,"__esModule",{value:!0});wFe.MeterSharedState=void 0;var cRa=MR(),uRa=tYn(),IRa=GF(),dRa=nYn(),hRa=cYn(),mRa=uYn(),pRa=pYn(),bRa=bYn(),fRa=Wut(),yut=class{constructor(t,r){this._meterProviderSharedState=t,this._instrumentationScope=r,this.metricStorageRegistry=new hRa.MetricStorageRegistry,this.observableRegistry=new pRa.ObservableRegistry,this.meter=new uRa.Meter(this)}registerMetricStorage(t){let r=this._registerMetricStorage(t,bRa.SyncMetricStorage);return r.length===1?r[0]:new mRa.MultiMetricStorage(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,dRa.AsyncMetricStorage)}async collect(t,r,a){let i=await this.observableRegistry.observe(r,a?.timeoutMillis),s=this.metricStorageRegistry.getStorages(t);if(s.length===0)return null;let e=s.map(o=>o.collect(t,r)).filter(IRa.isNotNullish);return e.length===0?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:e},errors:i}}_registerMetricStorage(t,r){let i=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(s=>{let e=(0,cRa.createInstrumentDescriptorWithView)(s,t),o=this.metricStorageRegistry.findOrUpdateCompatibleStorage(e);if(o!=null)return o;let u=s.aggregation.createAggregator(e),d=new r(e,u,s.attributesProcessor,this._meterProviderSharedState.metricCollectors);return this.metricStorageRegistry.register(d),d});if(i.length===0){let e=this._meterProviderSharedState.selectAggregations(t.type).map(([o,u])=>{let d=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(o,t);if(d!=null)return d;let I=u.createAggregator(t),h=new r(t,I,fRa.AttributesProcessor.Noop(),[o]);return this.metricStorageRegistry.registerForCollector(o,h),h});i=i.concat(e)}return i}};wFe.MeterSharedState=yut});var GYn=ve(CFe=>{"use strict";Object.defineProperty(CFe,"__esModule",{value:!0});CFe.MeterProviderSharedState=void 0;var GRa=GF(),gRa=eYn(),vRa=fYn(),Fut=class{constructor(t){this.resource=t,this.viewRegistry=new gRa.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(t){let r=(0,GRa.instrumentationScopeId)(t),a=this.meterSharedStates.get(r);return a==null&&(a=new vRa.MeterSharedState(this,t),this.meterSharedStates.set(r,a)),a}selectAggregations(t){let r=[];for(let a of this.metricCollectors)r.push([a,a.selectAggregation(t)]);return r}};CFe.MeterProviderSharedState=Fut});var gYn=ve(YFe=>{"use strict";Object.defineProperty(YFe,"__esModule",{value:!0});YFe.MetricCollector=void 0;var ZRa=Va(),Eut=class{constructor(t,r){this._sharedState=t,this._metricReader=r}async collect(t){let r=(0,ZRa.millisToHrTime)(Date.now()),a=[],i=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async e=>{let o=await e.collect(this,r,t);o?.scopeMetrics!=null&&a.push(o.scopeMetrics),o?.errors!=null&&i.push(...o.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:a},errors:i}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}};YFe.MetricCollector=Eut});var ZYn=ve(VFe=>{"use strict";Object.defineProperty(VFe,"__esModule",{value:!0});VFe.MeterProvider=void 0;var xFe=(Qr(),dr(kr)),vYn=gx(),NRa=GYn(),ARa=gYn(),Rut=class{constructor(t){var r;this._shutdown=!1;let a=vYn.Resource.default().merge((r=t?.resource)!==null&&r!==void 0?r:vYn.Resource.empty());if(this._sharedState=new NRa.MeterProviderSharedState(a),t?.views!=null&&t.views.length>0)for(let i of t.views)this._sharedState.viewRegistry.addView(i);if(t?.readers!=null&&t.readers.length>0)for(let i of t.readers)this.addMetricReader(i)}getMeter(t,r="",a={}){return this._shutdown?(xFe.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,xFe.createNoopMeter)()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:a.schemaUrl}).meter}addMetricReader(t){let r=new ARa.MetricCollector(this._sharedState,t);t.setMetricProducer(r),this._sharedState.metricCollectors.push(r)}async shutdown(t){if(this._shutdown){xFe.diag.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){xFe.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}};VFe.MeterProvider=Rut});var QFe=ve(xM=>{"use strict";Object.defineProperty(xM,"__esModule",{value:!0});xM.ExactPredicate=xM.PatternPredicate=void 0;var WRa=/[\^$\\.+?()[\]{}|]/g,wut=class n{constructor(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(n.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(WRa,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}};xM.PatternPredicate=wut;var Cut=class{constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}};xM.ExactPredicate=Cut});var AYn=ve(HFe=>{"use strict";Object.defineProperty(HFe,"__esModule",{value:!0});HFe.InstrumentSelector=void 0;var NYn=QFe(),Yut=class{constructor(t){var r;this._nameFilter=new NYn.PatternPredicate((r=t?.name)!==null&&r!==void 0?r:"*"),this._type=t?.type,this._unitFilter=new NYn.ExactPredicate(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};HFe.InstrumentSelector=Yut});var WYn=ve(XFe=>{"use strict";Object.defineProperty(XFe,"__esModule",{value:!0});XFe.MeterSelector=void 0;var xut=QFe(),Vut=class{constructor(t){this._nameFilter=new xut.ExactPredicate(t?.name),this._versionFilter=new xut.ExactPredicate(t?.version),this._schemaUrlFilter=new xut.ExactPredicate(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};XFe.MeterSelector=Vut});var FYn=ve(kFe=>{"use strict";Object.defineProperty(kFe,"__esModule",{value:!0});kFe.View=void 0;var yRa=QFe(),yYn=Wut(),FRa=AYn(),ERa=WYn(),RRa=Lye();function wRa(n){return n.instrumentName==null&&n.instrumentType==null&&n.instrumentUnit==null&&n.meterName==null&&n.meterVersion==null&&n.meterSchemaUrl==null}var Qut=class{constructor(t){var r;if(wRa(t))throw new Error("Cannot create view with no selector arguments supplied");if(t.name!=null&&(t?.instrumentName==null||yRa.PatternPredicate.hasWildcard(t.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");t.attributeKeys!=null?this.attributesProcessor=new yYn.FilteringAttributesProcessor(t.attributeKeys):this.attributesProcessor=yYn.AttributesProcessor.Noop(),this.name=t.name,this.description=t.description,this.aggregation=(r=t.aggregation)!==null&&r!==void 0?r:RRa.Aggregation.Default(),this.instrumentSelector=new FRa.InstrumentSelector({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new ERa.MeterSelector({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl})}};kFe.View=Qut});var VM=ve(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.TimeoutError=Cl.View=Cl.Aggregation=Cl.SumAggregation=Cl.LastValueAggregation=Cl.HistogramAggregation=Cl.DropAggregation=Cl.ExponentialHistogramAggregation=Cl.ExplicitBucketHistogramAggregation=Cl.DefaultAggregation=Cl.MeterProvider=Cl.InstrumentType=Cl.ConsoleMetricExporter=Cl.InMemoryMetricExporter=Cl.PeriodicExportingMetricReader=Cl.MetricReader=Cl.DataPointType=Cl.AggregationTemporality=void 0;var CRa=Nye();Object.defineProperty(Cl,"AggregationTemporality",{enumerable:!0,get:function(){return CRa.AggregationTemporality}});var YRa=uM();Object.defineProperty(Cl,"DataPointType",{enumerable:!0,get:function(){return YRa.DataPointType}});var xRa=Rct();Object.defineProperty(Cl,"MetricReader",{enumerable:!0,get:function(){return xRa.MetricReader}});var VRa=NCn();Object.defineProperty(Cl,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return VRa.PeriodicExportingMetricReader}});var QRa=WCn();Object.defineProperty(Cl,"InMemoryMetricExporter",{enumerable:!0,get:function(){return QRa.InMemoryMetricExporter}});var HRa=FCn();Object.defineProperty(Cl,"ConsoleMetricExporter",{enumerable:!0,get:function(){return HRa.ConsoleMetricExporter}});var XRa=MR();Object.defineProperty(Cl,"InstrumentType",{enumerable:!0,get:function(){return XRa.InstrumentType}});var kRa=ZYn();Object.defineProperty(Cl,"MeterProvider",{enumerable:!0,get:function(){return kRa.MeterProvider}});var Zx=Lye();Object.defineProperty(Cl,"DefaultAggregation",{enumerable:!0,get:function(){return Zx.DefaultAggregation}});Object.defineProperty(Cl,"ExplicitBucketHistogramAggregation",{enumerable:!0,get:function(){return Zx.ExplicitBucketHistogramAggregation}});Object.defineProperty(Cl,"ExponentialHistogramAggregation",{enumerable:!0,get:function(){return Zx.ExponentialHistogramAggregation}});Object.defineProperty(Cl,"DropAggregation",{enumerable:!0,get:function(){return Zx.DropAggregation}});Object.defineProperty(Cl,"HistogramAggregation",{enumerable:!0,get:function(){return Zx.HistogramAggregation}});Object.defineProperty(Cl,"LastValueAggregation",{enumerable:!0,get:function(){return Zx.LastValueAggregation}});Object.defineProperty(Cl,"SumAggregation",{enumerable:!0,get:function(){return Zx.SumAggregation}});Object.defineProperty(Cl,"Aggregation",{enumerable:!0,get:function(){return Zx.Aggregation}});var LRa=FYn();Object.defineProperty(Cl,"View",{enumerable:!0,get:function(){return LRa.View}});var SRa=GF();Object.defineProperty(Cl,"TimeoutError",{enumerable:!0,get:function(){return SRa.TimeoutError}})});var YYn=ve(Nx=>{"use strict";Object.defineProperty(Nx,"__esModule",{value:!0});Nx.toMetric=Nx.toScopeMetrics=Nx.toResourceMetrics=void 0;var EYn=(Qr(),dr(kr)),QM=VM(),BRa=Wle(),LFe=cM(),JRa=gye();function TRa(n,t){let r=(0,BRa.getOtlpEncoder)(t);return{resource:(0,JRa.createResource)(n.resource),schemaUrl:void 0,scopeMetrics:wYn(n.scopeMetrics,r)}}Nx.toResourceMetrics=TRa;function wYn(n,t){return Array.from(n.map(r=>({scope:(0,LFe.createInstrumentationScope)(r.scope),metrics:r.metrics.map(a=>CYn(a,t)),schemaUrl:r.scope.schemaUrl})))}Nx.toScopeMetrics=wYn;function CYn(n,t){let r={name:n.descriptor.name,description:n.descriptor.description,unit:n.descriptor.unit},a=MRa(n.aggregationTemporality);switch(n.dataPointType){case QM.DataPointType.SUM:r.sum={aggregationTemporality:a,isMonotonic:n.isMonotonic,dataPoints:RYn(n,t)};break;case QM.DataPointType.GAUGE:r.gauge={dataPoints:RYn(n,t)};break;case QM.DataPointType.HISTOGRAM:r.histogram={aggregationTemporality:a,dataPoints:ORa(n,t)};break;case QM.DataPointType.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:a,dataPoints:URa(n,t)};break}return r}Nx.toMetric=CYn;function DRa(n,t,r){let a={attributes:(0,LFe.toAttributes)(n.attributes),startTimeUnixNano:r.encodeHrTime(n.startTime),timeUnixNano:r.encodeHrTime(n.endTime)};switch(t){case EYn.ValueType.INT:a.asInt=n.value;break;case EYn.ValueType.DOUBLE:a.asDouble=n.value;break}return a}function RYn(n,t){return n.dataPoints.map(r=>DRa(r,n.descriptor.valueType,t))}function ORa(n,t){return n.dataPoints.map(r=>{let a=r.value;return{attributes:(0,LFe.toAttributes)(r.attributes),bucketCounts:a.buckets.counts,explicitBounds:a.buckets.boundaries,count:a.count,sum:a.sum,min:a.min,max:a.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function URa(n,t){return n.dataPoints.map(r=>{let a=r.value;return{attributes:(0,LFe.toAttributes)(r.attributes),count:a.count,min:a.min,max:a.max,sum:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},scale:a.scale,zeroCount:a.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function MRa(n){switch(n){case QM.AggregationTemporality.DELTA:return 1;case QM.AggregationTemporality.CUMULATIVE:return 2}}});var BFe=ve(SFe=>{"use strict";Object.defineProperty(SFe,"__esModule",{value:!0});SFe.createExportMetricsServiceRequest=void 0;var zRa=YYn();function _Ra(n,t){return{resourceMetrics:n.map(r=>(0,zRa.toResourceMetrics)(r,t))}}SFe.createExportMetricsServiceRequest=_Ra});var JFe=ve(HM=>{"use strict";Object.defineProperty(HM,"__esModule",{value:!0});HM.toLogAttributes=HM.createExportLogsServiceRequest=void 0;var PRa=Wle(),Hut=cM(),jRa=gye();function KRa(n,t){let r=(0,PRa.getOtlpEncoder)(t);return{resourceLogs:$Ra(n,r)}}HM.createExportLogsServiceRequest=KRa;function qRa(n){let t=new Map;for(let r of n){let{resource:a,instrumentationScope:{name:i,version:s="",schemaUrl:e=""}}=r,o=t.get(a);o||(o=new Map,t.set(a,o));let u=`${i}@${s}:${e}`,d=o.get(u);d||(d=[],o.set(u,d)),d.push(r)}return t}function $Ra(n,t){let r=qRa(n);return Array.from(r,([a,i])=>({resource:(0,jRa.createResource)(a),scopeLogs:Array.from(i,([,s])=>({scope:(0,Hut.createInstrumentationScope)(s[0].instrumentationScope),logRecords:s.map(e=>e4a(e,t)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:void 0}))}function e4a(n,t){var r,a,i;return{timeUnixNano:t.encodeHrTime(n.hrTime),observedTimeUnixNano:t.encodeHrTime(n.hrTimeObserved),severityNumber:n.severityNumber,severityText:n.severityText,body:(0,Hut.toAnyValue)(n.body),attributes:xYn(n.attributes),droppedAttributesCount:n.droppedAttributesCount,flags:(r=n.spanContext)===null||r===void 0?void 0:r.traceFlags,traceId:t.encodeOptionalSpanContext((a=n.spanContext)===null||a===void 0?void 0:a.traceId),spanId:t.encodeOptionalSpanContext((i=n.spanContext)===null||i===void 0?void 0:i.spanId)}}function xYn(n){return Object.keys(n).map(t=>(0,Hut.toKeyValue)(t,n[t]))}HM.toLogAttributes=xYn});var QYn=ve((cji,VYn)=>{"use strict";VYn.exports=llt()});var XYn=ve((uji,HYn)=>{"use strict";var za=QYn(),wn=za.Reader,ji=za.Writer,Vt=za.util,Et=za.roots.default||(za.roots.default={});Et.opentelemetry=(function(){var n={};return n.proto=(function(){var t={};return t.common=(function(){var r={};return r.v1=(function(){var a={};return a.AnyValue=(function(){function i(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.stringValue=null,i.prototype.boolValue=null,i.prototype.intValue=null,i.prototype.doubleValue=null,i.prototype.arrayValue=null,i.prototype.kvlistValue=null,i.prototype.bytesValue=null;var s;return Object.defineProperty(i.prototype,"value",{get:Vt.oneOfGetter(s=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){return u||(u=ji.create()),o.stringValue!=null&&Object.hasOwnProperty.call(o,"stringValue")&&u.uint32(10).string(o.stringValue),o.boolValue!=null&&Object.hasOwnProperty.call(o,"boolValue")&&u.uint32(16).bool(o.boolValue),o.intValue!=null&&Object.hasOwnProperty.call(o,"intValue")&&u.uint32(24).int64(o.intValue),o.doubleValue!=null&&Object.hasOwnProperty.call(o,"doubleValue")&&u.uint32(33).double(o.doubleValue),o.arrayValue!=null&&Object.hasOwnProperty.call(o,"arrayValue")&&Et.opentelemetry.proto.common.v1.ArrayValue.encode(o.arrayValue,u.uint32(42).fork()).ldelim(),o.kvlistValue!=null&&Object.hasOwnProperty.call(o,"kvlistValue")&&Et.opentelemetry.proto.common.v1.KeyValueList.encode(o.kvlistValue,u.uint32(50).fork()).ldelim(),o.bytesValue!=null&&Object.hasOwnProperty.call(o,"bytesValue")&&u.uint32(58).bytes(o.bytesValue),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.common.v1.AnyValue;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.stringValue=o.string();break}case 2:{I.boolValue=o.bool();break}case 3:{I.intValue=o.int64();break}case 4:{I.doubleValue=o.double();break}case 5:{I.arrayValue=Et.opentelemetry.proto.common.v1.ArrayValue.decode(o,o.uint32());break}case 6:{I.kvlistValue=Et.opentelemetry.proto.common.v1.KeyValueList.decode(o,o.uint32());break}case 7:{I.bytesValue=o.bytes();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.stringValue!=null&&o.hasOwnProperty("stringValue")&&(u.value=1,!Vt.isString(o.stringValue)))return"stringValue: string expected";if(o.boolValue!=null&&o.hasOwnProperty("boolValue")){if(u.value===1)return"value: multiple values";if(u.value=1,typeof o.boolValue!="boolean")return"boolValue: boolean expected"}if(o.intValue!=null&&o.hasOwnProperty("intValue")){if(u.value===1)return"value: multiple values";if(u.value=1,!Vt.isInteger(o.intValue)&&!(o.intValue&&Vt.isInteger(o.intValue.low)&&Vt.isInteger(o.intValue.high)))return"intValue: integer|Long expected"}if(o.doubleValue!=null&&o.hasOwnProperty("doubleValue")){if(u.value===1)return"value: multiple values";if(u.value=1,typeof o.doubleValue!="number")return"doubleValue: number expected"}if(o.arrayValue!=null&&o.hasOwnProperty("arrayValue")){if(u.value===1)return"value: multiple values";u.value=1;{var d=Et.opentelemetry.proto.common.v1.ArrayValue.verify(o.arrayValue);if(d)return"arrayValue."+d}}if(o.kvlistValue!=null&&o.hasOwnProperty("kvlistValue")){if(u.value===1)return"value: multiple values";u.value=1;{var d=Et.opentelemetry.proto.common.v1.KeyValueList.verify(o.kvlistValue);if(d)return"kvlistValue."+d}}if(o.bytesValue!=null&&o.hasOwnProperty("bytesValue")){if(u.value===1)return"value: multiple values";if(u.value=1,!(o.bytesValue&&typeof o.bytesValue.length=="number"||Vt.isString(o.bytesValue)))return"bytesValue: buffer expected"}return null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.common.v1.AnyValue)return o;var u=new Et.opentelemetry.proto.common.v1.AnyValue;if(o.stringValue!=null&&(u.stringValue=String(o.stringValue)),o.boolValue!=null&&(u.boolValue=!!o.boolValue),o.intValue!=null&&(Vt.Long?(u.intValue=Vt.Long.fromValue(o.intValue)).unsigned=!1:typeof o.intValue=="string"?u.intValue=parseInt(o.intValue,10):typeof o.intValue=="number"?u.intValue=o.intValue:typeof o.intValue=="object"&&(u.intValue=new Vt.LongBits(o.intValue.low>>>0,o.intValue.high>>>0).toNumber())),o.doubleValue!=null&&(u.doubleValue=Number(o.doubleValue)),o.arrayValue!=null){if(typeof o.arrayValue!="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");u.arrayValue=Et.opentelemetry.proto.common.v1.ArrayValue.fromObject(o.arrayValue)}if(o.kvlistValue!=null){if(typeof o.kvlistValue!="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");u.kvlistValue=Et.opentelemetry.proto.common.v1.KeyValueList.fromObject(o.kvlistValue)}return o.bytesValue!=null&&(typeof o.bytesValue=="string"?Vt.base64.decode(o.bytesValue,u.bytesValue=Vt.newBuffer(Vt.base64.length(o.bytesValue)),0):o.bytesValue.length>=0&&(u.bytesValue=o.bytesValue)),u},i.toObject=function(o,u){u||(u={});var d={};return o.stringValue!=null&&o.hasOwnProperty("stringValue")&&(d.stringValue=o.stringValue,u.oneofs&&(d.value="stringValue")),o.boolValue!=null&&o.hasOwnProperty("boolValue")&&(d.boolValue=o.boolValue,u.oneofs&&(d.value="boolValue")),o.intValue!=null&&o.hasOwnProperty("intValue")&&(typeof o.intValue=="number"?d.intValue=u.longs===String?String(o.intValue):o.intValue:d.intValue=u.longs===String?Vt.Long.prototype.toString.call(o.intValue):u.longs===Number?new Vt.LongBits(o.intValue.low>>>0,o.intValue.high>>>0).toNumber():o.intValue,u.oneofs&&(d.value="intValue")),o.doubleValue!=null&&o.hasOwnProperty("doubleValue")&&(d.doubleValue=u.json&&!isFinite(o.doubleValue)?String(o.doubleValue):o.doubleValue,u.oneofs&&(d.value="doubleValue")),o.arrayValue!=null&&o.hasOwnProperty("arrayValue")&&(d.arrayValue=Et.opentelemetry.proto.common.v1.ArrayValue.toObject(o.arrayValue,u),u.oneofs&&(d.value="arrayValue")),o.kvlistValue!=null&&o.hasOwnProperty("kvlistValue")&&(d.kvlistValue=Et.opentelemetry.proto.common.v1.KeyValueList.toObject(o.kvlistValue,u),u.oneofs&&(d.value="kvlistValue")),o.bytesValue!=null&&o.hasOwnProperty("bytesValue")&&(d.bytesValue=u.bytes===String?Vt.base64.encode(o.bytesValue,0,o.bytesValue.length):u.bytes===Array?Array.prototype.slice.call(o.bytesValue):o.bytesValue,u.oneofs&&(d.value="bytesValue")),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.common.v1.AnyValue"},i})(),a.ArrayValue=(function(){function i(s){if(this.values=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.values=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.values!=null&&e.values.length)for(var u=0;u<e.values.length;++u)Et.opentelemetry.proto.common.v1.AnyValue.encode(e.values[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.common.v1.ArrayValue;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.values&&d.values.length||(d.values=[]),d.values.push(Et.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.values!=null&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var o=0;o<e.values.length;++o){var u=Et.opentelemetry.proto.common.v1.AnyValue.verify(e.values[o]);if(u)return"values."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.common.v1.ArrayValue)return e;var o=new Et.opentelemetry.proto.common.v1.ArrayValue;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");o.values=[];for(var u=0;u<e.values.length;++u){if(typeof e.values[u]!="object")throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");o.values[u]=Et.opentelemetry.proto.common.v1.AnyValue.fromObject(e.values[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.values=[]),e.values&&e.values.length){u.values=[];for(var d=0;d<e.values.length;++d)u.values[d]=Et.opentelemetry.proto.common.v1.AnyValue.toObject(e.values[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.common.v1.ArrayValue"},i})(),a.KeyValueList=(function(){function i(s){if(this.values=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.values=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.values!=null&&e.values.length)for(var u=0;u<e.values.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.values[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.common.v1.KeyValueList;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.values&&d.values.length||(d.values=[]),d.values.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.values!=null&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var o=0;o<e.values.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.values[o]);if(u)return"values."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.common.v1.KeyValueList)return e;var o=new Et.opentelemetry.proto.common.v1.KeyValueList;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");o.values=[];for(var u=0;u<e.values.length;++u){if(typeof e.values[u]!="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");o.values[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.values[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.values=[]),e.values&&e.values.length){u.values=[];for(var d=0;d<e.values.length;++d)u.values[d]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.values[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.common.v1.KeyValueList"},i})(),a.KeyValue=(function(){function i(s){if(s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.key=null,i.prototype.value=null,i.create=function(e){return new i(e)},i.encode=function(e,o){return o||(o=ji.create()),e.key!=null&&Object.hasOwnProperty.call(e,"key")&&o.uint32(10).string(e.key),e.value!=null&&Object.hasOwnProperty.call(e,"value")&&Et.opentelemetry.proto.common.v1.AnyValue.encode(e.value,o.uint32(18).fork()).ldelim(),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.common.v1.KeyValue;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.key=e.string();break}case 2:{d.value=Et.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.key!=null&&e.hasOwnProperty("key")&&!Vt.isString(e.key))return"key: string expected";if(e.value!=null&&e.hasOwnProperty("value")){var o=Et.opentelemetry.proto.common.v1.AnyValue.verify(e.value);if(o)return"value."+o}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.common.v1.KeyValue)return e;var o=new Et.opentelemetry.proto.common.v1.KeyValue;if(e.key!=null&&(o.key=String(e.key)),e.value!=null){if(typeof e.value!="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");o.value=Et.opentelemetry.proto.common.v1.AnyValue.fromObject(e.value)}return o},i.toObject=function(e,o){o||(o={});var u={};return o.defaults&&(u.key="",u.value=null),e.key!=null&&e.hasOwnProperty("key")&&(u.key=e.key),e.value!=null&&e.hasOwnProperty("value")&&(u.value=Et.opentelemetry.proto.common.v1.AnyValue.toObject(e.value,o)),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.common.v1.KeyValue"},i})(),a.InstrumentationScope=(function(){function i(s){if(this.attributes=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.name=null,i.prototype.version=null,i.prototype.attributes=Vt.emptyArray,i.prototype.droppedAttributesCount=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&o.uint32(10).string(e.name),e.version!=null&&Object.hasOwnProperty.call(e,"version")&&o.uint32(18).string(e.version),e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(26).fork()).ldelim();return e.droppedAttributesCount!=null&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&o.uint32(32).uint32(e.droppedAttributesCount),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.common.v1.InstrumentationScope;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.name=e.string();break}case 2:{d.version=e.string();break}case 3:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 4:{d.droppedAttributesCount=e.uint32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!Vt.isString(e.name))return"name: string expected";if(e.version!=null&&e.hasOwnProperty("version")&&!Vt.isString(e.version))return"version: string expected";if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var o=0;o<e.attributes.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[o]);if(u)return"attributes."+u}}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.common.v1.InstrumentationScope)return e;var o=new Et.opentelemetry.proto.common.v1.InstrumentationScope;if(e.name!=null&&(o.name=String(e.name)),e.version!=null&&(o.version=String(e.version)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}return e.droppedAttributesCount!=null&&(o.droppedAttributesCount=e.droppedAttributesCount>>>0),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.attributes=[]),o.defaults&&(u.name="",u.version="",u.droppedAttributesCount=0),e.name!=null&&e.hasOwnProperty("name")&&(u.name=e.name),e.version!=null&&e.hasOwnProperty("version")&&(u.version=e.version),e.attributes&&e.attributes.length){u.attributes=[];for(var d=0;d<e.attributes.length;++d)u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[d],o)}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&(u.droppedAttributesCount=e.droppedAttributesCount),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.common.v1.InstrumentationScope"},i})(),a})(),r})(),t.resource=(function(){var r={};return r.v1=(function(){var a={};return a.Resource=(function(){function i(s){if(this.attributes=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.attributes=Vt.emptyArray,i.prototype.droppedAttributesCount=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(10).fork()).ldelim();return e.droppedAttributesCount!=null&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&o.uint32(16).uint32(e.droppedAttributesCount),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.resource.v1.Resource;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 2:{d.droppedAttributesCount=e.uint32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var o=0;o<e.attributes.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[o]);if(u)return"attributes."+u}}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.resource.v1.Resource)return e;var o=new Et.opentelemetry.proto.resource.v1.Resource;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}return e.droppedAttributesCount!=null&&(o.droppedAttributesCount=e.droppedAttributesCount>>>0),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.attributes=[]),o.defaults&&(u.droppedAttributesCount=0),e.attributes&&e.attributes.length){u.attributes=[];for(var d=0;d<e.attributes.length;++d)u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[d],o)}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&(u.droppedAttributesCount=e.droppedAttributesCount),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.resource.v1.Resource"},i})(),a})(),r})(),t.trace=(function(){var r={};return r.v1=(function(){var a={};return a.TracesData=(function(){function i(s){if(this.resourceSpans=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resourceSpans=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resourceSpans!=null&&e.resourceSpans.length)for(var u=0;u<e.resourceSpans.length;++u)Et.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.TracesData;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resourceSpans&&d.resourceSpans.length||(d.resourceSpans=[]),d.resourceSpans.push(Et.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resourceSpans!=null&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var o=0;o<e.resourceSpans.length;++o){var u=Et.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[o]);if(u)return"resourceSpans."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.TracesData)return e;var o=new Et.opentelemetry.proto.trace.v1.TracesData;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");o.resourceSpans=[];for(var u=0;u<e.resourceSpans.length;++u){if(typeof e.resourceSpans[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");o.resourceSpans[u]=Et.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){u.resourceSpans=[];for(var d=0;d<e.resourceSpans.length;++d)u.resourceSpans[d]=Et.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.TracesData"},i})(),a.ResourceSpans=(function(){function i(s){if(this.scopeSpans=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resource=null,i.prototype.scopeSpans=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resource!=null&&Object.hasOwnProperty.call(e,"resource")&&Et.opentelemetry.proto.resource.v1.Resource.encode(e.resource,o.uint32(10).fork()).ldelim(),e.scopeSpans!=null&&e.scopeSpans.length)for(var u=0;u<e.scopeSpans.length;++u)Et.opentelemetry.proto.trace.v1.ScopeSpans.encode(e.scopeSpans[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.ResourceSpans;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resource=Et.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break}case 2:{d.scopeSpans&&d.scopeSpans.length||(d.scopeSpans=[]),d.scopeSpans.push(Et.opentelemetry.proto.trace.v1.ScopeSpans.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resource!=null&&e.hasOwnProperty("resource")){var o=Et.opentelemetry.proto.resource.v1.Resource.verify(e.resource);if(o)return"resource."+o}if(e.scopeSpans!=null&&e.hasOwnProperty("scopeSpans")){if(!Array.isArray(e.scopeSpans))return"scopeSpans: array expected";for(var u=0;u<e.scopeSpans.length;++u){var o=Et.opentelemetry.proto.trace.v1.ScopeSpans.verify(e.scopeSpans[u]);if(o)return"scopeSpans."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.ResourceSpans)return e;var o=new Et.opentelemetry.proto.trace.v1.ResourceSpans;if(e.resource!=null){if(typeof e.resource!="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");o.resource=Et.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeSpans){if(!Array.isArray(e.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");o.scopeSpans=[];for(var u=0;u<e.scopeSpans.length;++u){if(typeof e.scopeSpans[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");o.scopeSpans[u]=Et.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(e.scopeSpans[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.scopeSpans=[]),o.defaults&&(u.resource=null,u.schemaUrl=""),e.resource!=null&&e.hasOwnProperty("resource")&&(u.resource=Et.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,o)),e.scopeSpans&&e.scopeSpans.length){u.scopeSpans=[];for(var d=0;d<e.scopeSpans.length;++d)u.scopeSpans[d]=Et.opentelemetry.proto.trace.v1.ScopeSpans.toObject(e.scopeSpans[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.ResourceSpans"},i})(),a.ScopeSpans=(function(){function i(s){if(this.spans=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.scope=null,i.prototype.spans=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.scope!=null&&Object.hasOwnProperty.call(e,"scope")&&Et.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,o.uint32(10).fork()).ldelim(),e.spans!=null&&e.spans.length)for(var u=0;u<e.spans.length;++u)Et.opentelemetry.proto.trace.v1.Span.encode(e.spans[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.ScopeSpans;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break}case 2:{d.spans&&d.spans.length||(d.spans=[]),d.spans.push(Et.opentelemetry.proto.trace.v1.Span.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.scope!=null&&e.hasOwnProperty("scope")){var o=Et.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope);if(o)return"scope."+o}if(e.spans!=null&&e.hasOwnProperty("spans")){if(!Array.isArray(e.spans))return"spans: array expected";for(var u=0;u<e.spans.length;++u){var o=Et.opentelemetry.proto.trace.v1.Span.verify(e.spans[u]);if(o)return"spans."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.ScopeSpans)return e;var o=new Et.opentelemetry.proto.trace.v1.ScopeSpans;if(e.scope!=null){if(typeof e.scope!="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");o.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.spans){if(!Array.isArray(e.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");o.spans=[];for(var u=0;u<e.spans.length;++u){if(typeof e.spans[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");o.spans[u]=Et.opentelemetry.proto.trace.v1.Span.fromObject(e.spans[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.spans=[]),o.defaults&&(u.scope=null,u.schemaUrl=""),e.scope!=null&&e.hasOwnProperty("scope")&&(u.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,o)),e.spans&&e.spans.length){u.spans=[];for(var d=0;d<e.spans.length;++d)u.spans[d]=Et.opentelemetry.proto.trace.v1.Span.toObject(e.spans[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.ScopeSpans"},i})(),a.Span=(function(){function i(s){if(this.attributes=[],this.events=[],this.links=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.traceId=null,i.prototype.spanId=null,i.prototype.traceState=null,i.prototype.parentSpanId=null,i.prototype.name=null,i.prototype.kind=null,i.prototype.startTimeUnixNano=null,i.prototype.endTimeUnixNano=null,i.prototype.attributes=Vt.emptyArray,i.prototype.droppedAttributesCount=null,i.prototype.events=Vt.emptyArray,i.prototype.droppedEventsCount=null,i.prototype.links=Vt.emptyArray,i.prototype.droppedLinksCount=null,i.prototype.status=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.traceId!=null&&Object.hasOwnProperty.call(e,"traceId")&&o.uint32(10).bytes(e.traceId),e.spanId!=null&&Object.hasOwnProperty.call(e,"spanId")&&o.uint32(18).bytes(e.spanId),e.traceState!=null&&Object.hasOwnProperty.call(e,"traceState")&&o.uint32(26).string(e.traceState),e.parentSpanId!=null&&Object.hasOwnProperty.call(e,"parentSpanId")&&o.uint32(34).bytes(e.parentSpanId),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&o.uint32(42).string(e.name),e.kind!=null&&Object.hasOwnProperty.call(e,"kind")&&o.uint32(48).int32(e.kind),e.startTimeUnixNano!=null&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&o.uint32(57).fixed64(e.startTimeUnixNano),e.endTimeUnixNano!=null&&Object.hasOwnProperty.call(e,"endTimeUnixNano")&&o.uint32(65).fixed64(e.endTimeUnixNano),e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(74).fork()).ldelim();if(e.droppedAttributesCount!=null&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&o.uint32(80).uint32(e.droppedAttributesCount),e.events!=null&&e.events.length)for(var u=0;u<e.events.length;++u)Et.opentelemetry.proto.trace.v1.Span.Event.encode(e.events[u],o.uint32(90).fork()).ldelim();if(e.droppedEventsCount!=null&&Object.hasOwnProperty.call(e,"droppedEventsCount")&&o.uint32(96).uint32(e.droppedEventsCount),e.links!=null&&e.links.length)for(var u=0;u<e.links.length;++u)Et.opentelemetry.proto.trace.v1.Span.Link.encode(e.links[u],o.uint32(106).fork()).ldelim();return e.droppedLinksCount!=null&&Object.hasOwnProperty.call(e,"droppedLinksCount")&&o.uint32(112).uint32(e.droppedLinksCount),e.status!=null&&Object.hasOwnProperty.call(e,"status")&&Et.opentelemetry.proto.trace.v1.Status.encode(e.status,o.uint32(122).fork()).ldelim(),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.Span;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.traceId=e.bytes();break}case 2:{d.spanId=e.bytes();break}case 3:{d.traceState=e.string();break}case 4:{d.parentSpanId=e.bytes();break}case 5:{d.name=e.string();break}case 6:{d.kind=e.int32();break}case 7:{d.startTimeUnixNano=e.fixed64();break}case 8:{d.endTimeUnixNano=e.fixed64();break}case 9:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 10:{d.droppedAttributesCount=e.uint32();break}case 11:{d.events&&d.events.length||(d.events=[]),d.events.push(Et.opentelemetry.proto.trace.v1.Span.Event.decode(e,e.uint32()));break}case 12:{d.droppedEventsCount=e.uint32();break}case 13:{d.links&&d.links.length||(d.links=[]),d.links.push(Et.opentelemetry.proto.trace.v1.Span.Link.decode(e,e.uint32()));break}case 14:{d.droppedLinksCount=e.uint32();break}case 15:{d.status=Et.opentelemetry.proto.trace.v1.Status.decode(e,e.uint32());break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.traceId!=null&&e.hasOwnProperty("traceId")&&!(e.traceId&&typeof e.traceId.length=="number"||Vt.isString(e.traceId)))return"traceId: buffer expected";if(e.spanId!=null&&e.hasOwnProperty("spanId")&&!(e.spanId&&typeof e.spanId.length=="number"||Vt.isString(e.spanId)))return"spanId: buffer expected";if(e.traceState!=null&&e.hasOwnProperty("traceState")&&!Vt.isString(e.traceState))return"traceState: string expected";if(e.parentSpanId!=null&&e.hasOwnProperty("parentSpanId")&&!(e.parentSpanId&&typeof e.parentSpanId.length=="number"||Vt.isString(e.parentSpanId)))return"parentSpanId: buffer expected";if(e.name!=null&&e.hasOwnProperty("name")&&!Vt.isString(e.name))return"name: string expected";if(e.kind!=null&&e.hasOwnProperty("kind"))switch(e.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:break}if(e.startTimeUnixNano!=null&&e.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(e.startTimeUnixNano)&&!(e.startTimeUnixNano&&Vt.isInteger(e.startTimeUnixNano.low)&&Vt.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(e.endTimeUnixNano!=null&&e.hasOwnProperty("endTimeUnixNano")&&!Vt.isInteger(e.endTimeUnixNano)&&!(e.endTimeUnixNano&&Vt.isInteger(e.endTimeUnixNano.low)&&Vt.isInteger(e.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected";if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var o=0;o<e.attributes.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[o]);if(u)return"attributes."+u}}if(e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(e.events!=null&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(var o=0;o<e.events.length;++o){var u=Et.opentelemetry.proto.trace.v1.Span.Event.verify(e.events[o]);if(u)return"events."+u}}if(e.droppedEventsCount!=null&&e.hasOwnProperty("droppedEventsCount")&&!Vt.isInteger(e.droppedEventsCount))return"droppedEventsCount: integer expected";if(e.links!=null&&e.hasOwnProperty("links")){if(!Array.isArray(e.links))return"links: array expected";for(var o=0;o<e.links.length;++o){var u=Et.opentelemetry.proto.trace.v1.Span.Link.verify(e.links[o]);if(u)return"links."+u}}if(e.droppedLinksCount!=null&&e.hasOwnProperty("droppedLinksCount")&&!Vt.isInteger(e.droppedLinksCount))return"droppedLinksCount: integer expected";if(e.status!=null&&e.hasOwnProperty("status")){var u=Et.opentelemetry.proto.trace.v1.Status.verify(e.status);if(u)return"status."+u}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.Span)return e;var o=new Et.opentelemetry.proto.trace.v1.Span;switch(e.traceId!=null&&(typeof e.traceId=="string"?Vt.base64.decode(e.traceId,o.traceId=Vt.newBuffer(Vt.base64.length(e.traceId)),0):e.traceId.length>=0&&(o.traceId=e.traceId)),e.spanId!=null&&(typeof e.spanId=="string"?Vt.base64.decode(e.spanId,o.spanId=Vt.newBuffer(Vt.base64.length(e.spanId)),0):e.spanId.length>=0&&(o.spanId=e.spanId)),e.traceState!=null&&(o.traceState=String(e.traceState)),e.parentSpanId!=null&&(typeof e.parentSpanId=="string"?Vt.base64.decode(e.parentSpanId,o.parentSpanId=Vt.newBuffer(Vt.base64.length(e.parentSpanId)),0):e.parentSpanId.length>=0&&(o.parentSpanId=e.parentSpanId)),e.name!=null&&(o.name=String(e.name)),e.kind){default:if(typeof e.kind=="number"){o.kind=e.kind;break}break;case"SPAN_KIND_UNSPECIFIED":case 0:o.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:o.kind=1;break;case"SPAN_KIND_SERVER":case 2:o.kind=2;break;case"SPAN_KIND_CLIENT":case 3:o.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:o.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:o.kind=5;break}if(e.startTimeUnixNano!=null&&(Vt.Long?(o.startTimeUnixNano=Vt.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:typeof e.startTimeUnixNano=="string"?o.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):typeof e.startTimeUnixNano=="number"?o.startTimeUnixNano=e.startTimeUnixNano:typeof e.startTimeUnixNano=="object"&&(o.startTimeUnixNano=new Vt.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),e.endTimeUnixNano!=null&&(Vt.Long?(o.endTimeUnixNano=Vt.Long.fromValue(e.endTimeUnixNano)).unsigned=!1:typeof e.endTimeUnixNano=="string"?o.endTimeUnixNano=parseInt(e.endTimeUnixNano,10):typeof e.endTimeUnixNano=="number"?o.endTimeUnixNano=e.endTimeUnixNano:typeof e.endTimeUnixNano=="object"&&(o.endTimeUnixNano=new Vt.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber())),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}if(e.droppedAttributesCount!=null&&(o.droppedAttributesCount=e.droppedAttributesCount>>>0),e.events){if(!Array.isArray(e.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");o.events=[];for(var u=0;u<e.events.length;++u){if(typeof e.events[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");o.events[u]=Et.opentelemetry.proto.trace.v1.Span.Event.fromObject(e.events[u])}}if(e.droppedEventsCount!=null&&(o.droppedEventsCount=e.droppedEventsCount>>>0),e.links){if(!Array.isArray(e.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");o.links=[];for(var u=0;u<e.links.length;++u){if(typeof e.links[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");o.links[u]=Et.opentelemetry.proto.trace.v1.Span.Link.fromObject(e.links[u])}}if(e.droppedLinksCount!=null&&(o.droppedLinksCount=e.droppedLinksCount>>>0),e.status!=null){if(typeof e.status!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");o.status=Et.opentelemetry.proto.trace.v1.Status.fromObject(e.status)}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.attributes=[],u.events=[],u.links=[]),o.defaults){if(o.bytes===String?u.traceId="":(u.traceId=[],o.bytes!==Array&&(u.traceId=Vt.newBuffer(u.traceId))),o.bytes===String?u.spanId="":(u.spanId=[],o.bytes!==Array&&(u.spanId=Vt.newBuffer(u.spanId))),u.traceState="",o.bytes===String?u.parentSpanId="":(u.parentSpanId=[],o.bytes!==Array&&(u.parentSpanId=Vt.newBuffer(u.parentSpanId))),u.name="",u.kind=o.enums===String?"SPAN_KIND_UNSPECIFIED":0,Vt.Long){var d=new Vt.Long(0,0,!1);u.startTimeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.startTimeUnixNano=o.longs===String?"0":0;if(Vt.Long){var d=new Vt.Long(0,0,!1);u.endTimeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.endTimeUnixNano=o.longs===String?"0":0;u.droppedAttributesCount=0,u.droppedEventsCount=0,u.droppedLinksCount=0,u.status=null}if(e.traceId!=null&&e.hasOwnProperty("traceId")&&(u.traceId=o.bytes===String?Vt.base64.encode(e.traceId,0,e.traceId.length):o.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),e.spanId!=null&&e.hasOwnProperty("spanId")&&(u.spanId=o.bytes===String?Vt.base64.encode(e.spanId,0,e.spanId.length):o.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),e.traceState!=null&&e.hasOwnProperty("traceState")&&(u.traceState=e.traceState),e.parentSpanId!=null&&e.hasOwnProperty("parentSpanId")&&(u.parentSpanId=o.bytes===String?Vt.base64.encode(e.parentSpanId,0,e.parentSpanId.length):o.bytes===Array?Array.prototype.slice.call(e.parentSpanId):e.parentSpanId),e.name!=null&&e.hasOwnProperty("name")&&(u.name=e.name),e.kind!=null&&e.hasOwnProperty("kind")&&(u.kind=o.enums===String?Et.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]===void 0?e.kind:Et.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]:e.kind),e.startTimeUnixNano!=null&&e.hasOwnProperty("startTimeUnixNano")&&(typeof e.startTimeUnixNano=="number"?u.startTimeUnixNano=o.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:u.startTimeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.startTimeUnixNano):o.longs===Number?new Vt.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),e.endTimeUnixNano!=null&&e.hasOwnProperty("endTimeUnixNano")&&(typeof e.endTimeUnixNano=="number"?u.endTimeUnixNano=o.longs===String?String(e.endTimeUnixNano):e.endTimeUnixNano:u.endTimeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.endTimeUnixNano):o.longs===Number?new Vt.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber():e.endTimeUnixNano),e.attributes&&e.attributes.length){u.attributes=[];for(var I=0;I<e.attributes.length;++I)u.attributes[I]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[I],o)}if(e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&(u.droppedAttributesCount=e.droppedAttributesCount),e.events&&e.events.length){u.events=[];for(var I=0;I<e.events.length;++I)u.events[I]=Et.opentelemetry.proto.trace.v1.Span.Event.toObject(e.events[I],o)}if(e.droppedEventsCount!=null&&e.hasOwnProperty("droppedEventsCount")&&(u.droppedEventsCount=e.droppedEventsCount),e.links&&e.links.length){u.links=[];for(var I=0;I<e.links.length;++I)u.links[I]=Et.opentelemetry.proto.trace.v1.Span.Link.toObject(e.links[I],o)}return e.droppedLinksCount!=null&&e.hasOwnProperty("droppedLinksCount")&&(u.droppedLinksCount=e.droppedLinksCount),e.status!=null&&e.hasOwnProperty("status")&&(u.status=Et.opentelemetry.proto.trace.v1.Status.toObject(e.status,o)),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.Span"},i.SpanKind=(function(){var s={},e=Object.create(s);return e[s[0]="SPAN_KIND_UNSPECIFIED"]=0,e[s[1]="SPAN_KIND_INTERNAL"]=1,e[s[2]="SPAN_KIND_SERVER"]=2,e[s[3]="SPAN_KIND_CLIENT"]=3,e[s[4]="SPAN_KIND_PRODUCER"]=4,e[s[5]="SPAN_KIND_CONSUMER"]=5,e})(),i.Event=(function(){function s(e){if(this.attributes=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.timeUnixNano=null,s.prototype.name=null,s.prototype.attributes=Vt.emptyArray,s.prototype.droppedAttributesCount=null,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(9).fixed64(o.timeUnixNano),o.name!=null&&Object.hasOwnProperty.call(o,"name")&&u.uint32(18).string(o.name),o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(26).fork()).ldelim();return o.droppedAttributesCount!=null&&Object.hasOwnProperty.call(o,"droppedAttributesCount")&&u.uint32(32).uint32(o.droppedAttributesCount),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.trace.v1.Span.Event;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.timeUnixNano=o.fixed64();break}case 2:{I.name=o.string();break}case 3:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 4:{I.droppedAttributesCount=o.uint32();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.name!=null&&o.hasOwnProperty("name")&&!Vt.isString(o.name))return"name: string expected";if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var u=0;u<o.attributes.length;++u){var d=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[u]);if(d)return"attributes."+d}}return o.droppedAttributesCount!=null&&o.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(o.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.trace.v1.Span.Event)return o;var u=new Et.opentelemetry.proto.trace.v1.Span.Event;if(o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.name!=null&&(u.name=String(o.name)),o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}return o.droppedAttributesCount!=null&&(u.droppedAttributesCount=o.droppedAttributesCount>>>0),u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.attributes=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;d.name="",d.droppedAttributesCount=0}if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.name!=null&&o.hasOwnProperty("name")&&(d.name=o.name),o.attributes&&o.attributes.length){d.attributes=[];for(var h=0;h<o.attributes.length;++h)d.attributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[h],u)}return o.droppedAttributesCount!=null&&o.hasOwnProperty("droppedAttributesCount")&&(d.droppedAttributesCount=o.droppedAttributesCount),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.trace.v1.Span.Event"},s})(),i.Link=(function(){function s(e){if(this.attributes=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.traceId=null,s.prototype.spanId=null,s.prototype.traceState=null,s.prototype.attributes=Vt.emptyArray,s.prototype.droppedAttributesCount=null,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.traceId!=null&&Object.hasOwnProperty.call(o,"traceId")&&u.uint32(10).bytes(o.traceId),o.spanId!=null&&Object.hasOwnProperty.call(o,"spanId")&&u.uint32(18).bytes(o.spanId),o.traceState!=null&&Object.hasOwnProperty.call(o,"traceState")&&u.uint32(26).string(o.traceState),o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(34).fork()).ldelim();return o.droppedAttributesCount!=null&&Object.hasOwnProperty.call(o,"droppedAttributesCount")&&u.uint32(40).uint32(o.droppedAttributesCount),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.trace.v1.Span.Link;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.traceId=o.bytes();break}case 2:{I.spanId=o.bytes();break}case 3:{I.traceState=o.string();break}case 4:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 5:{I.droppedAttributesCount=o.uint32();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.traceId!=null&&o.hasOwnProperty("traceId")&&!(o.traceId&&typeof o.traceId.length=="number"||Vt.isString(o.traceId)))return"traceId: buffer expected";if(o.spanId!=null&&o.hasOwnProperty("spanId")&&!(o.spanId&&typeof o.spanId.length=="number"||Vt.isString(o.spanId)))return"spanId: buffer expected";if(o.traceState!=null&&o.hasOwnProperty("traceState")&&!Vt.isString(o.traceState))return"traceState: string expected";if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var u=0;u<o.attributes.length;++u){var d=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[u]);if(d)return"attributes."+d}}return o.droppedAttributesCount!=null&&o.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(o.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.trace.v1.Span.Link)return o;var u=new Et.opentelemetry.proto.trace.v1.Span.Link;if(o.traceId!=null&&(typeof o.traceId=="string"?Vt.base64.decode(o.traceId,u.traceId=Vt.newBuffer(Vt.base64.length(o.traceId)),0):o.traceId.length>=0&&(u.traceId=o.traceId)),o.spanId!=null&&(typeof o.spanId=="string"?Vt.base64.decode(o.spanId,u.spanId=Vt.newBuffer(Vt.base64.length(o.spanId)),0):o.spanId.length>=0&&(u.spanId=o.spanId)),o.traceState!=null&&(u.traceState=String(o.traceState)),o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}return o.droppedAttributesCount!=null&&(u.droppedAttributesCount=o.droppedAttributesCount>>>0),u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.attributes=[]),u.defaults&&(u.bytes===String?d.traceId="":(d.traceId=[],u.bytes!==Array&&(d.traceId=Vt.newBuffer(d.traceId))),u.bytes===String?d.spanId="":(d.spanId=[],u.bytes!==Array&&(d.spanId=Vt.newBuffer(d.spanId))),d.traceState="",d.droppedAttributesCount=0),o.traceId!=null&&o.hasOwnProperty("traceId")&&(d.traceId=u.bytes===String?Vt.base64.encode(o.traceId,0,o.traceId.length):u.bytes===Array?Array.prototype.slice.call(o.traceId):o.traceId),o.spanId!=null&&o.hasOwnProperty("spanId")&&(d.spanId=u.bytes===String?Vt.base64.encode(o.spanId,0,o.spanId.length):u.bytes===Array?Array.prototype.slice.call(o.spanId):o.spanId),o.traceState!=null&&o.hasOwnProperty("traceState")&&(d.traceState=o.traceState),o.attributes&&o.attributes.length){d.attributes=[];for(var I=0;I<o.attributes.length;++I)d.attributes[I]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[I],u)}return o.droppedAttributesCount!=null&&o.hasOwnProperty("droppedAttributesCount")&&(d.droppedAttributesCount=o.droppedAttributesCount),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.trace.v1.Span.Link"},s})(),i})(),a.Status=(function(){function i(s){if(s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.message=null,i.prototype.code=null,i.create=function(e){return new i(e)},i.encode=function(e,o){return o||(o=ji.create()),e.message!=null&&Object.hasOwnProperty.call(e,"message")&&o.uint32(18).string(e.message),e.code!=null&&Object.hasOwnProperty.call(e,"code")&&o.uint32(24).int32(e.code),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.Status;e.pos<u;){var I=e.uint32();switch(I>>>3){case 2:{d.message=e.string();break}case 3:{d.code=e.int32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.message!=null&&e.hasOwnProperty("message")&&!Vt.isString(e.message))return"message: string expected";if(e.code!=null&&e.hasOwnProperty("code"))switch(e.code){default:return"code: enum value expected";case 0:case 1:case 2:break}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.Status)return e;var o=new Et.opentelemetry.proto.trace.v1.Status;switch(e.message!=null&&(o.message=String(e.message)),e.code){default:if(typeof e.code=="number"){o.code=e.code;break}break;case"STATUS_CODE_UNSET":case 0:o.code=0;break;case"STATUS_CODE_OK":case 1:o.code=1;break;case"STATUS_CODE_ERROR":case 2:o.code=2;break}return o},i.toObject=function(e,o){o||(o={});var u={};return o.defaults&&(u.message="",u.code=o.enums===String?"STATUS_CODE_UNSET":0),e.message!=null&&e.hasOwnProperty("message")&&(u.message=e.message),e.code!=null&&e.hasOwnProperty("code")&&(u.code=o.enums===String?Et.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]===void 0?e.code:Et.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]:e.code),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.Status"},i.StatusCode=(function(){var s={},e=Object.create(s);return e[s[0]="STATUS_CODE_UNSET"]=0,e[s[1]="STATUS_CODE_OK"]=1,e[s[2]="STATUS_CODE_ERROR"]=2,e})(),i})(),a})(),r})(),t.collector=(function(){var r={};return r.trace=(function(){var a={};return a.v1=(function(){var i={};return i.TraceService=(function(){function s(e,o,u){za.rpc.Service.call(this,e,o,u)}return(s.prototype=Object.create(za.rpc.Service.prototype)).constructor=s,s.create=function(o,u,d){return new this(o,u,d)},Object.defineProperty(s.prototype.export=function e(o,u){return this.rpcCall(e,Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,o,u)},"name",{value:"Export"}),s})(),i.ExportTraceServiceRequest=(function(){function s(e){if(this.resourceSpans=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.resourceSpans=Vt.emptyArray,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.resourceSpans!=null&&o.resourceSpans.length)for(var d=0;d<o.resourceSpans.length;++d)Et.opentelemetry.proto.trace.v1.ResourceSpans.encode(o.resourceSpans[d],u.uint32(10).fork()).ldelim();return u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.resourceSpans&&I.resourceSpans.length||(I.resourceSpans=[]),I.resourceSpans.push(Et.opentelemetry.proto.trace.v1.ResourceSpans.decode(o,o.uint32()));break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.resourceSpans!=null&&o.hasOwnProperty("resourceSpans")){if(!Array.isArray(o.resourceSpans))return"resourceSpans: array expected";for(var u=0;u<o.resourceSpans.length;++u){var d=Et.opentelemetry.proto.trace.v1.ResourceSpans.verify(o.resourceSpans[u]);if(d)return"resourceSpans."+d}}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return o;var u=new Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if(o.resourceSpans){if(!Array.isArray(o.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");u.resourceSpans=[];for(var d=0;d<o.resourceSpans.length;++d){if(typeof o.resourceSpans[d]!="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");u.resourceSpans[d]=Et.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(o.resourceSpans[d])}}return u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.resourceSpans=[]),o.resourceSpans&&o.resourceSpans.length){d.resourceSpans=[];for(var I=0;I<o.resourceSpans.length;++I)d.resourceSpans[I]=Et.opentelemetry.proto.trace.v1.ResourceSpans.toObject(o.resourceSpans[I],u)}return d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},s})(),i.ExportTraceServiceResponse=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.partialSuccess=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.partialSuccess!=null&&Object.hasOwnProperty.call(o,"partialSuccess")&&Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(o.partialSuccess,u.uint32(10).fork()).ldelim(),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.partialSuccess=Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(o,o.uint32());break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")){var u=Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(o.partialSuccess);if(u)return"partialSuccess."+u}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return o;var u=new Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if(o.partialSuccess!=null){if(typeof o.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");u.partialSuccess=Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(o.partialSuccess)}return u},s.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.partialSuccess=null),o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")&&(d.partialSuccess=Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(o.partialSuccess,u)),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},s})(),i.ExportTracePartialSuccess=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.rejectedSpans=null,s.prototype.errorMessage=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.rejectedSpans!=null&&Object.hasOwnProperty.call(o,"rejectedSpans")&&u.uint32(8).int64(o.rejectedSpans),o.errorMessage!=null&&Object.hasOwnProperty.call(o,"errorMessage")&&u.uint32(18).string(o.errorMessage),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.rejectedSpans=o.int64();break}case 2:{I.errorMessage=o.string();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.rejectedSpans!=null&&o.hasOwnProperty("rejectedSpans")&&!Vt.isInteger(o.rejectedSpans)&&!(o.rejectedSpans&&Vt.isInteger(o.rejectedSpans.low)&&Vt.isInteger(o.rejectedSpans.high))?"rejectedSpans: integer|Long expected":o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&!Vt.isString(o.errorMessage)?"errorMessage: string expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess)return o;var u=new Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;return o.rejectedSpans!=null&&(Vt.Long?(u.rejectedSpans=Vt.Long.fromValue(o.rejectedSpans)).unsigned=!1:typeof o.rejectedSpans=="string"?u.rejectedSpans=parseInt(o.rejectedSpans,10):typeof o.rejectedSpans=="number"?u.rejectedSpans=o.rejectedSpans:typeof o.rejectedSpans=="object"&&(u.rejectedSpans=new Vt.LongBits(o.rejectedSpans.low>>>0,o.rejectedSpans.high>>>0).toNumber())),o.errorMessage!=null&&(u.errorMessage=String(o.errorMessage)),u},s.toObject=function(o,u){u||(u={});var d={};if(u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.rejectedSpans=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.rejectedSpans=u.longs===String?"0":0;d.errorMessage=""}return o.rejectedSpans!=null&&o.hasOwnProperty("rejectedSpans")&&(typeof o.rejectedSpans=="number"?d.rejectedSpans=u.longs===String?String(o.rejectedSpans):o.rejectedSpans:d.rejectedSpans=u.longs===String?Vt.Long.prototype.toString.call(o.rejectedSpans):u.longs===Number?new Vt.LongBits(o.rejectedSpans.low>>>0,o.rejectedSpans.high>>>0).toNumber():o.rejectedSpans),o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&(d.errorMessage=o.errorMessage),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},s})(),i})(),a})(),r.metrics=(function(){var a={};return a.v1=(function(){var i={};return i.MetricsService=(function(){function s(e,o,u){za.rpc.Service.call(this,e,o,u)}return(s.prototype=Object.create(za.rpc.Service.prototype)).constructor=s,s.create=function(o,u,d){return new this(o,u,d)},Object.defineProperty(s.prototype.export=function e(o,u){return this.rpcCall(e,Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,o,u)},"name",{value:"Export"}),s})(),i.ExportMetricsServiceRequest=(function(){function s(e){if(this.resourceMetrics=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.resourceMetrics=Vt.emptyArray,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.resourceMetrics!=null&&o.resourceMetrics.length)for(var d=0;d<o.resourceMetrics.length;++d)Et.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(o.resourceMetrics[d],u.uint32(10).fork()).ldelim();return u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.resourceMetrics&&I.resourceMetrics.length||(I.resourceMetrics=[]),I.resourceMetrics.push(Et.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(o,o.uint32()));break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.resourceMetrics!=null&&o.hasOwnProperty("resourceMetrics")){if(!Array.isArray(o.resourceMetrics))return"resourceMetrics: array expected";for(var u=0;u<o.resourceMetrics.length;++u){var d=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(o.resourceMetrics[u]);if(d)return"resourceMetrics."+d}}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return o;var u=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if(o.resourceMetrics){if(!Array.isArray(o.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");u.resourceMetrics=[];for(var d=0;d<o.resourceMetrics.length;++d){if(typeof o.resourceMetrics[d]!="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");u.resourceMetrics[d]=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(o.resourceMetrics[d])}}return u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.resourceMetrics=[]),o.resourceMetrics&&o.resourceMetrics.length){d.resourceMetrics=[];for(var I=0;I<o.resourceMetrics.length;++I)d.resourceMetrics[I]=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(o.resourceMetrics[I],u)}return d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},s})(),i.ExportMetricsServiceResponse=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.partialSuccess=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.partialSuccess!=null&&Object.hasOwnProperty.call(o,"partialSuccess")&&Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(o.partialSuccess,u.uint32(10).fork()).ldelim(),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.partialSuccess=Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(o,o.uint32());break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")){var u=Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(o.partialSuccess);if(u)return"partialSuccess."+u}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return o;var u=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if(o.partialSuccess!=null){if(typeof o.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");u.partialSuccess=Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(o.partialSuccess)}return u},s.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.partialSuccess=null),o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")&&(d.partialSuccess=Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(o.partialSuccess,u)),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},s})(),i.ExportMetricsPartialSuccess=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.rejectedDataPoints=null,s.prototype.errorMessage=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.rejectedDataPoints!=null&&Object.hasOwnProperty.call(o,"rejectedDataPoints")&&u.uint32(8).int64(o.rejectedDataPoints),o.errorMessage!=null&&Object.hasOwnProperty.call(o,"errorMessage")&&u.uint32(18).string(o.errorMessage),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.rejectedDataPoints=o.int64();break}case 2:{I.errorMessage=o.string();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.rejectedDataPoints!=null&&o.hasOwnProperty("rejectedDataPoints")&&!Vt.isInteger(o.rejectedDataPoints)&&!(o.rejectedDataPoints&&Vt.isInteger(o.rejectedDataPoints.low)&&Vt.isInteger(o.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&!Vt.isString(o.errorMessage)?"errorMessage: string expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess)return o;var u=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;return o.rejectedDataPoints!=null&&(Vt.Long?(u.rejectedDataPoints=Vt.Long.fromValue(o.rejectedDataPoints)).unsigned=!1:typeof o.rejectedDataPoints=="string"?u.rejectedDataPoints=parseInt(o.rejectedDataPoints,10):typeof o.rejectedDataPoints=="number"?u.rejectedDataPoints=o.rejectedDataPoints:typeof o.rejectedDataPoints=="object"&&(u.rejectedDataPoints=new Vt.LongBits(o.rejectedDataPoints.low>>>0,o.rejectedDataPoints.high>>>0).toNumber())),o.errorMessage!=null&&(u.errorMessage=String(o.errorMessage)),u},s.toObject=function(o,u){u||(u={});var d={};if(u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.rejectedDataPoints=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.rejectedDataPoints=u.longs===String?"0":0;d.errorMessage=""}return o.rejectedDataPoints!=null&&o.hasOwnProperty("rejectedDataPoints")&&(typeof o.rejectedDataPoints=="number"?d.rejectedDataPoints=u.longs===String?String(o.rejectedDataPoints):o.rejectedDataPoints:d.rejectedDataPoints=u.longs===String?Vt.Long.prototype.toString.call(o.rejectedDataPoints):u.longs===Number?new Vt.LongBits(o.rejectedDataPoints.low>>>0,o.rejectedDataPoints.high>>>0).toNumber():o.rejectedDataPoints),o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&(d.errorMessage=o.errorMessage),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},s})(),i})(),a})(),r.logs=(function(){var a={};return a.v1=(function(){var i={};return i.LogsService=(function(){function s(e,o,u){za.rpc.Service.call(this,e,o,u)}return(s.prototype=Object.create(za.rpc.Service.prototype)).constructor=s,s.create=function(o,u,d){return new this(o,u,d)},Object.defineProperty(s.prototype.export=function e(o,u){return this.rpcCall(e,Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,o,u)},"name",{value:"Export"}),s})(),i.ExportLogsServiceRequest=(function(){function s(e){if(this.resourceLogs=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.resourceLogs=Vt.emptyArray,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.resourceLogs!=null&&o.resourceLogs.length)for(var d=0;d<o.resourceLogs.length;++d)Et.opentelemetry.proto.logs.v1.ResourceLogs.encode(o.resourceLogs[d],u.uint32(10).fork()).ldelim();return u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.resourceLogs&&I.resourceLogs.length||(I.resourceLogs=[]),I.resourceLogs.push(Et.opentelemetry.proto.logs.v1.ResourceLogs.decode(o,o.uint32()));break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.resourceLogs!=null&&o.hasOwnProperty("resourceLogs")){if(!Array.isArray(o.resourceLogs))return"resourceLogs: array expected";for(var u=0;u<o.resourceLogs.length;++u){var d=Et.opentelemetry.proto.logs.v1.ResourceLogs.verify(o.resourceLogs[u]);if(d)return"resourceLogs."+d}}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return o;var u=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if(o.resourceLogs){if(!Array.isArray(o.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");u.resourceLogs=[];for(var d=0;d<o.resourceLogs.length;++d){if(typeof o.resourceLogs[d]!="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");u.resourceLogs[d]=Et.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(o.resourceLogs[d])}}return u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.resourceLogs=[]),o.resourceLogs&&o.resourceLogs.length){d.resourceLogs=[];for(var I=0;I<o.resourceLogs.length;++I)d.resourceLogs[I]=Et.opentelemetry.proto.logs.v1.ResourceLogs.toObject(o.resourceLogs[I],u)}return d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},s})(),i.ExportLogsServiceResponse=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.partialSuccess=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.partialSuccess!=null&&Object.hasOwnProperty.call(o,"partialSuccess")&&Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(o.partialSuccess,u.uint32(10).fork()).ldelim(),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.partialSuccess=Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(o,o.uint32());break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")){var u=Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(o.partialSuccess);if(u)return"partialSuccess."+u}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return o;var u=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if(o.partialSuccess!=null){if(typeof o.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");u.partialSuccess=Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(o.partialSuccess)}return u},s.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.partialSuccess=null),o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")&&(d.partialSuccess=Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(o.partialSuccess,u)),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},s})(),i.ExportLogsPartialSuccess=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.rejectedLogRecords=null,s.prototype.errorMessage=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.rejectedLogRecords!=null&&Object.hasOwnProperty.call(o,"rejectedLogRecords")&&u.uint32(8).int64(o.rejectedLogRecords),o.errorMessage!=null&&Object.hasOwnProperty.call(o,"errorMessage")&&u.uint32(18).string(o.errorMessage),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.rejectedLogRecords=o.int64();break}case 2:{I.errorMessage=o.string();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.rejectedLogRecords!=null&&o.hasOwnProperty("rejectedLogRecords")&&!Vt.isInteger(o.rejectedLogRecords)&&!(o.rejectedLogRecords&&Vt.isInteger(o.rejectedLogRecords.low)&&Vt.isInteger(o.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&!Vt.isString(o.errorMessage)?"errorMessage: string expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess)return o;var u=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;return o.rejectedLogRecords!=null&&(Vt.Long?(u.rejectedLogRecords=Vt.Long.fromValue(o.rejectedLogRecords)).unsigned=!1:typeof o.rejectedLogRecords=="string"?u.rejectedLogRecords=parseInt(o.rejectedLogRecords,10):typeof o.rejectedLogRecords=="number"?u.rejectedLogRecords=o.rejectedLogRecords:typeof o.rejectedLogRecords=="object"&&(u.rejectedLogRecords=new Vt.LongBits(o.rejectedLogRecords.low>>>0,o.rejectedLogRecords.high>>>0).toNumber())),o.errorMessage!=null&&(u.errorMessage=String(o.errorMessage)),u},s.toObject=function(o,u){u||(u={});var d={};if(u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.rejectedLogRecords=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.rejectedLogRecords=u.longs===String?"0":0;d.errorMessage=""}return o.rejectedLogRecords!=null&&o.hasOwnProperty("rejectedLogRecords")&&(typeof o.rejectedLogRecords=="number"?d.rejectedLogRecords=u.longs===String?String(o.rejectedLogRecords):o.rejectedLogRecords:d.rejectedLogRecords=u.longs===String?Vt.Long.prototype.toString.call(o.rejectedLogRecords):u.longs===Number?new Vt.LongBits(o.rejectedLogRecords.low>>>0,o.rejectedLogRecords.high>>>0).toNumber():o.rejectedLogRecords),o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&(d.errorMessage=o.errorMessage),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},s})(),i})(),a})(),r})(),t.metrics=(function(){var r={};return r.v1=(function(){var a={};return a.MetricsData=(function(){function i(s){if(this.resourceMetrics=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resourceMetrics=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resourceMetrics!=null&&e.resourceMetrics.length)for(var u=0;u<e.resourceMetrics.length;++u)Et.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.MetricsData;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resourceMetrics&&d.resourceMetrics.length||(d.resourceMetrics=[]),d.resourceMetrics.push(Et.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resourceMetrics!=null&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var o=0;o<e.resourceMetrics.length;++o){var u=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[o]);if(u)return"resourceMetrics."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.MetricsData)return e;var o=new Et.opentelemetry.proto.metrics.v1.MetricsData;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");o.resourceMetrics=[];for(var u=0;u<e.resourceMetrics.length;++u){if(typeof e.resourceMetrics[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");o.resourceMetrics[u]=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){u.resourceMetrics=[];for(var d=0;d<e.resourceMetrics.length;++d)u.resourceMetrics[d]=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.MetricsData"},i})(),a.ResourceMetrics=(function(){function i(s){if(this.scopeMetrics=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resource=null,i.prototype.scopeMetrics=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resource!=null&&Object.hasOwnProperty.call(e,"resource")&&Et.opentelemetry.proto.resource.v1.Resource.encode(e.resource,o.uint32(10).fork()).ldelim(),e.scopeMetrics!=null&&e.scopeMetrics.length)for(var u=0;u<e.scopeMetrics.length;++u)Et.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(e.scopeMetrics[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.ResourceMetrics;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resource=Et.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break}case 2:{d.scopeMetrics&&d.scopeMetrics.length||(d.scopeMetrics=[]),d.scopeMetrics.push(Et.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resource!=null&&e.hasOwnProperty("resource")){var o=Et.opentelemetry.proto.resource.v1.Resource.verify(e.resource);if(o)return"resource."+o}if(e.scopeMetrics!=null&&e.hasOwnProperty("scopeMetrics")){if(!Array.isArray(e.scopeMetrics))return"scopeMetrics: array expected";for(var u=0;u<e.scopeMetrics.length;++u){var o=Et.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(e.scopeMetrics[u]);if(o)return"scopeMetrics."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.ResourceMetrics)return e;var o=new Et.opentelemetry.proto.metrics.v1.ResourceMetrics;if(e.resource!=null){if(typeof e.resource!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");o.resource=Et.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeMetrics){if(!Array.isArray(e.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");o.scopeMetrics=[];for(var u=0;u<e.scopeMetrics.length;++u){if(typeof e.scopeMetrics[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");o.scopeMetrics[u]=Et.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(e.scopeMetrics[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.scopeMetrics=[]),o.defaults&&(u.resource=null,u.schemaUrl=""),e.resource!=null&&e.hasOwnProperty("resource")&&(u.resource=Et.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,o)),e.scopeMetrics&&e.scopeMetrics.length){u.scopeMetrics=[];for(var d=0;d<e.scopeMetrics.length;++d)u.scopeMetrics[d]=Et.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(e.scopeMetrics[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},i})(),a.ScopeMetrics=(function(){function i(s){if(this.metrics=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.scope=null,i.prototype.metrics=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.scope!=null&&Object.hasOwnProperty.call(e,"scope")&&Et.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,o.uint32(10).fork()).ldelim(),e.metrics!=null&&e.metrics.length)for(var u=0;u<e.metrics.length;++u)Et.opentelemetry.proto.metrics.v1.Metric.encode(e.metrics[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.ScopeMetrics;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break}case 2:{d.metrics&&d.metrics.length||(d.metrics=[]),d.metrics.push(Et.opentelemetry.proto.metrics.v1.Metric.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.scope!=null&&e.hasOwnProperty("scope")){var o=Et.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope);if(o)return"scope."+o}if(e.metrics!=null&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var u=0;u<e.metrics.length;++u){var o=Et.opentelemetry.proto.metrics.v1.Metric.verify(e.metrics[u]);if(o)return"metrics."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.ScopeMetrics)return e;var o=new Et.opentelemetry.proto.metrics.v1.ScopeMetrics;if(e.scope!=null){if(typeof e.scope!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");o.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");o.metrics=[];for(var u=0;u<e.metrics.length;++u){if(typeof e.metrics[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");o.metrics[u]=Et.opentelemetry.proto.metrics.v1.Metric.fromObject(e.metrics[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.metrics=[]),o.defaults&&(u.scope=null,u.schemaUrl=""),e.scope!=null&&e.hasOwnProperty("scope")&&(u.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,o)),e.metrics&&e.metrics.length){u.metrics=[];for(var d=0;d<e.metrics.length;++d)u.metrics[d]=Et.opentelemetry.proto.metrics.v1.Metric.toObject(e.metrics[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},i})(),a.Metric=(function(){function i(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.name=null,i.prototype.description=null,i.prototype.unit=null,i.prototype.gauge=null,i.prototype.sum=null,i.prototype.histogram=null,i.prototype.exponentialHistogram=null,i.prototype.summary=null;var s;return Object.defineProperty(i.prototype,"data",{get:Vt.oneOfGetter(s=["gauge","sum","histogram","exponentialHistogram","summary"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){return u||(u=ji.create()),o.name!=null&&Object.hasOwnProperty.call(o,"name")&&u.uint32(10).string(o.name),o.description!=null&&Object.hasOwnProperty.call(o,"description")&&u.uint32(18).string(o.description),o.unit!=null&&Object.hasOwnProperty.call(o,"unit")&&u.uint32(26).string(o.unit),o.gauge!=null&&Object.hasOwnProperty.call(o,"gauge")&&Et.opentelemetry.proto.metrics.v1.Gauge.encode(o.gauge,u.uint32(42).fork()).ldelim(),o.sum!=null&&Object.hasOwnProperty.call(o,"sum")&&Et.opentelemetry.proto.metrics.v1.Sum.encode(o.sum,u.uint32(58).fork()).ldelim(),o.histogram!=null&&Object.hasOwnProperty.call(o,"histogram")&&Et.opentelemetry.proto.metrics.v1.Histogram.encode(o.histogram,u.uint32(74).fork()).ldelim(),o.exponentialHistogram!=null&&Object.hasOwnProperty.call(o,"exponentialHistogram")&&Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(o.exponentialHistogram,u.uint32(82).fork()).ldelim(),o.summary!=null&&Object.hasOwnProperty.call(o,"summary")&&Et.opentelemetry.proto.metrics.v1.Summary.encode(o.summary,u.uint32(90).fork()).ldelim(),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.Metric;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.name=o.string();break}case 2:{I.description=o.string();break}case 3:{I.unit=o.string();break}case 5:{I.gauge=Et.opentelemetry.proto.metrics.v1.Gauge.decode(o,o.uint32());break}case 7:{I.sum=Et.opentelemetry.proto.metrics.v1.Sum.decode(o,o.uint32());break}case 9:{I.histogram=Et.opentelemetry.proto.metrics.v1.Histogram.decode(o,o.uint32());break}case 10:{I.exponentialHistogram=Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(o,o.uint32());break}case 11:{I.summary=Et.opentelemetry.proto.metrics.v1.Summary.decode(o,o.uint32());break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.name!=null&&o.hasOwnProperty("name")&&!Vt.isString(o.name))return"name: string expected";if(o.description!=null&&o.hasOwnProperty("description")&&!Vt.isString(o.description))return"description: string expected";if(o.unit!=null&&o.hasOwnProperty("unit")&&!Vt.isString(o.unit))return"unit: string expected";if(o.gauge!=null&&o.hasOwnProperty("gauge")){u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.Gauge.verify(o.gauge);if(d)return"gauge."+d}}if(o.sum!=null&&o.hasOwnProperty("sum")){if(u.data===1)return"data: multiple values";u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.Sum.verify(o.sum);if(d)return"sum."+d}}if(o.histogram!=null&&o.hasOwnProperty("histogram")){if(u.data===1)return"data: multiple values";u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.Histogram.verify(o.histogram);if(d)return"histogram."+d}}if(o.exponentialHistogram!=null&&o.hasOwnProperty("exponentialHistogram")){if(u.data===1)return"data: multiple values";u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(o.exponentialHistogram);if(d)return"exponentialHistogram."+d}}if(o.summary!=null&&o.hasOwnProperty("summary")){if(u.data===1)return"data: multiple values";u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.Summary.verify(o.summary);if(d)return"summary."+d}}return null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.Metric)return o;var u=new Et.opentelemetry.proto.metrics.v1.Metric;if(o.name!=null&&(u.name=String(o.name)),o.description!=null&&(u.description=String(o.description)),o.unit!=null&&(u.unit=String(o.unit)),o.gauge!=null){if(typeof o.gauge!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");u.gauge=Et.opentelemetry.proto.metrics.v1.Gauge.fromObject(o.gauge)}if(o.sum!=null){if(typeof o.sum!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");u.sum=Et.opentelemetry.proto.metrics.v1.Sum.fromObject(o.sum)}if(o.histogram!=null){if(typeof o.histogram!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");u.histogram=Et.opentelemetry.proto.metrics.v1.Histogram.fromObject(o.histogram)}if(o.exponentialHistogram!=null){if(typeof o.exponentialHistogram!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");u.exponentialHistogram=Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(o.exponentialHistogram)}if(o.summary!=null){if(typeof o.summary!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");u.summary=Et.opentelemetry.proto.metrics.v1.Summary.fromObject(o.summary)}return u},i.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.name="",d.description="",d.unit=""),o.name!=null&&o.hasOwnProperty("name")&&(d.name=o.name),o.description!=null&&o.hasOwnProperty("description")&&(d.description=o.description),o.unit!=null&&o.hasOwnProperty("unit")&&(d.unit=o.unit),o.gauge!=null&&o.hasOwnProperty("gauge")&&(d.gauge=Et.opentelemetry.proto.metrics.v1.Gauge.toObject(o.gauge,u),u.oneofs&&(d.data="gauge")),o.sum!=null&&o.hasOwnProperty("sum")&&(d.sum=Et.opentelemetry.proto.metrics.v1.Sum.toObject(o.sum,u),u.oneofs&&(d.data="sum")),o.histogram!=null&&o.hasOwnProperty("histogram")&&(d.histogram=Et.opentelemetry.proto.metrics.v1.Histogram.toObject(o.histogram,u),u.oneofs&&(d.data="histogram")),o.exponentialHistogram!=null&&o.hasOwnProperty("exponentialHistogram")&&(d.exponentialHistogram=Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(o.exponentialHistogram,u),u.oneofs&&(d.data="exponentialHistogram")),o.summary!=null&&o.hasOwnProperty("summary")&&(d.summary=Et.opentelemetry.proto.metrics.v1.Summary.toObject(o.summary,u),u.oneofs&&(d.data="summary")),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.Metric"},i})(),a.Gauge=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.Gauge;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.Gauge)return e;var o=new Et.opentelemetry.proto.metrics.v1.Gauge;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.Gauge"},i})(),a.Sum=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.prototype.aggregationTemporality=null,i.prototype.isMonotonic=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return e.aggregationTemporality!=null&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&o.uint32(16).int32(e.aggregationTemporality),e.isMonotonic!=null&&Object.hasOwnProperty.call(e,"isMonotonic")&&o.uint32(24).bool(e.isMonotonic),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.Sum;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()));break}case 2:{d.aggregationTemporality=e.int32();break}case 3:{d.isMonotonic=e.bool();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}if(e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return e.isMonotonic!=null&&e.hasOwnProperty("isMonotonic")&&typeof e.isMonotonic!="boolean"?"isMonotonic: boolean expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.Sum)return e;var o=new Et.opentelemetry.proto.metrics.v1.Sum;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[u])}}switch(e.aggregationTemporality){default:if(typeof e.aggregationTemporality=="number"){o.aggregationTemporality=e.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:o.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:o.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:o.aggregationTemporality=2;break}return e.isMonotonic!=null&&(o.isMonotonic=!!e.isMonotonic),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),o.defaults&&(u.aggregationTemporality=o.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,u.isMonotonic=!1),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[d],o)}return e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality")&&(u.aggregationTemporality=o.enums===String?Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]===void 0?e.aggregationTemporality:Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]:e.aggregationTemporality),e.isMonotonic!=null&&e.hasOwnProperty("isMonotonic")&&(u.isMonotonic=e.isMonotonic),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.Sum"},i})(),a.Histogram=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.prototype.aggregationTemporality=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return e.aggregationTemporality!=null&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&o.uint32(16).int32(e.aggregationTemporality),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.Histogram;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(e,e.uint32()));break}case 2:{d.aggregationTemporality=e.int32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}if(e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.Histogram)return e;var o=new Et.opentelemetry.proto.metrics.v1.Histogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(e.dataPoints[u])}}switch(e.aggregationTemporality){default:if(typeof e.aggregationTemporality=="number"){o.aggregationTemporality=e.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:o.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:o.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:o.aggregationTemporality=2;break}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),o.defaults&&(u.aggregationTemporality=o.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(e.dataPoints[d],o)}return e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality")&&(u.aggregationTemporality=o.enums===String?Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]===void 0?e.aggregationTemporality:Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]:e.aggregationTemporality),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.Histogram"},i})(),a.ExponentialHistogram=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.prototype.aggregationTemporality=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return e.aggregationTemporality!=null&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&o.uint32(16).int32(e.aggregationTemporality),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogram;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(e,e.uint32()));break}case 2:{d.aggregationTemporality=e.int32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}if(e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.ExponentialHistogram)return e;var o=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(e.dataPoints[u])}}switch(e.aggregationTemporality){default:if(typeof e.aggregationTemporality=="number"){o.aggregationTemporality=e.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:o.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:o.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:o.aggregationTemporality=2;break}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),o.defaults&&(u.aggregationTemporality=o.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(e.dataPoints[d],o)}return e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality")&&(u.aggregationTemporality=o.enums===String?Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]===void 0?e.aggregationTemporality:Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]:e.aggregationTemporality),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},i})(),a.Summary=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.Summary;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.Summary)return e;var o=new Et.opentelemetry.proto.metrics.v1.Summary;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(e.dataPoints[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(e.dataPoints[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.Summary"},i})(),a.AggregationTemporality=(function(){var i={},s=Object.create(i);return s[i[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,s[i[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,s[i[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,s})(),a.DataPointFlags=(function(){var i={},s=Object.create(i);return s[i[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,s[i[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,s})(),a.NumberDataPoint=(function(){function i(e){if(this.attributes=[],this.exemplars=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.attributes=Vt.emptyArray,i.prototype.startTimeUnixNano=null,i.prototype.timeUnixNano=null,i.prototype.asDouble=null,i.prototype.asInt=null,i.prototype.exemplars=Vt.emptyArray,i.prototype.flags=null;var s;return Object.defineProperty(i.prototype,"value",{get:Vt.oneOfGetter(s=["asDouble","asInt"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){if(u||(u=ji.create()),o.startTimeUnixNano!=null&&Object.hasOwnProperty.call(o,"startTimeUnixNano")&&u.uint32(17).fixed64(o.startTimeUnixNano),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(25).fixed64(o.timeUnixNano),o.asDouble!=null&&Object.hasOwnProperty.call(o,"asDouble")&&u.uint32(33).double(o.asDouble),o.exemplars!=null&&o.exemplars.length)for(var d=0;d<o.exemplars.length;++d)Et.opentelemetry.proto.metrics.v1.Exemplar.encode(o.exemplars[d],u.uint32(42).fork()).ldelim();if(o.asInt!=null&&Object.hasOwnProperty.call(o,"asInt")&&u.uint32(49).sfixed64(o.asInt),o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(58).fork()).ldelim();return o.flags!=null&&Object.hasOwnProperty.call(o,"flags")&&u.uint32(64).uint32(o.flags),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.NumberDataPoint;o.pos<d;){var h=o.uint32();switch(h>>>3){case 7:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 2:{I.startTimeUnixNano=o.fixed64();break}case 3:{I.timeUnixNano=o.fixed64();break}case 4:{I.asDouble=o.double();break}case 6:{I.asInt=o.sfixed64();break}case 5:{I.exemplars&&I.exemplars.length||(I.exemplars=[]),I.exemplars.push(Et.opentelemetry.proto.metrics.v1.Exemplar.decode(o,o.uint32()));break}case 8:{I.flags=o.uint32();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var d=0;d<o.attributes.length;++d){var I=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[d]);if(I)return"attributes."+I}}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(o.startTimeUnixNano)&&!(o.startTimeUnixNano&&Vt.isInteger(o.startTimeUnixNano.low)&&Vt.isInteger(o.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.asDouble!=null&&o.hasOwnProperty("asDouble")&&(u.value=1,typeof o.asDouble!="number"))return"asDouble: number expected";if(o.asInt!=null&&o.hasOwnProperty("asInt")){if(u.value===1)return"value: multiple values";if(u.value=1,!Vt.isInteger(o.asInt)&&!(o.asInt&&Vt.isInteger(o.asInt.low)&&Vt.isInteger(o.asInt.high)))return"asInt: integer|Long expected"}if(o.exemplars!=null&&o.hasOwnProperty("exemplars")){if(!Array.isArray(o.exemplars))return"exemplars: array expected";for(var d=0;d<o.exemplars.length;++d){var I=Et.opentelemetry.proto.metrics.v1.Exemplar.verify(o.exemplars[d]);if(I)return"exemplars."+I}}return o.flags!=null&&o.hasOwnProperty("flags")&&!Vt.isInteger(o.flags)?"flags: integer expected":null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.NumberDataPoint)return o;var u=new Et.opentelemetry.proto.metrics.v1.NumberDataPoint;if(o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}if(o.startTimeUnixNano!=null&&(Vt.Long?(u.startTimeUnixNano=Vt.Long.fromValue(o.startTimeUnixNano)).unsigned=!1:typeof o.startTimeUnixNano=="string"?u.startTimeUnixNano=parseInt(o.startTimeUnixNano,10):typeof o.startTimeUnixNano=="number"?u.startTimeUnixNano=o.startTimeUnixNano:typeof o.startTimeUnixNano=="object"&&(u.startTimeUnixNano=new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber())),o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.asDouble!=null&&(u.asDouble=Number(o.asDouble)),o.asInt!=null&&(Vt.Long?(u.asInt=Vt.Long.fromValue(o.asInt)).unsigned=!1:typeof o.asInt=="string"?u.asInt=parseInt(o.asInt,10):typeof o.asInt=="number"?u.asInt=o.asInt:typeof o.asInt=="object"&&(u.asInt=new Vt.LongBits(o.asInt.low>>>0,o.asInt.high>>>0).toNumber())),o.exemplars){if(!Array.isArray(o.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");u.exemplars=[];for(var d=0;d<o.exemplars.length;++d){if(typeof o.exemplars[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");u.exemplars[d]=Et.opentelemetry.proto.metrics.v1.Exemplar.fromObject(o.exemplars[d])}}return o.flags!=null&&(u.flags=o.flags>>>0),u},i.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.exemplars=[],d.attributes=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.startTimeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.startTimeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;d.flags=0}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&(typeof o.startTimeUnixNano=="number"?d.startTimeUnixNano=u.longs===String?String(o.startTimeUnixNano):o.startTimeUnixNano:d.startTimeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.startTimeUnixNano):u.longs===Number?new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber():o.startTimeUnixNano),o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.asDouble!=null&&o.hasOwnProperty("asDouble")&&(d.asDouble=u.json&&!isFinite(o.asDouble)?String(o.asDouble):o.asDouble,u.oneofs&&(d.value="asDouble")),o.exemplars&&o.exemplars.length){d.exemplars=[];for(var h=0;h<o.exemplars.length;++h)d.exemplars[h]=Et.opentelemetry.proto.metrics.v1.Exemplar.toObject(o.exemplars[h],u)}if(o.asInt!=null&&o.hasOwnProperty("asInt")&&(typeof o.asInt=="number"?d.asInt=u.longs===String?String(o.asInt):o.asInt:d.asInt=u.longs===String?Vt.Long.prototype.toString.call(o.asInt):u.longs===Number?new Vt.LongBits(o.asInt.low>>>0,o.asInt.high>>>0).toNumber():o.asInt,u.oneofs&&(d.value="asInt")),o.attributes&&o.attributes.length){d.attributes=[];for(var h=0;h<o.attributes.length;++h)d.attributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[h],u)}return o.flags!=null&&o.hasOwnProperty("flags")&&(d.flags=o.flags),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},i})(),a.HistogramDataPoint=(function(){function i(e){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.attributes=Vt.emptyArray,i.prototype.startTimeUnixNano=null,i.prototype.timeUnixNano=null,i.prototype.count=null,i.prototype.sum=null,i.prototype.bucketCounts=Vt.emptyArray,i.prototype.explicitBounds=Vt.emptyArray,i.prototype.exemplars=Vt.emptyArray,i.prototype.flags=null,i.prototype.min=null,i.prototype.max=null;var s;return Object.defineProperty(i.prototype,"_sum",{get:Vt.oneOfGetter(s=["sum"]),set:Vt.oneOfSetter(s)}),Object.defineProperty(i.prototype,"_min",{get:Vt.oneOfGetter(s=["min"]),set:Vt.oneOfSetter(s)}),Object.defineProperty(i.prototype,"_max",{get:Vt.oneOfGetter(s=["max"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){if(u||(u=ji.create()),o.startTimeUnixNano!=null&&Object.hasOwnProperty.call(o,"startTimeUnixNano")&&u.uint32(17).fixed64(o.startTimeUnixNano),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(25).fixed64(o.timeUnixNano),o.count!=null&&Object.hasOwnProperty.call(o,"count")&&u.uint32(33).fixed64(o.count),o.sum!=null&&Object.hasOwnProperty.call(o,"sum")&&u.uint32(41).double(o.sum),o.bucketCounts!=null&&o.bucketCounts.length){u.uint32(50).fork();for(var d=0;d<o.bucketCounts.length;++d)u.fixed64(o.bucketCounts[d]);u.ldelim()}if(o.explicitBounds!=null&&o.explicitBounds.length){u.uint32(58).fork();for(var d=0;d<o.explicitBounds.length;++d)u.double(o.explicitBounds[d]);u.ldelim()}if(o.exemplars!=null&&o.exemplars.length)for(var d=0;d<o.exemplars.length;++d)Et.opentelemetry.proto.metrics.v1.Exemplar.encode(o.exemplars[d],u.uint32(66).fork()).ldelim();if(o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(74).fork()).ldelim();return o.flags!=null&&Object.hasOwnProperty.call(o,"flags")&&u.uint32(80).uint32(o.flags),o.min!=null&&Object.hasOwnProperty.call(o,"min")&&u.uint32(89).double(o.min),o.max!=null&&Object.hasOwnProperty.call(o,"max")&&u.uint32(97).double(o.max),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.HistogramDataPoint;o.pos<d;){var h=o.uint32();switch(h>>>3){case 9:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 2:{I.startTimeUnixNano=o.fixed64();break}case 3:{I.timeUnixNano=o.fixed64();break}case 4:{I.count=o.fixed64();break}case 5:{I.sum=o.double();break}case 6:{if(I.bucketCounts&&I.bucketCounts.length||(I.bucketCounts=[]),(h&7)===2)for(var c=o.uint32()+o.pos;o.pos<c;)I.bucketCounts.push(o.fixed64());else I.bucketCounts.push(o.fixed64());break}case 7:{if(I.explicitBounds&&I.explicitBounds.length||(I.explicitBounds=[]),(h&7)===2)for(var c=o.uint32()+o.pos;o.pos<c;)I.explicitBounds.push(o.double());else I.explicitBounds.push(o.double());break}case 8:{I.exemplars&&I.exemplars.length||(I.exemplars=[]),I.exemplars.push(Et.opentelemetry.proto.metrics.v1.Exemplar.decode(o,o.uint32()));break}case 10:{I.flags=o.uint32();break}case 11:{I.min=o.double();break}case 12:{I.max=o.double();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var d=0;d<o.attributes.length;++d){var I=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[d]);if(I)return"attributes."+I}}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(o.startTimeUnixNano)&&!(o.startTimeUnixNano&&Vt.isInteger(o.startTimeUnixNano.low)&&Vt.isInteger(o.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.count!=null&&o.hasOwnProperty("count")&&!Vt.isInteger(o.count)&&!(o.count&&Vt.isInteger(o.count.low)&&Vt.isInteger(o.count.high)))return"count: integer|Long expected";if(o.sum!=null&&o.hasOwnProperty("sum")&&(u._sum=1,typeof o.sum!="number"))return"sum: number expected";if(o.bucketCounts!=null&&o.hasOwnProperty("bucketCounts")){if(!Array.isArray(o.bucketCounts))return"bucketCounts: array expected";for(var d=0;d<o.bucketCounts.length;++d)if(!Vt.isInteger(o.bucketCounts[d])&&!(o.bucketCounts[d]&&Vt.isInteger(o.bucketCounts[d].low)&&Vt.isInteger(o.bucketCounts[d].high)))return"bucketCounts: integer|Long[] expected"}if(o.explicitBounds!=null&&o.hasOwnProperty("explicitBounds")){if(!Array.isArray(o.explicitBounds))return"explicitBounds: array expected";for(var d=0;d<o.explicitBounds.length;++d)if(typeof o.explicitBounds[d]!="number")return"explicitBounds: number[] expected"}if(o.exemplars!=null&&o.hasOwnProperty("exemplars")){if(!Array.isArray(o.exemplars))return"exemplars: array expected";for(var d=0;d<o.exemplars.length;++d){var I=Et.opentelemetry.proto.metrics.v1.Exemplar.verify(o.exemplars[d]);if(I)return"exemplars."+I}}return o.flags!=null&&o.hasOwnProperty("flags")&&!Vt.isInteger(o.flags)?"flags: integer expected":o.min!=null&&o.hasOwnProperty("min")&&(u._min=1,typeof o.min!="number")?"min: number expected":o.max!=null&&o.hasOwnProperty("max")&&(u._max=1,typeof o.max!="number")?"max: number expected":null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.HistogramDataPoint)return o;var u=new Et.opentelemetry.proto.metrics.v1.HistogramDataPoint;if(o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}if(o.startTimeUnixNano!=null&&(Vt.Long?(u.startTimeUnixNano=Vt.Long.fromValue(o.startTimeUnixNano)).unsigned=!1:typeof o.startTimeUnixNano=="string"?u.startTimeUnixNano=parseInt(o.startTimeUnixNano,10):typeof o.startTimeUnixNano=="number"?u.startTimeUnixNano=o.startTimeUnixNano:typeof o.startTimeUnixNano=="object"&&(u.startTimeUnixNano=new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber())),o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.count!=null&&(Vt.Long?(u.count=Vt.Long.fromValue(o.count)).unsigned=!1:typeof o.count=="string"?u.count=parseInt(o.count,10):typeof o.count=="number"?u.count=o.count:typeof o.count=="object"&&(u.count=new Vt.LongBits(o.count.low>>>0,o.count.high>>>0).toNumber())),o.sum!=null&&(u.sum=Number(o.sum)),o.bucketCounts){if(!Array.isArray(o.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");u.bucketCounts=[];for(var d=0;d<o.bucketCounts.length;++d)Vt.Long?(u.bucketCounts[d]=Vt.Long.fromValue(o.bucketCounts[d])).unsigned=!1:typeof o.bucketCounts[d]=="string"?u.bucketCounts[d]=parseInt(o.bucketCounts[d],10):typeof o.bucketCounts[d]=="number"?u.bucketCounts[d]=o.bucketCounts[d]:typeof o.bucketCounts[d]=="object"&&(u.bucketCounts[d]=new Vt.LongBits(o.bucketCounts[d].low>>>0,o.bucketCounts[d].high>>>0).toNumber())}if(o.explicitBounds){if(!Array.isArray(o.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");u.explicitBounds=[];for(var d=0;d<o.explicitBounds.length;++d)u.explicitBounds[d]=Number(o.explicitBounds[d])}if(o.exemplars){if(!Array.isArray(o.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");u.exemplars=[];for(var d=0;d<o.exemplars.length;++d){if(typeof o.exemplars[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");u.exemplars[d]=Et.opentelemetry.proto.metrics.v1.Exemplar.fromObject(o.exemplars[d])}}return o.flags!=null&&(u.flags=o.flags>>>0),o.min!=null&&(u.min=Number(o.min)),o.max!=null&&(u.max=Number(o.max)),u},i.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.bucketCounts=[],d.explicitBounds=[],d.exemplars=[],d.attributes=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.startTimeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.startTimeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.count=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.count=u.longs===String?"0":0;d.flags=0}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&(typeof o.startTimeUnixNano=="number"?d.startTimeUnixNano=u.longs===String?String(o.startTimeUnixNano):o.startTimeUnixNano:d.startTimeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.startTimeUnixNano):u.longs===Number?new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber():o.startTimeUnixNano),o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.count!=null&&o.hasOwnProperty("count")&&(typeof o.count=="number"?d.count=u.longs===String?String(o.count):o.count:d.count=u.longs===String?Vt.Long.prototype.toString.call(o.count):u.longs===Number?new Vt.LongBits(o.count.low>>>0,o.count.high>>>0).toNumber():o.count),o.sum!=null&&o.hasOwnProperty("sum")&&(d.sum=u.json&&!isFinite(o.sum)?String(o.sum):o.sum,u.oneofs&&(d._sum="sum")),o.bucketCounts&&o.bucketCounts.length){d.bucketCounts=[];for(var h=0;h<o.bucketCounts.length;++h)typeof o.bucketCounts[h]=="number"?d.bucketCounts[h]=u.longs===String?String(o.bucketCounts[h]):o.bucketCounts[h]:d.bucketCounts[h]=u.longs===String?Vt.Long.prototype.toString.call(o.bucketCounts[h]):u.longs===Number?new Vt.LongBits(o.bucketCounts[h].low>>>0,o.bucketCounts[h].high>>>0).toNumber():o.bucketCounts[h]}if(o.explicitBounds&&o.explicitBounds.length){d.explicitBounds=[];for(var h=0;h<o.explicitBounds.length;++h)d.explicitBounds[h]=u.json&&!isFinite(o.explicitBounds[h])?String(o.explicitBounds[h]):o.explicitBounds[h]}if(o.exemplars&&o.exemplars.length){d.exemplars=[];for(var h=0;h<o.exemplars.length;++h)d.exemplars[h]=Et.opentelemetry.proto.metrics.v1.Exemplar.toObject(o.exemplars[h],u)}if(o.attributes&&o.attributes.length){d.attributes=[];for(var h=0;h<o.attributes.length;++h)d.attributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[h],u)}return o.flags!=null&&o.hasOwnProperty("flags")&&(d.flags=o.flags),o.min!=null&&o.hasOwnProperty("min")&&(d.min=u.json&&!isFinite(o.min)?String(o.min):o.min,u.oneofs&&(d._min="min")),o.max!=null&&o.hasOwnProperty("max")&&(d.max=u.json&&!isFinite(o.max)?String(o.max):o.max,u.oneofs&&(d._max="max")),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},i})(),a.ExponentialHistogramDataPoint=(function(){function i(e){if(this.attributes=[],this.exemplars=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.attributes=Vt.emptyArray,i.prototype.startTimeUnixNano=null,i.prototype.timeUnixNano=null,i.prototype.count=null,i.prototype.sum=null,i.prototype.scale=null,i.prototype.zeroCount=null,i.prototype.positive=null,i.prototype.negative=null,i.prototype.flags=null,i.prototype.exemplars=Vt.emptyArray,i.prototype.min=null,i.prototype.max=null,i.prototype.zeroThreshold=null;var s;return Object.defineProperty(i.prototype,"_sum",{get:Vt.oneOfGetter(s=["sum"]),set:Vt.oneOfSetter(s)}),Object.defineProperty(i.prototype,"_min",{get:Vt.oneOfGetter(s=["min"]),set:Vt.oneOfSetter(s)}),Object.defineProperty(i.prototype,"_max",{get:Vt.oneOfGetter(s=["max"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){if(u||(u=ji.create()),o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(10).fork()).ldelim();if(o.startTimeUnixNano!=null&&Object.hasOwnProperty.call(o,"startTimeUnixNano")&&u.uint32(17).fixed64(o.startTimeUnixNano),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(25).fixed64(o.timeUnixNano),o.count!=null&&Object.hasOwnProperty.call(o,"count")&&u.uint32(33).fixed64(o.count),o.sum!=null&&Object.hasOwnProperty.call(o,"sum")&&u.uint32(41).double(o.sum),o.scale!=null&&Object.hasOwnProperty.call(o,"scale")&&u.uint32(48).sint32(o.scale),o.zeroCount!=null&&Object.hasOwnProperty.call(o,"zeroCount")&&u.uint32(57).fixed64(o.zeroCount),o.positive!=null&&Object.hasOwnProperty.call(o,"positive")&&Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(o.positive,u.uint32(66).fork()).ldelim(),o.negative!=null&&Object.hasOwnProperty.call(o,"negative")&&Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(o.negative,u.uint32(74).fork()).ldelim(),o.flags!=null&&Object.hasOwnProperty.call(o,"flags")&&u.uint32(80).uint32(o.flags),o.exemplars!=null&&o.exemplars.length)for(var d=0;d<o.exemplars.length;++d)Et.opentelemetry.proto.metrics.v1.Exemplar.encode(o.exemplars[d],u.uint32(90).fork()).ldelim();return o.min!=null&&Object.hasOwnProperty.call(o,"min")&&u.uint32(97).double(o.min),o.max!=null&&Object.hasOwnProperty.call(o,"max")&&u.uint32(105).double(o.max),o.zeroThreshold!=null&&Object.hasOwnProperty.call(o,"zeroThreshold")&&u.uint32(113).double(o.zeroThreshold),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 2:{I.startTimeUnixNano=o.fixed64();break}case 3:{I.timeUnixNano=o.fixed64();break}case 4:{I.count=o.fixed64();break}case 5:{I.sum=o.double();break}case 6:{I.scale=o.sint32();break}case 7:{I.zeroCount=o.fixed64();break}case 8:{I.positive=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(o,o.uint32());break}case 9:{I.negative=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(o,o.uint32());break}case 10:{I.flags=o.uint32();break}case 11:{I.exemplars&&I.exemplars.length||(I.exemplars=[]),I.exemplars.push(Et.opentelemetry.proto.metrics.v1.Exemplar.decode(o,o.uint32()));break}case 12:{I.min=o.double();break}case 13:{I.max=o.double();break}case 14:{I.zeroThreshold=o.double();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var d=0;d<o.attributes.length;++d){var I=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[d]);if(I)return"attributes."+I}}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(o.startTimeUnixNano)&&!(o.startTimeUnixNano&&Vt.isInteger(o.startTimeUnixNano.low)&&Vt.isInteger(o.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.count!=null&&o.hasOwnProperty("count")&&!Vt.isInteger(o.count)&&!(o.count&&Vt.isInteger(o.count.low)&&Vt.isInteger(o.count.high)))return"count: integer|Long expected";if(o.sum!=null&&o.hasOwnProperty("sum")&&(u._sum=1,typeof o.sum!="number"))return"sum: number expected";if(o.scale!=null&&o.hasOwnProperty("scale")&&!Vt.isInteger(o.scale))return"scale: integer expected";if(o.zeroCount!=null&&o.hasOwnProperty("zeroCount")&&!Vt.isInteger(o.zeroCount)&&!(o.zeroCount&&Vt.isInteger(o.zeroCount.low)&&Vt.isInteger(o.zeroCount.high)))return"zeroCount: integer|Long expected";if(o.positive!=null&&o.hasOwnProperty("positive")){var I=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(o.positive);if(I)return"positive."+I}if(o.negative!=null&&o.hasOwnProperty("negative")){var I=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(o.negative);if(I)return"negative."+I}if(o.flags!=null&&o.hasOwnProperty("flags")&&!Vt.isInteger(o.flags))return"flags: integer expected";if(o.exemplars!=null&&o.hasOwnProperty("exemplars")){if(!Array.isArray(o.exemplars))return"exemplars: array expected";for(var d=0;d<o.exemplars.length;++d){var I=Et.opentelemetry.proto.metrics.v1.Exemplar.verify(o.exemplars[d]);if(I)return"exemplars."+I}}return o.min!=null&&o.hasOwnProperty("min")&&(u._min=1,typeof o.min!="number")?"min: number expected":o.max!=null&&o.hasOwnProperty("max")&&(u._max=1,typeof o.max!="number")?"max: number expected":o.zeroThreshold!=null&&o.hasOwnProperty("zeroThreshold")&&typeof o.zeroThreshold!="number"?"zeroThreshold: number expected":null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return o;var u=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if(o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}if(o.startTimeUnixNano!=null&&(Vt.Long?(u.startTimeUnixNano=Vt.Long.fromValue(o.startTimeUnixNano)).unsigned=!1:typeof o.startTimeUnixNano=="string"?u.startTimeUnixNano=parseInt(o.startTimeUnixNano,10):typeof o.startTimeUnixNano=="number"?u.startTimeUnixNano=o.startTimeUnixNano:typeof o.startTimeUnixNano=="object"&&(u.startTimeUnixNano=new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber())),o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.count!=null&&(Vt.Long?(u.count=Vt.Long.fromValue(o.count)).unsigned=!1:typeof o.count=="string"?u.count=parseInt(o.count,10):typeof o.count=="number"?u.count=o.count:typeof o.count=="object"&&(u.count=new Vt.LongBits(o.count.low>>>0,o.count.high>>>0).toNumber())),o.sum!=null&&(u.sum=Number(o.sum)),o.scale!=null&&(u.scale=o.scale|0),o.zeroCount!=null&&(Vt.Long?(u.zeroCount=Vt.Long.fromValue(o.zeroCount)).unsigned=!1:typeof o.zeroCount=="string"?u.zeroCount=parseInt(o.zeroCount,10):typeof o.zeroCount=="number"?u.zeroCount=o.zeroCount:typeof o.zeroCount=="object"&&(u.zeroCount=new Vt.LongBits(o.zeroCount.low>>>0,o.zeroCount.high>>>0).toNumber())),o.positive!=null){if(typeof o.positive!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");u.positive=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(o.positive)}if(o.negative!=null){if(typeof o.negative!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");u.negative=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(o.negative)}if(o.flags!=null&&(u.flags=o.flags>>>0),o.exemplars){if(!Array.isArray(o.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");u.exemplars=[];for(var d=0;d<o.exemplars.length;++d){if(typeof o.exemplars[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");u.exemplars[d]=Et.opentelemetry.proto.metrics.v1.Exemplar.fromObject(o.exemplars[d])}}return o.min!=null&&(u.min=Number(o.min)),o.max!=null&&(u.max=Number(o.max)),o.zeroThreshold!=null&&(u.zeroThreshold=Number(o.zeroThreshold)),u},i.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.attributes=[],d.exemplars=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.startTimeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.startTimeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.count=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.count=u.longs===String?"0":0;if(d.scale=0,Vt.Long){var I=new Vt.Long(0,0,!1);d.zeroCount=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.zeroCount=u.longs===String?"0":0;d.positive=null,d.negative=null,d.flags=0,d.zeroThreshold=0}if(o.attributes&&o.attributes.length){d.attributes=[];for(var h=0;h<o.attributes.length;++h)d.attributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[h],u)}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&(typeof o.startTimeUnixNano=="number"?d.startTimeUnixNano=u.longs===String?String(o.startTimeUnixNano):o.startTimeUnixNano:d.startTimeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.startTimeUnixNano):u.longs===Number?new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber():o.startTimeUnixNano),o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.count!=null&&o.hasOwnProperty("count")&&(typeof o.count=="number"?d.count=u.longs===String?String(o.count):o.count:d.count=u.longs===String?Vt.Long.prototype.toString.call(o.count):u.longs===Number?new Vt.LongBits(o.count.low>>>0,o.count.high>>>0).toNumber():o.count),o.sum!=null&&o.hasOwnProperty("sum")&&(d.sum=u.json&&!isFinite(o.sum)?String(o.sum):o.sum,u.oneofs&&(d._sum="sum")),o.scale!=null&&o.hasOwnProperty("scale")&&(d.scale=o.scale),o.zeroCount!=null&&o.hasOwnProperty("zeroCount")&&(typeof o.zeroCount=="number"?d.zeroCount=u.longs===String?String(o.zeroCount):o.zeroCount:d.zeroCount=u.longs===String?Vt.Long.prototype.toString.call(o.zeroCount):u.longs===Number?new Vt.LongBits(o.zeroCount.low>>>0,o.zeroCount.high>>>0).toNumber():o.zeroCount),o.positive!=null&&o.hasOwnProperty("positive")&&(d.positive=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(o.positive,u)),o.negative!=null&&o.hasOwnProperty("negative")&&(d.negative=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(o.negative,u)),o.flags!=null&&o.hasOwnProperty("flags")&&(d.flags=o.flags),o.exemplars&&o.exemplars.length){d.exemplars=[];for(var h=0;h<o.exemplars.length;++h)d.exemplars[h]=Et.opentelemetry.proto.metrics.v1.Exemplar.toObject(o.exemplars[h],u)}return o.min!=null&&o.hasOwnProperty("min")&&(d.min=u.json&&!isFinite(o.min)?String(o.min):o.min,u.oneofs&&(d._min="min")),o.max!=null&&o.hasOwnProperty("max")&&(d.max=u.json&&!isFinite(o.max)?String(o.max):o.max,u.oneofs&&(d._max="max")),o.zeroThreshold!=null&&o.hasOwnProperty("zeroThreshold")&&(d.zeroThreshold=u.json&&!isFinite(o.zeroThreshold)?String(o.zeroThreshold):o.zeroThreshold),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},i.Buckets=(function(){function e(o){if(this.bucketCounts=[],o)for(var u=Object.keys(o),d=0;d<u.length;++d)o[u[d]]!=null&&(this[u[d]]=o[u[d]])}return e.prototype.offset=null,e.prototype.bucketCounts=Vt.emptyArray,e.create=function(u){return new e(u)},e.encode=function(u,d){if(d||(d=ji.create()),u.offset!=null&&Object.hasOwnProperty.call(u,"offset")&&d.uint32(8).sint32(u.offset),u.bucketCounts!=null&&u.bucketCounts.length){d.uint32(18).fork();for(var I=0;I<u.bucketCounts.length;++I)d.uint64(u.bucketCounts[I]);d.ldelim()}return d},e.encodeDelimited=function(u,d){return this.encode(u,d).ldelim()},e.decode=function(u,d){u instanceof wn||(u=wn.create(u));for(var I=d===void 0?u.len:u.pos+d,h=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;u.pos<I;){var c=u.uint32();switch(c>>>3){case 1:{h.offset=u.sint32();break}case 2:{if(h.bucketCounts&&h.bucketCounts.length||(h.bucketCounts=[]),(c&7)===2)for(var G=u.uint32()+u.pos;u.pos<G;)h.bucketCounts.push(u.uint64());else h.bucketCounts.push(u.uint64());break}default:u.skipType(c&7);break}}return h},e.decodeDelimited=function(u){return u instanceof wn||(u=new wn(u)),this.decode(u,u.uint32())},e.verify=function(u){if(typeof u!="object"||u===null)return"object expected";if(u.offset!=null&&u.hasOwnProperty("offset")&&!Vt.isInteger(u.offset))return"offset: integer expected";if(u.bucketCounts!=null&&u.hasOwnProperty("bucketCounts")){if(!Array.isArray(u.bucketCounts))return"bucketCounts: array expected";for(var d=0;d<u.bucketCounts.length;++d)if(!Vt.isInteger(u.bucketCounts[d])&&!(u.bucketCounts[d]&&Vt.isInteger(u.bucketCounts[d].low)&&Vt.isInteger(u.bucketCounts[d].high)))return"bucketCounts: integer|Long[] expected"}return null},e.fromObject=function(u){if(u instanceof Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return u;var d=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;if(u.offset!=null&&(d.offset=u.offset|0),u.bucketCounts){if(!Array.isArray(u.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected");d.bucketCounts=[];for(var I=0;I<u.bucketCounts.length;++I)Vt.Long?(d.bucketCounts[I]=Vt.Long.fromValue(u.bucketCounts[I])).unsigned=!0:typeof u.bucketCounts[I]=="string"?d.bucketCounts[I]=parseInt(u.bucketCounts[I],10):typeof u.bucketCounts[I]=="number"?d.bucketCounts[I]=u.bucketCounts[I]:typeof u.bucketCounts[I]=="object"&&(d.bucketCounts[I]=new Vt.LongBits(u.bucketCounts[I].low>>>0,u.bucketCounts[I].high>>>0).toNumber(!0))}return d},e.toObject=function(u,d){d||(d={});var I={};if((d.arrays||d.defaults)&&(I.bucketCounts=[]),d.defaults&&(I.offset=0),u.offset!=null&&u.hasOwnProperty("offset")&&(I.offset=u.offset),u.bucketCounts&&u.bucketCounts.length){I.bucketCounts=[];for(var h=0;h<u.bucketCounts.length;++h)typeof u.bucketCounts[h]=="number"?I.bucketCounts[h]=d.longs===String?String(u.bucketCounts[h]):u.bucketCounts[h]:I.bucketCounts[h]=d.longs===String?Vt.Long.prototype.toString.call(u.bucketCounts[h]):d.longs===Number?new Vt.LongBits(u.bucketCounts[h].low>>>0,u.bucketCounts[h].high>>>0).toNumber(!0):u.bucketCounts[h]}return I},e.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},e.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},e})(),i})(),a.SummaryDataPoint=(function(){function i(s){if(this.attributes=[],this.quantileValues=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.attributes=Vt.emptyArray,i.prototype.startTimeUnixNano=null,i.prototype.timeUnixNano=null,i.prototype.count=null,i.prototype.sum=null,i.prototype.quantileValues=Vt.emptyArray,i.prototype.flags=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.startTimeUnixNano!=null&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&o.uint32(17).fixed64(e.startTimeUnixNano),e.timeUnixNano!=null&&Object.hasOwnProperty.call(e,"timeUnixNano")&&o.uint32(25).fixed64(e.timeUnixNano),e.count!=null&&Object.hasOwnProperty.call(e,"count")&&o.uint32(33).fixed64(e.count),e.sum!=null&&Object.hasOwnProperty.call(e,"sum")&&o.uint32(41).double(e.sum),e.quantileValues!=null&&e.quantileValues.length)for(var u=0;u<e.quantileValues.length;++u)Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(e.quantileValues[u],o.uint32(50).fork()).ldelim();if(e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(58).fork()).ldelim();return e.flags!=null&&Object.hasOwnProperty.call(e,"flags")&&o.uint32(64).uint32(e.flags),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.SummaryDataPoint;e.pos<u;){var I=e.uint32();switch(I>>>3){case 7:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 2:{d.startTimeUnixNano=e.fixed64();break}case 3:{d.timeUnixNano=e.fixed64();break}case 4:{d.count=e.fixed64();break}case 5:{d.sum=e.double();break}case 6:{d.quantileValues&&d.quantileValues.length||(d.quantileValues=[]),d.quantileValues.push(Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(e,e.uint32()));break}case 8:{d.flags=e.uint32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var o=0;o<e.attributes.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[o]);if(u)return"attributes."+u}}if(e.startTimeUnixNano!=null&&e.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(e.startTimeUnixNano)&&!(e.startTimeUnixNano&&Vt.isInteger(e.startTimeUnixNano.low)&&Vt.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(e.timeUnixNano!=null&&e.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(e.timeUnixNano)&&!(e.timeUnixNano&&Vt.isInteger(e.timeUnixNano.low)&&Vt.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(e.count!=null&&e.hasOwnProperty("count")&&!Vt.isInteger(e.count)&&!(e.count&&Vt.isInteger(e.count.low)&&Vt.isInteger(e.count.high)))return"count: integer|Long expected";if(e.sum!=null&&e.hasOwnProperty("sum")&&typeof e.sum!="number")return"sum: number expected";if(e.quantileValues!=null&&e.hasOwnProperty("quantileValues")){if(!Array.isArray(e.quantileValues))return"quantileValues: array expected";for(var o=0;o<e.quantileValues.length;++o){var u=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(e.quantileValues[o]);if(u)return"quantileValues."+u}}return e.flags!=null&&e.hasOwnProperty("flags")&&!Vt.isInteger(e.flags)?"flags: integer expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.SummaryDataPoint)return e;var o=new Et.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}if(e.startTimeUnixNano!=null&&(Vt.Long?(o.startTimeUnixNano=Vt.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:typeof e.startTimeUnixNano=="string"?o.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):typeof e.startTimeUnixNano=="number"?o.startTimeUnixNano=e.startTimeUnixNano:typeof e.startTimeUnixNano=="object"&&(o.startTimeUnixNano=new Vt.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),e.timeUnixNano!=null&&(Vt.Long?(o.timeUnixNano=Vt.Long.fromValue(e.timeUnixNano)).unsigned=!1:typeof e.timeUnixNano=="string"?o.timeUnixNano=parseInt(e.timeUnixNano,10):typeof e.timeUnixNano=="number"?o.timeUnixNano=e.timeUnixNano:typeof e.timeUnixNano=="object"&&(o.timeUnixNano=new Vt.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),e.count!=null&&(Vt.Long?(o.count=Vt.Long.fromValue(e.count)).unsigned=!1:typeof e.count=="string"?o.count=parseInt(e.count,10):typeof e.count=="number"?o.count=e.count:typeof e.count=="object"&&(o.count=new Vt.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),e.sum!=null&&(o.sum=Number(e.sum)),e.quantileValues){if(!Array.isArray(e.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");o.quantileValues=[];for(var u=0;u<e.quantileValues.length;++u){if(typeof e.quantileValues[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");o.quantileValues[u]=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(e.quantileValues[u])}}return e.flags!=null&&(o.flags=e.flags>>>0),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.quantileValues=[],u.attributes=[]),o.defaults){if(Vt.Long){var d=new Vt.Long(0,0,!1);u.startTimeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.startTimeUnixNano=o.longs===String?"0":0;if(Vt.Long){var d=new Vt.Long(0,0,!1);u.timeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.timeUnixNano=o.longs===String?"0":0;if(Vt.Long){var d=new Vt.Long(0,0,!1);u.count=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.count=o.longs===String?"0":0;u.sum=0,u.flags=0}if(e.startTimeUnixNano!=null&&e.hasOwnProperty("startTimeUnixNano")&&(typeof e.startTimeUnixNano=="number"?u.startTimeUnixNano=o.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:u.startTimeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.startTimeUnixNano):o.longs===Number?new Vt.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),e.timeUnixNano!=null&&e.hasOwnProperty("timeUnixNano")&&(typeof e.timeUnixNano=="number"?u.timeUnixNano=o.longs===String?String(e.timeUnixNano):e.timeUnixNano:u.timeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.timeUnixNano):o.longs===Number?new Vt.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),e.count!=null&&e.hasOwnProperty("count")&&(typeof e.count=="number"?u.count=o.longs===String?String(e.count):e.count:u.count=o.longs===String?Vt.Long.prototype.toString.call(e.count):o.longs===Number?new Vt.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),e.sum!=null&&e.hasOwnProperty("sum")&&(u.sum=o.json&&!isFinite(e.sum)?String(e.sum):e.sum),e.quantileValues&&e.quantileValues.length){u.quantileValues=[];for(var I=0;I<e.quantileValues.length;++I)u.quantileValues[I]=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(e.quantileValues[I],o)}if(e.attributes&&e.attributes.length){u.attributes=[];for(var I=0;I<e.attributes.length;++I)u.attributes[I]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[I],o)}return e.flags!=null&&e.hasOwnProperty("flags")&&(u.flags=e.flags),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},i.ValueAtQuantile=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.quantile=null,s.prototype.value=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.quantile!=null&&Object.hasOwnProperty.call(o,"quantile")&&u.uint32(9).double(o.quantile),o.value!=null&&Object.hasOwnProperty.call(o,"value")&&u.uint32(17).double(o.value),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.quantile=o.double();break}case 2:{I.value=o.double();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.quantile!=null&&o.hasOwnProperty("quantile")&&typeof o.quantile!="number"?"quantile: number expected":o.value!=null&&o.hasOwnProperty("value")&&typeof o.value!="number"?"value: number expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile)return o;var u=new Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;return o.quantile!=null&&(u.quantile=Number(o.quantile)),o.value!=null&&(u.value=Number(o.value)),u},s.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.quantile=0,d.value=0),o.quantile!=null&&o.hasOwnProperty("quantile")&&(d.quantile=u.json&&!isFinite(o.quantile)?String(o.quantile):o.quantile),o.value!=null&&o.hasOwnProperty("value")&&(d.value=u.json&&!isFinite(o.value)?String(o.value):o.value),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},s})(),i})(),a.Exemplar=(function(){function i(e){if(this.filteredAttributes=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.filteredAttributes=Vt.emptyArray,i.prototype.timeUnixNano=null,i.prototype.asDouble=null,i.prototype.asInt=null,i.prototype.spanId=null,i.prototype.traceId=null;var s;return Object.defineProperty(i.prototype,"value",{get:Vt.oneOfGetter(s=["asDouble","asInt"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){if(u||(u=ji.create()),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(17).fixed64(o.timeUnixNano),o.asDouble!=null&&Object.hasOwnProperty.call(o,"asDouble")&&u.uint32(25).double(o.asDouble),o.spanId!=null&&Object.hasOwnProperty.call(o,"spanId")&&u.uint32(34).bytes(o.spanId),o.traceId!=null&&Object.hasOwnProperty.call(o,"traceId")&&u.uint32(42).bytes(o.traceId),o.asInt!=null&&Object.hasOwnProperty.call(o,"asInt")&&u.uint32(49).sfixed64(o.asInt),o.filteredAttributes!=null&&o.filteredAttributes.length)for(var d=0;d<o.filteredAttributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.filteredAttributes[d],u.uint32(58).fork()).ldelim();return u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.Exemplar;o.pos<d;){var h=o.uint32();switch(h>>>3){case 7:{I.filteredAttributes&&I.filteredAttributes.length||(I.filteredAttributes=[]),I.filteredAttributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 2:{I.timeUnixNano=o.fixed64();break}case 3:{I.asDouble=o.double();break}case 6:{I.asInt=o.sfixed64();break}case 4:{I.spanId=o.bytes();break}case 5:{I.traceId=o.bytes();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.filteredAttributes!=null&&o.hasOwnProperty("filteredAttributes")){if(!Array.isArray(o.filteredAttributes))return"filteredAttributes: array expected";for(var d=0;d<o.filteredAttributes.length;++d){var I=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.filteredAttributes[d]);if(I)return"filteredAttributes."+I}}if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.asDouble!=null&&o.hasOwnProperty("asDouble")&&(u.value=1,typeof o.asDouble!="number"))return"asDouble: number expected";if(o.asInt!=null&&o.hasOwnProperty("asInt")){if(u.value===1)return"value: multiple values";if(u.value=1,!Vt.isInteger(o.asInt)&&!(o.asInt&&Vt.isInteger(o.asInt.low)&&Vt.isInteger(o.asInt.high)))return"asInt: integer|Long expected"}return o.spanId!=null&&o.hasOwnProperty("spanId")&&!(o.spanId&&typeof o.spanId.length=="number"||Vt.isString(o.spanId))?"spanId: buffer expected":o.traceId!=null&&o.hasOwnProperty("traceId")&&!(o.traceId&&typeof o.traceId.length=="number"||Vt.isString(o.traceId))?"traceId: buffer expected":null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.Exemplar)return o;var u=new Et.opentelemetry.proto.metrics.v1.Exemplar;if(o.filteredAttributes){if(!Array.isArray(o.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");u.filteredAttributes=[];for(var d=0;d<o.filteredAttributes.length;++d){if(typeof o.filteredAttributes[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");u.filteredAttributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.filteredAttributes[d])}}return o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.asDouble!=null&&(u.asDouble=Number(o.asDouble)),o.asInt!=null&&(Vt.Long?(u.asInt=Vt.Long.fromValue(o.asInt)).unsigned=!1:typeof o.asInt=="string"?u.asInt=parseInt(o.asInt,10):typeof o.asInt=="number"?u.asInt=o.asInt:typeof o.asInt=="object"&&(u.asInt=new Vt.LongBits(o.asInt.low>>>0,o.asInt.high>>>0).toNumber())),o.spanId!=null&&(typeof o.spanId=="string"?Vt.base64.decode(o.spanId,u.spanId=Vt.newBuffer(Vt.base64.length(o.spanId)),0):o.spanId.length>=0&&(u.spanId=o.spanId)),o.traceId!=null&&(typeof o.traceId=="string"?Vt.base64.decode(o.traceId,u.traceId=Vt.newBuffer(Vt.base64.length(o.traceId)),0):o.traceId.length>=0&&(u.traceId=o.traceId)),u},i.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.filteredAttributes=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;u.bytes===String?d.spanId="":(d.spanId=[],u.bytes!==Array&&(d.spanId=Vt.newBuffer(d.spanId))),u.bytes===String?d.traceId="":(d.traceId=[],u.bytes!==Array&&(d.traceId=Vt.newBuffer(d.traceId)))}if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.asDouble!=null&&o.hasOwnProperty("asDouble")&&(d.asDouble=u.json&&!isFinite(o.asDouble)?String(o.asDouble):o.asDouble,u.oneofs&&(d.value="asDouble")),o.spanId!=null&&o.hasOwnProperty("spanId")&&(d.spanId=u.bytes===String?Vt.base64.encode(o.spanId,0,o.spanId.length):u.bytes===Array?Array.prototype.slice.call(o.spanId):o.spanId),o.traceId!=null&&o.hasOwnProperty("traceId")&&(d.traceId=u.bytes===String?Vt.base64.encode(o.traceId,0,o.traceId.length):u.bytes===Array?Array.prototype.slice.call(o.traceId):o.traceId),o.asInt!=null&&o.hasOwnProperty("asInt")&&(typeof o.asInt=="number"?d.asInt=u.longs===String?String(o.asInt):o.asInt:d.asInt=u.longs===String?Vt.Long.prototype.toString.call(o.asInt):u.longs===Number?new Vt.LongBits(o.asInt.low>>>0,o.asInt.high>>>0).toNumber():o.asInt,u.oneofs&&(d.value="asInt")),o.filteredAttributes&&o.filteredAttributes.length){d.filteredAttributes=[];for(var h=0;h<o.filteredAttributes.length;++h)d.filteredAttributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.filteredAttributes[h],u)}return d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.Exemplar"},i})(),a})(),r})(),t.logs=(function(){var r={};return r.v1=(function(){var a={};return a.LogsData=(function(){function i(s){if(this.resourceLogs=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resourceLogs=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resourceLogs!=null&&e.resourceLogs.length)for(var u=0;u<e.resourceLogs.length;++u)Et.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.logs.v1.LogsData;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resourceLogs&&d.resourceLogs.length||(d.resourceLogs=[]),d.resourceLogs.push(Et.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resourceLogs!=null&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var o=0;o<e.resourceLogs.length;++o){var u=Et.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[o]);if(u)return"resourceLogs."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.logs.v1.LogsData)return e;var o=new Et.opentelemetry.proto.logs.v1.LogsData;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");o.resourceLogs=[];for(var u=0;u<e.resourceLogs.length;++u){if(typeof e.resourceLogs[u]!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");o.resourceLogs[u]=Et.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){u.resourceLogs=[];for(var d=0;d<e.resourceLogs.length;++d)u.resourceLogs[d]=Et.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.logs.v1.LogsData"},i})(),a.ResourceLogs=(function(){function i(s){if(this.scopeLogs=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resource=null,i.prototype.scopeLogs=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resource!=null&&Object.hasOwnProperty.call(e,"resource")&&Et.opentelemetry.proto.resource.v1.Resource.encode(e.resource,o.uint32(10).fork()).ldelim(),e.scopeLogs!=null&&e.scopeLogs.length)for(var u=0;u<e.scopeLogs.length;++u)Et.opentelemetry.proto.logs.v1.ScopeLogs.encode(e.scopeLogs[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.logs.v1.ResourceLogs;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resource=Et.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break}case 2:{d.scopeLogs&&d.scopeLogs.length||(d.scopeLogs=[]),d.scopeLogs.push(Et.opentelemetry.proto.logs.v1.ScopeLogs.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resource!=null&&e.hasOwnProperty("resource")){var o=Et.opentelemetry.proto.resource.v1.Resource.verify(e.resource);if(o)return"resource."+o}if(e.scopeLogs!=null&&e.hasOwnProperty("scopeLogs")){if(!Array.isArray(e.scopeLogs))return"scopeLogs: array expected";for(var u=0;u<e.scopeLogs.length;++u){var o=Et.opentelemetry.proto.logs.v1.ScopeLogs.verify(e.scopeLogs[u]);if(o)return"scopeLogs."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.logs.v1.ResourceLogs)return e;var o=new Et.opentelemetry.proto.logs.v1.ResourceLogs;if(e.resource!=null){if(typeof e.resource!="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");o.resource=Et.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeLogs){if(!Array.isArray(e.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");o.scopeLogs=[];for(var u=0;u<e.scopeLogs.length;++u){if(typeof e.scopeLogs[u]!="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");o.scopeLogs[u]=Et.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(e.scopeLogs[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.scopeLogs=[]),o.defaults&&(u.resource=null,u.schemaUrl=""),e.resource!=null&&e.hasOwnProperty("resource")&&(u.resource=Et.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,o)),e.scopeLogs&&e.scopeLogs.length){u.scopeLogs=[];for(var d=0;d<e.scopeLogs.length;++d)u.scopeLogs[d]=Et.opentelemetry.proto.logs.v1.ScopeLogs.toObject(e.scopeLogs[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.logs.v1.ResourceLogs"},i})(),a.ScopeLogs=(function(){function i(s){if(this.logRecords=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.scope=null,i.prototype.logRecords=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.scope!=null&&Object.hasOwnProperty.call(e,"scope")&&Et.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,o.uint32(10).fork()).ldelim(),e.logRecords!=null&&e.logRecords.length)for(var u=0;u<e.logRecords.length;++u)Et.opentelemetry.proto.logs.v1.LogRecord.encode(e.logRecords[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.logs.v1.ScopeLogs;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break}case 2:{d.logRecords&&d.logRecords.length||(d.logRecords=[]),d.logRecords.push(Et.opentelemetry.proto.logs.v1.LogRecord.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.scope!=null&&e.hasOwnProperty("scope")){var o=Et.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope);if(o)return"scope."+o}if(e.logRecords!=null&&e.hasOwnProperty("logRecords")){if(!Array.isArray(e.logRecords))return"logRecords: array expected";for(var u=0;u<e.logRecords.length;++u){var o=Et.opentelemetry.proto.logs.v1.LogRecord.verify(e.logRecords[u]);if(o)return"logRecords."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.logs.v1.ScopeLogs)return e;var o=new Et.opentelemetry.proto.logs.v1.ScopeLogs;if(e.scope!=null){if(typeof e.scope!="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");o.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.logRecords){if(!Array.isArray(e.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");o.logRecords=[];for(var u=0;u<e.logRecords.length;++u){if(typeof e.logRecords[u]!="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");o.logRecords[u]=Et.opentelemetry.proto.logs.v1.LogRecord.fromObject(e.logRecords[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.logRecords=[]),o.defaults&&(u.scope=null,u.schemaUrl=""),e.scope!=null&&e.hasOwnProperty("scope")&&(u.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,o)),e.logRecords&&e.logRecords.length){u.logRecords=[];for(var d=0;d<e.logRecords.length;++d)u.logRecords[d]=Et.opentelemetry.proto.logs.v1.LogRecord.toObject(e.logRecords[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.logs.v1.ScopeLogs"},i})(),a.SeverityNumber=(function(){var i={},s=Object.create(i);return s[i[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,s[i[1]="SEVERITY_NUMBER_TRACE"]=1,s[i[2]="SEVERITY_NUMBER_TRACE2"]=2,s[i[3]="SEVERITY_NUMBER_TRACE3"]=3,s[i[4]="SEVERITY_NUMBER_TRACE4"]=4,s[i[5]="SEVERITY_NUMBER_DEBUG"]=5,s[i[6]="SEVERITY_NUMBER_DEBUG2"]=6,s[i[7]="SEVERITY_NUMBER_DEBUG3"]=7,s[i[8]="SEVERITY_NUMBER_DEBUG4"]=8,s[i[9]="SEVERITY_NUMBER_INFO"]=9,s[i[10]="SEVERITY_NUMBER_INFO2"]=10,s[i[11]="SEVERITY_NUMBER_INFO3"]=11,s[i[12]="SEVERITY_NUMBER_INFO4"]=12,s[i[13]="SEVERITY_NUMBER_WARN"]=13,s[i[14]="SEVERITY_NUMBER_WARN2"]=14,s[i[15]="SEVERITY_NUMBER_WARN3"]=15,s[i[16]="SEVERITY_NUMBER_WARN4"]=16,s[i[17]="SEVERITY_NUMBER_ERROR"]=17,s[i[18]="SEVERITY_NUMBER_ERROR2"]=18,s[i[19]="SEVERITY_NUMBER_ERROR3"]=19,s[i[20]="SEVERITY_NUMBER_ERROR4"]=20,s[i[21]="SEVERITY_NUMBER_FATAL"]=21,s[i[22]="SEVERITY_NUMBER_FATAL2"]=22,s[i[23]="SEVERITY_NUMBER_FATAL3"]=23,s[i[24]="SEVERITY_NUMBER_FATAL4"]=24,s})(),a.LogRecordFlags=(function(){var i={},s=Object.create(i);return s[i[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,s[i[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,s})(),a.LogRecord=(function(){function i(s){if(this.attributes=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.timeUnixNano=null,i.prototype.observedTimeUnixNano=null,i.prototype.severityNumber=null,i.prototype.severityText=null,i.prototype.body=null,i.prototype.attributes=Vt.emptyArray,i.prototype.droppedAttributesCount=null,i.prototype.flags=null,i.prototype.traceId=null,i.prototype.spanId=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.timeUnixNano!=null&&Object.hasOwnProperty.call(e,"timeUnixNano")&&o.uint32(9).fixed64(e.timeUnixNano),e.severityNumber!=null&&Object.hasOwnProperty.call(e,"severityNumber")&&o.uint32(16).int32(e.severityNumber),e.severityText!=null&&Object.hasOwnProperty.call(e,"severityText")&&o.uint32(26).string(e.severityText),e.body!=null&&Object.hasOwnProperty.call(e,"body")&&Et.opentelemetry.proto.common.v1.AnyValue.encode(e.body,o.uint32(42).fork()).ldelim(),e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(50).fork()).ldelim();return e.droppedAttributesCount!=null&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&o.uint32(56).uint32(e.droppedAttributesCount),e.flags!=null&&Object.hasOwnProperty.call(e,"flags")&&o.uint32(69).fixed32(e.flags),e.traceId!=null&&Object.hasOwnProperty.call(e,"traceId")&&o.uint32(74).bytes(e.traceId),e.spanId!=null&&Object.hasOwnProperty.call(e,"spanId")&&o.uint32(82).bytes(e.spanId),e.observedTimeUnixNano!=null&&Object.hasOwnProperty.call(e,"observedTimeUnixNano")&&o.uint32(89).fixed64(e.observedTimeUnixNano),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.logs.v1.LogRecord;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.timeUnixNano=e.fixed64();break}case 11:{d.observedTimeUnixNano=e.fixed64();break}case 2:{d.severityNumber=e.int32();break}case 3:{d.severityText=e.string();break}case 5:{d.body=Et.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break}case 6:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 7:{d.droppedAttributesCount=e.uint32();break}case 8:{d.flags=e.fixed32();break}case 9:{d.traceId=e.bytes();break}case 10:{d.spanId=e.bytes();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.timeUnixNano!=null&&e.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(e.timeUnixNano)&&!(e.timeUnixNano&&Vt.isInteger(e.timeUnixNano.low)&&Vt.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(e.observedTimeUnixNano!=null&&e.hasOwnProperty("observedTimeUnixNano")&&!Vt.isInteger(e.observedTimeUnixNano)&&!(e.observedTimeUnixNano&&Vt.isInteger(e.observedTimeUnixNano.low)&&Vt.isInteger(e.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected";if(e.severityNumber!=null&&e.hasOwnProperty("severityNumber"))switch(e.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:break}if(e.severityText!=null&&e.hasOwnProperty("severityText")&&!Vt.isString(e.severityText))return"severityText: string expected";if(e.body!=null&&e.hasOwnProperty("body")){var o=Et.opentelemetry.proto.common.v1.AnyValue.verify(e.body);if(o)return"body."+o}if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var u=0;u<e.attributes.length;++u){var o=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[u]);if(o)return"attributes."+o}}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":e.flags!=null&&e.hasOwnProperty("flags")&&!Vt.isInteger(e.flags)?"flags: integer expected":e.traceId!=null&&e.hasOwnProperty("traceId")&&!(e.traceId&&typeof e.traceId.length=="number"||Vt.isString(e.traceId))?"traceId: buffer expected":e.spanId!=null&&e.hasOwnProperty("spanId")&&!(e.spanId&&typeof e.spanId.length=="number"||Vt.isString(e.spanId))?"spanId: buffer expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.logs.v1.LogRecord)return e;var o=new Et.opentelemetry.proto.logs.v1.LogRecord;switch(e.timeUnixNano!=null&&(Vt.Long?(o.timeUnixNano=Vt.Long.fromValue(e.timeUnixNano)).unsigned=!1:typeof e.timeUnixNano=="string"?o.timeUnixNano=parseInt(e.timeUnixNano,10):typeof e.timeUnixNano=="number"?o.timeUnixNano=e.timeUnixNano:typeof e.timeUnixNano=="object"&&(o.timeUnixNano=new Vt.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),e.observedTimeUnixNano!=null&&(Vt.Long?(o.observedTimeUnixNano=Vt.Long.fromValue(e.observedTimeUnixNano)).unsigned=!1:typeof e.observedTimeUnixNano=="string"?o.observedTimeUnixNano=parseInt(e.observedTimeUnixNano,10):typeof e.observedTimeUnixNano=="number"?o.observedTimeUnixNano=e.observedTimeUnixNano:typeof e.observedTimeUnixNano=="object"&&(o.observedTimeUnixNano=new Vt.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber())),e.severityNumber){default:if(typeof e.severityNumber=="number"){o.severityNumber=e.severityNumber;break}break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:o.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:o.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:o.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:o.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:o.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:o.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:o.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:o.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:o.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:o.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:o.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:o.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:o.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:o.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:o.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:o.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:o.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:o.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:o.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:o.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:o.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:o.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:o.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:o.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:o.severityNumber=24;break}if(e.severityText!=null&&(o.severityText=String(e.severityText)),e.body!=null){if(typeof e.body!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");o.body=Et.opentelemetry.proto.common.v1.AnyValue.fromObject(e.body)}if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}return e.droppedAttributesCount!=null&&(o.droppedAttributesCount=e.droppedAttributesCount>>>0),e.flags!=null&&(o.flags=e.flags>>>0),e.traceId!=null&&(typeof e.traceId=="string"?Vt.base64.decode(e.traceId,o.traceId=Vt.newBuffer(Vt.base64.length(e.traceId)),0):e.traceId.length>=0&&(o.traceId=e.traceId)),e.spanId!=null&&(typeof e.spanId=="string"?Vt.base64.decode(e.spanId,o.spanId=Vt.newBuffer(Vt.base64.length(e.spanId)),0):e.spanId.length>=0&&(o.spanId=e.spanId)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.attributes=[]),o.defaults){if(Vt.Long){var d=new Vt.Long(0,0,!1);u.timeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.timeUnixNano=o.longs===String?"0":0;if(u.severityNumber=o.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,u.severityText="",u.body=null,u.droppedAttributesCount=0,u.flags=0,o.bytes===String?u.traceId="":(u.traceId=[],o.bytes!==Array&&(u.traceId=Vt.newBuffer(u.traceId))),o.bytes===String?u.spanId="":(u.spanId=[],o.bytes!==Array&&(u.spanId=Vt.newBuffer(u.spanId))),Vt.Long){var d=new Vt.Long(0,0,!1);u.observedTimeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.observedTimeUnixNano=o.longs===String?"0":0}if(e.timeUnixNano!=null&&e.hasOwnProperty("timeUnixNano")&&(typeof e.timeUnixNano=="number"?u.timeUnixNano=o.longs===String?String(e.timeUnixNano):e.timeUnixNano:u.timeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.timeUnixNano):o.longs===Number?new Vt.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),e.severityNumber!=null&&e.hasOwnProperty("severityNumber")&&(u.severityNumber=o.enums===String?Et.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]===void 0?e.severityNumber:Et.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]:e.severityNumber),e.severityText!=null&&e.hasOwnProperty("severityText")&&(u.severityText=e.severityText),e.body!=null&&e.hasOwnProperty("body")&&(u.body=Et.opentelemetry.proto.common.v1.AnyValue.toObject(e.body,o)),e.attributes&&e.attributes.length){u.attributes=[];for(var I=0;I<e.attributes.length;++I)u.attributes[I]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[I],o)}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&(u.droppedAttributesCount=e.droppedAttributesCount),e.flags!=null&&e.hasOwnProperty("flags")&&(u.flags=e.flags),e.traceId!=null&&e.hasOwnProperty("traceId")&&(u.traceId=o.bytes===String?Vt.base64.encode(e.traceId,0,e.traceId.length):o.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),e.spanId!=null&&e.hasOwnProperty("spanId")&&(u.spanId=o.bytes===String?Vt.base64.encode(e.spanId,0,e.spanId.length):o.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),e.observedTimeUnixNano!=null&&e.hasOwnProperty("observedTimeUnixNano")&&(typeof e.observedTimeUnixNano=="number"?u.observedTimeUnixNano=o.longs===String?String(e.observedTimeUnixNano):e.observedTimeUnixNano:u.observedTimeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.observedTimeUnixNano):o.longs===Number?new Vt.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber():e.observedTimeUnixNano),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.logs.v1.LogRecord"},i})(),a})(),r})(),t})(),n})();HYn.exports=Et});var kYn=ve(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});Ax.ProtobufTraceSerializer=Ax.ProtobufMetricsSerializer=Ax.ProtobufLogsSerializer=void 0;var XM=XYn(),t4a=Zye(),n4a=BFe(),r4a=JFe(),a4a=XM.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,i4a=XM.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,l4a=XM.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,s4a=XM.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,o4a=XM.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,c4a=XM.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;Ax.ProtobufLogsSerializer={serializeRequest:n=>{let t=(0,r4a.createExportLogsServiceRequest)(n);return i4a.encode(t).finish()},deserializeResponse:n=>a4a.decode(n)};Ax.ProtobufMetricsSerializer={serializeRequest:n=>{let t=(0,n4a.createExportMetricsServiceRequest)(n);return s4a.encode(t).finish()},deserializeResponse:n=>l4a.decode(n)};Ax.ProtobufTraceSerializer={serializeRequest:n=>{let t=(0,t4a.createExportTraceServiceRequest)(n);return c4a.encode(t).finish()},deserializeResponse:n=>o4a.decode(n)}});var LYn=ve(Wx=>{"use strict";Object.defineProperty(Wx,"__esModule",{value:!0});Wx.JsonLogsSerializer=Wx.JsonMetricsSerializer=Wx.JsonTraceSerializer=void 0;var u4a=Zye(),I4a=BFe(),d4a=JFe();Wx.JsonTraceSerializer={serializeRequest:n=>{let t=(0,u4a.createExportTraceServiceRequest)(n,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:n=>{let t=new TextDecoder;return JSON.parse(t.decode(n))}};Wx.JsonMetricsSerializer={serializeRequest:n=>{let t=(0,I4a.createExportMetricsServiceRequest)(n,{useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:n=>{let t=new TextDecoder;return JSON.parse(t.decode(n))}};Wx.JsonLogsSerializer={serializeRequest:n=>{let t=(0,d4a.createExportLogsServiceRequest)(n,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:n=>{let t=new TextDecoder;return JSON.parse(t.decode(n))}}});var xk=ve(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.JsonMetricsSerializer=qs.JsonLogsSerializer=qs.JsonTraceSerializer=qs.ProtobufTraceSerializer=qs.ProtobufMetricsSerializer=qs.ProtobufLogsSerializer=qs.createExportLogsServiceRequest=qs.createExportMetricsServiceRequest=qs.createExportTraceServiceRequest=qs.ESpanKind=qs.hrTimeToNanos=qs.encodeAsString=qs.encodeAsLongBits=qs.getOtlpEncoder=qs.toLongBits=void 0;var Sle=Wle();Object.defineProperty(qs,"toLongBits",{enumerable:!0,get:function(){return Sle.toLongBits}});Object.defineProperty(qs,"getOtlpEncoder",{enumerable:!0,get:function(){return Sle.getOtlpEncoder}});Object.defineProperty(qs,"encodeAsLongBits",{enumerable:!0,get:function(){return Sle.encodeAsLongBits}});Object.defineProperty(qs,"encodeAsString",{enumerable:!0,get:function(){return Sle.encodeAsString}});Object.defineProperty(qs,"hrTimeToNanos",{enumerable:!0,get:function(){return Sle.hrTimeToNanos}});var h4a=Uwn();Object.defineProperty(qs,"ESpanKind",{enumerable:!0,get:function(){return h4a.ESpanKind}});var m4a=Zye();Object.defineProperty(qs,"createExportTraceServiceRequest",{enumerable:!0,get:function(){return m4a.createExportTraceServiceRequest}});var p4a=BFe();Object.defineProperty(qs,"createExportMetricsServiceRequest",{enumerable:!0,get:function(){return p4a.createExportMetricsServiceRequest}});var b4a=JFe();Object.defineProperty(qs,"createExportLogsServiceRequest",{enumerable:!0,get:function(){return b4a.createExportLogsServiceRequest}});var Xut=kYn();Object.defineProperty(qs,"ProtobufLogsSerializer",{enumerable:!0,get:function(){return Xut.ProtobufLogsSerializer}});Object.defineProperty(qs,"ProtobufMetricsSerializer",{enumerable:!0,get:function(){return Xut.ProtobufMetricsSerializer}});Object.defineProperty(qs,"ProtobufTraceSerializer",{enumerable:!0,get:function(){return Xut.ProtobufTraceSerializer}});var kut=LYn();Object.defineProperty(qs,"JsonTraceSerializer",{enumerable:!0,get:function(){return kut.JsonTraceSerializer}});Object.defineProperty(qs,"JsonLogsSerializer",{enumerable:!0,get:function(){return kut.JsonLogsSerializer}});Object.defineProperty(qs,"JsonMetricsSerializer",{enumerable:!0,get:function(){return kut.JsonMetricsSerializer}})});var SYn=ve(TFe=>{"use strict";Object.defineProperty(TFe,"__esModule",{value:!0});TFe.VERSION=void 0;TFe.VERSION="0.52.1"});var BYn=ve(OFe=>{"use strict";Object.defineProperty(OFe,"__esModule",{value:!0});OFe.OTLPTraceExporter=void 0;var DFe=Va(),Lut=bye(),f4a=xk(),G4a=SYn(),g4a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${G4a.VERSION}`},Sut=class extends Lut.OTLPGRPCExporterNodeBase{constructor(t={}){let r=Object.assign(Object.assign({},g4a),DFe.baggageUtils.parseKeyPairsIntoRecord((0,DFe.getEnv)().OTEL_EXPORTER_OTLP_TRACES_HEADERS));super(t,r,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export",f4a.ProtobufTraceSerializer)}getDefaultUrl(t){return(0,Lut.validateAndNormalizeUrl)(this.getUrlFromConfig(t))}getUrlFromConfig(t){return typeof t.url=="string"?t.url:(0,DFe.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||(0,DFe.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT||Lut.DEFAULT_COLLECTOR_URL}};OFe.OTLPTraceExporter=Sut});var But=ve(Vk=>{"use strict";var v4a=Vk&&Vk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),Z4a=Vk&&Vk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&v4a(t,n,r)};Object.defineProperty(Vk,"__esModule",{value:!0});Z4a(BYn(),Vk)});var JYn=ve(UFe=>{"use strict";Object.defineProperty(UFe,"__esModule",{value:!0});UFe.VERSION=void 0;UFe.VERSION="0.52.1"});var TYn=ve(zFe=>{"use strict";Object.defineProperty(zFe,"__esModule",{value:!0});zFe.OTLPLogExporter=void 0;var MFe=Va(),Jut=bye(),N4a=xk(),A4a=JYn(),W4a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${A4a.VERSION}`},Tut=class extends Jut.OTLPGRPCExporterNodeBase{constructor(t={}){let r=Object.assign(Object.assign({},W4a),MFe.baggageUtils.parseKeyPairsIntoRecord((0,MFe.getEnv)().OTEL_EXPORTER_OTLP_LOGS_HEADERS));super(t,r,"LogsExportService","/opentelemetry.proto.collector.logs.v1.LogsService/Export",N4a.ProtobufLogsSerializer)}getDefaultUrl(t){return(0,Jut.validateAndNormalizeUrl)(this.getUrlFromConfig(t))}getUrlFromConfig(t){return typeof t.url=="string"?t.url:(0,MFe.getEnv)().OTEL_EXPORTER_OTLP_LOGS_ENDPOINT||(0,MFe.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT||Jut.DEFAULT_COLLECTOR_URL}};zFe.OTLPLogExporter=Tut});var DYn=ve(Qk=>{"use strict";var y4a=Qk&&Qk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),F4a=Qk&&Qk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&y4a(t,n,r)};Object.defineProperty(Qk,"__esModule",{value:!0});F4a(TYn(),Qk)});var Dut=ve(Ble=>{"use strict";Object.defineProperty(Ble,"__esModule",{value:!0});Ble.AggregationTemporalityPreference=void 0;var E4a;(function(n){n[n.DELTA=0]="DELTA",n[n.CUMULATIVE=1]="CUMULATIVE",n[n.LOWMEMORY=2]="LOWMEMORY"})(E4a=Ble.AggregationTemporalityPreference||(Ble.AggregationTemporalityPreference={}))});var Uut=ve(Sm=>{"use strict";Object.defineProperty(Sm,"__esModule",{value:!0});Sm.OTLPMetricExporterBase=Sm.LowMemoryTemporalitySelector=Sm.DeltaTemporalitySelector=Sm.CumulativeTemporalitySelector=void 0;var R4a=Va(),qd=VM(),OYn=Dut(),w4a=(Qr(),dr(kr)),C4a=()=>qd.AggregationTemporality.CUMULATIVE;Sm.CumulativeTemporalitySelector=C4a;var Y4a=n=>{switch(n){case qd.InstrumentType.COUNTER:case qd.InstrumentType.OBSERVABLE_COUNTER:case qd.InstrumentType.GAUGE:case qd.InstrumentType.HISTOGRAM:case qd.InstrumentType.OBSERVABLE_GAUGE:return qd.AggregationTemporality.DELTA;case qd.InstrumentType.UP_DOWN_COUNTER:case qd.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return qd.AggregationTemporality.CUMULATIVE}};Sm.DeltaTemporalitySelector=Y4a;var x4a=n=>{switch(n){case qd.InstrumentType.COUNTER:case qd.InstrumentType.HISTOGRAM:return qd.AggregationTemporality.DELTA;case qd.InstrumentType.GAUGE:case qd.InstrumentType.UP_DOWN_COUNTER:case qd.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:case qd.InstrumentType.OBSERVABLE_COUNTER:case qd.InstrumentType.OBSERVABLE_GAUGE:return qd.AggregationTemporality.CUMULATIVE}};Sm.LowMemoryTemporalitySelector=x4a;function V4a(){let n=(0,R4a.getEnv)(),t=n.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();return t==="cumulative"?Sm.CumulativeTemporalitySelector:t==="delta"?Sm.DeltaTemporalitySelector:t==="lowmemory"?Sm.LowMemoryTemporalitySelector:(w4a.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${n.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Sm.CumulativeTemporalitySelector)}function Q4a(n){return n!=null?n===OYn.AggregationTemporalityPreference.DELTA?Sm.DeltaTemporalitySelector:n===OYn.AggregationTemporalityPreference.LOWMEMORY?Sm.LowMemoryTemporalitySelector:Sm.CumulativeTemporalitySelector:V4a()}function H4a(n){return n?.aggregationPreference?n.aggregationPreference:t=>qd.Aggregation.Default()}var Out=class{constructor(t,r){this._otlpExporter=t,this._aggregationSelector=H4a(r),this._aggregationTemporalitySelector=Q4a(r?.temporalityPreference)}export(t,r){this._otlpExporter.export([t],r)}async shutdown(){await this._otlpExporter.shutdown()}forceFlush(){return Promise.resolve()}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}};Sm.OTLPMetricExporterBase=Out});var UYn=ve(_Fe=>{"use strict";Object.defineProperty(_Fe,"__esModule",{value:!0});_Fe.VERSION=void 0;_Fe.VERSION="0.52.1"});var zYn=ve(jFe=>{"use strict";Object.defineProperty(jFe,"__esModule",{value:!0});jFe.OTLPMetricExporter=void 0;var kM=Va(),X4a=Uut(),PFe=PY(),k4a=xk(),L4a=UYn(),MYn="v1/metrics",S4a=`http://localhost:4318/${MYn}`,B4a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${L4a.VERSION}`},Mut=class extends PFe.OTLPExporterNodeBase{constructor(t){super(t,k4a.JsonMetricsSerializer,"application/json"),this.headers=Object.assign(Object.assign(Object.assign(Object.assign({},this.headers),B4a),kM.baggageUtils.parseKeyPairsIntoRecord((0,kM.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS)),(0,PFe.parseHeaders)(t?.headers))}getDefaultUrl(t){return typeof t.url=="string"?t.url:(0,kM.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length>0?(0,PFe.appendRootPathToUrlIfNeeded)((0,kM.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT):(0,kM.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length>0?(0,PFe.appendResourcePathToUrl)((0,kM.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT,MYn):S4a}},zut=class extends X4a.OTLPMetricExporterBase{constructor(t){super(new Mut(t),t)}};jFe.OTLPMetricExporter=zut});var _Yn=ve(Hk=>{"use strict";var J4a=Hk&&Hk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),T4a=Hk&&Hk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&J4a(t,n,r)};Object.defineProperty(Hk,"__esModule",{value:!0});T4a(zYn(),Hk)});var PYn=ve(Xk=>{"use strict";var D4a=Xk&&Xk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),O4a=Xk&&Xk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&D4a(t,n,r)};Object.defineProperty(Xk,"__esModule",{value:!0});O4a(_Yn(),Xk)});var jYn=ve(jR=>{"use strict";var U4a=jR&&jR.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),_ut=jR&&jR.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&U4a(t,n,r)};Object.defineProperty(jR,"__esModule",{value:!0});_ut(PYn(),jR);_ut(Dut(),jR);_ut(Uut(),jR)});var KYn=ve(KFe=>{"use strict";Object.defineProperty(KFe,"__esModule",{value:!0});KFe.VERSION=void 0;KFe.VERSION="0.52.1"});var qYn=ve($Fe=>{"use strict";Object.defineProperty($Fe,"__esModule",{value:!0});$Fe.OTLPMetricExporter=void 0;var M4a=jYn(),Put=bye(),qFe=Va(),z4a=xk(),_4a=KYn(),P4a=PY(),j4a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${_4a.VERSION}`},jut=class extends Put.OTLPGRPCExporterNodeBase{constructor(t){let r=Object.assign(Object.assign(Object.assign({},j4a),qFe.baggageUtils.parseKeyPairsIntoRecord((0,qFe.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS)),(0,P4a.parseHeaders)(t?.headers));super(t,r,"MetricsExportService","/opentelemetry.proto.collector.metrics.v1.MetricsService/Export",z4a.ProtobufMetricsSerializer)}getDefaultUrl(t){return(0,Put.validateAndNormalizeUrl)(this.getUrlFromConfig(t))}getUrlFromConfig(t){return typeof t.url=="string"?t.url:(0,qFe.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT||(0,qFe.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT||Put.DEFAULT_COLLECTOR_URL}},Kut=class extends M4a.OTLPMetricExporterBase{constructor(t){super(new jut(t),t)}};$Fe.OTLPMetricExporter=Kut});var $Yn=ve(kk=>{"use strict";var K4a=kk&&kk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),q4a=kk&&kk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K4a(t,n,r)};Object.defineProperty(kk,"__esModule",{value:!0});q4a(qYn(),kk)});var $ut=ve(t5e=>{"use strict";Object.defineProperty(t5e,"__esModule",{value:!0});t5e.LogRecord=void 0;var $4a=(Qr(),dr(kr)),LM=(Qr(),dr(kr)),e5e=Va(),qut=class{constructor(t,r,a){this.attributes={},this.totalAttributesCount=0,this._isReadonly=!1;let{timestamp:i,observedTimestamp:s,severityNumber:e,severityText:o,body:u,attributes:d={},context:I}=a,h=Date.now();if(this.hrTime=(0,e5e.timeInputToHrTime)(i??h),this.hrTimeObserved=(0,e5e.timeInputToHrTime)(s??h),I){let c=LM.trace.getSpanContext(I);c&&LM.isSpanContextValid(c)&&(this.spanContext=c)}this.severityNumber=e,this.severityText=o,this.body=u,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this.setAttributes(d)}set severityText(t){this._isLogRecordReadonly()||(this._severityText=t)}get severityText(){return this._severityText}set severityNumber(t){this._isLogRecordReadonly()||(this._severityNumber=t)}get severityNumber(){return this._severityNumber}set body(t){this._isLogRecordReadonly()||(this._body=t)}get body(){return this._body}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}setAttribute(t,r){return this._isLogRecordReadonly()?this:r===null?this:t.length===0?(LM.diag.warn(`Invalid attribute key: ${t}`),this):!(0,e5e.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(LM.diag.warn(`Invalid attribute value set for key: ${t}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this.droppedAttributesCount===1&&LM.diag.warn("Dropping extra attributes."),this):((0,e5e.isAttributeValue)(r)?this.attributes[t]=this._truncateToSize(r):this.attributes[t]=r,this))}setAttributes(t){for(let[r,a]of Object.entries(t))this.setAttribute(r,a);return this}setBody(t){return this.body=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(t){let r=this._logRecordLimits.attributeValueLengthLimit;return r<=0?(LM.diag.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(a=>typeof a=="string"?this._truncateToLimitUtil(a,r):a):t}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&$4a.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};t5e.LogRecord=qut});var exn=ve(n5e=>{"use strict";Object.defineProperty(n5e,"__esModule",{value:!0});n5e.Logger=void 0;var ewa=(Qr(),dr(kr)),twa=$ut(),eIt=class{constructor(t,r){this.instrumentationScope=t,this._sharedState=r}emit(t){let r=t.context||ewa.context.active(),a=new twa.LogRecord(this._sharedState,this.instrumentationScope,Object.assign({context:r},t));this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}};n5e.Logger=eIt});var txn=ve(SM=>{"use strict";Object.defineProperty(SM,"__esModule",{value:!0});SM.reconfigureLimits=SM.loadDefaultConfig=void 0;var Jle=Va();function nwa(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,Jle.getEnv)().OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:(0,Jle.getEnv)().OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT},includeTraceContext:!0}}SM.loadDefaultConfig=nwa;function rwa(n){var t,r,a,i,s,e;let o=(0,Jle.getEnvWithoutDefaults)();return{attributeCountLimit:(a=(r=(t=n.attributeCountLimit)!==null&&t!==void 0?t:o.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT)!==null&&r!==void 0?r:o.OTEL_ATTRIBUTE_COUNT_LIMIT)!==null&&a!==void 0?a:Jle.DEFAULT_ATTRIBUTE_COUNT_LIMIT,attributeValueLengthLimit:(e=(s=(i=n.attributeValueLengthLimit)!==null&&i!==void 0?i:o.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&s!==void 0?s:o.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&e!==void 0?e:Jle.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT}}SM.reconfigureLimits=rwa});var nxn=ve(r5e=>{"use strict";Object.defineProperty(r5e,"__esModule",{value:!0});r5e.MultiLogRecordProcessor=void 0;var awa=Va(),tIt=class{constructor(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>(0,awa.callWithTimeout)(r.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(a=>a.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(t=>t.shutdown()))}};r5e.MultiLogRecordProcessor=tIt});var rIt=ve(a5e=>{"use strict";Object.defineProperty(a5e,"__esModule",{value:!0});a5e.NoopLogRecordProcessor=void 0;var nIt=class{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}};a5e.NoopLogRecordProcessor=nIt});var rxn=ve(i5e=>{"use strict";Object.defineProperty(i5e,"__esModule",{value:!0});i5e.LoggerProviderSharedState=void 0;var iwa=rIt(),aIt=class{constructor(t,r,a){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=a,this.loggers=new Map,this.registeredLogRecordProcessors=[],this.activeProcessor=new iwa.NoopLogRecordProcessor}};i5e.LoggerProviderSharedState=aIt});var sxn=ve(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});Lk.LoggerProvider=Lk.DEFAULT_LOGGER_NAME=void 0;var Tle=(Qr(),dr(kr)),lwa=pU(),axn=gx(),ixn=Va(),swa=exn(),lxn=txn(),owa=nxn(),cwa=rxn();Lk.DEFAULT_LOGGER_NAME="unknown";var iIt=class{constructor(t={}){var r;let a=(0,ixn.merge)({},(0,lxn.loadDefaultConfig)(),t),i=axn.Resource.default().merge((r=a.resource)!==null&&r!==void 0?r:axn.Resource.empty());this._sharedState=new cwa.LoggerProviderSharedState(i,a.forceFlushTimeoutMillis,(0,lxn.reconfigureLimits)(a.logRecordLimits)),this._shutdownOnce=new ixn.BindOnceFuture(this._shutdown,this)}getLogger(t,r,a){if(this._shutdownOnce.isCalled)return Tle.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),lwa.NOOP_LOGGER;t||Tle.diag.warn("Logger requested without instrumentation scope name.");let i=t||Lk.DEFAULT_LOGGER_NAME,s=`${i}@${r||""}:${a?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new swa.Logger({name:i,version:r,schemaUrl:a?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}addLogRecordProcessor(t){this._sharedState.registeredLogRecordProcessors.length===0&&this._sharedState.activeProcessor.shutdown().catch(r=>Tle.diag.error("Error while trying to shutdown current log record processor",r)),this._sharedState.registeredLogRecordProcessors.push(t),this._sharedState.activeProcessor=new owa.MultiLogRecordProcessor(this._sharedState.registeredLogRecordProcessors,this._sharedState.forceFlushTimeoutMillis)}forceFlush(){return this._shutdownOnce.isCalled?(Tle.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(Tle.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};Lk.LoggerProvider=iIt});var oxn=ve(l5e=>{"use strict";Object.defineProperty(l5e,"__esModule",{value:!0});l5e.ConsoleLogRecordExporter=void 0;var uwa=Va(),Iwa=Va(),lIt=class{export(t,r){this._sendLogRecords(t,r)}shutdown(){return Promise.resolve()}_exportInfo(t){var r,a,i;return{resource:{attributes:t.resource.attributes},timestamp:(0,uwa.hrTimeToMicroseconds)(t.hrTime),traceId:(r=t.spanContext)===null||r===void 0?void 0:r.traceId,spanId:(a=t.spanContext)===null||a===void 0?void 0:a.spanId,traceFlags:(i=t.spanContext)===null||i===void 0?void 0:i.traceFlags,severityText:t.severityText,severityNumber:t.severityNumber,body:t.body,attributes:t.attributes}}_sendLogRecords(t,r){for(let a of t)console.dir(this._exportInfo(a),{depth:3});r?.({code:Iwa.ExportResultCode.SUCCESS})}};l5e.ConsoleLogRecordExporter=lIt});var cxn=ve(s5e=>{"use strict";Object.defineProperty(s5e,"__esModule",{value:!0});s5e.SimpleLogRecordProcessor=void 0;var BM=Va(),sIt=class{constructor(t){this._exporter=t,this._shutdownOnce=new BM.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(t){var r,a;if(this._shutdownOnce.isCalled)return;let i=()=>BM.internal._export(this._exporter,[t]).then(s=>{var e;s.code!==BM.ExportResultCode.SUCCESS&&(0,BM.globalErrorHandler)((e=s.error)!==null&&e!==void 0?e:new Error(`SimpleLogRecordProcessor: log record export failed (status ${s})`))}).catch(BM.globalErrorHandler);if(t.resource.asyncAttributesPending){let s=(a=(r=t.resource).waitForAsyncAttributes)===null||a===void 0?void 0:a.call(r).then(()=>(this._unresolvedExports.delete(s),i()),BM.globalErrorHandler);s!=null&&this._unresolvedExports.add(s)}else i()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};s5e.SimpleLogRecordProcessor=sIt});var Ixn=ve(o5e=>{"use strict";Object.defineProperty(o5e,"__esModule",{value:!0});o5e.InMemoryLogRecordExporter=void 0;var uxn=Va(),oIt=class{constructor(){this._finishedLogRecords=[],this._stopped=!1}export(t,r){if(this._stopped)return r({code:uxn.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...t),r({code:uxn.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};o5e.InMemoryLogRecordExporter=oIt});var dxn=ve(c5e=>{"use strict";Object.defineProperty(c5e,"__esModule",{value:!0});c5e.BatchLogRecordProcessorBase=void 0;var dwa=(Qr(),dr(kr)),ZF=Va(),cIt=class{constructor(t,r){var a,i,s,e;this._exporter=t,this._finishedLogRecords=[];let o=(0,ZF.getEnv)();this._maxExportBatchSize=(a=r?.maxExportBatchSize)!==null&&a!==void 0?a:o.OTEL_BLRP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize=(i=r?.maxQueueSize)!==null&&i!==void 0?i:o.OTEL_BLRP_MAX_QUEUE_SIZE,this._scheduledDelayMillis=(s=r?.scheduledDelayMillis)!==null&&s!==void 0?s:o.OTEL_BLRP_SCHEDULE_DELAY,this._exportTimeoutMillis=(e=r?.exportTimeoutMillis)!==null&&e!==void 0?e:o.OTEL_BLRP_EXPORT_TIMEOUT,this._shutdownOnce=new ZF.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(dwa.diag.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(t){this._shutdownOnce.isCalled||this._addToBuffer(t)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())}_flushAll(){return new Promise((t,r)=>{let a=[],i=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let s=0;s<i;s++)a.push(this._flushOneBatch());Promise.all(a).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((t,r)=>{(0,ZF.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>t()).catch(r)})}_maybeStartTimer(){this._timer===void 0&&(this._timer=setTimeout(()=>{this._flushOneBatch().then(()=>{this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(t=>{(0,ZF.globalErrorHandler)(t)})},this._scheduledDelayMillis),(0,ZF.unrefTimer)(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(t){let r=()=>ZF.internal._export(this._exporter,t).then(i=>{var s;i.code!==ZF.ExportResultCode.SUCCESS&&(0,ZF.globalErrorHandler)((s=i.error)!==null&&s!==void 0?s:new Error(`BatchLogRecordProcessor: log record export failed (status ${i})`))}).catch(ZF.globalErrorHandler),a=t.map(i=>i.resource).filter(i=>i.asyncAttributesPending);return a.length===0?r():Promise.all(a.map(i=>{var s;return(s=i.waitForAsyncAttributes)===null||s===void 0?void 0:s.call(i)})).then(r,ZF.globalErrorHandler)}};c5e.BatchLogRecordProcessorBase=cIt});var hxn=ve(u5e=>{"use strict";Object.defineProperty(u5e,"__esModule",{value:!0});u5e.BatchLogRecordProcessor=void 0;var hwa=dxn(),uIt=class extends hwa.BatchLogRecordProcessorBase{onShutdown(){}};u5e.BatchLogRecordProcessor=uIt});var mxn=ve(I5e=>{"use strict";Object.defineProperty(I5e,"__esModule",{value:!0});I5e.BatchLogRecordProcessor=void 0;var mwa=hxn();Object.defineProperty(I5e,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return mwa.BatchLogRecordProcessor}})});var pxn=ve(d5e=>{"use strict";Object.defineProperty(d5e,"__esModule",{value:!0});d5e.BatchLogRecordProcessor=void 0;var pwa=mxn();Object.defineProperty(d5e,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return pwa.BatchLogRecordProcessor}})});var h5e=ve(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});rb.BatchLogRecordProcessor=rb.InMemoryLogRecordExporter=rb.SimpleLogRecordProcessor=rb.ConsoleLogRecordExporter=rb.NoopLogRecordProcessor=rb.LogRecord=rb.LoggerProvider=void 0;var bwa=sxn();Object.defineProperty(rb,"LoggerProvider",{enumerable:!0,get:function(){return bwa.LoggerProvider}});var fwa=$ut();Object.defineProperty(rb,"LogRecord",{enumerable:!0,get:function(){return fwa.LogRecord}});var Gwa=rIt();Object.defineProperty(rb,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return Gwa.NoopLogRecordProcessor}});var gwa=oxn();Object.defineProperty(rb,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return gwa.ConsoleLogRecordExporter}});var vwa=cxn();Object.defineProperty(rb,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return vwa.SimpleLogRecordProcessor}});var Zwa=Ixn();Object.defineProperty(rb,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return Zwa.InMemoryLogRecordExporter}});var Nwa=pxn();Object.defineProperty(rb,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return Nwa.BatchLogRecordProcessor}})});var dIt=ve(m5e=>{"use strict";Object.defineProperty(m5e,"__esModule",{value:!0});m5e.AbstractAsyncHooksContextManager=void 0;var Awa=vt("events"),Wwa=["addListener","on","once","prependListener","prependOnceListener"],IIt=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(t,r){return r instanceof Awa.EventEmitter?this._bindEventEmitter(t,r):typeof r=="function"?this._bindFunction(t,r):r}_bindFunction(t,r){let a=this,i=function(...s){return a.with(t,()=>r.apply(this,s))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),i}_bindEventEmitter(t,r){return this._getPatchMap(r)!==void 0||(this._createPatchMap(r),Wwa.forEach(i=>{r[i]!==void 0&&(r[i]=this._patchAddListener(r,r[i],t))}),typeof r.removeListener=="function"&&(r.removeListener=this._patchRemoveListener(r,r.removeListener)),typeof r.off=="function"&&(r.off=this._patchRemoveListener(r,r.off)),typeof r.removeAllListeners=="function"&&(r.removeAllListeners=this._patchRemoveAllListeners(r,r.removeAllListeners))),r}_patchRemoveListener(t,r){let a=this;return function(i,s){var e;let o=(e=a._getPatchMap(t))===null||e===void 0?void 0:e[i];if(o===void 0)return r.call(this,i,s);let u=o.get(s);return r.call(this,i,u||s)}}_patchRemoveAllListeners(t,r){let a=this;return function(i){let s=a._getPatchMap(t);return s!==void 0&&(arguments.length===0?a._createPatchMap(t):s[i]!==void 0&&delete s[i]),r.apply(this,arguments)}}_patchAddListener(t,r,a){let i=this;return function(s,e){if(i._wrapped)return r.call(this,s,e);let o=i._getPatchMap(t);o===void 0&&(o=i._createPatchMap(t));let u=o[s];u===void 0&&(u=new WeakMap,o[s]=u);let d=i.bind(a,e);u.set(e,d),i._wrapped=!0;try{return r.call(this,s,d)}finally{i._wrapped=!1}}}_createPatchMap(t){let r=Object.create(null);return t[this._kOtListeners]=r,r}_getPatchMap(t){return t[this._kOtListeners]}};m5e.AbstractAsyncHooksContextManager=IIt});var bxn=ve(p5e=>{"use strict";Object.defineProperty(p5e,"__esModule",{value:!0});p5e.AsyncHooksContextManager=void 0;var ywa=(Qr(),dr(kr)),Fwa=vt("async_hooks"),Ewa=dIt(),hIt=class extends Ewa.AbstractAsyncHooksContextManager{constructor(){super(),this._contexts=new Map,this._stack=[],this._asyncHook=Fwa.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){var t;return(t=this._stack[this._stack.length-1])!==null&&t!==void 0?t:ywa.ROOT_CONTEXT}with(t,r,a,...i){this._enterContext(t);try{return r.call(a,...i)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(t,r){if(r==="TIMERWRAP")return;let a=this._stack[this._stack.length-1];a!==void 0&&this._contexts.set(t,a)}_destroy(t){this._contexts.delete(t)}_before(t){let r=this._contexts.get(t);r!==void 0&&this._enterContext(r)}_after(){this._exitContext()}_enterContext(t){this._stack.push(t)}_exitContext(){this._stack.pop()}};p5e.AsyncHooksContextManager=hIt});var fxn=ve(b5e=>{"use strict";Object.defineProperty(b5e,"__esModule",{value:!0});b5e.AsyncLocalStorageContextManager=void 0;var Rwa=(Qr(),dr(kr)),wwa=vt("async_hooks"),Cwa=dIt(),mIt=class extends Cwa.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new wwa.AsyncLocalStorage}active(){var t;return(t=this._asyncLocalStorage.getStore())!==null&&t!==void 0?t:Rwa.ROOT_CONTEXT}with(t,r,a,...i){let s=a==null?r:r.bind(a);return this._asyncLocalStorage.run(t,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};b5e.AsyncLocalStorageContextManager=mIt});var Gxn=ve(JM=>{"use strict";Object.defineProperty(JM,"__esModule",{value:!0});JM.AsyncLocalStorageContextManager=JM.AsyncHooksContextManager=void 0;var Ywa=bxn();Object.defineProperty(JM,"AsyncHooksContextManager",{enumerable:!0,get:function(){return Ywa.AsyncHooksContextManager}});var xwa=fxn();Object.defineProperty(JM,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return xwa.AsyncLocalStorageContextManager}})});var pIt=ve(f5e=>{"use strict";Object.defineProperty(f5e,"__esModule",{value:!0});f5e.B3_DEBUG_FLAG_KEY=void 0;var Vwa=(Qr(),dr(kr));f5e.B3_DEBUG_FLAG_KEY=(0,Vwa.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var Dle=ve(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});cG.X_B3_FLAGS=cG.X_B3_PARENT_SPAN_ID=cG.X_B3_SAMPLED=cG.X_B3_SPAN_ID=cG.X_B3_TRACE_ID=cG.B3_CONTEXT_HEADER=void 0;cG.B3_CONTEXT_HEADER="b3";cG.X_B3_TRACE_ID="x-b3-traceid";cG.X_B3_SPAN_ID="x-b3-spanid";cG.X_B3_SAMPLED="x-b3-sampled";cG.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";cG.X_B3_FLAGS="x-b3-flags"});var Zxn=ve(g5e=>{"use strict";Object.defineProperty(g5e,"__esModule",{value:!0});g5e.B3MultiPropagator=void 0;var u3=(Qr(),dr(kr)),Qwa=Va(),gxn=pIt(),cg=Dle(),Hwa=new Set([!0,"true","True","1",1]),Xwa=new Set([!1,"false","False","0",0]);function kwa(n){return n===u3.TraceFlags.SAMPLED||n===u3.TraceFlags.NONE}function Lwa(n){return Array.isArray(n)?n[0]:n}function G5e(n,t,r){let a=t.get(n,r);return Lwa(a)}function Swa(n,t){let r=G5e(n,t,cg.X_B3_TRACE_ID);return typeof r=="string"?r.padStart(32,"0"):""}function Bwa(n,t){let r=G5e(n,t,cg.X_B3_SPAN_ID);return typeof r=="string"?r:""}function vxn(n,t){return G5e(n,t,cg.X_B3_FLAGS)==="1"?"1":void 0}function Jwa(n,t){let r=G5e(n,t,cg.X_B3_SAMPLED);if(vxn(n,t)==="1"||Hwa.has(r))return u3.TraceFlags.SAMPLED;if(r===void 0||Xwa.has(r))return u3.TraceFlags.NONE}var bIt=class{inject(t,r,a){let i=u3.trace.getSpanContext(t);if(!i||!(0,u3.isSpanContextValid)(i)||(0,Qwa.isTracingSuppressed)(t))return;let s=t.getValue(gxn.B3_DEBUG_FLAG_KEY);a.set(r,cg.X_B3_TRACE_ID,i.traceId),a.set(r,cg.X_B3_SPAN_ID,i.spanId),s==="1"?a.set(r,cg.X_B3_FLAGS,s):i.traceFlags!==void 0&&a.set(r,cg.X_B3_SAMPLED,(u3.TraceFlags.SAMPLED&i.traceFlags)===u3.TraceFlags.SAMPLED?"1":"0")}extract(t,r,a){let i=Swa(r,a),s=Bwa(r,a),e=Jwa(r,a),o=vxn(r,a);return(0,u3.isValidTraceId)(i)&&(0,u3.isValidSpanId)(s)&&kwa(e)?(t=t.setValue(gxn.B3_DEBUG_FLAG_KEY,o),u3.trace.setSpanContext(t,{traceId:i,spanId:s,isRemote:!0,traceFlags:e})):t}fields(){return[cg.X_B3_TRACE_ID,cg.X_B3_SPAN_ID,cg.X_B3_FLAGS,cg.X_B3_SAMPLED,cg.X_B3_PARENT_SPAN_ID]}};g5e.B3MultiPropagator=bIt});var Axn=ve(v5e=>{"use strict";Object.defineProperty(v5e,"__esModule",{value:!0});v5e.B3SinglePropagator=void 0;var Sk=(Qr(),dr(kr)),Twa=Va(),Nxn=pIt(),fIt=Dle(),Dwa=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,Owa="0".repeat(16),Uwa=new Set(["d","1"]),Mwa="d";function zwa(n){return n.length===32?n:`${Owa}${n}`}function _wa(n){return n&&Uwa.has(n)?Sk.TraceFlags.SAMPLED:Sk.TraceFlags.NONE}var GIt=class{inject(t,r,a){let i=Sk.trace.getSpanContext(t);if(!i||!(0,Sk.isSpanContextValid)(i)||(0,Twa.isTracingSuppressed)(t))return;let s=t.getValue(Nxn.B3_DEBUG_FLAG_KEY)||i.traceFlags&1,e=`${i.traceId}-${i.spanId}-${s}`;a.set(r,fIt.B3_CONTEXT_HEADER,e)}extract(t,r,a){let i=a.get(r,fIt.B3_CONTEXT_HEADER),s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return t;let e=s.match(Dwa);if(!e)return t;let[,o,u,d]=e,I=zwa(o);if(!(0,Sk.isValidTraceId)(I)||!(0,Sk.isValidSpanId)(u))return t;let h=_wa(d);return d===Mwa&&(t=t.setValue(Nxn.B3_DEBUG_FLAG_KEY,d)),Sk.trace.setSpanContext(t,{traceId:I,spanId:u,isRemote:!0,traceFlags:h})}fields(){return[fIt.B3_CONTEXT_HEADER]}};v5e.B3SinglePropagator=GIt});var gIt=ve(Ole=>{"use strict";Object.defineProperty(Ole,"__esModule",{value:!0});Ole.B3InjectEncoding=void 0;var Pwa;(function(n){n[n.SINGLE_HEADER=0]="SINGLE_HEADER",n[n.MULTI_HEADER=1]="MULTI_HEADER"})(Pwa=Ole.B3InjectEncoding||(Ole.B3InjectEncoding={}))});var Wxn=ve(Z5e=>{"use strict";Object.defineProperty(Z5e,"__esModule",{value:!0});Z5e.B3Propagator=void 0;var jwa=Va(),Kwa=Zxn(),qwa=Axn(),$wa=Dle(),eCa=gIt(),vIt=class{constructor(t={}){this._b3MultiPropagator=new Kwa.B3MultiPropagator,this._b3SinglePropagator=new qwa.B3SinglePropagator,t.injectEncoding===eCa.B3InjectEncoding.MULTI_HEADER?(this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields()):(this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields())}inject(t,r,a){(0,jwa.isTracingSuppressed)(t)||this._inject(t,r,a)}extract(t,r,a){let i=a.get(r,$wa.B3_CONTEXT_HEADER);return(Array.isArray(i)?i[0]:i)?this._b3SinglePropagator.extract(t,r,a):this._b3MultiPropagator.extract(t,r,a)}fields(){return this._fields}};Z5e.B3Propagator=vIt});var yxn=ve(KR=>{"use strict";var tCa=KR&&KR.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),ZIt=KR&&KR.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&tCa(t,n,r)};Object.defineProperty(KR,"__esModule",{value:!0});ZIt(Wxn(),KR);ZIt(Dle(),KR);ZIt(gIt(),KR)});var Fxn=ve(N5e=>{"use strict";Object.defineProperty(N5e,"__esModule",{value:!0});N5e.ExceptionEventName=void 0;N5e.ExceptionEventName="exception"});var AIt=ve(A5e=>{"use strict";Object.defineProperty(A5e,"__esModule",{value:!0});A5e.Span=void 0;var I3=(Qr(),dr(kr)),ab=Va(),Bk=Xm(),nCa=Fxn(),NIt=class{constructor(t,r,a,i,s,e,o=[],u,d,I){this.attributes={},this.links=[],this.events=[],this._droppedAttributesCount=0,this._droppedEventsCount=0,this._droppedLinksCount=0,this.status={code:I3.SpanStatusCode.UNSET},this.endTime=[0,0],this._ended=!1,this._duration=[-1,-1],this.name=a,this._spanContext=i,this.parentSpanId=e,this.kind=s,this.links=o;let h=Date.now();this._performanceStartTime=ab.otperformance.now(),this._performanceOffset=h-(this._performanceStartTime+(0,ab.getTimeOrigin)()),this._startTimeProvided=u!=null,this.startTime=this._getTime(u??h),this.resource=t.resource,this.instrumentationLibrary=t.instrumentationLibrary,this._spanLimits=t.getSpanLimits(),this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,I!=null&&this.setAttributes(I),this._spanProcessor=t.getActiveSpanProcessor(),this._spanProcessor.onStart(this,r)}spanContext(){return this._spanContext}setAttribute(t,r){return r==null||this._isSpanEnded()?this:t.length===0?(I3.diag.warn(`Invalid attribute key: ${t}`),this):(0,ab.isAttributeValue)(r)?Object.keys(this.attributes).length>=this._spanLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),this):(I3.diag.warn(`Invalid attribute value set for key: ${t}`),this)}setAttributes(t){for(let[r,a]of Object.entries(t))this.setAttribute(r,a);return this}addEvent(t,r,a){if(this._isSpanEnded())return this;if(this._spanLimits.eventCountLimit===0)return I3.diag.warn("No events allowed."),this._droppedEventsCount++,this;this.events.length>=this._spanLimits.eventCountLimit&&(this._droppedEventsCount===0&&I3.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,ab.isTimeInput)(r)&&((0,ab.isTimeInput)(a)||(a=r),r=void 0);let i=(0,ab.sanitizeAttributes)(r);return this.events.push({name:t,attributes:i,time:this._getTime(a),droppedAttributesCount:0}),this}addLink(t){return this.links.push(t),this}addLinks(t){return this.links.push(...t),this}setStatus(t){return this._isSpanEnded()?this:(this.status=t,this)}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){I3.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this._ended=!0,this.endTime=this._getTime(t),this._duration=(0,ab.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(I3.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&I3.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<ab.otperformance.now())return(0,ab.hrTime)(t+this._performanceOffset);if(typeof t=="number")return(0,ab.millisToHrTime)(t);if(t instanceof Date)return(0,ab.millisToHrTime)(t.getTime());if((0,ab.isTimeInputHrTime)(t))return t;if(this._startTimeProvided)return(0,ab.millisToHrTime)(Date.now());let r=ab.otperformance.now()-this._performanceStartTime;return(0,ab.addHrTimes)(this.startTime,(0,ab.millisToHrTime)(r))}isRecording(){return this._ended===!1}recordException(t,r){let a={};typeof t=="string"?a[Bk.SEMATTRS_EXCEPTION_MESSAGE]=t:t&&(t.code?a[Bk.SEMATTRS_EXCEPTION_TYPE]=t.code.toString():t.name&&(a[Bk.SEMATTRS_EXCEPTION_TYPE]=t.name),t.message&&(a[Bk.SEMATTRS_EXCEPTION_MESSAGE]=t.message),t.stack&&(a[Bk.SEMATTRS_EXCEPTION_STACKTRACE]=t.stack)),a[Bk.SEMATTRS_EXCEPTION_TYPE]||a[Bk.SEMATTRS_EXCEPTION_MESSAGE]?this.addEvent(nCa.ExceptionEventName,a,r):I3.diag.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){return this._ended&&I3.diag.warn(`Can not execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`),this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substr(0,r)}_truncateToSize(t){let r=this._attributeValueLengthLimit;return r<=0?(I3.diag.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(a=>typeof a=="string"?this._truncateToLimitUtil(a,r):a):t}};A5e.Span=NIt});var Mle=ve(Ule=>{"use strict";Object.defineProperty(Ule,"__esModule",{value:!0});Ule.SamplingDecision=void 0;var rCa;(function(n){n[n.NOT_RECORD=0]="NOT_RECORD",n[n.RECORD=1]="RECORD",n[n.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(rCa=Ule.SamplingDecision||(Ule.SamplingDecision={}))});var y5e=ve(W5e=>{"use strict";Object.defineProperty(W5e,"__esModule",{value:!0});W5e.AlwaysOffSampler=void 0;var aCa=Mle(),WIt=class{shouldSample(){return{decision:aCa.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};W5e.AlwaysOffSampler=WIt});var E5e=ve(F5e=>{"use strict";Object.defineProperty(F5e,"__esModule",{value:!0});F5e.AlwaysOnSampler=void 0;var iCa=Mle(),yIt=class{shouldSample(){return{decision:iCa.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};F5e.AlwaysOnSampler=yIt});var RIt=ve(w5e=>{"use strict";Object.defineProperty(w5e,"__esModule",{value:!0});w5e.ParentBasedSampler=void 0;var R5e=(Qr(),dr(kr)),lCa=Va(),Exn=y5e(),FIt=E5e(),EIt=class{constructor(t){var r,a,i,s;this._root=t.root,this._root||((0,lCa.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new FIt.AlwaysOnSampler),this._remoteParentSampled=(r=t.remoteParentSampled)!==null&&r!==void 0?r:new FIt.AlwaysOnSampler,this._remoteParentNotSampled=(a=t.remoteParentNotSampled)!==null&&a!==void 0?a:new Exn.AlwaysOffSampler,this._localParentSampled=(i=t.localParentSampled)!==null&&i!==void 0?i:new FIt.AlwaysOnSampler,this._localParentNotSampled=(s=t.localParentNotSampled)!==null&&s!==void 0?s:new Exn.AlwaysOffSampler}shouldSample(t,r,a,i,s,e){let o=R5e.trace.getSpanContext(t);return!o||!(0,R5e.isSpanContextValid)(o)?this._root.shouldSample(t,r,a,i,s,e):o.isRemote?o.traceFlags&R5e.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(t,r,a,i,s,e):this._remoteParentNotSampled.shouldSample(t,r,a,i,s,e):o.traceFlags&R5e.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(t,r,a,i,s,e):this._localParentNotSampled.shouldSample(t,r,a,i,s,e)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};w5e.ParentBasedSampler=EIt});var CIt=ve(C5e=>{"use strict";Object.defineProperty(C5e,"__esModule",{value:!0});C5e.TraceIdRatioBasedSampler=void 0;var sCa=(Qr(),dr(kr)),Rxn=Mle(),wIt=class{constructor(t=0){this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:(0,sCa.isValidTraceId)(r)&&this._accumulate(r)<this._upperBound?Rxn.SamplingDecision.RECORD_AND_SAMPLED:Rxn.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let a=0;a<t.length/8;a++){let i=a*8,s=parseInt(t.slice(i,i+8),16);r=(r^s)>>>0}return r}};C5e.TraceIdRatioBasedSampler=wIt});var VIt=ve(DM=>{"use strict";Object.defineProperty(DM,"__esModule",{value:!0});DM.buildSamplerFromEnv=DM.loadDefaultConfig=void 0;var Y5e=(Qr(),dr(kr)),Bm=Va(),wxn=y5e(),YIt=E5e(),xIt=RIt(),Cxn=CIt(),oCa=(0,Bm.getEnv)(),cCa=Bm.TracesSamplerValues.AlwaysOn,TM=1;function uCa(){return{sampler:xxn(oCa),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,Bm.getEnv)().OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:(0,Bm.getEnv)().OTEL_ATTRIBUTE_COUNT_LIMIT},spanLimits:{attributeValueLengthLimit:(0,Bm.getEnv)().OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:(0,Bm.getEnv)().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,linkCountLimit:(0,Bm.getEnv)().OTEL_SPAN_LINK_COUNT_LIMIT,eventCountLimit:(0,Bm.getEnv)().OTEL_SPAN_EVENT_COUNT_LIMIT,attributePerEventCountLimit:(0,Bm.getEnv)().OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,attributePerLinkCountLimit:(0,Bm.getEnv)().OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT}}}DM.loadDefaultConfig=uCa;function xxn(n=(0,Bm.getEnv)()){switch(n.OTEL_TRACES_SAMPLER){case Bm.TracesSamplerValues.AlwaysOn:return new YIt.AlwaysOnSampler;case Bm.TracesSamplerValues.AlwaysOff:return new wxn.AlwaysOffSampler;case Bm.TracesSamplerValues.ParentBasedAlwaysOn:return new xIt.ParentBasedSampler({root:new YIt.AlwaysOnSampler});case Bm.TracesSamplerValues.ParentBasedAlwaysOff:return new xIt.ParentBasedSampler({root:new wxn.AlwaysOffSampler});case Bm.TracesSamplerValues.TraceIdRatio:return new Cxn.TraceIdRatioBasedSampler(Yxn(n));case Bm.TracesSamplerValues.ParentBasedTraceIdRatio:return new xIt.ParentBasedSampler({root:new Cxn.TraceIdRatioBasedSampler(Yxn(n))});default:return Y5e.diag.error(`OTEL_TRACES_SAMPLER value "${n.OTEL_TRACES_SAMPLER} invalid, defaulting to ${cCa}".`),new YIt.AlwaysOnSampler}}DM.buildSamplerFromEnv=xxn;function Yxn(n){if(n.OTEL_TRACES_SAMPLER_ARG===void 0||n.OTEL_TRACES_SAMPLER_ARG==="")return Y5e.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${TM}.`),TM;let t=Number(n.OTEL_TRACES_SAMPLER_ARG);return isNaN(t)?(Y5e.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${TM}.`),TM):t<0||t>1?(Y5e.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${TM}.`),TM):t}});var HIt=ve(OM=>{"use strict";Object.defineProperty(OM,"__esModule",{value:!0});OM.reconfigureLimits=OM.mergeConfig=void 0;var Vxn=VIt(),QIt=Va();function ICa(n){let t={sampler:(0,Vxn.buildSamplerFromEnv)()},r=(0,Vxn.loadDefaultConfig)(),a=Object.assign({},r,t,n);return a.generalLimits=Object.assign({},r.generalLimits,n.generalLimits||{}),a.spanLimits=Object.assign({},r.spanLimits,n.spanLimits||{}),a}OM.mergeConfig=ICa;function dCa(n){var t,r,a,i,s,e,o,u,d,I,h,c;let G=Object.assign({},n.spanLimits),W=(0,QIt.getEnvWithoutDefaults)();return G.attributeCountLimit=(e=(s=(i=(r=(t=n.spanLimits)===null||t===void 0?void 0:t.attributeCountLimit)!==null&&r!==void 0?r:(a=n.generalLimits)===null||a===void 0?void 0:a.attributeCountLimit)!==null&&i!==void 0?i:W.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT)!==null&&s!==void 0?s:W.OTEL_ATTRIBUTE_COUNT_LIMIT)!==null&&e!==void 0?e:QIt.DEFAULT_ATTRIBUTE_COUNT_LIMIT,G.attributeValueLengthLimit=(c=(h=(I=(u=(o=n.spanLimits)===null||o===void 0?void 0:o.attributeValueLengthLimit)!==null&&u!==void 0?u:(d=n.generalLimits)===null||d===void 0?void 0:d.attributeValueLengthLimit)!==null&&I!==void 0?I:W.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&h!==void 0?h:W.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&c!==void 0?c:QIt.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},n,{spanLimits:G})}OM.reconfigureLimits=dCa});var Qxn=ve(x5e=>{"use strict";Object.defineProperty(x5e,"__esModule",{value:!0});x5e.BatchSpanProcessorBase=void 0;var UM=(Qr(),dr(kr)),Jk=Va(),XIt=class{constructor(t,r){this._exporter=t,this._isExporting=!1,this._finishedSpans=[],this._droppedSpansCount=0;let a=(0,Jk.getEnv)();this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:a.OTEL_BSP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:a.OTEL_BSP_MAX_QUEUE_SIZE,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:a.OTEL_BSP_SCHEDULE_DELAY,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:a.OTEL_BSP_EXPORT_TIMEOUT,this._shutdownOnce=new Jk.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(UM.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&UM.TraceFlags.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&UM.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(UM.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{let a=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let s=0,e=i;s<e;s++)a.push(this._flushOneBatch());Promise.all(a).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{let a=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);UM.context.with((0,Jk.suppressTracing)(UM.context.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(i,o=>{var u;clearTimeout(a),o.code===Jk.ExportResultCode.SUCCESS?t():r((u=o.error)!==null&&u!==void 0?u:new Error("BatchSpanProcessor: span export failed"))}),e=null;for(let o=0,u=i.length;o<u;o++){let d=i[o];d.resource.asyncAttributesPending&&d.resource.waitForAsyncAttributes&&(e??(e=[]),e.push(d.resource.waitForAsyncAttributes()))}e===null?s():Promise.all(e).then(s,o=>{(0,Jk.globalErrorHandler)(o),r(o)})})})}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,(0,Jk.globalErrorHandler)(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),(0,Jk.unrefTimer)(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};x5e.BatchSpanProcessorBase=XIt});var Hxn=ve(V5e=>{"use strict";Object.defineProperty(V5e,"__esModule",{value:!0});V5e.BatchSpanProcessor=void 0;var hCa=Qxn(),kIt=class extends hCa.BatchSpanProcessorBase{onShutdown(){}};V5e.BatchSpanProcessor=kIt});var Lxn=ve(H5e=>{"use strict";Object.defineProperty(H5e,"__esModule",{value:!0});H5e.RandomIdGenerator=void 0;var mCa=8,kxn=16,LIt=class{constructor(){this.generateTraceId=Xxn(kxn),this.generateSpanId=Xxn(mCa)}};H5e.RandomIdGenerator=LIt;var Q5e=Buffer.allocUnsafe(kxn);function Xxn(n){return function(){for(let r=0;r<n/4;r++)Q5e.writeUInt32BE(Math.random()*2**32>>>0,r*4);for(let r=0;r<n&&!(Q5e[r]>0);r++)r===n-1&&(Q5e[n-1]=1);return Q5e.toString("hex",0,n)}}});var Bxn=ve(yx=>{"use strict";var pCa=yx&&yx.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),Sxn=yx&&yx.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&pCa(t,n,r)};Object.defineProperty(yx,"__esModule",{value:!0});Sxn(Hxn(),yx);Sxn(Lxn(),yx)});var X5e=ve(Tk=>{"use strict";var bCa=Tk&&Tk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),fCa=Tk&&Tk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&bCa(t,n,r)};Object.defineProperty(Tk,"__esModule",{value:!0});fCa(Bxn(),Tk)});var Jxn=ve(L5e=>{"use strict";Object.defineProperty(L5e,"__esModule",{value:!0});L5e.Tracer=void 0;var Jm=(Qr(),dr(kr)),k5e=Va(),GCa=AIt(),gCa=HIt(),vCa=X5e(),SIt=class{constructor(t,r,a){this._tracerProvider=a;let i=(0,gCa.mergeConfig)(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new vCa.RandomIdGenerator,this.resource=a.resource,this.instrumentationLibrary=t}startSpan(t,r={},a=Jm.context.active()){var i,s,e;r.root&&(a=Jm.trace.deleteSpan(a));let o=Jm.trace.getSpan(a);if((0,k5e.isTracingSuppressed)(a))return Jm.diag.debug("Instrumentation suppressed, returning Noop Span"),Jm.trace.wrapSpanContext(Jm.INVALID_SPAN_CONTEXT);let u=o?.spanContext(),d=this._idGenerator.generateSpanId(),I,h,c;!u||!Jm.trace.isSpanContextValid(u)?I=this._idGenerator.generateTraceId():(I=u.traceId,h=u.traceState,c=u.spanId);let G=(i=r.kind)!==null&&i!==void 0?i:Jm.SpanKind.INTERNAL,W=((s=r.links)!==null&&s!==void 0?s:[]).map(f=>({context:f.context,attributes:(0,k5e.sanitizeAttributes)(f.attributes)})),y=(0,k5e.sanitizeAttributes)(r.attributes),R=this._sampler.shouldSample(a,I,t,G,y,W);h=(e=R.traceState)!==null&&e!==void 0?e:h;let F=R.decision===Jm.SamplingDecision.RECORD_AND_SAMPLED?Jm.TraceFlags.SAMPLED:Jm.TraceFlags.NONE,C={traceId:I,spanId:d,traceFlags:F,traceState:h};if(R.decision===Jm.SamplingDecision.NOT_RECORD)return Jm.diag.debug("Recording is off, propagating context in a non-recording span"),Jm.trace.wrapSpanContext(C);let A=(0,k5e.sanitizeAttributes)(Object.assign(y,R.attributes));return new GCa.Span(this,a,t,C,G,c,W,r.startTime,void 0,A)}startActiveSpan(t,r,a,i){let s,e,o;if(arguments.length<2)return;arguments.length===2?o=r:arguments.length===3?(s=r,o=a):(s=r,e=a,o=i);let u=e??Jm.context.active(),d=this.startSpan(t,s,u),I=Jm.trace.setSpan(u,d);return Jm.context.with(I,o,void 0,d)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}getActiveSpanProcessor(){return this._tracerProvider.getActiveSpanProcessor()}};L5e.Tracer=SIt});var Txn=ve(S5e=>{"use strict";Object.defineProperty(S5e,"__esModule",{value:!0});S5e.MultiSpanProcessor=void 0;var ZCa=Va(),BIt=class{constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(a=>{(0,ZCa.globalErrorHandler)(a||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(let a of this._spanProcessors)a.onStart(t,r)}onEnd(t){for(let r of this._spanProcessors)r.onEnd(t)}shutdown(){let t=[];for(let r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,a)=>{Promise.all(t).then(()=>{r()},a)})}};S5e.MultiSpanProcessor=BIt});var TIt=ve(B5e=>{"use strict";Object.defineProperty(B5e,"__esModule",{value:!0});B5e.NoopSpanProcessor=void 0;var JIt=class{onStart(t,r){}onEnd(t){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};B5e.NoopSpanProcessor=JIt});var Oxn=ve(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});Dk.BasicTracerProvider=Dk.ForceFlushState=void 0;var MM=(Qr(),dr(kr)),_M=Va(),Dxn=gx(),NCa=Ok(),ACa=VIt(),WCa=Txn(),yCa=TIt(),FCa=X5e(),ECa=HIt(),zM;(function(n){n[n.resolved=0]="resolved",n[n.timeout=1]="timeout",n[n.error=2]="error",n[n.unresolved=3]="unresolved"})(zM=Dk.ForceFlushState||(Dk.ForceFlushState={}));var zle=class{constructor(t={}){var r;this._registeredSpanProcessors=[],this._tracers=new Map;let a=(0,_M.merge)({},(0,ACa.loadDefaultConfig)(),(0,ECa.reconfigureLimits)(t));this.resource=(r=a.resource)!==null&&r!==void 0?r:Dxn.Resource.empty(),this.resource=Dxn.Resource.default().merge(this.resource),this._config=Object.assign({},a,{resource:this.resource});let i=this._buildExporterFromEnv();if(i!==void 0){let s=new FCa.BatchSpanProcessor(i);this.activeSpanProcessor=s}else this.activeSpanProcessor=new yCa.NoopSpanProcessor}getTracer(t,r,a){let i=`${t}@${r||""}:${a?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new NCa.Tracer({name:t,version:r,schemaUrl:a?.schemaUrl},this._config,this)),this._tracers.get(i)}addSpanProcessor(t){this._registeredSpanProcessors.length===0&&this.activeSpanProcessor.shutdown().catch(r=>MM.diag.error("Error while trying to shutdown current span processor",r)),this._registeredSpanProcessors.push(t),this.activeSpanProcessor=new WCa.MultiSpanProcessor(this._registeredSpanProcessors)}getActiveSpanProcessor(){return this.activeSpanProcessor}register(t={}){MM.trace.setGlobalTracerProvider(this),t.propagator===void 0&&(t.propagator=this._buildPropagatorFromEnv()),t.contextManager&&MM.context.setGlobalContextManager(t.contextManager),t.propagator&&MM.propagation.setGlobalPropagator(t.propagator)}forceFlush(){let t=this._config.forceFlushTimeoutMillis,r=this._registeredSpanProcessors.map(a=>new Promise(i=>{let s,e=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${t} ms`)),s=zM.timeout},t);a.forceFlush().then(()=>{clearTimeout(e),s!==zM.timeout&&(s=zM.resolved,i(s))}).catch(o=>{clearTimeout(e),s=zM.error,i(o)})}));return new Promise((a,i)=>{Promise.all(r).then(s=>{let e=s.filter(o=>o!==zM.resolved);e.length>0?i(e):a()}).catch(s=>i([s]))})}shutdown(){return this.activeSpanProcessor.shutdown()}_getPropagator(t){var r;return(r=this.constructor._registeredPropagators.get(t))===null||r===void 0?void 0:r()}_getSpanExporter(t){var r;return(r=this.constructor._registeredExporters.get(t))===null||r===void 0?void 0:r()}_buildPropagatorFromEnv(){let t=Array.from(new Set((0,_M.getEnv)().OTEL_PROPAGATORS)),a=t.map(i=>{let s=this._getPropagator(i);return s||MM.diag.warn(`Propagator "${i}" requested through environment variable is unavailable.`),s}).reduce((i,s)=>(s&&i.push(s),i),[]);if(a.length!==0)return t.length===1?a[0]:new _M.CompositePropagator({propagators:a})}_buildExporterFromEnv(){let t=(0,_M.getEnv)().OTEL_TRACES_EXPORTER;if(t==="none"||t==="")return;let r=this._getSpanExporter(t);return r||MM.diag.error(`Exporter "${t}" requested through environment variable is unavailable.`),r}};Dk.BasicTracerProvider=zle;zle._registeredPropagators=new Map([["tracecontext",()=>new _M.W3CTraceContextPropagator],["baggage",()=>new _M.W3CBaggagePropagator]]);zle._registeredExporters=new Map});var Uxn=ve(J5e=>{"use strict";Object.defineProperty(J5e,"__esModule",{value:!0});J5e.ConsoleSpanExporter=void 0;var DIt=Va(),OIt=class{export(t,r){return this._sendSpans(t,r)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(t){var r;return{resource:{attributes:t.resource.attributes},traceId:t.spanContext().traceId,parentId:t.parentSpanId,traceState:(r=t.spanContext().traceState)===null||r===void 0?void 0:r.serialize(),name:t.name,id:t.spanContext().spanId,kind:t.kind,timestamp:(0,DIt.hrTimeToMicroseconds)(t.startTime),duration:(0,DIt.hrTimeToMicroseconds)(t.duration),attributes:t.attributes,status:t.status,events:t.events,links:t.links}}_sendSpans(t,r){for(let a of t)console.dir(this._exportInfo(a),{depth:3});if(r)return r({code:DIt.ExportResultCode.SUCCESS})}};J5e.ConsoleSpanExporter=OIt});var zxn=ve(T5e=>{"use strict";Object.defineProperty(T5e,"__esModule",{value:!0});T5e.InMemorySpanExporter=void 0;var Mxn=Va(),UIt=class{constructor(){this._finishedSpans=[],this._stopped=!1}export(t,r){if(this._stopped)return r({code:Mxn.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...t),setTimeout(()=>r({code:Mxn.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};T5e.InMemorySpanExporter=UIt});var Pxn=ve(_xn=>{"use strict";Object.defineProperty(_xn,"__esModule",{value:!0})});var jxn=ve(D5e=>{"use strict";Object.defineProperty(D5e,"__esModule",{value:!0});D5e.SimpleSpanProcessor=void 0;var RCa=(Qr(),dr(kr)),PM=Va(),MIt=class{constructor(t){this._exporter=t,this._shutdownOnce=new PM.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(t,r){}onEnd(t){var r,a;if(this._shutdownOnce.isCalled||(t.spanContext().traceFlags&RCa.TraceFlags.SAMPLED)===0)return;let i=()=>PM.internal._export(this._exporter,[t]).then(s=>{var e;s.code!==PM.ExportResultCode.SUCCESS&&(0,PM.globalErrorHandler)((e=s.error)!==null&&e!==void 0?e:new Error(`SimpleSpanProcessor: span export failed (status ${s})`))}).catch(s=>{(0,PM.globalErrorHandler)(s)});if(t.resource.asyncAttributesPending){let s=(a=(r=t.resource).waitForAsyncAttributes)===null||a===void 0?void 0:a.call(r).then(()=>(s!=null&&this._unresolvedExports.delete(s),i()),e=>(0,PM.globalErrorHandler)(e));s!=null&&this._unresolvedExports.add(s)}else i()}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};D5e.SimpleSpanProcessor=MIt});var qxn=ve(Kxn=>{"use strict";Object.defineProperty(Kxn,"__esModule",{value:!0})});var eVn=ve($xn=>{"use strict";Object.defineProperty($xn,"__esModule",{value:!0})});var nVn=ve(tVn=>{"use strict";Object.defineProperty(tVn,"__esModule",{value:!0})});var aVn=ve(rVn=>{"use strict";Object.defineProperty(rVn,"__esModule",{value:!0})});var lVn=ve(iVn=>{"use strict";Object.defineProperty(iVn,"__esModule",{value:!0})});var Ok=ve(Iu=>{"use strict";var wCa=Iu&&Iu.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),L0=Iu&&Iu.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&wCa(t,n,r)};Object.defineProperty(Iu,"__esModule",{value:!0});L0(Jxn(),Iu);L0(Oxn(),Iu);L0(X5e(),Iu);L0(Uxn(),Iu);L0(zxn(),Iu);L0(Pxn(),Iu);L0(jxn(),Iu);L0(qxn(),Iu);L0(TIt(),Iu);L0(y5e(),Iu);L0(E5e(),Iu);L0(RIt(),Iu);L0(CIt(),Iu);L0(Mle(),Iu);L0(AIt(),Iu);L0(eVn(),Iu);L0(nVn(),Iu);L0(aVn(),Iu);L0(lVn(),Iu)});var _le=ve((CKi,sVn)=>{"use strict";var CCa="2.0.0",YCa=Number.MAX_SAFE_INTEGER||9007199254740991,xCa=16,VCa=250,QCa=["major","premajor","minor","preminor","patch","prepatch","prerelease"];sVn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:xCa,MAX_SAFE_BUILD_LENGTH:VCa,MAX_SAFE_INTEGER:YCa,RELEASE_TYPES:QCa,SEMVER_SPEC_VERSION:CCa,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Ple=ve((YKi,oVn)=>{"use strict";var HCa=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{};oVn.exports=HCa});var jM=ve((NF,cVn)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:zIt,MAX_SAFE_BUILD_LENGTH:XCa,MAX_LENGTH:kCa}=_le(),LCa=Ple();NF=cVn.exports={};var SCa=NF.re=[],BCa=NF.safeRe=[],aa=NF.src=[],JCa=NF.safeSrc=[],ia=NF.t={},TCa=0,_It="[a-zA-Z0-9-]",DCa=[["\\s",1],["\\d",kCa],[_It,XCa]],OCa=n=>{for(let[t,r]of DCa)n=n.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return n},Di=(n,t,r)=>{let a=OCa(t),i=TCa++;LCa(n,i,t),ia[n]=i,aa[i]=t,JCa[i]=a,SCa[i]=new RegExp(t,r?"g":void 0),BCa[i]=new RegExp(a,r?"g":void 0)};Di("NUMERICIDENTIFIER","0|[1-9]\\d*");Di("NUMERICIDENTIFIERLOOSE","\\d+");Di("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${_It}*`);Di("MAINVERSION",`(${aa[ia.NUMERICIDENTIFIER]})\\.(${aa[ia.NUMERICIDENTIFIER]})\\.(${aa[ia.NUMERICIDENTIFIER]})`);Di("MAINVERSIONLOOSE",`(${aa[ia.NUMERICIDENTIFIERLOOSE]})\\.(${aa[ia.NUMERICIDENTIFIERLOOSE]})\\.(${aa[ia.NUMERICIDENTIFIERLOOSE]})`);Di("PRERELEASEIDENTIFIER",`(?:${aa[ia.NONNUMERICIDENTIFIER]}|${aa[ia.NUMERICIDENTIFIER]})`);Di("PRERELEASEIDENTIFIERLOOSE",`(?:${aa[ia.NONNUMERICIDENTIFIER]}|${aa[ia.NUMERICIDENTIFIERLOOSE]})`);Di("PRERELEASE",`(?:-(${aa[ia.PRERELEASEIDENTIFIER]}(?:\\.${aa[ia.PRERELEASEIDENTIFIER]})*))`);Di("PRERELEASELOOSE",`(?:-?(${aa[ia.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${aa[ia.PRERELEASEIDENTIFIERLOOSE]})*))`);Di("BUILDIDENTIFIER",`${_It}+`);Di("BUILD",`(?:\\+(${aa[ia.BUILDIDENTIFIER]}(?:\\.${aa[ia.BUILDIDENTIFIER]})*))`);Di("FULLPLAIN",`v?${aa[ia.MAINVERSION]}${aa[ia.PRERELEASE]}?${aa[ia.BUILD]}?`);Di("FULL",`^${aa[ia.FULLPLAIN]}$`);Di("LOOSEPLAIN",`[v=\\s]*${aa[ia.MAINVERSIONLOOSE]}${aa[ia.PRERELEASELOOSE]}?${aa[ia.BUILD]}?`);Di("LOOSE",`^${aa[ia.LOOSEPLAIN]}$`);Di("GTLT","((?:<|>)?=?)");Di("XRANGEIDENTIFIERLOOSE",`${aa[ia.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Di("XRANGEIDENTIFIER",`${aa[ia.NUMERICIDENTIFIER]}|x|X|\\*`);Di("XRANGEPLAIN",`[v=\\s]*(${aa[ia.XRANGEIDENTIFIER]})(?:\\.(${aa[ia.XRANGEIDENTIFIER]})(?:\\.(${aa[ia.XRANGEIDENTIFIER]})(?:${aa[ia.PRERELEASE]})?${aa[ia.BUILD]}?)?)?`);Di("XRANGEPLAINLOOSE",`[v=\\s]*(${aa[ia.XRANGEIDENTIFIERLOOSE]})(?:\\.(${aa[ia.XRANGEIDENTIFIERLOOSE]})(?:\\.(${aa[ia.XRANGEIDENTIFIERLOOSE]})(?:${aa[ia.PRERELEASELOOSE]})?${aa[ia.BUILD]}?)?)?`);Di("XRANGE",`^${aa[ia.GTLT]}\\s*${aa[ia.XRANGEPLAIN]}$`);Di("XRANGELOOSE",`^${aa[ia.GTLT]}\\s*${aa[ia.XRANGEPLAINLOOSE]}$`);Di("COERCEPLAIN",`(^|[^\\d])(\\d{1,${zIt}})(?:\\.(\\d{1,${zIt}}))?(?:\\.(\\d{1,${zIt}}))?`);Di("COERCE",`${aa[ia.COERCEPLAIN]}(?:$|[^\\d])`);Di("COERCEFULL",aa[ia.COERCEPLAIN]+`(?:${aa[ia.PRERELEASE]})?(?:${aa[ia.BUILD]})?(?:$|[^\\d])`);Di("COERCERTL",aa[ia.COERCE],!0);Di("COERCERTLFULL",aa[ia.COERCEFULL],!0);Di("LONETILDE","(?:~>?)");Di("TILDETRIM",`(\\s*)${aa[ia.LONETILDE]}\\s+`,!0);NF.tildeTrimReplace="$1~";Di("TILDE",`^${aa[ia.LONETILDE]}${aa[ia.XRANGEPLAIN]}$`);Di("TILDELOOSE",`^${aa[ia.LONETILDE]}${aa[ia.XRANGEPLAINLOOSE]}$`);Di("LONECARET","(?:\\^)");Di("CARETTRIM",`(\\s*)${aa[ia.LONECARET]}\\s+`,!0);NF.caretTrimReplace="$1^";Di("CARET",`^${aa[ia.LONECARET]}${aa[ia.XRANGEPLAIN]}$`);Di("CARETLOOSE",`^${aa[ia.LONECARET]}${aa[ia.XRANGEPLAINLOOSE]}$`);Di("COMPARATORLOOSE",`^${aa[ia.GTLT]}\\s*(${aa[ia.LOOSEPLAIN]})$|^$`);Di("COMPARATOR",`^${aa[ia.GTLT]}\\s*(${aa[ia.FULLPLAIN]})$|^$`);Di("COMPARATORTRIM",`(\\s*)${aa[ia.GTLT]}\\s*(${aa[ia.LOOSEPLAIN]}|${aa[ia.XRANGEPLAIN]})`,!0);NF.comparatorTrimReplace="$1$2$3";Di("HYPHENRANGE",`^\\s*(${aa[ia.XRANGEPLAIN]})\\s+-\\s+(${aa[ia.XRANGEPLAIN]})\\s*$`);Di("HYPHENRANGELOOSE",`^\\s*(${aa[ia.XRANGEPLAINLOOSE]})\\s+-\\s+(${aa[ia.XRANGEPLAINLOOSE]})\\s*$`);Di("STAR","(<|>)?=?\\s*\\*");Di("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Di("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var O5e=ve((xKi,uVn)=>{"use strict";var UCa=Object.freeze({loose:!0}),MCa=Object.freeze({}),zCa=n=>n?typeof n!="object"?UCa:n:MCa;uVn.exports=zCa});var PIt=ve((VKi,hVn)=>{"use strict";var IVn=/^[0-9]+$/,dVn=(n,t)=>{if(typeof n=="number"&&typeof t=="number")return n===t?0:n<t?-1:1;let r=IVn.test(n),a=IVn.test(t);return r&&a&&(n=+n,t=+t),n===t?0:r&&!a?-1:a&&!r?1:n<t?-1:1},_Ca=(n,t)=>dVn(t,n);hVn.exports={compareIdentifiers:dVn,rcompareIdentifiers:_Ca}});var ib=ve((QKi,pVn)=>{"use strict";var U5e=Ple(),{MAX_LENGTH:mVn,MAX_SAFE_INTEGER:M5e}=_le(),{safeRe:z5e,t:_5e}=jM(),PCa=O5e(),{compareIdentifiers:jIt}=PIt(),KIt=class n{constructor(t,r){if(r=PCa(r),t instanceof n){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>mVn)throw new TypeError(`version is longer than ${mVn} characters`);U5e("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let a=t.trim().match(r.loose?z5e[_5e.LOOSE]:z5e[_5e.FULL]);if(!a)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>M5e||this.major<0)throw new TypeError("Invalid major version");if(this.minor>M5e||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>M5e||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<M5e)return s}return i}):this.prerelease=[],this.build=a[5]?a[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(U5e("SemVer.compare",this.version,this.options,t),!(t instanceof n)){if(typeof t=="string"&&t===this.version)return 0;t=new n(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof n||(t=new n(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof n||(t=new n(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let a=this.prerelease[r],i=t.prerelease[r];if(U5e("prerelease compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return jIt(a,i)}while(++r)}compareBuild(t){t instanceof n||(t=new n(t,this.options));let r=0;do{let a=this.build[r],i=t.build[r];if(U5e("build compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return jIt(a,i)}while(++r)}inc(t,r,a){if(t.startsWith("pre")){if(!r&&a===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?z5e[_5e.PRERELEASELOOSE]:z5e[_5e.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,a);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,a);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,a),this.inc("pre",r,a);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,a),this.inc("pre",r,a);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(a)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&a===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];a===!1&&(s=[r]),jIt(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};pVn.exports=KIt});var Uk=ve((HKi,fVn)=>{"use strict";var bVn=ib(),jCa=(n,t,r=!1)=>{if(n instanceof bVn)return n;try{return new bVn(n,t)}catch(a){if(!r)return null;throw a}};fVn.exports=jCa});var qIt=ve((XKi,GVn)=>{"use strict";var KCa=Uk(),qCa=(n,t)=>{let r=KCa(n,t);return r?r.version:null};GVn.exports=qCa});var $It=ve((kKi,gVn)=>{"use strict";var $Ca=Uk(),eYa=(n,t)=>{let r=$Ca(n.trim().replace(/^[=v]+/,""),t);return r?r.version:null};gVn.exports=eYa});var NVn=ve((LKi,ZVn)=>{"use strict";var vVn=ib(),tYa=(n,t,r,a,i)=>{typeof r=="string"&&(i=a,a=r,r=void 0);try{return new vVn(n instanceof vVn?n.version:n,r).inc(t,a,i).version}catch{return null}};ZVn.exports=tYa});var yVn=ve((SKi,WVn)=>{"use strict";var AVn=Uk(),nYa=(n,t)=>{let r=AVn(n,null,!0),a=AVn(t,null,!0),i=r.compare(a);if(i===0)return null;let s=i>0,e=s?r:a,o=s?a:r,u=!!e.prerelease.length;if(!!o.prerelease.length&&!u){if(!o.patch&&!o.minor)return"major";if(o.compareMain(e)===0)return o.minor&&!o.patch?"minor":"patch"}let I=u?"pre":"";return r.major!==a.major?I+"major":r.minor!==a.minor?I+"minor":r.patch!==a.patch?I+"patch":"prerelease"};WVn.exports=nYa});var EVn=ve((BKi,FVn)=>{"use strict";var rYa=ib(),aYa=(n,t)=>new rYa(n,t).major;FVn.exports=aYa});var wVn=ve((JKi,RVn)=>{"use strict";var iYa=ib(),lYa=(n,t)=>new iYa(n,t).minor;RVn.exports=lYa});var YVn=ve((TKi,CVn)=>{"use strict";var sYa=ib(),oYa=(n,t)=>new sYa(n,t).patch;CVn.exports=oYa});var VVn=ve((DKi,xVn)=>{"use strict";var cYa=Uk(),uYa=(n,t)=>{let r=cYa(n,t);return r&&r.prerelease.length?r.prerelease:null};xVn.exports=uYa});var AZ=ve((OKi,HVn)=>{"use strict";var QVn=ib(),IYa=(n,t,r)=>new QVn(n,r).compare(new QVn(t,r));HVn.exports=IYa});var kVn=ve((UKi,XVn)=>{"use strict";var dYa=AZ(),hYa=(n,t,r)=>dYa(t,n,r);XVn.exports=hYa});var SVn=ve((MKi,LVn)=>{"use strict";var mYa=AZ(),pYa=(n,t)=>mYa(n,t,!0);LVn.exports=pYa});var P5e=ve((zKi,JVn)=>{"use strict";var BVn=ib(),bYa=(n,t,r)=>{let a=new BVn(n,r),i=new BVn(t,r);return a.compare(i)||a.compareBuild(i)};JVn.exports=bYa});var DVn=ve((_Ki,TVn)=>{"use strict";var fYa=P5e(),GYa=(n,t)=>n.sort((r,a)=>fYa(r,a,t));TVn.exports=GYa});var UVn=ve((PKi,OVn)=>{"use strict";var gYa=P5e(),vYa=(n,t)=>n.sort((r,a)=>gYa(a,r,t));OVn.exports=vYa});var jle=ve((jKi,MVn)=>{"use strict";var ZYa=AZ(),NYa=(n,t,r)=>ZYa(n,t,r)>0;MVn.exports=NYa});var j5e=ve((KKi,zVn)=>{"use strict";var AYa=AZ(),WYa=(n,t,r)=>AYa(n,t,r)<0;zVn.exports=WYa});var edt=ve((qKi,_Vn)=>{"use strict";var yYa=AZ(),FYa=(n,t,r)=>yYa(n,t,r)===0;_Vn.exports=FYa});var tdt=ve(($Ki,PVn)=>{"use strict";var EYa=AZ(),RYa=(n,t,r)=>EYa(n,t,r)!==0;PVn.exports=RYa});var K5e=ve((eqi,jVn)=>{"use strict";var wYa=AZ(),CYa=(n,t,r)=>wYa(n,t,r)>=0;jVn.exports=CYa});var q5e=ve((tqi,KVn)=>{"use strict";var YYa=AZ(),xYa=(n,t,r)=>YYa(n,t,r)<=0;KVn.exports=xYa});var ndt=ve((nqi,qVn)=>{"use strict";var VYa=edt(),QYa=tdt(),HYa=jle(),XYa=K5e(),kYa=j5e(),LYa=q5e(),SYa=(n,t,r,a)=>{switch(t){case"===":return typeof n=="object"&&(n=n.version),typeof r=="object"&&(r=r.version),n===r;case"!==":return typeof n=="object"&&(n=n.version),typeof r=="object"&&(r=r.version),n!==r;case"":case"=":case"==":return VYa(n,r,a);case"!=":return QYa(n,r,a);case">":return HYa(n,r,a);case">=":return XYa(n,r,a);case"<":return kYa(n,r,a);case"<=":return LYa(n,r,a);default:throw new TypeError(`Invalid operator: ${t}`)}};qVn.exports=SYa});var eQn=ve((rqi,$Vn)=>{"use strict";var BYa=ib(),JYa=Uk(),{safeRe:$5e,t:eEe}=jM(),TYa=(n,t)=>{if(n instanceof BYa)return n;if(typeof n=="number"&&(n=String(n)),typeof n!="string")return null;t=t||{};let r=null;if(!t.rtl)r=n.match(t.includePrerelease?$5e[eEe.COERCEFULL]:$5e[eEe.COERCE]);else{let u=t.includePrerelease?$5e[eEe.COERCERTLFULL]:$5e[eEe.COERCERTL],d;for(;(d=u.exec(n))&&(!r||r.index+r[0].length!==n.length);)(!r||d.index+d[0].length!==r.index+r[0].length)&&(r=d),u.lastIndex=d.index+d[1].length+d[2].length;u.lastIndex=-1}if(r===null)return null;let a=r[2],i=r[3]||"0",s=r[4]||"0",e=t.includePrerelease&&r[5]?`-${r[5]}`:"",o=t.includePrerelease&&r[6]?`+${r[6]}`:"";return JYa(`${a}.${i}.${s}${e}${o}`,t)};$Vn.exports=TYa});var nQn=ve((aqi,tQn)=>{"use strict";var rdt=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}};tQn.exports=rdt});var WZ=ve((iqi,lQn)=>{"use strict";var DYa=/\s+/g,adt=class n{constructor(t,r){if(r=UYa(r),t instanceof n)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new n(t.raw,r);if(t instanceof idt)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(DYa," "),this.set=this.raw.split("||").map(a=>this.parseRange(a.trim())).filter(a=>a.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let a=this.set[0];if(this.set=this.set.filter(i=>!aQn(i[0])),this.set.length===0)this.set=[a];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&qYa(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let a=0;a<r.length;a++)a>0&&(this.formatted+=" "),this.formatted+=r[a].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let a=((this.options.includePrerelease&&jYa)|(this.options.loose&&KYa))+":"+t,i=rQn.get(a);if(i)return i;let s=this.options.loose,e=s?G2[lb.HYPHENRANGELOOSE]:G2[lb.HYPHENRANGE];t=t.replace(e,oxa(this.options.includePrerelease)),du("hyphen replace",t),t=t.replace(G2[lb.COMPARATORTRIM],zYa),du("comparator trim",t),t=t.replace(G2[lb.TILDETRIM],_Ya),du("tilde trim",t),t=t.replace(G2[lb.CARETTRIM],PYa),du("caret trim",t);let o=t.split(" ").map(h=>$Ya(h,this.options)).join(" ").split(/\s+/).map(h=>sxa(h,this.options));s&&(o=o.filter(h=>(du("loose invalid filter",h,this.options),!!h.match(G2[lb.COMPARATORLOOSE])))),du("range list",o);let u=new Map,d=o.map(h=>new idt(h,this.options));for(let h of d){if(aQn(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let I=[...u.values()];return rQn.set(a,I),I}intersects(t,r){if(!(t instanceof n))throw new TypeError("a Range is required");return this.set.some(a=>iQn(a,r)&&t.set.some(i=>iQn(i,r)&&a.every(s=>i.every(e=>s.intersects(e,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new MYa(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(cxa(this.set[r],t,this.options))return!0;return!1}};lQn.exports=adt;var OYa=nQn(),rQn=new OYa,UYa=O5e(),idt=Kle(),du=Ple(),MYa=ib(),{safeRe:G2,t:lb,comparatorTrimReplace:zYa,tildeTrimReplace:_Ya,caretTrimReplace:PYa}=jM(),{FLAG_INCLUDE_PRERELEASE:jYa,FLAG_LOOSE:KYa}=_le(),aQn=n=>n.value==="<0.0.0-0",qYa=n=>n.value==="",iQn=(n,t)=>{let r=!0,a=n.slice(),i=a.pop();for(;r&&a.length;)r=a.every(s=>i.intersects(s,t)),i=a.pop();return r},$Ya=(n,t)=>(n=n.replace(G2[lb.BUILD],""),du("comp",n,t),n=nxa(n,t),du("caret",n),n=exa(n,t),du("tildes",n),n=axa(n,t),du("xrange",n),n=lxa(n,t),du("stars",n),n),g2=n=>!n||n.toLowerCase()==="x"||n==="*",exa=(n,t)=>n.trim().split(/\s+/).map(r=>txa(r,t)).join(" "),txa=(n,t)=>{let r=t.loose?G2[lb.TILDELOOSE]:G2[lb.TILDE];return n.replace(r,(a,i,s,e,o)=>{du("tilde",n,a,i,s,e,o);let u;return g2(i)?u="":g2(s)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:g2(e)?u=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:o?(du("replaceTilde pr",o),u=`>=${i}.${s}.${e}-${o} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${e} <${i}.${+s+1}.0-0`,du("tilde return",u),u})},nxa=(n,t)=>n.trim().split(/\s+/).map(r=>rxa(r,t)).join(" "),rxa=(n,t)=>{du("caret",n,t);let r=t.loose?G2[lb.CARETLOOSE]:G2[lb.CARET],a=t.includePrerelease?"-0":"";return n.replace(r,(i,s,e,o,u)=>{du("caret",n,i,s,e,o,u);let d;return g2(s)?d="":g2(e)?d=`>=${s}.0.0${a} <${+s+1}.0.0-0`:g2(o)?s==="0"?d=`>=${s}.${e}.0${a} <${s}.${+e+1}.0-0`:d=`>=${s}.${e}.0${a} <${+s+1}.0.0-0`:u?(du("replaceCaret pr",u),s==="0"?e==="0"?d=`>=${s}.${e}.${o}-${u} <${s}.${e}.${+o+1}-0`:d=`>=${s}.${e}.${o}-${u} <${s}.${+e+1}.0-0`:d=`>=${s}.${e}.${o}-${u} <${+s+1}.0.0-0`):(du("no pr"),s==="0"?e==="0"?d=`>=${s}.${e}.${o}${a} <${s}.${e}.${+o+1}-0`:d=`>=${s}.${e}.${o}${a} <${s}.${+e+1}.0-0`:d=`>=${s}.${e}.${o} <${+s+1}.0.0-0`),du("caret return",d),d})},axa=(n,t)=>(du("replaceXRanges",n,t),n.split(/\s+/).map(r=>ixa(r,t)).join(" ")),ixa=(n,t)=>{n=n.trim();let r=t.loose?G2[lb.XRANGELOOSE]:G2[lb.XRANGE];return n.replace(r,(a,i,s,e,o,u)=>{du("xRange",n,a,i,s,e,o,u);let d=g2(s),I=d||g2(e),h=I||g2(o),c=h;return i==="="&&c&&(i=""),u=t.includePrerelease?"-0":"",d?i===">"||i==="<"?a="<0.0.0-0":a="*":i&&c?(I&&(e=0),o=0,i===">"?(i=">=",I?(s=+s+1,e=0,o=0):(e=+e+1,o=0)):i==="<="&&(i="<",I?s=+s+1:e=+e+1),i==="<"&&(u="-0"),a=`${i+s}.${e}.${o}${u}`):I?a=`>=${s}.0.0${u} <${+s+1}.0.0-0`:h&&(a=`>=${s}.${e}.0${u} <${s}.${+e+1}.0-0`),du("xRange return",a),a})},lxa=(n,t)=>(du("replaceStars",n,t),n.trim().replace(G2[lb.STAR],"")),sxa=(n,t)=>(du("replaceGTE0",n,t),n.trim().replace(G2[t.includePrerelease?lb.GTE0PRE:lb.GTE0],"")),oxa=n=>(t,r,a,i,s,e,o,u,d,I,h,c)=>(g2(a)?r="":g2(i)?r=`>=${a}.0.0${n?"-0":""}`:g2(s)?r=`>=${a}.${i}.0${n?"-0":""}`:e?r=`>=${r}`:r=`>=${r}${n?"-0":""}`,g2(d)?u="":g2(I)?u=`<${+d+1}.0.0-0`:g2(h)?u=`<${d}.${+I+1}.0-0`:c?u=`<=${d}.${I}.${h}-${c}`:n?u=`<${d}.${I}.${+h+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),cxa=(n,t,r)=>{for(let a=0;a<n.length;a++)if(!n[a].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let a=0;a<n.length;a++)if(du(n[a].semver),n[a].semver!==idt.ANY&&n[a].semver.prerelease.length>0){let i=n[a].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}});var Kle=ve((lqi,dQn)=>{"use strict";var qle=Symbol("SemVer ANY"),odt=class n{static get ANY(){return qle}constructor(t,r){if(r=sQn(r),t instanceof n){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),sdt("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===qle?this.value="":this.value=this.operator+this.semver.version,sdt("comp",this)}parse(t){let r=this.options.loose?oQn[cQn.COMPARATORLOOSE]:oQn[cQn.COMPARATOR],a=t.match(r);if(!a)throw new TypeError(`Invalid comparator: ${t}`);this.operator=a[1]!==void 0?a[1]:"",this.operator==="="&&(this.operator=""),a[2]?this.semver=new uQn(a[2],this.options.loose):this.semver=qle}toString(){return this.value}test(t){if(sdt("Comparator.test",t,this.options.loose),this.semver===qle||t===qle)return!0;if(typeof t=="string")try{t=new uQn(t,this.options)}catch{return!1}return ldt(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new IQn(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new IQn(this.value,r).test(t.semver):(r=sQn(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||ldt(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||ldt(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};dQn.exports=odt;var sQn=O5e(),{safeRe:oQn,t:cQn}=jM(),ldt=ndt(),sdt=Ple(),uQn=ib(),IQn=WZ()});var $le=ve((sqi,hQn)=>{"use strict";var uxa=WZ(),Ixa=(n,t,r)=>{try{t=new uxa(t,r)}catch{return!1}return t.test(n)};hQn.exports=Ixa});var pQn=ve((oqi,mQn)=>{"use strict";var dxa=WZ(),hxa=(n,t)=>new dxa(n,t).set.map(r=>r.map(a=>a.value).join(" ").trim().split(" "));mQn.exports=hxa});var fQn=ve((cqi,bQn)=>{"use strict";var mxa=ib(),pxa=WZ(),bxa=(n,t,r)=>{let a=null,i=null,s=null;try{s=new pxa(t,r)}catch{return null}return n.forEach(e=>{s.test(e)&&(!a||i.compare(e)===-1)&&(a=e,i=new mxa(a,r))}),a};bQn.exports=bxa});var gQn=ve((uqi,GQn)=>{"use strict";var fxa=ib(),Gxa=WZ(),gxa=(n,t,r)=>{let a=null,i=null,s=null;try{s=new Gxa(t,r)}catch{return null}return n.forEach(e=>{s.test(e)&&(!a||i.compare(e)===1)&&(a=e,i=new fxa(a,r))}),a};GQn.exports=gxa});var NQn=ve((Iqi,ZQn)=>{"use strict";var cdt=ib(),vxa=WZ(),vQn=jle(),Zxa=(n,t)=>{n=new vxa(n,t);let r=new cdt("0.0.0");if(n.test(r)||(r=new cdt("0.0.0-0"),n.test(r)))return r;r=null;for(let a=0;a<n.set.length;++a){let i=n.set[a],s=null;i.forEach(e=>{let o=new cdt(e.semver.version);switch(e.operator){case">":o.prerelease.length===0?o.patch++:o.prerelease.push(0),o.raw=o.format();case"":case">=":(!s||vQn(o,s))&&(s=o);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),s&&(!r||vQn(r,s))&&(r=s)}return r&&n.test(r)?r:null};ZQn.exports=Zxa});var WQn=ve((dqi,AQn)=>{"use strict";var Nxa=WZ(),Axa=(n,t)=>{try{return new Nxa(n,t).range||"*"}catch{return null}};AQn.exports=Axa});var tEe=ve((hqi,RQn)=>{"use strict";var Wxa=ib(),EQn=Kle(),{ANY:yxa}=EQn,Fxa=WZ(),Exa=$le(),yQn=jle(),FQn=j5e(),Rxa=q5e(),wxa=K5e(),Cxa=(n,t,r,a)=>{n=new Wxa(n,a),t=new Fxa(t,a);let i,s,e,o,u;switch(r){case">":i=yQn,s=Rxa,e=FQn,o=">",u=">=";break;case"<":i=FQn,s=wxa,e=yQn,o="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Exa(n,t,a))return!1;for(let d=0;d<t.set.length;++d){let I=t.set[d],h=null,c=null;if(I.forEach(G=>{G.semver===yxa&&(G=new EQn(">=0.0.0")),h=h||G,c=c||G,i(G.semver,h.semver,a)?h=G:e(G.semver,c.semver,a)&&(c=G)}),h.operator===o||h.operator===u||(!c.operator||c.operator===o)&&s(n,c.semver))return!1;if(c.operator===u&&e(n,c.semver))return!1}return!0};RQn.exports=Cxa});var CQn=ve((mqi,wQn)=>{"use strict";var Yxa=tEe(),xxa=(n,t,r)=>Yxa(n,t,">",r);wQn.exports=xxa});var xQn=ve((pqi,YQn)=>{"use strict";var Vxa=tEe(),Qxa=(n,t,r)=>Vxa(n,t,"<",r);YQn.exports=Qxa});var HQn=ve((bqi,QQn)=>{"use strict";var VQn=WZ(),Hxa=(n,t,r)=>(n=new VQn(n,r),t=new VQn(t,r),n.intersects(t,r));QQn.exports=Hxa});var kQn=ve((fqi,XQn)=>{"use strict";var Xxa=$le(),kxa=AZ();XQn.exports=(n,t,r)=>{let a=[],i=null,s=null,e=n.sort((I,h)=>kxa(I,h,r));for(let I of e)Xxa(I,t,r)?(s=I,i||(i=I)):(s&&a.push([i,s]),s=null,i=null);i&&a.push([i,null]);let o=[];for(let[I,h]of a)I===h?o.push(I):!h&&I===e[0]?o.push("*"):h?I===e[0]?o.push(`<=${h}`):o.push(`${I} - ${h}`):o.push(`>=${I}`);let u=o.join(" || "),d=typeof t.raw=="string"?t.raw:String(t);return u.length<d.length?u:t}});var DQn=ve((Gqi,TQn)=>{"use strict";var LQn=WZ(),Idt=Kle(),{ANY:udt}=Idt,ese=$le(),ddt=AZ(),Lxa=(n,t,r={})=>{if(n===t)return!0;n=new LQn(n,r),t=new LQn(t,r);let a=!1;e:for(let i of n.set){for(let s of t.set){let e=Bxa(i,s,r);if(a=a||e!==null,e)continue e}if(a)return!1}return!0},Sxa=[new Idt(">=0.0.0-0")],SQn=[new Idt(">=0.0.0")],Bxa=(n,t,r)=>{if(n===t)return!0;if(n.length===1&&n[0].semver===udt){if(t.length===1&&t[0].semver===udt)return!0;r.includePrerelease?n=Sxa:n=SQn}if(t.length===1&&t[0].semver===udt){if(r.includePrerelease)return!0;t=SQn}let a=new Set,i,s;for(let G of n)G.operator===">"||G.operator===">="?i=BQn(i,G,r):G.operator==="<"||G.operator==="<="?s=JQn(s,G,r):a.add(G.semver);if(a.size>1)return null;let e;if(i&&s){if(e=ddt(i.semver,s.semver,r),e>0)return null;if(e===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let G of a){if(i&&!ese(G,String(i),r)||s&&!ese(G,String(s),r))return null;for(let W of t)if(!ese(G,String(W),r))return!1;return!0}let o,u,d,I,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,c=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let G of t){if(I=I||G.operator===">"||G.operator===">=",d=d||G.operator==="<"||G.operator==="<=",i){if(c&&G.semver.prerelease&&G.semver.prerelease.length&&G.semver.major===c.major&&G.semver.minor===c.minor&&G.semver.patch===c.patch&&(c=!1),G.operator===">"||G.operator===">="){if(o=BQn(i,G,r),o===G&&o!==i)return!1}else if(i.operator===">="&&!ese(i.semver,String(G),r))return!1}if(s){if(h&&G.semver.prerelease&&G.semver.prerelease.length&&G.semver.major===h.major&&G.semver.minor===h.minor&&G.semver.patch===h.patch&&(h=!1),G.operator==="<"||G.operator==="<="){if(u=JQn(s,G,r),u===G&&u!==s)return!1}else if(s.operator==="<="&&!ese(s.semver,String(G),r))return!1}if(!G.operator&&(s||i)&&e!==0)return!1}return!(i&&d&&!s&&e!==0||s&&I&&!i&&e!==0||c||h)},BQn=(n,t,r)=>{if(!n)return t;let a=ddt(n.semver,t.semver,r);return a>0?n:a<0||t.operator===">"&&n.operator===">="?t:n},JQn=(n,t,r)=>{if(!n)return t;let a=ddt(n.semver,t.semver,r);return a<0?n:a>0||t.operator==="<"&&n.operator==="<="?t:n};TQn.exports=Lxa});var tse=ve((gqi,MQn)=>{"use strict";var hdt=jM(),OQn=_le(),Jxa=ib(),UQn=PIt(),Txa=Uk(),Dxa=qIt(),Oxa=$It(),Uxa=NVn(),Mxa=yVn(),zxa=EVn(),_xa=wVn(),Pxa=YVn(),jxa=VVn(),Kxa=AZ(),qxa=kVn(),$xa=SVn(),eVa=P5e(),tVa=DVn(),nVa=UVn(),rVa=jle(),aVa=j5e(),iVa=edt(),lVa=tdt(),sVa=K5e(),oVa=q5e(),cVa=ndt(),uVa=eQn(),IVa=Kle(),dVa=WZ(),hVa=$le(),mVa=pQn(),pVa=fQn(),bVa=gQn(),fVa=NQn(),GVa=WQn(),gVa=tEe(),vVa=CQn(),ZVa=xQn(),NVa=HQn(),AVa=kQn(),WVa=DQn();MQn.exports={parse:Txa,valid:Dxa,clean:Oxa,inc:Uxa,diff:Mxa,major:zxa,minor:_xa,patch:Pxa,prerelease:jxa,compare:Kxa,rcompare:qxa,compareLoose:$xa,compareBuild:eVa,sort:tVa,rsort:nVa,gt:rVa,lt:aVa,eq:iVa,neq:lVa,gte:sVa,lte:oVa,cmp:cVa,coerce:uVa,Comparator:IVa,Range:dVa,satisfies:hVa,toComparators:mVa,maxSatisfying:pVa,minSatisfying:bVa,minVersion:fVa,validRange:GVa,outside:gVa,gtr:vVa,ltr:ZVa,intersects:NVa,simplifyRange:AVa,subset:WVa,SemVer:Jxa,re:hdt.re,src:hdt.src,tokens:hdt.t,SEMVER_SPEC_VERSION:OQn.SEMVER_SPEC_VERSION,RELEASE_TYPES:OQn.RELEASE_TYPES,compareIdentifiers:UQn.compareIdentifiers,rcompareIdentifiers:UQn.rcompareIdentifiers}});var zQn=ve(d3=>{"use strict";Object.defineProperty(d3,"__esModule",{value:!0});d3.JaegerPropagator=d3.UBER_BAGGAGE_HEADER_PREFIX=d3.UBER_TRACE_ID_HEADER=void 0;var Mk=(Qr(),dr(kr)),yVa=Va();d3.UBER_TRACE_ID_HEADER="uber-trace-id";d3.UBER_BAGGAGE_HEADER_PREFIX="uberctx";var mdt=class{constructor(t){typeof t=="string"?(this._jaegerTraceHeader=t,this._jaegerBaggageHeaderPrefix=d3.UBER_BAGGAGE_HEADER_PREFIX):(this._jaegerTraceHeader=t?.customTraceHeader||d3.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=t?.customBaggageHeaderPrefix||d3.UBER_BAGGAGE_HEADER_PREFIX)}inject(t,r,a){let i=Mk.trace.getSpanContext(t),s=Mk.propagation.getBaggage(t);if(i&&(0,yVa.isTracingSuppressed)(t)===!1){let e=`0${(i.traceFlags||Mk.TraceFlags.NONE).toString(16)}`;a.set(r,this._jaegerTraceHeader,`${i.traceId}:${i.spanId}:0:${e}`)}if(s)for(let[e,o]of s.getAllEntries())a.set(r,`${this._jaegerBaggageHeaderPrefix}-${e}`,encodeURIComponent(o.value))}extract(t,r,a){var i;let s=a.get(r,this._jaegerTraceHeader),e=Array.isArray(s)?s[0]:s,o=a.keys(r).filter(I=>I.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map(I=>{let h=a.get(r,I);return{key:I.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(h)?h[0]:h}}),u=t;if(typeof e=="string"){let I=EVa(e);I&&(u=Mk.trace.setSpanContext(u,I))}if(o.length===0)return u;let d=(i=Mk.propagation.getBaggage(t))!==null&&i!==void 0?i:Mk.propagation.createBaggage();for(let I of o)I.value!==void 0&&(d=d.setEntry(I.key,{value:decodeURIComponent(I.value)}));return u=Mk.propagation.setBaggage(u,d),u}fields(){return[this._jaegerTraceHeader]}};d3.JaegerPropagator=mdt;var FVa=/^[0-9a-f]{1,2}$/i;function EVa(n){let t=decodeURIComponent(n).split(":");if(t.length!==4)return null;let[r,a,,i]=t,s=r.padStart(32,"0"),e=a.padStart(16,"0"),o=FVa.test(i)?parseInt(i,16)&1:1;return{traceId:s,spanId:e,isRemote:!0,traceFlags:o}}});var _Qn=ve(zk=>{"use strict";var RVa=zk&&zk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),wVa=zk&&zk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&RVa(t,n,r)};Object.defineProperty(zk,"__esModule",{value:!0});wVa(zQn(),zk)});var KQn=ve(aEe=>{"use strict";Object.defineProperty(aEe,"__esModule",{value:!0});aEe.NodeTracerProvider=void 0;var PQn=Gxn(),nEe=yxn(),jQn=Ok(),CVa=tse(),YVa=_Qn(),rEe=class extends jQn.BasicTracerProvider{constructor(t={}){super(t)}register(t={}){if(t.contextManager===void 0){let r=CVa.gte(process.version,"14.8.0")?PQn.AsyncLocalStorageContextManager:PQn.AsyncHooksContextManager;t.contextManager=new r,t.contextManager.enable()}super.register(t)}};aEe.NodeTracerProvider=rEe;rEe._registeredPropagators=new Map([...jQn.BasicTracerProvider._registeredPropagators,["b3",()=>new nEe.B3Propagator({injectEncoding:nEe.B3InjectEncoding.SINGLE_HEADER})],["b3multi",()=>new nEe.B3Propagator({injectEncoding:nEe.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new YVa.JaegerPropagator]])});var iEe=ve(Fx=>{"use strict";var xVa=Fx&&Fx.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),qQn=Fx&&Fx.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&xVa(t,n,r)};Object.defineProperty(Fx,"__esModule",{value:!0});qQn(KQn(),Fx);qQn(Ok(),Fx)});var $Qn=ve(KM=>{"use strict";Object.defineProperty(KM,"__esModule",{value:!0});KM.disableInstrumentations=KM.enableInstrumentations=void 0;function VVa(n,t,r,a){for(let i=0,s=n.length;i<s;i++){let e=n[i];t&&e.setTracerProvider(t),r&&e.setMeterProvider(r),a&&e.setLoggerProvider&&e.setLoggerProvider(a),e.getConfig().enabled||e.enable()}}KM.enableInstrumentations=VVa;function QVa(n){n.forEach(t=>t.disable())}KM.disableInstrumentations=QVa});var n9n=ve(lEe=>{"use strict";Object.defineProperty(lEe,"__esModule",{value:!0});lEe.registerInstrumentations=void 0;var e9n=(Qr(),dr(kr)),HVa=pU(),t9n=$Qn();function XVa(n){var t,r;let a=n.tracerProvider||e9n.trace.getTracerProvider(),i=n.meterProvider||e9n.metrics.getMeterProvider(),s=n.loggerProvider||HVa.logs.getLoggerProvider(),e=(r=(t=n.instrumentations)===null||t===void 0?void 0:t.flat())!==null&&r!==void 0?r:[];return(0,t9n.enableInstrumentations)(e,a,i,s),()=>{(0,t9n.disableInstrumentations)(e)}}lEe.registerInstrumentations=XVa});var bdt=ve((Fqi,i9n)=>{"use strict";function pdt(n){return typeof n=="function"}var v2=console.error.bind(console);function nse(n,t,r){var a=!!n[t]&&n.propertyIsEnumerable(t);Object.defineProperty(n,t,{configurable:!0,enumerable:a,writable:!0,value:r})}function rse(n){n&&n.logger&&(pdt(n.logger)?v2=n.logger:v2("new logger isn't a function, not replacing"))}function r9n(n,t,r){if(!n||!n[t]){v2("no original function "+t+" to wrap");return}if(!r){v2("no wrapper function"),v2(new Error().stack);return}if(!pdt(n[t])||!pdt(r)){v2("original object and wrapper must be functions");return}var a=n[t],i=r(a,t);return nse(i,"__original",a),nse(i,"__unwrap",function(){n[t]===i&&nse(n,t,a)}),nse(i,"__wrapped",!0),nse(n,t,i),i}function kVa(n,t,r){if(n)Array.isArray(n)||(n=[n]);else{v2("must provide one or more modules to patch"),v2(new Error().stack);return}if(!(t&&Array.isArray(t))){v2("must provide one or more functions to wrap on modules");return}n.forEach(function(a){t.forEach(function(i){r9n(a,i,r)})})}function a9n(n,t){if(!n||!n[t]){v2("no function to unwrap."),v2(new Error().stack);return}if(!n[t].__unwrap)v2("no original to unwrap to -- has "+t+" already been unwrapped?");else return n[t].__unwrap()}function LVa(n,t){if(n)Array.isArray(n)||(n=[n]);else{v2("must provide one or more modules to patch"),v2(new Error().stack);return}if(!(t&&Array.isArray(t))){v2("must provide one or more functions to unwrap on modules");return}n.forEach(function(r){t.forEach(function(a){a9n(r,a)})})}rse.wrap=r9n;rse.massWrap=kVa;rse.unwrap=a9n;rse.massUnwrap=LVa;i9n.exports=rse});var l9n=ve(oEe=>{"use strict";Object.defineProperty(oEe,"__esModule",{value:!0});oEe.InstrumentationAbstract=void 0;var fdt=(Qr(),dr(kr)),SVa=pU(),sEe=bdt(),Gdt=class{constructor(t,r,a){this.instrumentationName=t,this.instrumentationVersion=r,this._wrap=sEe.wrap,this._unwrap=sEe.unwrap,this._massWrap=sEe.massWrap,this._massUnwrap=sEe.massUnwrap,this._config=Object.assign({enabled:!0},a),this._diag=fdt.diag.createComponentLogger({namespace:t}),this._tracer=fdt.trace.getTracer(t,r),this._meter=fdt.metrics.getMeter(t,r),this._logger=SVa.logs.getLogger(t,r),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var t;let r=(t=this.init())!==null&&t!==void 0?t:[];return Array.isArray(r)?r:[r]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config=Object.assign({},t)}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,a,i){if(t)try{t(a,i)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},s)}}};oEe.InstrumentationAbstract=Gdt});var vdt=ve((Rqi,s9n)=>{"use strict";var gdt=vt("path").sep;s9n.exports=function(n){var t=n.split(gdt),r=t.lastIndexOf("node_modules");if(r!==-1&&t[r+1]){for(var a=t[r+1][0]==="@",i=a?t[r+1]+"/"+t[r+2]:t[r+1],s=a?3:2,e="",o=r+s-1,u=0;u<=o;u++)u===o?e+=t[u]:e+=t[u]+gdt;for(var d="",I=t.length-1,h=r+s;h<=I;h++)h===I?d+=t[h]:d+=t[h]+gdt;return{name:i,basedir:e,path:d}}}});var Zdt=ve((wqi,o9n)=>{"use strict";var BVa=vt("os");o9n.exports=BVa.homedir||function(){var t=process.env.HOME,r=process.env.LOGNAME||process.env.USER||process.env.LNAME||process.env.USERNAME;return process.platform==="win32"?process.env.USERPROFILE||process.env.HOMEDRIVE+process.env.HOMEPATH||t||null:process.platform==="darwin"?t||(r?"/Users/"+r:null):process.platform==="linux"?t||(process.getuid()===0?"/root":r?"/home/"+r:null):t||null}});var Ndt=ve((Cqi,c9n)=>{c9n.exports=function(){var n=Error.prepareStackTrace;Error.prepareStackTrace=function(r,a){return a};var t=new Error().stack;return Error.prepareStackTrace=n,t[2].getFileName()}});var u9n=ve((Yqi,ase)=>{"use strict";var JVa=process.platform==="win32",TVa=/^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/,Adt={};function DVa(n){return TVa.exec(n).slice(1)}Adt.parse=function(n){if(typeof n!="string")throw new TypeError("Parameter 'pathString' must be a string, not "+typeof n);var t=DVa(n);if(!t||t.length!==5)throw new TypeError("Invalid path '"+n+"'");return{root:t[1],dir:t[0]===t[1]?t[0]:t[0].slice(0,-1),base:t[2],ext:t[4],name:t[3]}};var OVa=/^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/,Wdt={};function UVa(n){return OVa.exec(n).slice(1)}Wdt.parse=function(n){if(typeof n!="string")throw new TypeError("Parameter 'pathString' must be a string, not "+typeof n);var t=UVa(n);if(!t||t.length!==5)throw new TypeError("Invalid path '"+n+"'");return{root:t[1],dir:t[0].slice(0,-1),base:t[2],ext:t[4],name:t[3]}};JVa?ase.exports=Adt.parse:ase.exports=Wdt.parse;ase.exports.posix=Wdt.parse;ase.exports.win32=Adt.parse});var ydt=ve((xqi,m9n)=>{var h9n=vt("path"),I9n=h9n.parse||u9n(),MVa=/^([A-Za-z]:)/,zVa=/^\\\\/,d9n=function(t,r){var a="/";MVa.test(t)?a="":zVa.test(t)&&(a="\\\\");for(var i=[t],s=I9n(t);s.dir!==i[i.length-1];)i.push(s.dir),s=I9n(s.dir);return i.reduce(function(e,o){return e.concat(r.map(function(u){return h9n.resolve(a,o,u)}))},[])};m9n.exports=function(t,r,a){var i=r&&r.moduleDirectory?[].concat(r.moduleDirectory):["node_modules"];if(r&&typeof r.paths=="function")return r.paths(a,t,function(){return d9n(t,i)},r);var s=d9n(t,i);return r&&r.paths?s.concat(r.paths):s}});var Fdt=ve((Vqi,p9n)=>{p9n.exports=function(n,t){return t||{}}});var G9n=ve((Qqi,f9n)=>{"use strict";var _Va="Function.prototype.bind called on incompatible ",PVa=Object.prototype.toString,jVa=Math.max,KVa="[object Function]",b9n=function(t,r){for(var a=[],i=0;i<t.length;i+=1)a[i]=t[i];for(var s=0;s<r.length;s+=1)a[s+t.length]=r[s];return a},qVa=function(t,r){for(var a=[],i=r||0,s=0;i<t.length;i+=1,s+=1)a[s]=t[i];return a},$Va=function(n,t){for(var r="",a=0;a<n.length;a+=1)r+=n[a],a+1<n.length&&(r+=t);return r};f9n.exports=function(t){var r=this;if(typeof r!="function"||PVa.apply(r)!==KVa)throw new TypeError(_Va+r);for(var a=qVa(arguments,1),i,s=function(){if(this instanceof i){var I=r.apply(this,b9n(a,arguments));return Object(I)===I?I:this}return r.apply(t,b9n(a,arguments))},e=jVa(0,r.length-a.length),o=[],u=0;u<e;u++)o[u]="$"+u;if(i=Function("binder","return function ("+$Va(o,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var d=function(){};d.prototype=r.prototype,i.prototype=new d,d.prototype=null}return i}});var v9n=ve((Hqi,g9n)=>{"use strict";var eQa=G9n();g9n.exports=Function.prototype.bind||eQa});var N9n=ve((Xqi,Z9n)=>{"use strict";var tQa=Function.prototype.call,nQa=Object.prototype.hasOwnProperty,rQa=v9n();Z9n.exports=rQa.call(tQa,nQa)});var A9n=ve((kqi,aQa)=>{aQa.exports={assert:!0,"node:assert":[">= 14.18 && < 15",">= 16"],"assert/strict":">= 15","node:assert/strict":">= 16",async_hooks:">= 8","node:async_hooks":[">= 14.18 && < 15",">= 16"],buffer_ieee754:">= 0.5 && < 0.9.7",buffer:!0,"node:buffer":[">= 14.18 && < 15",">= 16"],child_process:!0,"node:child_process":[">= 14.18 && < 15",">= 16"],cluster:">= 0.5","node:cluster":[">= 14.18 && < 15",">= 16"],console:!0,"node:console":[">= 14.18 && < 15",">= 16"],constants:!0,"node:constants":[">= 14.18 && < 15",">= 16"],crypto:!0,"node:crypto":[">= 14.18 && < 15",">= 16"],_debug_agent:">= 1 && < 8",_debugger:"< 8",dgram:!0,"node:dgram":[">= 14.18 && < 15",">= 16"],diagnostics_channel:[">= 14.17 && < 15",">= 15.1"],"node:diagnostics_channel":[">= 14.18 && < 15",">= 16"],dns:!0,"node:dns":[">= 14.18 && < 15",">= 16"],"dns/promises":">= 15","node:dns/promises":">= 16",domain:">= 0.7.12","node:domain":[">= 14.18 && < 15",">= 16"],events:!0,"node:events":[">= 14.18 && < 15",">= 16"],freelist:"< 6",fs:!0,"node:fs":[">= 14.18 && < 15",">= 16"],"fs/promises":[">= 10 && < 10.1",">= 14"],"node:fs/promises":[">= 14.18 && < 15",">= 16"],_http_agent:">= 0.11.1","node:_http_agent":[">= 14.18 && < 15",">= 16"],_http_client:">= 0.11.1","node:_http_client":[">= 14.18 && < 15",">= 16"],_http_common:">= 0.11.1","node:_http_common":[">= 14.18 && < 15",">= 16"],_http_incoming:">= 0.11.1","node:_http_incoming":[">= 14.18 && < 15",">= 16"],_http_outgoing:">= 0.11.1","node:_http_outgoing":[">= 14.18 && < 15",">= 16"],_http_server:">= 0.11.1","node:_http_server":[">= 14.18 && < 15",">= 16"],http:!0,"node:http":[">= 14.18 && < 15",">= 16"],http2:">= 8.8","node:http2":[">= 14.18 && < 15",">= 16"],https:!0,"node:https":[">= 14.18 && < 15",">= 16"],inspector:">= 8","node:inspector":[">= 14.18 && < 15",">= 16"],"inspector/promises":[">= 19"],"node:inspector/promises":[">= 19"],_linklist:"< 8",module:!0,"node:module":[">= 14.18 && < 15",">= 16"],net:!0,"node:net":[">= 14.18 && < 15",">= 16"],"node-inspect/lib/_inspect":">= 7.6 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6 && < 12",os:!0,"node:os":[">= 14.18 && < 15",">= 16"],path:!0,"node:path":[">= 14.18 && < 15",">= 16"],"path/posix":">= 15.3","node:path/posix":">= 16","path/win32":">= 15.3","node:path/win32":">= 16",perf_hooks:">= 8.5","node:perf_hooks":[">= 14.18 && < 15",">= 16"],process:">= 1","node:process":[">= 14.18 && < 15",">= 16"],punycode:">= 0.5","node:punycode":[">= 14.18 && < 15",">= 16"],querystring:!0,"node:querystring":[">= 14.18 && < 15",">= 16"],readline:!0,"node:readline":[">= 14.18 && < 15",">= 16"],"readline/promises":">= 17","node:readline/promises":">= 17",repl:!0,"node:repl":[">= 14.18 && < 15",">= 16"],"node:sea":[">= 20.12 && < 21",">= 21.7"],smalloc:">= 0.11.5 && < 3","node:sqlite":[">= 22.13 && < 23",">= 23.4"],_stream_duplex:">= 0.9.4","node:_stream_duplex":[">= 14.18 && < 15",">= 16"],_stream_transform:">= 0.9.4","node:_stream_transform":[">= 14.18 && < 15",">= 16"],_stream_wrap:">= 1.4.1","node:_stream_wrap":[">= 14.18 && < 15",">= 16"],_stream_passthrough:">= 0.9.4","node:_stream_passthrough":[">= 14.18 && < 15",">= 16"],_stream_readable:">= 0.9.4","node:_stream_readable":[">= 14.18 && < 15",">= 16"],_stream_writable:">= 0.9.4","node:_stream_writable":[">= 14.18 && < 15",">= 16"],stream:!0,"node:stream":[">= 14.18 && < 15",">= 16"],"stream/consumers":">= 16.7","node:stream/consumers":">= 16.7","stream/promises":">= 15","node:stream/promises":">= 16","stream/web":">= 16.5","node:stream/web":">= 16.5",string_decoder:!0,"node:string_decoder":[">= 14.18 && < 15",">= 16"],sys:[">= 0.4 && < 0.7",">= 0.8"],"node:sys":[">= 14.18 && < 15",">= 16"],"test/reporters":">= 19.9 && < 20.2","node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:!0,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common:">= 0.11.13","node:_tls_common":[">= 14.18 && < 15",">= 16"],_tls_legacy:">= 0.11.3 && < 10",_tls_wrap:">= 0.11.3","node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls:!0,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events:">= 10","node:trace_events":[">= 14.18 && < 15",">= 16"],tty:!0,"node:tty":[">= 14.18 && < 15",">= 16"],url:!0,"node:url":[">= 14.18 && < 15",">= 16"],util:!0,"node:util":[">= 14.18 && < 15",">= 16"],"util/types":">= 15.3","node:util/types":">= 16","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/consarray":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/csvparser":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/logreader":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/profile_view":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/splaytree":[">= 4.4 && < 5",">= 5.2 && < 12"],v8:">= 1","node:v8":[">= 14.18 && < 15",">= 16"],vm:!0,"node:vm":[">= 14.18 && < 15",">= 16"],wasi:[">= 13.4 && < 13.5",">= 18.17 && < 19",">= 20"],"node:wasi":[">= 18.17 && < 19",">= 20"],worker_threads:">= 11.7","node:worker_threads":[">= 14.18 && < 15",">= 16"],zlib:">= 0.5","node:zlib":[">= 14.18 && < 15",">= 16"]}});var ise=ve((Lqi,F9n)=>{"use strict";var iQa=N9n();function lQa(n,t){for(var r=n.split("."),a=t.split(" "),i=a.length>1?a[0]:"=",s=(a.length>1?a[1]:a[0]).split("."),e=0;e<3;++e){var o=parseInt(r[e]||0,10),u=parseInt(s[e]||0,10);if(o!==u)return i==="<"?o<u:i===">="?o>=u:!1}return i===">="}function W9n(n,t){var r=t.split(/ ?&& ?/);if(r.length===0)return!1;for(var a=0;a<r.length;++a)if(!lQa(n,r[a]))return!1;return!0}function sQa(n,t){if(typeof t=="boolean")return t;var r=typeof n>"u"?process.versions&&process.versions.node:n;if(typeof r!="string")throw new TypeError(typeof n>"u"?"Unable to determine current node version":"If provided, a valid node version is required");if(t&&typeof t=="object"){for(var a=0;a<t.length;++a)if(W9n(r,t[a]))return!0;return!1}return W9n(r,t)}var y9n=A9n();F9n.exports=function(t,r){return iQa(y9n,t)&&sQa(r,y9n[t])}});var w9n=ve((Sqi,R9n)=>{var _k=vt("fs"),oQa=Zdt(),$d=vt("path"),cQa=Ndt(),uQa=ydt(),IQa=Fdt(),dQa=ise(),hQa=process.platform!=="win32"&&_k.realpath&&typeof _k.realpath.native=="function"?_k.realpath.native:_k.realpath,mQa=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,pQa=/^\w:[/\\]*$/,bQa=/[/\\]node_modules[/\\]*$/,E9n=oQa(),fQa=function(){return[$d.join(E9n,".node_modules"),$d.join(E9n,".node_libraries")]},GQa=function(t,r){_k.stat(t,function(a,i){return a?a.code==="ENOENT"||a.code==="ENOTDIR"?r(null,!1):r(a):r(null,i.isFile()||i.isFIFO())})},gQa=function(t,r){_k.stat(t,function(a,i){return a?a.code==="ENOENT"||a.code==="ENOTDIR"?r(null,!1):r(a):r(null,i.isDirectory())})},vQa=function(t,r){hQa(t,function(a,i){a&&a.code!=="ENOENT"?r(a):r(null,a?t:i)})},lse=function(t,r,a,i){a&&a.preserveSymlinks===!1?t(r,i):i(null,r)},ZQa=function(t,r,a){t(r,function(i,s){if(i)a(i);else try{var e=JSON.parse(s);a(null,e)}catch{a(null)}})},NQa=function(t,r,a){for(var i=uQa(r,a,t),s=0;s<i.length;s++)i[s]=$d.join(i[s],t);return i};R9n.exports=function(t,r,a){var i=a,s=r;if(typeof r=="function"&&(i=s,s={}),typeof t!="string"){var e=new TypeError("Path must be a string.");return process.nextTick(function(){i(e)})}s=IQa(t,s);var o=s.isFile||GQa,u=s.isDirectory||gQa,d=s.readFile||_k.readFile,I=s.realpath||vQa,h=s.readPackage||ZQa;if(s.readFile&&s.readPackage){var c=new TypeError("`readFile` and `readPackage` are mutually exclusive.");return process.nextTick(function(){i(c)})}var G=s.packageIterator,W=s.extensions||[".js"],y=s.includeCoreModules!==!1,R=s.basedir||$d.dirname(cQa()),F=s.filename||R;s.paths=s.paths||fQa();var C=$d.resolve(R);lse(I,C,s,function(b,Z){b?i(b):E(Z)});var A;function E(b){if(mQa.test(t))A=$d.resolve(b,t),(t==="."||t===".."||t.slice(-1)==="/")&&(A+="/"),t.slice(-1)==="/"&&A===b?N(A,s.package,f):g(A,s.package,f);else{if(y&&dQa(t))return i(null,t);p(t,b,function(Z,Y,S){if(Z)i(Z);else{if(Y)return lse(I,Y,s,function(L,T){L?i(L):i(null,T,S)});var H=new Error("Cannot find module '"+t+"' from '"+F+"'");H.code="MODULE_NOT_FOUND",i(H)}})}}function f(b,Z,Y){b?i(b):Z?i(null,Z,Y):N(A,function(S,H,L){if(S)i(S);else if(H)lse(I,H,s,function(k,X){k?i(k):i(null,X,L)});else{var T=new Error("Cannot find module '"+t+"' from '"+F+"'");T.code="MODULE_NOT_FOUND",i(T)}})}function g(b,Z,Y){var S=Z,H=Y;typeof S=="function"&&(H=S,S=void 0);var L=[""].concat(W);T(L,b,S);function T(k,X,Q){if(k.length===0)return H(null,void 0,Q);var V=X+k[0],w=Q;w?x(null,w):v($d.dirname(V),x);function x(U,O,B){if(w=O,U)return H(U);if(B&&w&&s.pathFilter){var D=$d.relative(B,V),M=D.slice(0,D.length-k[0].length),z=s.pathFilter(w,X,M);if(z)return T([""].concat(W.slice()),$d.resolve(B,z),w)}o(V,J)}function J(U,O){if(U)return H(U);if(O)return H(null,V,w);T(k.slice(1),X,w)}}}function v(b,Z){if(b===""||b==="/"||process.platform==="win32"&&pQa.test(b)||bQa.test(b))return Z(null);lse(I,b,s,function(Y,S){if(Y)return v($d.dirname(b),Z);var H=$d.join(S,"package.json");o(H,function(L,T){if(!T)return v($d.dirname(b),Z);h(d,H,function(k,X){k&&Z(k);var Q=X;Q&&s.packageFilter&&(Q=s.packageFilter(Q,H)),Z(null,Q,b)})})})}function N(b,Z,Y){var S=Y,H=Z;typeof H=="function"&&(S=H,H=s.package),lse(I,b,s,function(L,T){if(L)return S(L);var k=$d.join(T,"package.json");o(k,function(X,Q){if(X)return S(X);if(!Q)return g($d.join(b,"index"),H,S);h(d,k,function(V,w){if(V)return S(V);var x=w;if(x&&s.packageFilter&&(x=s.packageFilter(x,k)),x&&x.main){if(typeof x.main!="string"){var J=new TypeError("package \u201C"+x.name+"\u201D `main` must be a string");return J.code="INVALID_PACKAGE_MAIN",S(J)}(x.main==="."||x.main==="./")&&(x.main="index"),g($d.resolve(b,x.main),x,function(U,O,B){if(U)return S(U);if(O)return S(null,O,B);if(!B)return g($d.join(b,"index"),B,S);var D=$d.resolve(b,B.main);N(D,B,function(M,z,_){if(M)return S(M);if(z)return S(null,z,_);g($d.join(b,"index"),_,S)})});return}g($d.join(b,"/index"),x,S)})})})}function m(b,Z){if(Z.length===0)return b(null,void 0);var Y=Z[0];u($d.dirname(Y),S);function S(T,k){if(T)return b(T);if(!k)return m(b,Z.slice(1));g(Y,s.package,H)}function H(T,k,X){if(T)return b(T);if(k)return b(null,k,X);N(Y,s.package,L)}function L(T,k,X){if(T)return b(T);if(k)return b(null,k,X);m(b,Z.slice(1))}}function p(b,Z,Y){var S=function(){return NQa(b,Z,s)};m(Y,G?G(b,Z,S,s):S())}}});var C9n=ve((Bqi,AQa)=>{AQa.exports={assert:!0,"node:assert":[">= 14.18 && < 15",">= 16"],"assert/strict":">= 15","node:assert/strict":">= 16",async_hooks:">= 8","node:async_hooks":[">= 14.18 && < 15",">= 16"],buffer_ieee754:">= 0.5 && < 0.9.7",buffer:!0,"node:buffer":[">= 14.18 && < 15",">= 16"],child_process:!0,"node:child_process":[">= 14.18 && < 15",">= 16"],cluster:">= 0.5","node:cluster":[">= 14.18 && < 15",">= 16"],console:!0,"node:console":[">= 14.18 && < 15",">= 16"],constants:!0,"node:constants":[">= 14.18 && < 15",">= 16"],crypto:!0,"node:crypto":[">= 14.18 && < 15",">= 16"],_debug_agent:">= 1 && < 8",_debugger:"< 8",dgram:!0,"node:dgram":[">= 14.18 && < 15",">= 16"],diagnostics_channel:[">= 14.17 && < 15",">= 15.1"],"node:diagnostics_channel":[">= 14.18 && < 15",">= 16"],dns:!0,"node:dns":[">= 14.18 && < 15",">= 16"],"dns/promises":">= 15","node:dns/promises":">= 16",domain:">= 0.7.12","node:domain":[">= 14.18 && < 15",">= 16"],events:!0,"node:events":[">= 14.18 && < 15",">= 16"],freelist:"< 6",fs:!0,"node:fs":[">= 14.18 && < 15",">= 16"],"fs/promises":[">= 10 && < 10.1",">= 14"],"node:fs/promises":[">= 14.18 && < 15",">= 16"],_http_agent:">= 0.11.1","node:_http_agent":[">= 14.18 && < 15",">= 16"],_http_client:">= 0.11.1","node:_http_client":[">= 14.18 && < 15",">= 16"],_http_common:">= 0.11.1","node:_http_common":[">= 14.18 && < 15",">= 16"],_http_incoming:">= 0.11.1","node:_http_incoming":[">= 14.18 && < 15",">= 16"],_http_outgoing:">= 0.11.1","node:_http_outgoing":[">= 14.18 && < 15",">= 16"],_http_server:">= 0.11.1","node:_http_server":[">= 14.18 && < 15",">= 16"],http:!0,"node:http":[">= 14.18 && < 15",">= 16"],http2:">= 8.8","node:http2":[">= 14.18 && < 15",">= 16"],https:!0,"node:https":[">= 14.18 && < 15",">= 16"],inspector:">= 8","node:inspector":[">= 14.18 && < 15",">= 16"],"inspector/promises":[">= 19"],"node:inspector/promises":[">= 19"],_linklist:"< 8",module:!0,"node:module":[">= 14.18 && < 15",">= 16"],net:!0,"node:net":[">= 14.18 && < 15",">= 16"],"node-inspect/lib/_inspect":">= 7.6 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6 && < 12",os:!0,"node:os":[">= 14.18 && < 15",">= 16"],path:!0,"node:path":[">= 14.18 && < 15",">= 16"],"path/posix":">= 15.3","node:path/posix":">= 16","path/win32":">= 15.3","node:path/win32":">= 16",perf_hooks:">= 8.5","node:perf_hooks":[">= 14.18 && < 15",">= 16"],process:">= 1","node:process":[">= 14.18 && < 15",">= 16"],punycode:">= 0.5","node:punycode":[">= 14.18 && < 15",">= 16"],querystring:!0,"node:querystring":[">= 14.18 && < 15",">= 16"],readline:!0,"node:readline":[">= 14.18 && < 15",">= 16"],"readline/promises":">= 17","node:readline/promises":">= 17",repl:!0,"node:repl":[">= 14.18 && < 15",">= 16"],"node:sea":[">= 20.12 && < 21",">= 21.7"],smalloc:">= 0.11.5 && < 3","node:sqlite":[">= 22.13 && < 23",">= 23.4"],_stream_duplex:">= 0.9.4","node:_stream_duplex":[">= 14.18 && < 15",">= 16"],_stream_transform:">= 0.9.4","node:_stream_transform":[">= 14.18 && < 15",">= 16"],_stream_wrap:">= 1.4.1","node:_stream_wrap":[">= 14.18 && < 15",">= 16"],_stream_passthrough:">= 0.9.4","node:_stream_passthrough":[">= 14.18 && < 15",">= 16"],_stream_readable:">= 0.9.4","node:_stream_readable":[">= 14.18 && < 15",">= 16"],_stream_writable:">= 0.9.4","node:_stream_writable":[">= 14.18 && < 15",">= 16"],stream:!0,"node:stream":[">= 14.18 && < 15",">= 16"],"stream/consumers":">= 16.7","node:stream/consumers":">= 16.7","stream/promises":">= 15","node:stream/promises":">= 16","stream/web":">= 16.5","node:stream/web":">= 16.5",string_decoder:!0,"node:string_decoder":[">= 14.18 && < 15",">= 16"],sys:[">= 0.4 && < 0.7",">= 0.8"],"node:sys":[">= 14.18 && < 15",">= 16"],"test/reporters":">= 19.9 && < 20.2","node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:!0,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common:">= 0.11.13","node:_tls_common":[">= 14.18 && < 15",">= 16"],_tls_legacy:">= 0.11.3 && < 10",_tls_wrap:">= 0.11.3","node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls:!0,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events:">= 10","node:trace_events":[">= 14.18 && < 15",">= 16"],tty:!0,"node:tty":[">= 14.18 && < 15",">= 16"],url:!0,"node:url":[">= 14.18 && < 15",">= 16"],util:!0,"node:util":[">= 14.18 && < 15",">= 16"],"util/types":">= 15.3","node:util/types":">= 16","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/consarray":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/csvparser":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/logreader":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/profile_view":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/splaytree":[">= 4.4 && < 5",">= 5.2 && < 12"],v8:">= 1","node:v8":[">= 14.18 && < 15",">= 16"],vm:!0,"node:vm":[">= 14.18 && < 15",">= 16"],wasi:[">= 13.4 && < 13.5",">= 18.17 && < 19",">= 20"],"node:wasi":[">= 18.17 && < 19",">= 20"],worker_threads:">= 11.7","node:worker_threads":[">= 14.18 && < 15",">= 16"],zlib:">= 0.5","node:zlib":[">= 14.18 && < 15",">= 16"]}});var Q9n=ve((Jqi,V9n)=>{"use strict";var WQa=ise(),Y9n=C9n(),x9n={};for(cEe in Y9n)Object.prototype.hasOwnProperty.call(Y9n,cEe)&&(x9n[cEe]=WQa(cEe));var cEe;V9n.exports=x9n});var X9n=ve((Tqi,H9n)=>{var yQa=ise();H9n.exports=function(t){return yQa(t)}});var S9n=ve((Dqi,L9n)=>{var FQa=ise(),Pk=vt("fs"),sb=vt("path"),EQa=Zdt(),RQa=Ndt(),wQa=ydt(),CQa=Fdt(),YQa=process.platform!=="win32"&&Pk.realpathSync&&typeof Pk.realpathSync.native=="function"?Pk.realpathSync.native:Pk.realpathSync,xQa=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,VQa=/^\w:[/\\]*$/,QQa=/[/\\]node_modules[/\\]*$/,k9n=EQa(),HQa=function(){return[sb.join(k9n,".node_modules"),sb.join(k9n,".node_libraries")]},XQa=function(t){try{var r=Pk.statSync(t,{throwIfNoEntry:!1})}catch(a){if(a&&(a.code==="ENOENT"||a.code==="ENOTDIR"))return!1;throw a}return!!r&&(r.isFile()||r.isFIFO())},kQa=function(t){try{var r=Pk.statSync(t,{throwIfNoEntry:!1})}catch(a){if(a&&(a.code==="ENOENT"||a.code==="ENOTDIR"))return!1;throw a}return!!r&&r.isDirectory()},LQa=function(t){try{return YQa(t)}catch(r){if(r.code!=="ENOENT")throw r}return t},sse=function(t,r,a){return a&&a.preserveSymlinks===!1?t(r):r},SQa=function(t,r){var a=t(r);try{var i=JSON.parse(a);return i}catch{}},BQa=function(t,r,a){for(var i=wQa(r,a,t),s=0;s<i.length;s++)i[s]=sb.join(i[s],t);return i};L9n.exports=function(t,r){if(typeof t!="string")throw new TypeError("Path must be a string.");var a=CQa(t,r),i=a.isFile||XQa,s=a.readFileSync||Pk.readFileSync,e=a.isDirectory||kQa,o=a.realpathSync||LQa,u=a.readPackageSync||SQa;if(a.readFileSync&&a.readPackageSync)throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");var d=a.packageIterator,I=a.extensions||[".js"],h=a.includeCoreModules!==!1,c=a.basedir||sb.dirname(RQa()),G=a.filename||c;a.paths=a.paths||HQa();var W=sse(o,sb.resolve(c),a);if(xQa.test(t)){var y=sb.resolve(W,t);(t==="."||t===".."||t.slice(-1)==="/")&&(y+="/");var R=A(y)||f(y);if(R)return sse(o,R,a)}else{if(h&&FQa(t))return t;var F=g(t,W);if(F)return sse(o,F,a)}var C=new Error("Cannot find module '"+t+"' from '"+G+"'");throw C.code="MODULE_NOT_FOUND",C;function A(v){var N=E(sb.dirname(v));if(N&&N.dir&&N.pkg&&a.pathFilter){var m=sb.relative(N.dir,v),p=a.pathFilter(N.pkg,v,m);p&&(v=sb.resolve(N.dir,p))}if(i(v))return v;for(var b=0;b<I.length;b++){var Z=v+I[b];if(i(Z))return Z}}function E(v){if(!(v===""||v==="/")&&!(process.platform==="win32"&&VQa.test(v))&&!QQa.test(v)){var N=sb.join(sse(o,v,a),"package.json");if(!i(N))return E(sb.dirname(v));var m=u(s,N);return m&&a.packageFilter&&(m=a.packageFilter(m,v)),{pkg:m,dir:v}}}function f(v){var N=sb.join(sse(o,v,a),"/package.json");if(i(N)){try{var m=u(s,N)}catch{}if(m&&a.packageFilter&&(m=a.packageFilter(m,v)),m&&m.main){if(typeof m.main!="string"){var p=new TypeError("package \u201C"+m.name+"\u201D `main` must be a string");throw p.code="INVALID_PACKAGE_MAIN",p}(m.main==="."||m.main==="./")&&(m.main="index");try{var b=A(sb.resolve(v,m.main));if(b)return b;var Z=f(sb.resolve(v,m.main));if(Z)return Z}catch{}}}return A(sb.join(v,"/index"))}function g(v,N){for(var m=function(){return BQa(v,N,a)},p=d?d(v,N,m,a):m(),b=0;b<p.length;b++){var Z=p[b];if(e(sb.dirname(Z))){var Y=A(Z);if(Y)return Y;var S=f(Z);if(S)return S}}}}});var Edt=ve((Oqi,B9n)=>{var uEe=w9n();uEe.core=Q9n();uEe.isCore=X9n();uEe.sync=S9n();B9n.exports=uEe});var J9n=ve((Uqi,JQa)=>{JQa.exports={name:"require-in-the-middle",version:"7.5.2",description:"Module to hook into the Node.js require function",main:"index.js",types:"types/index.d.ts",dependencies:{debug:"^4.3.5","module-details-from-path":"^1.0.3",resolve:"^1.22.8"},devDependencies:{"@babel/core":"^7.9.0","@babel/preset-env":"^7.9.5","@babel/preset-typescript":"^7.9.0","@babel/register":"^7.9.0","ipp-printer":"^1.0.0",patterns:"^1.0.3",roundround:"^0.2.0",semver:"^6.3.0",standard:"^14.3.1",tape:"^4.11.0"},scripts:{test:"npm run test:lint && npm run test:tape && npm run test:babel","test:lint":"standard","test:tape":"tape test/*.js","test:babel":"node test/babel/babel-register.js"},repository:{type:"git",url:"git+https://github.com/nodejs/require-in-the-middle.git"},keywords:["require","hook","shim","shimmer","shimming","patch","monkey","monkeypatch","module","load"],files:["types"],author:"Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",license:"MIT",bugs:{url:"https://github.com/nodejs/require-in-the-middle/issues"},homepage:"https://github.com/nodejs/require-in-the-middle#readme",engines:{node:">=8.6.0"}}});var Ydt=ve((Mqi,Cdt)=>{"use strict";var $M=vt("path"),h3=vt("module"),od=iQ()("require-in-the-middle"),TQa=vdt();Cdt.exports=ose;Cdt.exports.Hook=ose;var Rdt,qM;if(h3.isBuiltin)qM=h3.isBuiltin;else if(h3.builtinModules)qM=n=>n.startsWith("node:")?!0:(Rdt===void 0&&(Rdt=new Set(h3.builtinModules)),Rdt.has(n));else{let n=Edt(),[t,r]=process.versions.node.split(".").map(Number);t===8&&r<8?qM=a=>a==="http2"?!0:!!n.core[a]:qM=a=>!!n.core[a]}var IEe;function DQa(n,t){if(!IEe)if(vt.resolve&&vt.resolve.paths)IEe=function(r,a){return vt.resolve(r,{paths:[a]})};else{let r=Edt();IEe=function(a,i){return r.sync(a,{basedir:i})}}return IEe(n,t)}var OQa=/([/\\]index)?(\.js)?$/,wdt=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(t,r){if(this._localCache.has(t))return!0;if(r)return!1;{let a=vt.cache[t];return!!(a&&this._kRitmExports in a)}}get(t,r){let a=this._localCache.get(t);if(a!==void 0)return a;if(!r){let i=vt.cache[t];return i&&i[this._kRitmExports]}}set(t,r,a){a?this._localCache.set(t,r):t in vt.cache?vt.cache[t][this._kRitmExports]=r:(od('non-core module is unexpectedly not in require.cache: "%s"',t),this._localCache.set(t,r))}};function ose(n,t,r){if(!(this instanceof ose))return new ose(n,t,r);if(typeof n=="function"?(r=n,n=null,t=null):typeof t=="function"&&(r=t,t=null),typeof h3._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof h3._resolveFilename),console.error("Please report this error as an issue related to Node.js %s at %s",process.version,J9n().bugs.url);return}this._cache=new wdt,this._unhooked=!1,this._origRequire=h3.prototype.require;let a=this,i=new Set,s=t?t.internals===!0:!1,e=Array.isArray(n);od("registering require hook"),this._require=h3.prototype.require=function(u){return a._unhooked===!0?(od("ignoring require call - module is soft-unhooked"),a._origRequire.apply(this,arguments)):o.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(u){return a._unhooked===!0?(od("ignoring process.getBuiltinModule call - module is soft-unhooked"),a._origGetBuiltinModule.apply(this,arguments)):o.call(this,arguments,!0)});function o(u,d){let I=u[0],h=qM(I),c;if(h){if(c=I,I.startsWith("node:")){let C=I.slice(5);qM(C)&&(c=C)}}else{if(d)return od("call to process.getBuiltinModule with unknown built-in id"),a._origGetBuiltinModule.apply(this,u);try{c=h3._resolveFilename(I,this)}catch(C){return od('Module._resolveFilename("%s") threw %j, calling original Module.require',I,C.message),a._origRequire.apply(this,u)}}let G,W;if(od("processing %s module require('%s'): %s",h===!0?"core":"non-core",I,c),a._cache.has(c,h)===!0)return od("returning already patched cached module: %s",c),a._cache.get(c,h);let y=i.has(c);y===!1&&i.add(c);let R=d?a._origGetBuiltinModule.apply(this,u):a._origRequire.apply(this,u);if(y===!0)return od("module is in the process of being patched already - ignoring: %s",c),R;if(i.delete(c),h===!0){if(e===!0&&n.includes(c)===!1)return od("ignoring core module not on whitelist: %s",c),R;G=c}else if(e===!0&&n.includes(c)){let C=$M.parse(c);G=C.name,W=C.dir}else{let C=TQa(c);if(C===void 0)return od("could not parse filename: %s",c),R;G=C.name,W=C.basedir;let A=UQa(C);od("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",G,I,A,W);let E=!1;if(e){if(!I.startsWith(".")&&n.includes(I)&&(G=I,E=!0),!n.includes(G)&&!n.includes(A))return R;n.includes(A)&&A!==G&&(G=A,E=!0)}if(!E){let f;try{f=DQa(G,W)}catch{return od("could not resolve module: %s",G),a._cache.set(c,R,h),R}if(f!==c)if(s===!0)G=G+$M.sep+$M.relative(W,c),od("preparing to process require of internal file: %s",G);else return od("ignoring require of non-main module file: %s",f),a._cache.set(c,R,h),R}}a._cache.set(c,R,h),od("calling require hook: %s",G);let F=r(R,G,W);return a._cache.set(c,F,h),od("returning module: %s",G),F}}ose.prototype.unhook=function(){this._unhooked=!0,this._require===h3.prototype.require?(h3.prototype.require=this._origRequire,od("require unhook successful")):od("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,od("process.getBuiltinModule unhook successful")):od("process.getBuiltinModule unhook unsuccessful"))};function UQa(n){let t=$M.sep!=="/"?n.path.split($M.sep).join("/"):n.path;return $M.posix.join(n.name,t).replace(OQa,"")}});var T9n=ve(Ex=>{"use strict";Object.defineProperty(Ex,"__esModule",{value:!0});Ex.ModuleNameTrie=Ex.ModuleNameSeparator=void 0;Ex.ModuleNameSeparator="/";var dEe=class{constructor(){this.hooks=[],this.children=new Map}},xdt=class{constructor(){this._trie=new dEe,this._counter=0}insert(t){let r=this._trie;for(let a of t.moduleName.split(Ex.ModuleNameSeparator)){let i=r.children.get(a);i||(i=new dEe,r.children.set(a,i)),r=i}r.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:r,fullOnly:a}={}){let i=this._trie,s=[],e=!0;for(let o of t.split(Ex.ModuleNameSeparator)){let u=i.children.get(o);if(!u){e=!1;break}a||s.push(...u.hooks),i=u}return a&&e&&s.push(...i.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(r&&s.sort((o,u)=>o.insertedId-u.insertedId),s.map(({hook:o})=>o))}};Ex.ModuleNameTrie=xdt});var O9n=ve(hEe=>{"use strict";Object.defineProperty(hEe,"__esModule",{value:!0});hEe.RequireInTheMiddleSingleton=void 0;var MQa=Ydt(),D9n=vt("path"),Vdt=T9n(),zQa=["afterEach","after","beforeEach","before","describe","it"].every(n=>typeof global[n]=="function"),Qdt=class n{constructor(){this._moduleNameTrie=new Vdt.ModuleNameTrie,this._initialize()}_initialize(){new MQa.Hook(null,{internals:!0},(t,r,a)=>{let i=_Qa(r),s=this._moduleNameTrie.search(i,{maintainInsertionOrder:!0,fullOnly:a===void 0});for(let{onRequire:e}of s)t=e(t,r,a);return t})}register(t,r){let a={moduleName:t,onRequire:r};return this._moduleNameTrie.insert(a),a}static getInstance(){var t;return zQa?new n:this._instance=(t=this._instance)!==null&&t!==void 0?t:new n}};hEe.RequireInTheMiddleSingleton=Qdt;function _Qa(n){return D9n.sep!==Vdt.ModuleNameSeparator?n.split(D9n.sep).join(Vdt.ModuleNameSeparator):n}});var j9n=ve(jk=>{var U9n=[],Hdt=new WeakMap,M9n=new WeakMap,z9n=new Map,_9n=[],PQa={set(n,t,r){return Hdt.get(n)[t](r)},get(n,t){if(t===Symbol.toStringTag)return"Module";let r=M9n.get(n)[t];if(typeof r=="function")return r()},defineProperty(n,t,r){if(!("value"in r))throw new Error("Getters/setters are not supported for exports property descriptors.");return Hdt.get(n)[t](r.value)}};function jQa(n,t,r,a,i){z9n.set(n,i),Hdt.set(t,r),M9n.set(t,a);let s=new Proxy(t,PQa);U9n.forEach(e=>e(n,s)),_9n.push([n,s])}var P9n=!1;function KQa(){return P9n}function qQa(n){P9n=n}jk.register=jQa;jk.importHooks=U9n;jk.specifiers=z9n;jk.toHook=_9n;jk.getExperimentalPatchInternals=KQa;jk.setExperimentalPatchInternals=qQa});var nHn=ve((Kqi,ez)=>{var K9n=vt("path"),$Qa=vdt(),{fileURLToPath:q9n}=vt("url"),{MessageChannel:e9a}=vt("worker_threads"),{importHooks:Xdt,specifiers:t9a,toHook:n9a,getExperimentalPatchInternals:r9a}=j9n();function eHn(n){Xdt.push(n),n9a.forEach(([t,r])=>n(t,r))}function tHn(n){let t=Xdt.indexOf(n);t>-1&&Xdt.splice(t,1)}function $9n(n,t,r,a){let i=n(t,r,a);i&&i!==t&&(t.default=i)}var kdt;function a9a(){let{port1:n,port2:t}=new e9a,r=0,a;kdt=o=>{r++,n.postMessage(o)},n.on("message",()=>{r--,a&&r<=0&&a()}).unref();function i(){let o=setInterval(()=>{},1e3),u=new Promise(d=>{a=d}).then(()=>{clearInterval(o)});return r===0&&a(),u}let s=t;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:i}}function cse(n,t,r){if(!(this instanceof cse))return new cse(n,t,r);typeof n=="function"?(r=n,n=null,t=null):typeof t=="function"&&(r=t,t=null);let a=t?t.internals===!0:!1;kdt&&Array.isArray(n)&&kdt(n),this._iitmHook=(i,s)=>{let e=i,o=i.startsWith("node:"),u;if(o)i=i.replace(/^node:/,"");else{if(i.startsWith("file://"))try{i=q9n(i)}catch{}let d=$Qa(i);d&&(i=d.name,u=d.basedir)}if(n){for(let d of n)if(d===i){if(u){if(a)i=i+K9n.sep+K9n.relative(u,q9n(e));else if(!r9a()&&!u.endsWith(t9a.get(e)))continue}$9n(r,s,i,u)}}else $9n(r,s,i,u)},eHn(this._iitmHook)}cse.prototype.unhook=function(){tHn(this._iitmHook)};ez.exports=cse;ez.exports.Hook=cse;ez.exports.addHook=eHn;ez.exports.removeHook=tHn;ez.exports.createAddHookMessageChannel=a9a});var Ldt=ve(Rx=>{"use strict";Object.defineProperty(Rx,"__esModule",{value:!0});Rx.isWrapped=Rx.safeExecuteInTheMiddleAsync=Rx.safeExecuteInTheMiddle=void 0;function i9a(n,t,r){let a,i;try{i=n()}catch(s){a=s}finally{if(t(a,i),a&&!r)throw a;return i}}Rx.safeExecuteInTheMiddle=i9a;async function l9a(n,t,r){let a,i;try{i=await n()}catch(s){a=s}finally{if(t(a,i),a&&!r)throw a;return i}}Rx.safeExecuteInTheMiddleAsync=l9a;function s9a(n){return typeof n=="function"&&typeof n.__original=="function"&&typeof n.__unwrap=="function"&&n.__wrapped===!0}Rx.isWrapped=s9a});var iHn=ve(mEe=>{"use strict";Object.defineProperty(mEe,"__esModule",{value:!0});mEe.InstrumentationBase=void 0;var Sdt=vt("path"),rHn=vt("util"),o9a=tse(),Bdt=bdt(),c9a=l9n(),u9a=O9n(),I9a=nHn(),tz=(Qr(),dr(kr)),d9a=Ydt(),h9a=vt("fs"),m9a=Ldt(),Jdt=class extends c9a.InstrumentationAbstract{constructor(t,r,a){super(t,r,a),this._hooks=[],this._requireInTheMiddleSingleton=u9a.RequireInTheMiddleSingleton.getInstance(),this._enabled=!1,this._wrap=(s,e,o)=>{if((0,m9a.isWrapped)(s[e])&&this._unwrap(s,e),rHn.types.isProxy(s)){let u=(0,Bdt.wrap)(Object.assign({},s),e,o);return Object.defineProperty(s,e,{value:u})}else return(0,Bdt.wrap)(s,e,o)},this._unwrap=(s,e)=>rHn.types.isProxy(s)?Object.defineProperty(s,e,{value:s[e]}):(0,Bdt.unwrap)(s,e),this._massWrap=(s,e,o)=>{if(s)Array.isArray(s)||(s=[s]);else{tz.diag.error("must provide one or more modules to patch");return}if(!(e&&Array.isArray(e))){tz.diag.error("must provide one or more functions to wrap on modules");return}s.forEach(u=>{e.forEach(d=>{this._wrap(u,d,o)})})},this._massUnwrap=(s,e)=>{if(s)Array.isArray(s)||(s=[s]);else{tz.diag.error("must provide one or more modules to patch");return}if(!(e&&Array.isArray(e))){tz.diag.error("must provide one or more functions to wrap on modules");return}s.forEach(o=>{e.forEach(u=>{this._unwrap(o,u)})})};let i=this.init();i&&!Array.isArray(i)&&(i=[i]),this._modules=i||[],this._modules.length===0&&tz.diag.debug(`No modules instrumentation has been defined for '${this.instrumentationName}@${this.instrumentationVersion}', nothing will be patched`),this._config.enabled&&this.enable()}_warnOnPreloadedModules(){this._modules.forEach(t=>{let{name:r}=t;try{let a=vt.resolve(r);vt.cache[a]&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(t){try{let r=(0,h9a.readFileSync)(Sdt.join(t,"package.json"),{encoding:"utf8"}),a=JSON.parse(r).version;return typeof a=="string"?a:void 0}catch{tz.diag.warn("Failed extracting version",t)}}_onRequire(t,r,a,i){var s;if(!i)return typeof t.patch=="function"&&(t.moduleExports=r,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:t.name}),t.patch(r)):r;let e=this._extractPackageVersion(i);if(t.moduleVersion=e,t.name===a)return aHn(t.supportedVersions,e,t.includePrerelease)&&typeof t.patch=="function"&&(t.moduleExports=r,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:t.name,version:t.moduleVersion,baseDir:i}),t.patch(r,t.moduleVersion)):r;let o=(s=t.files)!==null&&s!==void 0?s:[],u=Sdt.normalize(a);return o.filter(I=>I.name===u).filter(I=>aHn(I.supportedVersions,e,t.includePrerelease)).reduce((I,h)=>(h.moduleExports=I,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:t.name,version:t.moduleVersion,fileName:h.name,baseDir:i}),h.patch(I,t.moduleVersion)):I),r)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let t of this._modules){typeof t.patch=="function"&&t.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:t.name,version:t.moduleVersion}),t.patch(t.moduleExports,t.moduleVersion));for(let r of t.files)r.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:t.name,version:t.moduleVersion,fileName:r.name}),r.patch(r.moduleExports,t.moduleVersion))}return}this._warnOnPreloadedModules();for(let t of this._modules){let r=(e,o,u)=>this._onRequire(t,e,o,u),a=(e,o,u)=>this._onRequire(t,e,o,u),i=Sdt.isAbsolute(t.name)?new d9a.Hook([t.name],{internals:!0},a):this._requireInTheMiddleSingleton.register(t.name,a);this._hooks.push(i);let s=new I9a.Hook([t.name],{internals:!1},r);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let t of this._modules){typeof t.unpatch=="function"&&t.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:t.name,version:t.moduleVersion}),t.unpatch(t.moduleExports,t.moduleVersion));for(let r of t.files)r.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:t.name,version:t.moduleVersion,fileName:r.name}),r.unpatch(r.moduleExports,t.moduleVersion))}}}isEnabled(){return this._enabled}};mEe.InstrumentationBase=Jdt;function aHn(n,t,r){return typeof t>"u"?n.includes("*"):n.some(a=>(0,o9a.satisfies)(t,a,{includePrerelease:r}))}});var lHn=ve(pEe=>{"use strict";Object.defineProperty(pEe,"__esModule",{value:!0});pEe.normalize=void 0;var p9a=vt("path");Object.defineProperty(pEe,"normalize",{enumerable:!0,get:function(){return p9a.normalize}})});var sHn=ve(nz=>{"use strict";Object.defineProperty(nz,"__esModule",{value:!0});nz.normalize=nz.InstrumentationBase=void 0;var b9a=iHn();Object.defineProperty(nz,"InstrumentationBase",{enumerable:!0,get:function(){return b9a.InstrumentationBase}});var f9a=lHn();Object.defineProperty(nz,"normalize",{enumerable:!0,get:function(){return f9a.normalize}})});var Tdt=ve(rz=>{"use strict";Object.defineProperty(rz,"__esModule",{value:!0});rz.normalize=rz.InstrumentationBase=void 0;var oHn=sHn();Object.defineProperty(rz,"InstrumentationBase",{enumerable:!0,get:function(){return oHn.InstrumentationBase}});Object.defineProperty(rz,"normalize",{enumerable:!0,get:function(){return oHn.normalize}})});var cHn=ve(bEe=>{"use strict";Object.defineProperty(bEe,"__esModule",{value:!0});bEe.InstrumentationNodeModuleDefinition=void 0;var Ddt=class{constructor(t,r,a,i,s){this.name=t,this.supportedVersions=r,this.patch=a,this.unpatch=i,this.files=s||[]}};bEe.InstrumentationNodeModuleDefinition=Ddt});var uHn=ve(fEe=>{"use strict";Object.defineProperty(fEe,"__esModule",{value:!0});fEe.InstrumentationNodeModuleFile=void 0;var G9a=Tdt(),Odt=class{constructor(t,r,a,i){this.supportedVersions=r,this.patch=a,this.unpatch=i,this.name=(0,G9a.normalize)(t)}};fEe.InstrumentationNodeModuleFile=Odt});var dHn=ve(IHn=>{"use strict";Object.defineProperty(IHn,"__esModule",{value:!0})});var mHn=ve(hHn=>{"use strict";Object.defineProperty(hHn,"__esModule",{value:!0})});var Mdt=ve(Tm=>{"use strict";var g9a=Tm&&Tm.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),Udt=Tm&&Tm.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&g9a(t,n,r)};Object.defineProperty(Tm,"__esModule",{value:!0});Tm.InstrumentationNodeModuleFile=Tm.InstrumentationNodeModuleDefinition=Tm.InstrumentationBase=Tm.registerInstrumentations=void 0;var v9a=n9n();Object.defineProperty(Tm,"registerInstrumentations",{enumerable:!0,get:function(){return v9a.registerInstrumentations}});var Z9a=Tdt();Object.defineProperty(Tm,"InstrumentationBase",{enumerable:!0,get:function(){return Z9a.InstrumentationBase}});var N9a=cHn();Object.defineProperty(Tm,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return N9a.InstrumentationNodeModuleDefinition}});var A9a=uHn();Object.defineProperty(Tm,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return A9a.InstrumentationNodeModuleFile}});Udt(dHn(),Tm);Udt(mHn(),Tm);Udt(Ldt(),Tm)});var pHn=ve(GEe=>{"use strict";Object.defineProperty(GEe,"__esModule",{value:!0});GEe.VERSION=void 0;GEe.VERSION="0.52.1"});var fHn=ve(vEe=>{"use strict";Object.defineProperty(vEe,"__esModule",{value:!0});vEe.OTLPTraceExporter=void 0;var az=Va(),gEe=PY(),W9a=xk(),y9a=pHn(),bHn="v1/traces",F9a=`http://localhost:4318/${bHn}`,E9a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${y9a.VERSION}`},zdt=class extends gEe.OTLPExporterNodeBase{constructor(t={}){super(t,W9a.ProtobufTraceSerializer,"application/x-protobuf"),this.headers=Object.assign(Object.assign(Object.assign(Object.assign({},this.headers),E9a),az.baggageUtils.parseKeyPairsIntoRecord((0,az.getEnv)().OTEL_EXPORTER_OTLP_TRACES_HEADERS)),(0,gEe.parseHeaders)(t?.headers))}getDefaultUrl(t){return typeof t.url=="string"?t.url:(0,az.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length>0?(0,gEe.appendRootPathToUrlIfNeeded)((0,az.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT):(0,az.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length>0?(0,gEe.appendResourcePathToUrl)((0,az.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT,bHn):F9a}};vEe.OTLPTraceExporter=zdt});var GHn=ve(ZEe=>{"use strict";Object.defineProperty(ZEe,"__esModule",{value:!0});ZEe.OTLPTraceExporter=void 0;var R9a=fHn();Object.defineProperty(ZEe,"OTLPTraceExporter",{enumerable:!0,get:function(){return R9a.OTLPTraceExporter}})});var gHn=ve(NEe=>{"use strict";Object.defineProperty(NEe,"__esModule",{value:!0});NEe.OTLPTraceExporter=void 0;var w9a=GHn();Object.defineProperty(NEe,"OTLPTraceExporter",{enumerable:!0,get:function(){return w9a.OTLPTraceExporter}})});var vHn=ve(AEe=>{"use strict";Object.defineProperty(AEe,"__esModule",{value:!0});AEe.OTLPTraceExporter=void 0;var C9a=gHn();Object.defineProperty(AEe,"OTLPTraceExporter",{enumerable:!0,get:function(){return C9a.OTLPTraceExporter}})});var ZHn=ve(WEe=>{"use strict";Object.defineProperty(WEe,"__esModule",{value:!0});WEe.VERSION=void 0;WEe.VERSION="0.52.1"});var yHn=ve(yEe=>{"use strict";Object.defineProperty(yEe,"__esModule",{value:!0});yEe.OTLPTraceExporter=void 0;var iz=Va(),NHn=PY(),AHn=PY(),Y9a=ZHn(),x9a=xk(),WHn="v1/traces",V9a=`http://localhost:4318/${WHn}`,Q9a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${Y9a.VERSION}`},_dt=class extends NHn.OTLPExporterNodeBase{constructor(t={}){super(t,x9a.JsonTraceSerializer,"application/json"),this.headers=Object.assign(Object.assign(Object.assign(Object.assign({},this.headers),Q9a),iz.baggageUtils.parseKeyPairsIntoRecord((0,iz.getEnv)().OTEL_EXPORTER_OTLP_TRACES_HEADERS)),(0,NHn.parseHeaders)(t?.headers))}getDefaultUrl(t){return typeof t.url=="string"?t.url:(0,iz.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length>0?(0,AHn.appendRootPathToUrlIfNeeded)((0,iz.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT):(0,iz.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length>0?(0,AHn.appendResourcePathToUrl)((0,iz.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT,WHn):V9a}};yEe.OTLPTraceExporter=_dt});var FHn=ve(Kk=>{"use strict";var H9a=Kk&&Kk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),X9a=Kk&&Kk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&H9a(t,n,r)};Object.defineProperty(Kk,"__esModule",{value:!0});X9a(yHn(),Kk)});var EHn=ve(qk=>{"use strict";var k9a=qk&&qk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),L9a=qk&&qk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&k9a(t,n,r)};Object.defineProperty(qk,"__esModule",{value:!0});L9a(FHn(),qk)});var RHn=ve($k=>{"use strict";var S9a=$k&&$k.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),B9a=$k&&$k.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&S9a(t,n,r)};Object.defineProperty($k,"__esModule",{value:!0});B9a(EHn(),$k)});var wHn=ve(EEe=>{"use strict";Object.defineProperty(EEe,"__esModule",{value:!0});EEe.prepareSend=void 0;var Pdt=(Qr(),dr(kr)),FEe=Va(),J9a=vt("http"),T9a=vt("https"),D9a=vt("url");function O9a(n,t){let r=D9a.parse(n),a=Object.assign({method:"POST",headers:Object.assign({"Content-Type":"application/json"},t)},r);return function(s,e){if(s.length===0)return Pdt.diag.debug("Zipkin send with empty spans"),e({code:FEe.ExportResultCode.SUCCESS});let{request:o}=a.protocol==="http:"?J9a:T9a,u=o(a,I=>{let h="";I.on("data",c=>{h+=c}),I.on("end",()=>{let c=I.statusCode||0;return Pdt.diag.debug(`Zipkin response status code: ${c}, body: ${h}`),c<400?e({code:FEe.ExportResultCode.SUCCESS}):e({code:FEe.ExportResultCode.FAILED,error:new Error(`Got unexpected status code from zipkin: ${c}`)})})});u.on("error",I=>e({code:FEe.ExportResultCode.FAILED,error:I}));let d=JSON.stringify(s);Pdt.diag.debug(`Zipkin request payload: ${d}`),u.write(d,"utf8"),u.end()}}EEe.prepareSend=O9a});var CHn=ve(e6=>{"use strict";var U9a=e6&&e6.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),M9a=e6&&e6.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&U9a(t,n,r)};Object.defineProperty(e6,"__esModule",{value:!0});M9a(wHn(),e6)});var jdt=ve(t6=>{"use strict";var z9a=t6&&t6.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),_9a=t6&&t6.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&z9a(t,n,r)};Object.defineProperty(t6,"__esModule",{value:!0});_9a(CHn(),t6)});var YHn=ve(use=>{"use strict";Object.defineProperty(use,"__esModule",{value:!0});use.SpanKind=void 0;var P9a;(function(n){n.CLIENT="CLIENT",n.SERVER="SERVER",n.CONSUMER="CONSUMER",n.PRODUCER="PRODUCER"})(P9a=use.SpanKind||(use.SpanKind={}))});var QHn=ve(yZ=>{"use strict";Object.defineProperty(yZ,"__esModule",{value:!0});yZ._toZipkinAnnotations=yZ._toZipkinTags=yZ.toZipkinSpan=yZ.defaultStatusErrorTagName=yZ.defaultStatusCodeTagName=void 0;var wx=(Qr(),dr(kr)),Kdt=Va(),REe=YHn(),j9a={[wx.SpanKind.CLIENT]:REe.SpanKind.CLIENT,[wx.SpanKind.SERVER]:REe.SpanKind.SERVER,[wx.SpanKind.CONSUMER]:REe.SpanKind.CONSUMER,[wx.SpanKind.PRODUCER]:REe.SpanKind.PRODUCER,[wx.SpanKind.INTERNAL]:void 0};yZ.defaultStatusCodeTagName="otel.status_code";yZ.defaultStatusErrorTagName="error";function K9a(n,t,r,a){return{traceId:n.spanContext().traceId,parentId:n.parentSpanId,name:n.name,id:n.spanContext().spanId,kind:j9a[n.kind],timestamp:(0,Kdt.hrTimeToMicroseconds)(n.startTime),duration:Math.round((0,Kdt.hrTimeToMicroseconds)(n.duration)),localEndpoint:{serviceName:t},tags:xHn(n,r,a),annotations:n.events.length?VHn(n.events):void 0}}yZ.toZipkinSpan=K9a;function xHn({attributes:n,resource:t,status:r,droppedAttributesCount:a,droppedEventsCount:i,droppedLinksCount:s},e,o){let u={};for(let d of Object.keys(n))u[d]=String(n[d]);return r.code!==wx.SpanStatusCode.UNSET&&(u[e]=String(wx.SpanStatusCode[r.code])),r.code===wx.SpanStatusCode.ERROR&&r.message&&(u[o]=r.message),a&&(u["otel.dropped_attributes_count"]=String(a)),i&&(u["otel.dropped_events_count"]=String(i)),s&&(u["otel.dropped_links_count"]=String(s)),Object.keys(t.attributes).forEach(d=>u[d]=String(t.attributes[d])),u}yZ._toZipkinTags=xHn;function VHn(n){return n.map(t=>({timestamp:Math.round((0,Kdt.hrTimeToMicroseconds)(t.time)),value:t.name}))}yZ._toZipkinAnnotations=VHn});var HHn=ve(wEe=>{"use strict";Object.defineProperty(wEe,"__esModule",{value:!0});wEe.prepareGetHeaders=void 0;function q9a(n){return function(){return n()}}wEe.prepareGetHeaders=q9a});var SHn=ve(CEe=>{"use strict";Object.defineProperty(CEe,"__esModule",{value:!0});CEe.ZipkinExporter=void 0;var XHn=(Qr(),dr(kr)),kHn=Va(),LHn=jdt(),qdt=QHn(),$dt=Xm(),$9a=HHn(),e0t=class{constructor(t={}){this.DEFAULT_SERVICE_NAME="OpenTelemetry Service",this._sendingPromises=[],this._urlStr=t.url||(0,kHn.getEnv)().OTEL_EXPORTER_ZIPKIN_ENDPOINT,this._send=(0,LHn.prepareSend)(this._urlStr,t.headers),this._serviceName=t.serviceName,this._statusCodeTagName=t.statusCodeTagName||qdt.defaultStatusCodeTagName,this._statusDescriptionTagName=t.statusDescriptionTagName||qdt.defaultStatusErrorTagName,this._isShutdown=!1,typeof t.getExportRequestHeaders=="function"?this._getHeaders=(0,$9a.prepareGetHeaders)(t.getExportRequestHeaders):this._beforeSend=function(){}}export(t,r){let a=String(this._serviceName||t[0].resource.attributes[$dt.SEMRESATTRS_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(XHn.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>r({code:kHn.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")}));return}let i=new Promise(e=>{this._sendSpans(t,a,o=>{e(),r(o)})});this._sendingPromises.push(i);let s=()=>{let e=this._sendingPromises.indexOf(i);this._sendingPromises.splice(e,1)};i.then(s,s)}shutdown(){return XHn.diag.debug("Zipkin exporter shutdown"),this._isShutdown=!0,this.forceFlush()}forceFlush(){return new Promise((t,r)=>{Promise.all(this._sendingPromises).then(()=>{t()},r)})}_beforeSend(){this._getHeaders&&(this._send=(0,LHn.prepareSend)(this._urlStr,this._getHeaders()))}_sendSpans(t,r,a){let i=t.map(s=>(0,qdt.toZipkinSpan)(s,String(s.attributes[$dt.SEMRESATTRS_SERVICE_NAME]||s.resource.attributes[$dt.SEMRESATTRS_SERVICE_NAME]||r),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(i,s=>{if(a)return a(s)})}};CEe.ZipkinExporter=e0t});var JHn=ve(Cx=>{"use strict";var eHa=Cx&&Cx.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),BHn=Cx&&Cx.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&eHa(t,n,r)};Object.defineProperty(Cx,"__esModule",{value:!0});BHn(jdt(),Cx);BHn(SHn(),Cx)});var DHn=ve(VEe=>{"use strict";var t0t;Object.defineProperty(VEe,"__esModule",{value:!0});VEe.TracerProviderWithEnvExporters=void 0;var lz=(Qr(),dr(kr)),YEe=Va(),xEe=Ok(),tHa=iEe(),THn=vHn(),nHa=RHn(),rHa=But(),aHa=JHn(),Ise=class extends tHa.NodeTracerProvider{constructor(t={}){super(t),this._configuredExporters=[],this._hasSpanProcessors=!1;let r=this.filterBlanksAndNulls(Array.from(new Set((0,YEe.getEnv)().OTEL_TRACES_EXPORTER.split(","))));r[0]==="none"?lz.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'):r.length===0?(lz.diag.warn("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),r=["otlp"],this.createExportersFromList(r),this._spanProcessors=this.configureSpanProcessors(this._configuredExporters),this._spanProcessors.forEach(a=>{this.addSpanProcessor(a)})):(r.length>1&&r.includes("none")&&(lz.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),r=["otlp"]),this.createExportersFromList(r),this._configuredExporters.length>0?(this._spanProcessors=this.configureSpanProcessors(this._configuredExporters),this._spanProcessors.forEach(a=>{this.addSpanProcessor(a)})):lz.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values."))}static configureOtlp(){let t=this.getOtlpProtocol();switch(t){case"grpc":return new rHa.OTLPTraceExporter;case"http/json":return new nHa.OTLPTraceExporter;case"http/protobuf":return new THn.OTLPTraceExporter;default:return lz.diag.warn(`Unsupported OTLP traces protocol: ${t}. Using http/protobuf.`),new THn.OTLPTraceExporter}}static getOtlpProtocol(){var t,r,a;let i=(0,YEe.getEnvWithoutDefaults)();return(a=(r=(t=i.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL)!==null&&t!==void 0?t:i.OTEL_EXPORTER_OTLP_PROTOCOL)!==null&&r!==void 0?r:(0,YEe.getEnv)().OTEL_EXPORTER_OTLP_TRACES_PROTOCOL)!==null&&a!==void 0?a:(0,YEe.getEnv)().OTEL_EXPORTER_OTLP_PROTOCOL}static configureJaeger(){try{let{JaegerExporter:t}=vt("@opentelemetry/exporter-jaeger");return new t}catch(t){throw new Error(`Could not instantiate JaegerExporter. This could be due to the JaegerExporter's lack of support for bundling. If possible, use @opentelemetry/exporter-trace-otlp-proto instead. Original Error: ${t}`)}}addSpanProcessor(t){super.addSpanProcessor(t),this._hasSpanProcessors=!0}register(t){this._hasSpanProcessors&&super.register(t)}createExportersFromList(t){t.forEach(r=>{let a=this._getSpanExporter(r);a?this._configuredExporters.push(a):lz.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${r}.`)})}configureSpanProcessors(t){return t.map(r=>r instanceof xEe.ConsoleSpanExporter?new xEe.SimpleSpanProcessor(r):new xEe.BatchSpanProcessor(r))}filterBlanksAndNulls(t){return t.map(r=>r.trim()).filter(r=>r!=="null"&&r!=="")}};VEe.TracerProviderWithEnvExporters=Ise;t0t=Ise;Ise._registeredExporters=new Map([["otlp",()=>t0t.configureOtlp()],["zipkin",()=>new aHa.ZipkinExporter],["jaeger",()=>t0t.configureJaeger()],["console",()=>new xEe.ConsoleSpanExporter]])});var OHn=ve(QEe=>{"use strict";Object.defineProperty(QEe,"__esModule",{value:!0});QEe.getResourceDetectorsFromEnv=void 0;var iHa=(Qr(),dr(kr)),dse=gx(),lHa="env",sHa="host",oHa="os",cHa="process",uHa="serviceinstance";function IHa(){var n,t;let r=new Map([[lHa,dse.envDetectorSync],[sHa,dse.hostDetectorSync],[oHa,dse.osDetectorSync],[uHa,dse.serviceInstanceIdDetectorSync],[cHa,dse.processDetectorSync]]),a=(t=(n=process.env.OTEL_NODE_RESOURCE_DETECTORS)===null||n===void 0?void 0:n.split(","))!==null&&t!==void 0?t:["all"];return a.includes("all")?[...r.values()].flat():a.includes("none")?[]:a.flatMap(i=>{let s=r.get(i);return s||iHa.diag.error(`Invalid resource detector "${i}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`),s||[]})}QEe.getResourceDetectorsFromEnv=IHa});var MHn=ve(HEe=>{"use strict";Object.defineProperty(HEe,"__esModule",{value:!0});HEe.NodeSDK=void 0;var hse=(Qr(),dr(kr)),dHa=pU(),hHa=Mdt(),sz=gx(),mHa=h5e(),pHa=VM(),bHa=Ok(),fHa=iEe(),GHa=Xm(),gHa=DHn(),UHn=Va(),vHa=OHn(),n0t=class{constructor(t={}){var r,a,i,s,e,o,u;let d=(0,UHn.getEnv)(),I=(0,UHn.getEnvWithoutDefaults)();d.OTEL_SDK_DISABLED&&(this._disabled=!0),I.OTEL_LOG_LEVEL&&hse.diag.setLogger(new hse.DiagConsoleLogger,{logLevel:I.OTEL_LOG_LEVEL}),this._configuration=t,this._resource=(r=t.resource)!==null&&r!==void 0?r:new sz.Resource({});let h=[];if(process.env.OTEL_NODE_RESOURCE_DETECTORS!=null?h=(0,vHa.getResourceDetectorsFromEnv)():h=[sz.envDetector,sz.processDetector,sz.hostDetector],this._resourceDetectors=(a=t.resourceDetectors)!==null&&a!==void 0?a:h,this._serviceName=t.serviceName,this._autoDetectResources=(i=t.autoDetectResources)!==null&&i!==void 0?i:!0,t.traceExporter||t.spanProcessor||t.spanProcessors){let c={};t.sampler&&(c.sampler=t.sampler),t.spanLimits&&(c.spanLimits=t.spanLimits),t.idGenerator&&(c.idGenerator=t.idGenerator),t.spanProcessor&&hse.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let G=(s=t.spanProcessor)!==null&&s!==void 0?s:new bHa.BatchSpanProcessor(t.traceExporter),W=(e=t.spanProcessors)!==null&&e!==void 0?e:[G];this._tracerProviderConfig={tracerConfig:c,spanProcessors:W,contextManager:t.contextManager,textMapPropagator:t.textMapPropagator}}if(t.logRecordProcessor&&(this._loggerProviderConfig={logRecordProcessor:t.logRecordProcessor}),t.metricReader||t.views){let c={};t.metricReader&&(c.reader=t.metricReader),t.views&&(c.views=t.views),this._meterProviderConfig=c}this._instrumentations=(u=(o=t.instrumentations)===null||o===void 0?void 0:o.flat())!==null&&u!==void 0?u:[]}start(){var t,r,a,i,s,e;if(this._disabled)return;if((0,hHa.registerInstrumentations)({instrumentations:this._instrumentations}),this._autoDetectResources){let d={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,sz.detectResourcesSync)(d))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge(new sz.Resource({[GHa.SEMRESATTRS_SERVICE_NAME]:this._serviceName}));let o=this._tracerProviderConfig?fHa.NodeTracerProvider:gHa.TracerProviderWithEnvExporters,u=new o(Object.assign(Object.assign({},this._configuration),{resource:this._resource}));if(this._tracerProvider=u,this._tracerProviderConfig)for(let d of this._tracerProviderConfig.spanProcessors)u.addSpanProcessor(d);if(u.register({contextManager:(r=(t=this._tracerProviderConfig)===null||t===void 0?void 0:t.contextManager)!==null&&r!==void 0?r:(a=this._configuration)===null||a===void 0?void 0:a.contextManager,propagator:(i=this._tracerProviderConfig)===null||i===void 0?void 0:i.textMapPropagator}),this._loggerProviderConfig){let d=new mHa.LoggerProvider({resource:this._resource});d.addLogRecordProcessor(this._loggerProviderConfig.logRecordProcessor),this._loggerProvider=d,dHa.logs.setGlobalLoggerProvider(d)}if(this._meterProviderConfig){let d=[];this._meterProviderConfig.reader&&d.push(this._meterProviderConfig.reader);let I=new pHa.MeterProvider({resource:this._resource,views:(e=(s=this._meterProviderConfig)===null||s===void 0?void 0:s.views)!==null&&e!==void 0?e:[],readers:d});this._meterProvider=I,hse.metrics.setGlobalMeterProvider(I);for(let h of this._instrumentations)h.setMeterProvider(hse.metrics.getMeterProvider())}}shutdown(){let t=[];return this._tracerProvider&&t.push(this._tracerProvider.shutdown()),this._loggerProvider&&t.push(this._loggerProvider.shutdown()),this._meterProvider&&t.push(this._meterProvider.shutdown()),Promise.all(t).then(()=>{})}};HEe.NodeSDK=n0t});var _Hn=ve(zHn=>{"use strict";Object.defineProperty(zHn,"__esModule",{value:!0})});var jHn=ve(Du=>{"use strict";var ZHa=Du&&Du.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),PHn=Du&&Du.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ZHa(t,n,r)};Object.defineProperty(Du,"__esModule",{value:!0});Du.tracing=Du.resources=Du.node=Du.metrics=Du.logs=Du.core=Du.contextBase=Du.api=void 0;Du.api=(Qr(),dr(kr));Du.contextBase=(Qr(),dr(kr));Du.core=Va();Du.logs=h5e();Du.metrics=VM();Du.node=iEe();Du.resources=gx();Du.tracing=Ok();PHn(MHn(),Du);PHn(_Hn(),Du)});var KHn=ve(mse=>{"use strict";Object.defineProperty(mse,"__esModule",{value:!0});mse.AttributeNames=void 0;var NHa;(function(n){n.HTTP_ERROR_NAME="http.error_name",n.HTTP_ERROR_MESSAGE="http.error_message",n.HTTP_STATUS_TEXT="http.status_text"})(NHa=mse.AttributeNames||(mse.AttributeNames={}))});var r0t=ve(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.headerCapture=_a.getIncomingRequestMetricAttributesOnResponse=_a.getIncomingRequestAttributesOnResponse=_a.getIncomingRequestMetricAttributes=_a.getIncomingRequestAttributes=_a.getOutgoingRequestMetricAttributesOnResponse=_a.getOutgoingRequestAttributesOnResponse=_a.setAttributesFromHttpKind=_a.getOutgoingRequestMetricAttributes=_a.getOutgoingRequestAttributes=_a.extractHostnameAndPort=_a.isValidOptionsType=_a.getRequestInfo=_a.isCompressed=_a.setResponseContentLengthAttribute=_a.setRequestContentLengthAttribute=_a.setSpanWithError=_a.isIgnored=_a.satisfiesPattern=_a.parseResponseStatus=_a.getAbsoluteUrl=void 0;var pse=(Qr(),dr(kr)),Ca=Xm(),qHn=Va(),XEe=vt("url"),kEe=KHn(),AHa=(n,t,r="http:")=>{let a=n||{},i=a.protocol||r,s=(a.port||"").toString(),e=a.path||"/",o=a.host||a.hostname||t.host||"localhost";return o.indexOf(":")===-1&&s&&s!=="80"&&s!=="443"&&(o+=`:${s}`),`${i}//${o}${e}`};_a.getAbsoluteUrl=AHa;var WHa=(n,t)=>{let r=n===pse.SpanKind.CLIENT?400:500;return t&&t>=100&&t<r?pse.SpanStatusCode.UNSET:pse.SpanStatusCode.ERROR};_a.parseResponseStatus=WHa;var yHa=(n,t)=>{if(typeof t=="string")return t===n;if(t instanceof RegExp)return t.test(n);if(typeof t=="function")return t(n);throw new TypeError("Pattern is in unsupported datatype")};_a.satisfiesPattern=yHa;var FHa=(n,t,r)=>{if(!t)return!1;try{for(let a of t)if((0,_a.satisfiesPattern)(n,a))return!0}catch(a){r&&r(a)}return!1};_a.isIgnored=FHa;var EHa=(n,t)=>{let r=t.message;n.setAttribute(kEe.AttributeNames.HTTP_ERROR_NAME,t.name),n.setAttribute(kEe.AttributeNames.HTTP_ERROR_MESSAGE,r),n.setStatus({code:pse.SpanStatusCode.ERROR,message:r}),n.recordException(t)};_a.setSpanWithError=EHa;var RHa=(n,t)=>{let r=$Hn(n.headers);r!==null&&((0,_a.isCompressed)(n.headers)?t[Ca.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH]=r:t[Ca.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=r)};_a.setRequestContentLengthAttribute=RHa;var wHa=(n,t)=>{let r=$Hn(n.headers);r!==null&&((0,_a.isCompressed)(n.headers)?t[Ca.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH]=r:t[Ca.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=r)};_a.setResponseContentLengthAttribute=wHa;function $Hn(n){let t=n["content-length"];if(t===void 0)return null;let r=parseInt(t,10);return isNaN(r)?null:r}var CHa=n=>{let t=n["content-encoding"];return!!t&&t!=="identity"};_a.isCompressed=CHa;var YHa=(n,t)=>{let r="/",a="",i;if(typeof n=="string")i=XEe.parse(n),r=i.pathname||"/",a=`${i.protocol||"http:"}//${i.host}`,t!==void 0&&Object.assign(i,t);else if(n instanceof XEe.URL)i={protocol:n.protocol,hostname:typeof n.hostname=="string"&&n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,path:`${n.pathname||""}${n.search||""}`},n.port!==""&&(i.port=Number(n.port)),(n.username||n.password)&&(i.auth=`${n.username}:${n.password}`),r=n.pathname,a=n.origin,t!==void 0&&Object.assign(i,t);else{i=Object.assign({protocol:n.host?"http:":void 0},n),r=n.pathname,!r&&i.path&&(r=XEe.parse(i.path).pathname||"/");let e=i.host||(i.port!=null?`${i.hostname}${i.port}`:i.hostname);a=`${i.protocol||"http:"}//${e}`}let s=i.method?i.method.toUpperCase():"GET";return{origin:a,pathname:r,method:s,optionsParsed:i}};_a.getRequestInfo=YHa;var xHa=n=>{if(!n)return!1;let t=typeof n;return t==="string"||t==="object"&&!Array.isArray(n)};_a.isValidOptionsType=xHa;var VHa=n=>{var t;if(n.hostname&&n.port)return{hostname:n.hostname,port:n.port};let r=((t=n.host)===null||t===void 0?void 0:t.match(/^([^:/ ]+)(:\d{1,5})?/))||null,a=n.hostname||(r===null?"localhost":r[1]),i=n.port;return i||(r&&r[2]?i=r[2].substring(1):i=n.protocol==="https:"?"443":"80"),{hostname:a,port:i}};_a.extractHostnameAndPort=VHa;var QHa=(n,t)=>{var r;let a=t.hostname,i=t.port,s=n.method,e=s?s.toUpperCase():"GET",o=n.headers||{},u=o["user-agent"],d={[Ca.SEMATTRS_HTTP_URL]:(0,_a.getAbsoluteUrl)(n,o,`${t.component}:`),[Ca.SEMATTRS_HTTP_METHOD]:e,[Ca.SEMATTRS_HTTP_TARGET]:n.path||"/",[Ca.SEMATTRS_NET_PEER_NAME]:a,[Ca.SEMATTRS_HTTP_HOST]:(r=o.host)!==null&&r!==void 0?r:`${a}:${i}`};return u!==void 0&&(d[Ca.SEMATTRS_HTTP_USER_AGENT]=u),Object.assign(d,t.hookAttributes)};_a.getOutgoingRequestAttributes=QHa;var HHa=n=>{let t={};return t[Ca.SEMATTRS_HTTP_METHOD]=n[Ca.SEMATTRS_HTTP_METHOD],t[Ca.SEMATTRS_NET_PEER_NAME]=n[Ca.SEMATTRS_NET_PEER_NAME],t};_a.getOutgoingRequestMetricAttributes=HHa;var XHa=(n,t)=>{n&&(t[Ca.SEMATTRS_HTTP_FLAVOR]=n,n.toUpperCase()!=="QUIC"?t[Ca.SEMATTRS_NET_TRANSPORT]=Ca.NETTRANSPORTVALUES_IP_TCP:t[Ca.SEMATTRS_NET_TRANSPORT]=Ca.NETTRANSPORTVALUES_IP_UDP)};_a.setAttributesFromHttpKind=XHa;var kHa=n=>{let{statusCode:t,statusMessage:r,httpVersion:a,socket:i}=n,s={};if(i){let{remoteAddress:e,remotePort:o}=i;s[Ca.SEMATTRS_NET_PEER_IP]=e,s[Ca.SEMATTRS_NET_PEER_PORT]=o}return(0,_a.setResponseContentLengthAttribute)(n,s),t&&(s[Ca.SEMATTRS_HTTP_STATUS_CODE]=t,s[kEe.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,_a.setAttributesFromHttpKind)(a,s),s};_a.getOutgoingRequestAttributesOnResponse=kHa;var LHa=n=>{let t={};return t[Ca.SEMATTRS_NET_PEER_PORT]=n[Ca.SEMATTRS_NET_PEER_PORT],t[Ca.SEMATTRS_HTTP_STATUS_CODE]=n[Ca.SEMATTRS_HTTP_STATUS_CODE],t[Ca.SEMATTRS_HTTP_FLAVOR]=n[Ca.SEMATTRS_HTTP_FLAVOR],t};_a.getOutgoingRequestMetricAttributesOnResponse=LHa;var SHa=(n,t)=>{let r=n.headers,a=r["user-agent"],i=r["x-forwarded-for"],s=n.method||"GET",e=n.httpVersion,o=n.url?XEe.parse(n.url):null,u=o?.host||r.host,d=o?.hostname||u?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",I=t.serverName,h={[Ca.SEMATTRS_HTTP_URL]:(0,_a.getAbsoluteUrl)(o,r,`${t.component}:`),[Ca.SEMATTRS_HTTP_HOST]:u,[Ca.SEMATTRS_NET_HOST_NAME]:d,[Ca.SEMATTRS_HTTP_METHOD]:s,[Ca.SEMATTRS_HTTP_SCHEME]:t.component};return typeof i=="string"&&(h[Ca.SEMATTRS_HTTP_CLIENT_IP]=i.split(",")[0]),typeof I=="string"&&(h[Ca.SEMATTRS_HTTP_SERVER_NAME]=I),o&&(h[Ca.SEMATTRS_HTTP_TARGET]=o.path||"/"),a!==void 0&&(h[Ca.SEMATTRS_HTTP_USER_AGENT]=a),(0,_a.setRequestContentLengthAttribute)(n,h),(0,_a.setAttributesFromHttpKind)(e,h),Object.assign(h,t.hookAttributes)};_a.getIncomingRequestAttributes=SHa;var BHa=n=>{let t={};return t[Ca.SEMATTRS_HTTP_SCHEME]=n[Ca.SEMATTRS_HTTP_SCHEME],t[Ca.SEMATTRS_HTTP_METHOD]=n[Ca.SEMATTRS_HTTP_METHOD],t[Ca.SEMATTRS_NET_HOST_NAME]=n[Ca.SEMATTRS_NET_HOST_NAME],t[Ca.SEMATTRS_HTTP_FLAVOR]=n[Ca.SEMATTRS_HTTP_FLAVOR],t};_a.getIncomingRequestMetricAttributes=BHa;var JHa=(n,t)=>{let{socket:r}=n,{statusCode:a,statusMessage:i}=t,s=(0,qHn.getRPCMetadata)(pse.context.active()),e={};if(r){let{localAddress:o,localPort:u,remoteAddress:d,remotePort:I}=r;e[Ca.SEMATTRS_NET_HOST_IP]=o,e[Ca.SEMATTRS_NET_HOST_PORT]=u,e[Ca.SEMATTRS_NET_PEER_IP]=d,e[Ca.SEMATTRS_NET_PEER_PORT]=I}return e[Ca.SEMATTRS_HTTP_STATUS_CODE]=a,e[kEe.AttributeNames.HTTP_STATUS_TEXT]=(i||"").toUpperCase(),s?.type===qHn.RPCType.HTTP&&s.route!==void 0&&(e[Ca.SEMATTRS_HTTP_ROUTE]=s.route),e};_a.getIncomingRequestAttributesOnResponse=JHa;var THa=n=>{let t={};return t[Ca.SEMATTRS_HTTP_STATUS_CODE]=n[Ca.SEMATTRS_HTTP_STATUS_CODE],t[Ca.SEMATTRS_NET_HOST_PORT]=n[Ca.SEMATTRS_NET_HOST_PORT],n[Ca.SEMATTRS_HTTP_ROUTE]!==void 0&&(t[Ca.SEMATTRS_HTTP_ROUTE]=n[Ca.SEMATTRS_HTTP_ROUTE]),t};_a.getIncomingRequestMetricAttributesOnResponse=THa;function DHa(n,t){let r=new Map;for(let a=0,i=t.length;a<i;a++){let s=t[a].toLowerCase();r.set(s,s.replace(/-/g,"_"))}return(a,i)=>{for(let s of r.keys()){let e=i(s);if(e===void 0)continue;let o=r.get(s),u=`http.${n}.header.${o}`;typeof e=="string"?a.setAttribute(u,[e]):Array.isArray(e)?a.setAttribute(u,e):a.setAttribute(u,[e])}}}_a.headerCapture=DHa});var eXn=ve(LEe=>{"use strict";Object.defineProperty(LEe,"__esModule",{value:!0});LEe.VERSION=void 0;LEe.VERSION="0.52.1"});var aXn=ve(SEe=>{"use strict";Object.defineProperty(SEe,"__esModule",{value:!0});SEe.HttpInstrumentation=void 0;var xi=(Qr(),dr(kr)),oz=Va(),tXn=tse(),nXn=vt("url"),Ou=r0t(),OHa=eXn(),FZ=Mdt(),rXn=Va(),a0t=vt("events"),UHa=Xm(),i0t=class extends FZ.InstrumentationBase{constructor(t={}){super("@opentelemetry/instrumentation-http",OHa.VERSION,t),this._spanNotEnded=new WeakSet,this._headerCapture=this._createHeaderCapture()}_updateMetricInstruments(){this._httpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:xi.ValueType.DOUBLE}),this._httpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:xi.ValueType.DOUBLE})}setConfig(t={}){super.setConfig(t),this._headerCapture=this._createHeaderCapture()}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new FZ.InstrumentationNodeModuleDefinition("http",["*"],t=>(this._wrap(t,"request",this._getPatchOutgoingRequestFunction("http")),this._wrap(t,"get",this._getPatchOutgoingGetFunction(t.request)),this._wrap(t.Server.prototype,"emit",this._getPatchIncomingRequestFunction("http")),t),t=>{t!==void 0&&(this._unwrap(t,"request"),this._unwrap(t,"get"),this._unwrap(t.Server.prototype,"emit"))})}_getHttpsInstrumentation(){return new FZ.InstrumentationNodeModuleDefinition("https",["*"],t=>(this._wrap(t,"request",this._getPatchHttpsOutgoingRequestFunction("https")),this._wrap(t,"get",this._getPatchHttpsOutgoingGetFunction(t.request)),this._wrap(t.Server.prototype,"emit",this._getPatchIncomingRequestFunction("https")),t),t=>{t!==void 0&&(this._unwrap(t,"request"),this._unwrap(t,"get"),this._unwrap(t.Server.prototype,"emit"))})}_getPatchIncomingRequestFunction(t){return r=>this._incomingRequestFunction(t,r)}_getPatchOutgoingRequestFunction(t){return r=>this._outgoingRequestFunction(t,r)}_getPatchOutgoingGetFunction(t){return r=>function(i,...s){let e=t(i,...s);return e.end(),e}}_getPatchHttpsOutgoingRequestFunction(t){return r=>{let a=this;return function(s,...e){var o;return t==="https"&&typeof s=="object"&&((o=s?.constructor)===null||o===void 0?void 0:o.name)!=="URL"&&(s=Object.assign({},s),a._setDefaultOptions(s)),a._getPatchOutgoingRequestFunction(t)(r)(s,...e)}}}_setDefaultOptions(t){t.protocol=t.protocol||"https:",t.port=t.port||443}_getPatchHttpsOutgoingGetFunction(t){return r=>{let a=this;return function(s,...e){return a._getPatchOutgoingGetFunction(t)(r)(s,...e)}}}_traceClientRequest(t,r,a,i){this.getConfig().requestHook&&this._callRequestHook(r,t);let s=!1;return t.prependListener("response",e=>{this._diag.debug("outgoingRequest on response()"),t.listenerCount("response")<=1&&e.resume();let o=Ou.getOutgoingRequestAttributesOnResponse(e);r.setAttributes(o),i=Object.assign(i,Ou.getOutgoingRequestMetricAttributesOnResponse(o)),this.getConfig().responseHook&&this._callResponseHook(r,e),this._headerCapture.client.captureRequestHeaders(r,d=>t.getHeader(d)),this._headerCapture.client.captureResponseHeaders(r,d=>e.headers[d]),xi.context.bind(xi.context.active(),e);let u=()=>{if(this._diag.debug("outgoingRequest on end()"),s)return;s=!0;let d;e.aborted&&!e.complete?d={code:xi.SpanStatusCode.ERROR}:d={code:Ou.parseResponseStatus(xi.SpanKind.CLIENT,e.statusCode)},r.setStatus(d),this.getConfig().applyCustomAttributesOnSpan&&(0,FZ.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,t,e),()=>{},!0),this._closeHttpSpan(r,xi.SpanKind.CLIENT,a,i)};e.on("end",u),tXn.lt(process.version,"16.0.0")&&e.on("close",u),e.on(a0t.errorMonitor,d=>{this._diag.debug("outgoingRequest on error()",d),!s&&(s=!0,Ou.setSpanWithError(r,d),r.setStatus({code:xi.SpanStatusCode.ERROR,message:d.message}),this._closeHttpSpan(r,xi.SpanKind.CLIENT,a,i))})}),t.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(t.aborted||s)&&(s=!0,this._closeHttpSpan(r,xi.SpanKind.CLIENT,a,i))}),t.on(a0t.errorMonitor,e=>{this._diag.debug("outgoingRequest on request error()",e),!s&&(s=!0,Ou.setSpanWithError(r,e),this._closeHttpSpan(r,xi.SpanKind.CLIENT,a,i))}),this._diag.debug("http.ClientRequest return request"),t}_incomingRequestFunction(t,r){let a=this;return function(s,...e){if(s!=="request")return r.apply(this,[s,...e]);let o=e[0],u=e[1],d=o.url&&nXn.parse(o.url).pathname||"/",I=o.method||"GET";if(a._diag.debug(`${t} instrumentation incomingRequest`),Ou.isIgnored(d,a.getConfig().ignoreIncomingPaths,A=>a._diag.error("caught ignoreIncomingPaths error: ",A))||(0,FZ.safeExecuteInTheMiddle)(()=>{var A,E;return(E=(A=a.getConfig()).ignoreIncomingRequestHook)===null||E===void 0?void 0:E.call(A,o)},A=>{A!=null&&a._diag.error("caught ignoreIncomingRequestHook error: ",A)},!0))return xi.context.with((0,oz.suppressTracing)(xi.context.active()),()=>(xi.context.bind(xi.context.active(),o),xi.context.bind(xi.context.active(),u),r.apply(this,[s,...e])));let h=o.headers,c=Ou.getIncomingRequestAttributes(o,{component:t,serverName:a.getConfig().serverName,hookAttributes:a._callStartSpanHook(o,a.getConfig().startIncomingSpanHook)}),G={kind:xi.SpanKind.SERVER,attributes:c},W=(0,oz.hrTime)(),y=Ou.getIncomingRequestMetricAttributes(c),R=xi.propagation.extract(xi.ROOT_CONTEXT,h),F=a._startHttpSpan(I,G,R),C={type:rXn.RPCType.HTTP,span:F};return xi.context.with((0,rXn.setRPCMetadata)(xi.trace.setSpan(R,F),C),()=>{xi.context.bind(xi.context.active(),o),xi.context.bind(xi.context.active(),u),a.getConfig().requestHook&&a._callRequestHook(F,o),a.getConfig().responseHook&&a._callResponseHook(F,u),a._headerCapture.server.captureRequestHeaders(F,E=>o.headers[E]);let A=!1;return u.on("close",()=>{A||a._onServerResponseFinish(o,u,F,y,W)}),u.on(a0t.errorMonitor,E=>{A=!0,a._onServerResponseError(F,y,W,E)}),(0,FZ.safeExecuteInTheMiddle)(()=>r.apply(this,[s,...e]),E=>{if(E)throw Ou.setSpanWithError(F,E),a._closeHttpSpan(F,xi.SpanKind.SERVER,W,y),E})})}}_outgoingRequestFunction(t,r){let a=this;return function(s,...e){if(!Ou.isValidOptionsType(s))return r.apply(this,[s,...e]);let o=typeof e[0]=="object"&&(typeof s=="string"||s instanceof nXn.URL)?e.shift():void 0,{origin:u,pathname:d,method:I,optionsParsed:h}=Ou.getRequestInfo(s,o);if(t==="http"&&tXn.lt(process.version,"9.0.0")&&h.protocol==="https:")return r.apply(this,[h,...e]);if(Ou.isIgnored(u+d,a.getConfig().ignoreOutgoingUrls,f=>a._diag.error("caught ignoreOutgoingUrls error: ",f))||(0,FZ.safeExecuteInTheMiddle)(()=>{var f,g;return(g=(f=a.getConfig()).ignoreOutgoingRequestHook)===null||g===void 0?void 0:g.call(f,h)},f=>{f!=null&&a._diag.error("caught ignoreOutgoingRequestHook error: ",f)},!0))return r.apply(this,[h,...e]);let{hostname:c,port:G}=Ou.extractHostnameAndPort(h),W=Ou.getOutgoingRequestAttributes(h,{component:t,port:G,hostname:c,hookAttributes:a._callStartSpanHook(h,a.getConfig().startOutgoingSpanHook)}),y=(0,oz.hrTime)(),R=Ou.getOutgoingRequestMetricAttributes(W),F={kind:xi.SpanKind.CLIENT,attributes:W},C=a._startHttpSpan(I,F),A=xi.context.active(),E=xi.trace.setSpan(A,C);return h.headers?h.headers=Object.assign({},h.headers):h.headers={},xi.propagation.inject(E,h.headers),xi.context.with(E,()=>{let f=e[e.length-1];typeof f=="function"&&(e[e.length-1]=xi.context.bind(A,f));let g=(0,FZ.safeExecuteInTheMiddle)(()=>r.apply(this,[h,...e]),v=>{if(v)throw Ou.setSpanWithError(C,v),a._closeHttpSpan(C,xi.SpanKind.CLIENT,y,R),v});return a._diag.debug(`${t} instrumentation outgoingRequest`),xi.context.bind(A,g),a._traceClientRequest(g,C,y,R)})}}_onServerResponseFinish(t,r,a,i,s){let e=Ou.getIncomingRequestAttributesOnResponse(t,r);i=Object.assign(i,Ou.getIncomingRequestMetricAttributesOnResponse(e)),this._headerCapture.server.captureResponseHeaders(a,u=>r.getHeader(u)),a.setAttributes(e).setStatus({code:Ou.parseResponseStatus(xi.SpanKind.SERVER,r.statusCode)});let o=e[UHa.SEMATTRS_HTTP_ROUTE];o&&a.updateName(`${t.method||"GET"} ${o}`),this.getConfig().applyCustomAttributesOnSpan&&(0,FZ.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(a,t,r),()=>{},!0),this._closeHttpSpan(a,xi.SpanKind.SERVER,s,i)}_onServerResponseError(t,r,a,i){Ou.setSpanWithError(t,i),this._closeHttpSpan(t,xi.SpanKind.SERVER,a,r)}_startHttpSpan(t,r,a=xi.context.active()){let i=r.kind===xi.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,e=xi.trace.getSpan(a);return i===!0&&e===void 0?s=xi.trace.wrapSpanContext(xi.INVALID_SPAN_CONTEXT):i===!0&&e?.spanContext().isRemote?s=e:s=this.tracer.startSpan(t,r,a),this._spanNotEnded.add(s),s}_closeHttpSpan(t,r,a,i){if(!this._spanNotEnded.has(t))return;t.end(),this._spanNotEnded.delete(t);let s=(0,oz.hrTimeToMilliseconds)((0,oz.hrTimeDuration)(a,(0,oz.hrTime)()));r===xi.SpanKind.SERVER?this._httpServerDurationHistogram.record(s,i):r===xi.SpanKind.CLIENT&&this._httpClientDurationHistogram.record(s,i)}_callResponseHook(t,r){(0,FZ.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(t,r),()=>{},!0)}_callRequestHook(t,r){(0,FZ.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(t,r),()=>{},!0)}_callStartSpanHook(t,r){if(typeof r=="function")return(0,FZ.safeExecuteInTheMiddle)(()=>r(t),()=>{},!0)}_createHeaderCapture(){var t,r,a,i,s,e,o,u,d,I,h,c;let G=this.getConfig();return{client:{captureRequestHeaders:Ou.headerCapture("request",(a=(r=(t=G.headersToSpanAttributes)===null||t===void 0?void 0:t.client)===null||r===void 0?void 0:r.requestHeaders)!==null&&a!==void 0?a:[]),captureResponseHeaders:Ou.headerCapture("response",(e=(s=(i=G.headersToSpanAttributes)===null||i===void 0?void 0:i.client)===null||s===void 0?void 0:s.responseHeaders)!==null&&e!==void 0?e:[])},server:{captureRequestHeaders:Ou.headerCapture("request",(d=(u=(o=G.headersToSpanAttributes)===null||o===void 0?void 0:o.server)===null||u===void 0?void 0:u.requestHeaders)!==null&&d!==void 0?d:[]),captureResponseHeaders:Ou.headerCapture("response",(c=(h=(I=G.headersToSpanAttributes)===null||I===void 0?void 0:I.server)===null||h===void 0?void 0:h.responseHeaders)!==null&&c!==void 0?c:[])}}}};SEe.HttpInstrumentation=i0t});var lXn=ve(iXn=>{"use strict";Object.defineProperty(iXn,"__esModule",{value:!0})});var sXn=ve(qR=>{"use strict";var MHa=qR&&qR.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),l0t=qR&&qR.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&MHa(t,n,r)};Object.defineProperty(qR,"__esModule",{value:!0});l0t(aXn(),qR);l0t(lXn(),qR);l0t(r0t(),qR)});function zHa(n){switch(n){case Mr.ProceedOnce:case Mr.ProceedAlways:case Mr.ProceedAlwaysServer:case Mr.ProceedAlwaysTool:case Mr.ProceedAlwaysProject:return EZ.ACCEPT;case Mr.ModifyWithEditor:return EZ.MODIFY;case Mr.Cancel:default:return EZ.REJECT}}function _Ha(n){if(!n)return 0;let t=0,r=Array.isArray(n)?n:[n];for(let a of r)a&&typeof a=="object"?a.text&&typeof a.text=="string"?t+=a.text.length:a.functionResponse?t+=JSON.stringify(a.functionResponse).length:typeof a=="string"&&(t+=a.length):typeof a=="string"&&(t+=a.length);return t}var EZ,cz,uz,Iz,FO,dz,hz,mz,pz,Z2,n6,BEe,r6=It(()=>{"use strict";Ll();(function(n){n.ACCEPT="accept",n.REJECT="reject",n.MODIFY="modify"})(EZ||(EZ={}));cz=class{"event.name";"event.timestamp";model;embedding_model;sandbox_enabled;core_tools_enabled;approval_mode;api_key_enabled;vertex_ai_enabled;debug_enabled;mcp_servers;telemetry_enabled;telemetry_log_user_prompts_enabled;file_filtering_respect_git_ignore;constructor(t){let r=t.getContentGeneratorConfig(),a=t.getMcpServers(),i=!1,s=!1;r&&r.authType&&(i=!1,s=!1),this["event.name"]="cli_config",this.model=t.getModel(),this.embedding_model=t.getEmbeddingModel(),this.sandbox_enabled=typeof t.getSandbox()=="string"||!!t.getSandbox(),this.core_tools_enabled=(t.getCoreTools()??[]).join(","),this.approval_mode=t.getApprovalMode(),this.api_key_enabled=i||s,this.vertex_ai_enabled=s,this.debug_enabled=t.getDebugMode(),this.mcp_servers=a?Object.keys(a).join(","):"",this.telemetry_enabled=t.getTelemetryEnabled(),this.telemetry_log_user_prompts_enabled=t.getTelemetryLogPromptsEnabled(),this.file_filtering_respect_git_ignore=t.getFileFilteringRespectGitIgnore()}},uz=class{"event.name";"event.timestamp";session_id;constructor(t){this["event.name"]="end_session",this["event.timestamp"]=new Date().toISOString(),this.session_id=t?.getSessionId()}},Iz=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(t,r,a,i){this["event.name"]="user_prompt",this["event.timestamp"]=new Date().toISOString(),this.prompt_length=t,this.prompt_id=r,this.auth_type=a,this.prompt=i}};FO=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;response_length;constructor(t){this["event.name"]="tool_call",this["event.timestamp"]=new Date().toISOString(),this.function_name=t.request.name,this.function_args=t.request.args,this.duration_ms=t.durationMs??0,this.success=t.status==="success",this.decision=t.outcome?zHa(t.outcome):void 0,this.error=t.response.error?.message,this.error_type=t.response.error?.name,this.prompt_id=t.request.prompt_id,this.response_length=_Ha(t.response.responseParts)}},dz=class{"event.name";"event.timestamp";model;prompt_id;request_text;constructor(t,r,a){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=t,this.prompt_id=r,this.request_text=a}},hz=class{"event.name";"event.timestamp";model;error;error_type;status_code;duration_ms;prompt_id;auth_type;agent_context;constructor(t,r,a,i,s,e,o,u){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=t,this.error=r,this.error_type=e,this.status_code=o,this.duration_ms=a,this.prompt_id=i,this.auth_type=s,this.agent_context=u}},mz=class{"event.name";"event.timestamp";model;status_code;duration_ms;error;input_token_count;output_token_count;cached_content_token_count;cache_write_input_tokens;cache_read_input_tokens;thoughts_token_count;tool_token_count;total_token_count;credits_usage;response_text;prompt_id;auth_type;agent_context;constructor(t,r,a,i,s,e,o,u){this["event.name"]="api_response",this["event.timestamp"]=new Date().toISOString(),this.model=t,this.duration_ms=r,this.status_code=200,this.input_token_count=s?.promptTokenCount??0,this.output_token_count=s?.candidatesTokenCount??0,this.cached_content_token_count=s?.cachedContentTokenCount??0,this.cache_write_input_tokens=s?.cacheWriteInputTokens??0,this.cache_read_input_tokens=s?.cacheReadInputTokens??0,this.thoughts_token_count=s?.thoughtsTokenCount??0,this.tool_token_count=s?.toolUsePromptTokenCount??0,this.total_token_count=s?.totalTokenCount??0,this.credits_usage=s?.creditsUsage??0,this.response_text=e,this.error=o,this.prompt_id=a,this.auth_type=i,this.agent_context=u}},pz=class{"event.name";"event.timestamp";auth_type;constructor(t){this["event.name"]="flash_fallback",this["event.timestamp"]=new Date().toISOString(),this.auth_type=t}};(function(n){n.CONSECUTIVE_IDENTICAL_TOOL_CALLS="consecutive_identical_tool_calls",n.CHANTING_IDENTICAL_SENTENCES="chanting_identical_sentences",n.LLM_DETECTED_LOOP="llm_detected_loop"})(Z2||(Z2={}));n6=class{"event.name";"event.timestamp";loop_type;prompt_id;constructor(t,r){this["event.name"]="loop_detected",this["event.timestamp"]=new Date().toISOString(),this.loop_type=t,this.prompt_id=r}},BEe=class{"event.name";"event.timestamp";prompt_id;constructor(t){this["event.name"]="flash_decided_to_continue",this["event.timestamp"]=new Date().toISOString(),this.prompt_id=t}}});var Sa,oXn=It(()=>{"use strict";(function(n){n[n.GEMINI_CLI_KEY_UNKNOWN=0]="GEMINI_CLI_KEY_UNKNOWN",n[n.GEMINI_CLI_START_SESSION_MODEL=1]="GEMINI_CLI_START_SESSION_MODEL",n[n.GEMINI_CLI_START_SESSION_EMBEDDING_MODEL=2]="GEMINI_CLI_START_SESSION_EMBEDDING_MODEL",n[n.GEMINI_CLI_START_SESSION_SANDBOX=3]="GEMINI_CLI_START_SESSION_SANDBOX",n[n.GEMINI_CLI_START_SESSION_CORE_TOOLS=4]="GEMINI_CLI_START_SESSION_CORE_TOOLS",n[n.GEMINI_CLI_START_SESSION_APPROVAL_MODE=5]="GEMINI_CLI_START_SESSION_APPROVAL_MODE",n[n.GEMINI_CLI_START_SESSION_API_KEY_ENABLED=6]="GEMINI_CLI_START_SESSION_API_KEY_ENABLED",n[n.GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED=7]="GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED",n[n.GEMINI_CLI_START_SESSION_DEBUG_MODE_ENABLED=8]="GEMINI_CLI_START_SESSION_DEBUG_MODE_ENABLED",n[n.GEMINI_CLI_START_SESSION_MCP_SERVERS=9]="GEMINI_CLI_START_SESSION_MCP_SERVERS",n[n.GEMINI_CLI_START_SESSION_TELEMETRY_ENABLED=10]="GEMINI_CLI_START_SESSION_TELEMETRY_ENABLED",n[n.GEMINI_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED=11]="GEMINI_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED",n[n.GEMINI_CLI_START_SESSION_RESPECT_GITIGNORE=12]="GEMINI_CLI_START_SESSION_RESPECT_GITIGNORE",n[n.GEMINI_CLI_USER_PROMPT_LENGTH=13]="GEMINI_CLI_USER_PROMPT_LENGTH",n[n.GEMINI_CLI_TOOL_CALL_NAME=14]="GEMINI_CLI_TOOL_CALL_NAME",n[n.GEMINI_CLI_TOOL_CALL_DECISION=15]="GEMINI_CLI_TOOL_CALL_DECISION",n[n.GEMINI_CLI_TOOL_CALL_SUCCESS=16]="GEMINI_CLI_TOOL_CALL_SUCCESS",n[n.GEMINI_CLI_TOOL_CALL_DURATION_MS=17]="GEMINI_CLI_TOOL_CALL_DURATION_MS",n[n.GEMINI_CLI_TOOL_ERROR_MESSAGE=18]="GEMINI_CLI_TOOL_ERROR_MESSAGE",n[n.GEMINI_CLI_TOOL_CALL_ERROR_TYPE=19]="GEMINI_CLI_TOOL_CALL_ERROR_TYPE",n[n.GEMINI_CLI_API_REQUEST_MODEL=20]="GEMINI_CLI_API_REQUEST_MODEL",n[n.GEMINI_CLI_API_RESPONSE_MODEL=21]="GEMINI_CLI_API_RESPONSE_MODEL",n[n.GEMINI_CLI_API_RESPONSE_STATUS_CODE=22]="GEMINI_CLI_API_RESPONSE_STATUS_CODE",n[n.GEMINI_CLI_API_RESPONSE_DURATION_MS=23]="GEMINI_CLI_API_RESPONSE_DURATION_MS",n[n.GEMINI_CLI_API_ERROR_MESSAGE=24]="GEMINI_CLI_API_ERROR_MESSAGE",n[n.GEMINI_CLI_API_RESPONSE_INPUT_TOKEN_COUNT=25]="GEMINI_CLI_API_RESPONSE_INPUT_TOKEN_COUNT",n[n.GEMINI_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT=26]="GEMINI_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT",n[n.GEMINI_CLI_API_RESPONSE_CACHED_TOKEN_COUNT=27]="GEMINI_CLI_API_RESPONSE_CACHED_TOKEN_COUNT",n[n.GEMINI_CLI_API_RESPONSE_THINKING_TOKEN_COUNT=28]="GEMINI_CLI_API_RESPONSE_THINKING_TOKEN_COUNT",n[n.GEMINI_CLI_API_RESPONSE_TOOL_TOKEN_COUNT=29]="GEMINI_CLI_API_RESPONSE_TOOL_TOKEN_COUNT",n[n.GEMINI_CLI_API_ERROR_MODEL=30]="GEMINI_CLI_API_ERROR_MODEL",n[n.GEMINI_CLI_API_ERROR_TYPE=31]="GEMINI_CLI_API_ERROR_TYPE",n[n.GEMINI_CLI_API_ERROR_STATUS_CODE=32]="GEMINI_CLI_API_ERROR_STATUS_CODE",n[n.GEMINI_CLI_API_ERROR_DURATION_MS=33]="GEMINI_CLI_API_ERROR_DURATION_MS",n[n.GEMINI_CLI_END_SESSION_ID=34]="GEMINI_CLI_END_SESSION_ID",n[n.GEMINI_CLI_PROMPT_ID=35]="GEMINI_CLI_PROMPT_ID",n[n.GEMINI_CLI_AUTH_TYPE=36]="GEMINI_CLI_AUTH_TYPE",n[n.GEMINI_CLI_GOOGLE_ACCOUNTS_COUNT=37]="GEMINI_CLI_GOOGLE_ACCOUNTS_COUNT",n[n.GEMINI_CLI_SURFACE=39]="GEMINI_CLI_SURFACE",n[n.GEMINI_CLI_SESSION_ID=40]="GEMINI_CLI_SESSION_ID",n[n.GEMINI_CLI_LOOP_DETECTED_TYPE=38]="GEMINI_CLI_LOOP_DETECTED_TYPE"})(Sa||(Sa={}))});import*as cXn from"os";import*as $R from"fs";import*as c0t from"path";import{randomUUID as PHa}from"crypto";function KHa(){$R.existsSync(s0t)||$R.mkdirSync(s0t,{recursive:!0})}function qHa(){return $R.existsSync(o0t)&&$R.readFileSync(o0t,"utf-8").trim()||null}function $Ha(n){$R.writeFileSync(o0t,n,"utf-8")}function uXn(){try{KHa();let n=qHa();return n||(n=PHa(),$Ha(n)),n}catch(n){return console.error("Error accessing installation ID file, generating ephemeral ID:",n),"123456789"}}var jHa,s0t,o0t,IXn=It(()=>{"use strict";ch();jHa=cXn.homedir()??"",s0t=c0t.join(jHa,lA),o0t=c0t.join(s0t,"installation_id")});import eXa from"node:path";import{promises as M$i,existsSync as dXn,readFileSync as hXn}from"node:fs";import*as mXn from"os";function pXn(){return eXa.join(mXn.homedir(),lA,EDe)}function bXn(){try{let n=pXn();if(dXn(n)){let t=hXn(n,"utf-8").trim();return t?JSON.parse(t).active:null}return null}catch(n){return console.debug("Error reading cached Google Account:",n),null}}function fXn(){try{let n=pXn();if(!dXn(n))return 0;let t=hXn(n,"utf-8").trim();if(!t)return 0;let r=JSON.parse(t),a=r.old.length;return r.active&&a++,a}catch(n){return console.debug("Error reading lifetime Google Accounts:",n),0}}var GXn=It(()=>{"use strict";ch();});function JEe(n,t){let r=new WeakSet;return JSON.stringify(n,(a,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},t)}var u0t=It(()=>{"use strict";});var gXn,tXa,nXa,rXa,aXa,iXa,lXa,sXa,oXa,cXa,uXa,ob,TEe=It(()=>{"use strict";gXn=Qt(HQe(),1);r6();oXn();IXn();GXn();u0t();tXa="start_session",nXa="new_prompt",rXa="tool_call",aXa="api_request",iXa="api_response",lXa="api_error",sXa="end_session",oXa="flash_fallback",cXa="loop_detected",uXa="flash_decided_to_continue",ob=class{static instance;config;events=[];last_flush_time=Date.now();flush_interval_ms=1e3*60;constructor(t){this.config=t}static getInstance(t){}enqueueLogEvent(t){this.events.push([{event_time_ms:Date.now(),source_extension_json:JEe(t)}])}createLogEvent(t,r){let a=bXn(),i=fXn();r.push({gemini_cli_key:Sa.GEMINI_CLI_GOOGLE_ACCOUNTS_COUNT,value:i.toString()});let s={console_type:"GEMINI_CLI",application:102,event_name:t,event_metadata:[r]};return a?s.client_email=a:s.client_install_id=uXn(),s}flushIfNeeded(){Date.now()-this.last_flush_time<this.flush_interval_ms||this.flushToClearcut().catch(t=>{console.debug("Error flushing to Clearcut:",t)})}flushToClearcut(){return this.events.length=0,this.last_flush_time=Date.now(),Promise.resolve({})}decodeLogResponse(t){if(t.length<1||t.readUInt8(0)!==8)return;let r=BigInt(0),a=!0;for(let s=1;a&&s<t.length;s++){let e=t.readUInt8(s);r|=BigInt(e&127)<<BigInt(7*(s-1)),a=(e&128)!==0}return a?void 0:{nextRequestWaitMs:Number(r)}}logStartSessionEvent(t){let r=process.env.SURFACE||"SURFACE_NOT_SET",a=[{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_MODEL,value:t.model},{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_EMBEDDING_MODEL,value:t.embedding_model},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_SANDBOX,value:t.sandbox_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_CORE_TOOLS,value:t.core_tools_enabled},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_APPROVAL_MODE,value:t.approval_mode},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_API_KEY_ENABLED,value:t.api_key_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED,value:t.vertex_ai_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:t.debug_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED,value:t.vertex_ai_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_MCP_SERVERS,value:t.mcp_servers},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED,value:t.vertex_ai_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_TELEMETRY_ENABLED,value:t.telemetry_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:t.telemetry_log_user_prompts_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_SURFACE,value:r}];this.enqueueLogEvent(this.createLogEvent(tXa,a)),this.flushToClearcut().catch(i=>{console.debug("Error flushing to Clearcut:",i)})}logNewPromptEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(t.prompt_length)},{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_AUTH_TYPE,value:JSON.stringify(t.auth_type)}];this.enqueueLogEvent(this.createLogEvent(nXa,r)),this.flushIfNeeded()}logToolCallEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_NAME,value:JSON.stringify(t.function_name)},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_DECISION,value:JSON.stringify(t.decision)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(t.success)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(t.duration_ms)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(t.error)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(t.error_type)}],a=this.createLogEvent(rXa,r);this.enqueueLogEvent(a),this.flushIfNeeded()}logApiRequestEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_API_REQUEST_MODEL,value:JSON.stringify(t.model)},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)}];this.enqueueLogEvent(this.createLogEvent(aXa,r)),this.flushIfNeeded()}logApiResponseEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_MODEL,value:JSON.stringify(t.model)},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(t.status_code)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(t.duration_ms)},{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_MESSAGE,value:JSON.stringify(t.error)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(t.input_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(t.output_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(t.cached_content_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(t.thoughts_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(t.tool_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_AUTH_TYPE,value:JSON.stringify(t.auth_type)}];this.enqueueLogEvent(this.createLogEvent(iXa,r)),this.flushIfNeeded()}logApiErrorEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_MODEL,value:JSON.stringify(t.model)},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_TYPE,value:JSON.stringify(t.error_type)},{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(t.status_code)},{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(t.duration_ms)},{gemini_cli_key:Sa.GEMINI_CLI_AUTH_TYPE,value:JSON.stringify(t.auth_type)}];this.enqueueLogEvent(this.createLogEvent(lXa,r)),this.flushIfNeeded()}logFlashFallbackEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_AUTH_TYPE,value:JSON.stringify(t.auth_type)},{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(oXa,r)),this.flushToClearcut().catch(a=>{console.debug("Error flushing to Clearcut:",a)})}logLoopDetectedEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(t.loop_type)}];this.enqueueLogEvent(this.createLogEvent(cXa,r)),this.flushIfNeeded()}logFlashDecidedToContinueEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(uXa,r)),this.flushIfNeeded()}logEndSessionEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:t?.session_id?.toString()??""}];this.enqueueLogEvent(this.createLogEvent(sXa,r)),this.flushToClearcut().catch(a=>{console.debug("Error flushing to Clearcut:",a)})}getProxyAgent(){let t=this.config?.getProxy();if(t){if(t.startsWith("http"))return new gXn.HttpsProxyAgent(t);throw new Error("Unsupported proxy type")}}shutdown(){let t=new uz(this.config);this.logEndSessionEvent(t)}}});function uG(){return bse}function IXa(n){if(!n)return;let t=n.replace(/^["']|["']$/g,"");try{return new URL(t).origin}catch(r){Y7.error("Invalid OTLP endpoint URL provided:",t,r);return}}function OEe(n){if(bse)return;let t=n.getTelemetryEnabled(),r=IXa(n.getTelemetryOtlpEndpoint());if(t&&r){DEe=new AXn.NodeSDK({resource:new yXn.Resource({[WXn.SemanticResourceAttributes.SERVICE_NAME]:D1,"session.id":n.getSessionId()}),traceExporter:new vXn.OTLPTraceExporter({url:`${r}/v1/traces`}),metricReader:new EXn.PeriodicExportingMetricReader({exporter:new NXn.OTLPMetricExporter({url:`${r}/v1/metrics`})}),logRecordProcessor:new FXn.BatchLogRecordProcessor(new ZXn.OTLPLogExporter({url:`${r}/v1/logs`})),instrumentations:[new RXn.HttpInstrumentation]});try{DEe.start(),console.log("OpenTelemetry SDK initialized successfully.")}catch(a){console.error("Failed to start OpenTelemetry SDK:",a)}}bse=!0}async function UEe(){if(!(!bse||!DEe))try{ob.getInstance()?.shutdown(),await DEe.shutdown(),console.log("OpenTelemetry SDK shut down successfully.")}catch(n){console.error("Error shutting down SDK:",n)}finally{bse=!1}}var vXn,ZXn,NXn,AXn,WXn,yXn,FXn,EXn,RXn,DEe,bse,I0t=It(()=>{"use strict";Qr();vXn=Qt(But(),1),ZXn=Qt(DYn(),1),NXn=Qt($Yn(),1),AXn=Qt(jHn(),1),WXn=Qt(Xm(),1),yXn=Qt(gx(),1),FXn=Qt(h5e(),1),EXn=Qt(VM(),1),RXn=Qt(sXn(),1);Wre();TEe();Y7.setLogger(new tve,x0.INFO);bse=!1});import{EventEmitter as dXa}from"events";var hXa,mXa,MEe,cd,d0t=It(()=>{"use strict";Wre();r6();hXa=()=>({api:{totalRequests:0,totalErrors:0,totalLatencyMs:0},tokens:{prompt:0,candidates:0,total:0,cached:0,cacheWrite:0,cacheRead:0,thoughts:0,tool:0},credits:{total:0},subAgents:{api:{totalRequests:0,totalErrors:0,totalLatencyMs:0},tokens:{prompt:0,candidates:0,total:0,cached:0,cacheWrite:0,cacheRead:0,thoughts:0,tool:0},credits:{total:0}}}),mXa=()=>({models:{},tools:{totalCalls:0,totalSuccess:0,totalFail:0,totalDurationMs:0,totalDecisions:{[EZ.ACCEPT]:0,[EZ.REJECT]:0,[EZ.MODIFY]:0},byName:{}}}),MEe=class extends dXa{#e=mXa();#t=0;addEvent(t){switch(t["event.name"]){case Are:this.processApiResponse(t);break;case Nre:this.processApiError(t);break;case Zre:this.processToolCall(t);break;default:return}this.emit("update",{metrics:this.#e,lastPromptTokenCount:this.#t})}getMetrics(){return this.#e}getLastPromptTokenCount(){return this.#t}resetLastPromptTokenCount(){this.#t=0,this.emit("update",{metrics:this.#e,lastPromptTokenCount:this.#t})}getOrCreateModelMetrics(t){return this.#e.models[t]||(this.#e.models[t]=hXa()),this.#e.models[t]}processApiResponse(t){let r=this.getOrCreateModelMetrics(t.model);t.agent_context?.type==="sub"?(r.subAgents.api.totalRequests++,r.subAgents.api.totalLatencyMs+=t.duration_ms,r.subAgents.tokens.prompt+=t.input_token_count,r.subAgents.tokens.candidates+=t.output_token_count,r.subAgents.tokens.total+=t.total_token_count,r.subAgents.tokens.cached+=t.cached_content_token_count+t.cache_write_input_tokens,r.subAgents.tokens.cacheWrite+=t.cache_write_input_tokens,r.subAgents.tokens.cacheRead+=t.cache_read_input_tokens,r.subAgents.tokens.thoughts+=t.thoughts_token_count,r.subAgents.tokens.tool+=t.tool_token_count,r.subAgents.credits.total+=t.credits_usage):this.#t=t.input_token_count,r.api.totalRequests++,r.api.totalLatencyMs+=t.duration_ms,r.tokens.prompt+=t.input_token_count,r.tokens.candidates+=t.output_token_count,r.tokens.total+=t.total_token_count,r.tokens.cached+=t.cached_content_token_count,r.tokens.cacheWrite+=t.cache_write_input_tokens,r.tokens.cacheRead+=t.cache_read_input_tokens,r.tokens.thoughts+=t.thoughts_token_count,r.tokens.tool+=t.tool_token_count,r.credits.total+=t.credits_usage}processApiError(t){let r=this.getOrCreateModelMetrics(t.model);t.agent_context?.type==="sub"?(r.subAgents.api.totalRequests++,r.subAgents.api.totalErrors++,r.subAgents.api.totalLatencyMs+=t.duration_ms):(r.api.totalRequests++,r.api.totalErrors++,r.api.totalLatencyMs+=t.duration_ms)}processToolCall(t){let{tools:r}=this.#e;r.totalCalls++,r.totalDurationMs+=t.duration_ms,t.success?r.totalSuccess++:r.totalFail++,r.byName[t.function_name]||(r.byName[t.function_name]={count:0,success:0,fail:0,durationMs:0,responseLength:0,decisions:{[EZ.ACCEPT]:0,[EZ.REJECT]:0,[EZ.MODIFY]:0}});let a=r.byName[t.function_name];a.count++,a.durationMs+=t.duration_ms,a.responseLength+=t.response_length,t.success?a.success++:a.fail++,t.decision&&(r.totalDecisions[t.decision]++,a.decisions[t.decision]++)}},cd=new MEe});function e4(n){return{"session.id":n.getSessionId()}}function wXn(n,t){if(ob.getInstance(n)?.logStartSessionEvent(t),!uG())return;let r={...e4(n),"event.name":iIn,"event.timestamp":new Date().toISOString(),model:t.model,embedding_model:t.embedding_model,sandbox_enabled:t.sandbox_enabled,core_tools_enabled:t.core_tools_enabled,approval_mode:t.approval_mode,api_key_enabled:t.api_key_enabled,vertex_ai_enabled:t.vertex_ai_enabled,log_user_prompts_enabled:t.telemetry_log_user_prompts_enabled,file_filtering_respect_git_ignore:t.file_filtering_respect_git_ignore,debug_mode:t.debug_enabled,mcp_servers:t.mcp_servers},a=AF.logs.getLogger(D1),i={body:"CLI configuration loaded.",attributes:r};a.emit(i)}function bz(n,t){if(ob.getInstance(n)?.logNewPromptEvent(t),!uG())return;let r={...e4(n),"event.name":rIn,"event.timestamp":new Date().toISOString(),prompt_length:t.prompt_length};pXa(n)&&(r.prompt=t.prompt);let a=AF.logs.getLogger(D1),i={body:`User prompt. Length: ${t.prompt_length}.`,attributes:r};a.emit(i)}function cZ(n,t){let r={...t,"event.name":Zre,"event.timestamp":new Date().toISOString()};if(cd.addEvent(r),ob.getInstance(n)?.logToolCallEvent(t),!uG())return;let a={...e4(n),...t,"event.name":Zre,"event.timestamp":new Date().toISOString(),function_args:JEe(t.function_args,2)};t.error&&(a["error.message"]=t.error,t.error_type&&(a["error.type"]=t.error_type));let i=AF.logs.getLogger(D1),s={body:`Tool call: ${t.function_name}${t.decision?`. Decision: ${t.decision}`:""}. Success: ${t.success}. Duration: ${t.duration_ms}ms.`,attributes:a};i.emit(s),dIn(n,t.function_name,t.duration_ms,t.success,t.decision)}function zEe(n,t){if(ob.getInstance(n)?.logApiRequestEvent(t),!uG())return;let r={...e4(n),...t,"event.name":aIn,"event.timestamp":new Date().toISOString()},a=AF.logs.getLogger(D1),i={body:`API request to ${t.model}.`,attributes:r};a.emit(i)}function _Ee(n,t){if(ob.getInstance(n)?.logFlashFallbackEvent(t),!uG())return;let r={...e4(n),...t,"event.name":lIn,"event.timestamp":new Date().toISOString()},a=AF.logs.getLogger(D1),i={body:"Switching to flash as Fallback.",attributes:r};a.emit(i)}function PEe(n,t){let r={...t,"event.name":Nre,"event.timestamp":new Date().toISOString()};if(cd.addEvent(r),ob.getInstance(n)?.logApiErrorEvent(t),!uG())return;let a={...e4(n),"event.name":Nre,"event.timestamp":new Date().toISOString(),"error.message":t.error,model_name:t.model,model:t.model,error:t.error,duration:t.duration_ms,duration_ms:t.duration_ms,prompt_id:t.prompt_id,auth_type:t.auth_type};t.agent_context&&(a.agent_type=t.agent_context.type,t.agent_context.agentId&&(a.agent_id=t.agent_context.agentId),t.agent_context.taskDescription&&(a.task_description=t.agent_context.taskDescription)),t.error_type&&(a["error.type"]=t.error_type),typeof t.status_code=="number"&&(a[h0t.SemanticAttributes.HTTP_STATUS_CODE]=t.status_code);let i=AF.logs.getLogger(D1),s={body:`API error for ${t.model}. Error: ${t.error}. Duration: ${t.duration_ms}ms.`,attributes:a};i.emit(s),mIn(n,t.model,t.duration_ms,t.status_code,t.error_type)}function jEe(n,t){let r={...t,"event.name":Are,"event.timestamp":new Date().toISOString()};if(cd.addEvent(r),ob.getInstance(n)?.logApiResponseEvent(t),!uG())return;let a={...e4(n),"event.name":Are,"event.timestamp":new Date().toISOString(),model:t.model,status_code:t.status_code,duration_ms:t.duration_ms,input_token_count:t.input_token_count,output_token_count:t.output_token_count,cached_content_token_count:t.cached_content_token_count,thoughts_token_count:t.thoughts_token_count,tool_token_count:t.tool_token_count,total_token_count:t.total_token_count,prompt_id:t.prompt_id,auth_type:t.auth_type};t.agent_context&&(a.agent_type=t.agent_context.type,t.agent_context.agentId&&(a.agent_id=t.agent_context.agentId),t.agent_context.taskDescription&&(a.task_description=t.agent_context.taskDescription)),t.response_text&&(a.response_text=t.response_text),t.error?a["error.message"]=t.error:t.status_code&&typeof t.status_code=="number"&&(a[h0t.SemanticAttributes.HTTP_STATUS_CODE]=t.status_code);let i=AF.logs.getLogger(D1),s={body:`API response from ${t.model}. Status: ${t.status_code||"N/A"}. Duration: ${t.duration_ms}ms.`,attributes:a};i.emit(s),hIn(n,t.model,t.duration_ms,t.status_code,t.error),x7(n,t.model,t.input_token_count,"input"),x7(n,t.model,t.output_token_count,"output"),x7(n,t.model,t.cached_content_token_count,"cache"),x7(n,t.model,t.thoughts_token_count,"thought"),x7(n,t.model,t.tool_token_count,"tool")}function fse(n,t){if(ob.getInstance(n)?.logLoopDetectedEvent(t),!uG())return;let r={...e4(n),...t},a=AF.logs.getLogger(D1),i={body:`Loop detected. Type: ${t.loop_type}.`,attributes:r};a.emit(i)}function CXn(n,t){if(ob.getInstance(n)?.logFlashDecidedToContinueEvent(t),!uG())return;let r={...e4(n),...t,"event.name":sIn},a=AF.logs.getLogger(D1),i={body:"Flash decided to continue.",attributes:r};a.emit(i)}var AF,h0t,pXa,Gse=It(()=>{"use strict";AF=Qt(pU(),1),h0t=Qt(Xm(),1);Wre();V7();I0t();d0t();TEe();u0t();pXa=n=>n.getTelemetryLogPromptsEnabled()});import{EventEmitter as bXa}from"events";var m0t,a6,p0t=It(()=>{"use strict";m0t=class n extends bXa{static instance=null;static getInstance(){return n.instance||(n.instance=new n),n.instance}emitTokenUsage(t){this.emit("tokenUsage",t)}onTokenUsage(t){this.on("tokenUsage",t)}offTokenUsage(t){this.off("tokenUsage",t)}},a6=m0t.getInstance()});function YXn(n){if(n.candidates===void 0||n.candidates.length===0)return!1;let t=n.candidates[0]?.content;return t===void 0?!1:VXn(t)}function VXn(n){if(n.parts===void 0||n.parts.length===0)return!1;for(let t of n.parts)if(t===void 0||Object.keys(t).length===0||!t.thought&&t.text!==void 0&&t.text==="")return!1;return!0}function fXa(n){for(let t of n)if(t.role!==Pr.USER&&t.role!==Pr.MODEL)throw new Error(`Role must be user or model, but got ${t.role}.`)}function QXn(n){return!!(n&&n.role==="model"&&n.parts&&n.parts.length>0&&"reasoning"in n.parts[0])}function xXn(n){if(n===void 0||n.length===0)return[];let t=[],r=n.length,a=0;for(;a<r;)if(n[a].role===Pr.USER)t.push(n[a]),a++;else{let i=[],s=!0;for(;a<r&&n[a].role===Pr.MODEL;){let e=n[a];QXn(e)||(i.push(e),s&&!VXn(e)&&(s=!1)),a++}s&&i.length>0?t.push(...i):s||t.pop()}return t}var fz,b0t=It(()=>{"use strict";Ci();A0e();XB();Y$e();av();QB();Gse();r6();K7();p0t();E0e();KZe();fz=class{config;contentGenerator;generationConfig;history;agentContext;sendPromise=Promise.resolve();specifiedModel;constructor(t,r,a={},i=[],s={type:"main"},e){this.config=t,this.contentGenerator=r,this.generationConfig=a,this.history=i,this.agentContext=s,fXa(i),this.specifiedModel=e||this.config.getModel()}_getRequestTextFromContents(t){return JSON.stringify(t)}setSpecifiedModel(t){this.specifiedModel=t}async _logApiRequest(t,r,a){let i=this._getRequestTextFromContents(t);zEe(this.config,new dz(r,a,i))}async _logApiResponse(t,r,a,i,s){if(jEe(this.config,new mz(this.config.getModel(),t,r,this.config.getContentGeneratorConfig()?.authType,a,i,void 0,s)),a&&this.config.getProjectRoot()){try{await new Eo(this.config.getProjectRoot()).updateTokenStats(this.config.getSessionId(),this.config.getModel(),{input_token_count:a.promptTokenCount||0,output_token_count:a.candidatesTokenCount||0,total_token_count:a.totalTokenCount||0,cached_content_token_count:a.cachedContentTokenCount||0,thoughts_token_count:0,tool_token_count:0,cache_creation_input_tokens:a.cacheCreationInputTokens||0,cache_read_input_tokens:a.cacheReadInputTokens||0})}catch(e){console.warn("[SessionManager] Failed to update token stats:",e)}a6.emitTokenUsage({cache_creation_input_tokens:a.cacheCreationInputTokens||0,cache_read_input_tokens:a.cacheReadInputTokens||0,input_tokens:a.promptTokenCount||0,output_tokens:a.candidatesTokenCount||0,credits_usage:a.creditsUsage||0,model:this.config.getModel(),timestamp:Date.now()}),of.clearRealTimeToken()}}_logApiError(t,r,a,i){let s=r instanceof Error?r.message:String(r),e=r instanceof Error?r.name:"unknown";PEe(this.config,new hz(this.config.getModel(),s,t,a,this.config.getContentGeneratorConfig()?.authType,e,void 0,i))}async handleFlashFallback(t,r){return null}async sendMessage(t,r,a){await this.sendPromise;let s={...KHe(t.message),prompt_id:r},e=this.getHistory(!0).concat(s),o=this.fixRequestContents(e);this._logApiRequest(o,this.config.getModel(),r);let u=Date.now(),d;try{d=await Hb(()=>{let c=this.specifiedModel||nZ;if(this.config.getQuotaErrorOccurred()&&c===td)throw new Error("Please submit a new query to continue with the Flash model.");return this.contentGenerator.generateContent({model:c,contents:bQ(o),config:{...this.generationConfig,...t.config}},a)},{shouldRetry:c=>!!(c&&c.message&&(c.message.includes("429")||c.message.match(/5\d{2}/))),onPersistent429:async(c,G)=>await this.handleFlashFallback(c,G),authType:this.config.getContentGeneratorConfig()?.authType});let h=Date.now()-u;return await this._logApiResponse(h,r,d.usageMetadata,JSON.stringify(d),this.agentContext),this.sendPromise=(async()=>{let c=d.candidates?.[0]?.content,G=d.automaticFunctionCallingHistory,W=this.getHistory(!0).length,y=[];G!=null&&(y=G.slice(W)??[]);let R=c?[c]:[];this.recordHistory(s,R,y)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),d}catch(I){let h=Date.now()-u;throw this._logApiError(h,I,r,this.agentContext),of.clearRealTimeToken(),this.sendPromise=Promise.resolve(),I}}fixRequestContents(t){let r=[],a=(c,G)=>!c||!G||c.name!==G.name?!1:c.id&&G.id?c.id===G.id:!0,i=[];for(let c=0;c<t.length;c++){let G=t[c];G.role===Pr.MODEL&&G.parts&&G.parts.forEach(W=>{W.functionCall&&i.push({call:W.functionCall,messageIndex:c})})}let s=new Map,e=c=>c.functionResponse?.response?.result==="user cancel"?10:100;for(let c=0;c<t.length;c++){let G=t[c];if(G.role===Pr.USER&&G.parts){for(let W of G.parts)if(W.functionResponse){let y=W.functionResponse,R=e(W),F=y.id||`name:${y.name}`,C=s.get(F);if((!C||R>C.priority)&&s.set(F,{part:W,priority:R,originalIndex:c}),y.id){let A=`name:${y.name}`,E=s.get(A);E&&R>=E.priority&&s.delete(A)}}}}let o=[],u=new Set;for(let c=0;c<t.length;c++){let G=t[c];if(G.role===Pr.USER&&G.parts){let W=[];for(let y of G.parts)if(y.functionResponse){let R=y.functionResponse,F=R.id||`name:${R.name}`,C=s.get(F);if(C&&C.part===y&&!u.has(F)){let A=i.find(E=>a(E.call,R));A&&A.call.id!==R.id&&(console.log(`[fixRequestContents] \u{1F527} ID \u5BF9\u9F50\uFF1A\u5C06\u54CD\u5E94 ${R.name} \u7684 ID \u4ECE "${R.id||"unnamed"}" \u540C\u6B65\u4E3A\u8C03\u7528\u65B9\u7684 ID "${A.call.id||"unnamed"}"`),R.id=A.call.id),W.push(y),u.add(F)}else console.warn(`[fixRequestContents] \u{1F5D1}\uFE0F \u79FB\u9664\u6B21\u4F18\u6216\u91CD\u590D\u7684 functionResponse\uFF1A${R.name} (id: ${R.id||"unnamed"})\u3002\u4FDD\u7559\u4F18\u5148\u7EA7\u66F4\u9AD8\u6216\u66F4\u7CBE\u51C6\u7684\u54CD\u5E94\u3002`)}else W.push(y);W.length>0&&o.push({...G,parts:W})}else o.push(G)}for(let c=0;c<o.length;c++){let G=o[c];if(r.push(G),G.role===Pr.USER&&G.parts){let y=G.parts.filter(R=>R.functionResponse);if(y.length>0){let R=y.filter(F=>{let C=F.functionResponse;return!i.some(({call:A})=>a(A,C))});R.length>0&&console.log(`[fixRequestContents] \u68C0\u6D4B\u5230\u7B2C${c+1}\u6761\u6D88\u606F\u4E2D\u6709 ${R.length} \u4E2A\u5B64\u7ACB\u7684 function response:`,R.map(F=>({name:F.functionResponse.name,id:F.functionResponse.id,result:F.functionResponse.response?.result})))}}if(G.role===Pr.MODEL&&G.parts?.some(y=>y.functionCall)){let y=o[c+1],R=G.parts?.filter(F=>F.functionCall)||[];if(R.length>0){let F=y?.role===Pr.USER&&y.parts?y.parts.filter(A=>A.functionResponse):[],C=R.filter(A=>{let E=A.functionCall;return!F.some(f=>{let g=f.functionResponse;return a(E,g)})});if(C.length>0){let A=C.map(E=>{let f=E.functionCall;return{functionResponse:{name:f.name,response:{result:"user cancel"},...f.id&&{id:f.id}}}});r.push({role:Pr.USER,parts:A}),console.log(`[fixRequestContents] \u4E3A\u7B2C${c+1}\u6761\u6D88\u606F\u8865\u5168\u4E86 ${C.length} \u4E2A\u672A\u5339\u914D\u7684 function call`)}if(y&&F.length>0){let A=y.parts?.filter(E=>!E.functionResponse)||[];A.length>0&&(o[c+1]={...y,parts:[...F,...A]},console.log(`[fixRequestContents] \u8C03\u6574\u4E86\u7B2C${c+2}\u6761\u6D88\u606F\u7684\u5185\u5BB9\u987A\u5E8F\uFF0Cfunction-response \u5728\u524D`))}}}}let d=[],I={},h={};for(let c of r)if(c.role===Pr.MODEL&&c.parts)c.parts.forEach(G=>{G.functionCall&&(G.functionCall.id&&(I[G.functionCall.id]=!0),G.functionCall.name&&(h[G.functionCall.name]=!0))}),d.push(c);else if(c.role===Pr.USER&&c.parts){let G=c.parts.filter(W=>{if(!W.functionResponse)return!0;let y=W.functionResponse,R=y.id&&I[y.id],F=y.name&&h[y.name];return R||F?!0:(console.warn(`[fixRequestContents] \u274C \u79FB\u9664\u5B64\u7ACB\u7684 functionResponse\uFF1A${y.name} (id: ${y.id})\u3002\u8FD9\u4E2A response \u6CA1\u6709\u5BF9\u5E94\u7684 function call\u3002`),!1)});G.length>0?d.push({...c,parts:G}):console.warn("[fixRequestContents] \u79FB\u9664\u7A7A\u7684\u7528\u6237\u6D88\u606F\uFF08\u6240\u6709 functionResponse \u90FD\u88AB\u8FC7\u6EE4\uFF09")}else d.push(c);return d}async sendMessageStream(t,r,a){await this.sendPromise;let s={...KHe(t.message),prompt_id:r},e=this.getHistory(!0).concat(s),o=this.fixRequestContents(e);this._logApiRequest(o,this.config.getModel(),r);let u=Date.now();try{let I=await Hb(()=>{let c=this.specifiedModel||nZ;if(this.config.getQuotaErrorOccurred()&&c===td)throw new Error("Please submit a new query to continue with the Flash model.");return this.contentGenerator.generateContentStream({model:c,contents:bQ(o),config:{...this.generationConfig,...t.config}},a)},{shouldRetry:c=>{if(sf(c))return!1;if(c&&c.message){if(c.message.includes("429"))return!0;if(c.message.includes("REGION_BLOCKED_451")||c.message.includes("451"))return!1;if(c.message.match(/5\d{2}/))return!0}return!1},onPersistent429:async(c,G)=>await this.handleFlashFallback(c,G),authType:this.config.getContentGeneratorConfig()?.authType});return this.sendPromise=Promise.resolve(I).then(()=>{}).catch(()=>{}),this.processStreamResponse(I,s,u,r)}catch(d){let I=Date.now()-u;throw this._logApiError(I,d,r,this.agentContext),of.clearRealTimeToken(),this.sendPromise=Promise.resolve(),d}}getHistory(t=!1){let r=t?xXn(this.history):this.history;return structuredClone(r)}clearHistory(){this.history=[]}addHistory(t){this.history.push(t)}setHistory(t){this.history=t}setTools(t){this.generationConfig.tools=t}getTools(){return this.generationConfig.tools}setSystemInstruction(t){this.generationConfig.systemInstruction=t}getSystemInstruction(){return this.generationConfig.systemInstruction}getFinalUsageMetadata(t){return t.slice().reverse().find(a=>a.usageMetadata)?.usageMetadata}async*processStreamResponse(t,r,a,i){let s=[],e=[],o=!1;try{for await(let u of t){let d=u.candidates?.[0]?.content,I=d&&this.isReasoningContent(d),h=d&&this.isThoughtContent(d);if((YXn(u)||u.usageMetadata)&&!I&&!h&&e.push(u),YXn(u)&&d!==void 0){if(h||I){yield u;continue}s.push(d)}yield u}}catch(u){o=!0;let d=Date.now()-a;throw this._logApiError(d,u,i,this.agentContext),of.clearRealTimeToken(),s.length>0&&this.recordHistory(r,s),u}if(!o){let u=Date.now()-a,d=[];for(let I of s)I.parts&&d.push(...I.parts);await this._logApiResponse(u,i,this.getFinalUsageMetadata(e),JSON.stringify(e),this.agentContext),this.recordHistory(r,s)}}recordHistory(t,r,a){let i=r.filter(o=>!this.isThoughtContent(o)&&!this.isReasoningContent(o)),s=[];i.length>0&&i.every(o=>o.role!==void 0)?s=i:i.length===0&&r.length>0||C$e(t)||s.push({role:Pr.MODEL,parts:[]}),a&&a.length>0?this.history.push(...xXn(a)):this.history.push(t);let e=[];for(let o of s){if(this.isThoughtContent(o)||this.isReasoningContent(o))continue;let u=e[e.length-1],d=o.parts?.some(h=>h.functionCall),I=u?.parts?.some(h=>h.functionCall);this.isTextContent(u)&&this.isTextContent(o)?(u.parts[0].text+=o.parts[0].text||"",o.parts.length>1&&u.parts.push(...o.parts.slice(1))):d&&I&&u.role===Pr.MODEL?(console.log("[recordHistory] Merging consecutive function calls into single message"),u.parts?.push(...o.parts||[])):e.push(o)}if(e.length>0){let o=this.history[this.history.length-1];(!a||a.length===0)&&this.isTextContent(o)&&this.isTextContent(e[0])&&(o.parts[0].text+=e[0].parts[0].text||"",e[0].parts.length>1&&o.parts.push(...e[0].parts.slice(1)),e.shift()),this.history.push(...e)}}isTextContent(t){return!!(t&&t.role==="model"&&t.parts&&t.parts.length>0&&typeof t.parts[0].text=="string"&&t.parts[0].text!=="")}isThoughtContent(t){return!!(t&&t.role==="model"&&t.parts&&t.parts.length>0&&typeof t.parts[0].thought=="boolean"&&t.parts[0].thought===!0)}isReasoningContent(t){return QXn(t)}}});import{createHash as HXn}from"crypto";async function AXa(n,t,r,a){let i=a.getGeminiClient()?.getContentGenerator();if(!i)throw new Error("DeepVServerAdapter not available");console.log("[LoopDetection] Calling unified interface for loop detection");let s=await i.generateContent({contents:n,config:{responseMimeType:"application/json",abortSignal:r,httpOptions:{headers:{"X-Scene-Type":"json_generation","X-Request-ID":`loop-detection-${Date.now()}`}}}},"json_generation");return console.log("[LoopDetection] Loop detection completed successfully"),s}var GXa,f0t,Gz,XXn,gXa,kXn,vXa,ZXa,LXn,SXn,NXa,KEe,BXn=It(()=>{"use strict";gAe();Gse();r6();av();Ci();GXa=10,f0t=20,Gz=500,XXn=1e4,gXa=new Set(["read_file","read_many_files","glob","search_file_content","ls","replace","write_file","delete_file","shell"]),kXn=32,vXa=20,ZXa=30,LXn=3,SXn=5,NXa=15;KEe=class{config;promptId="";isPreviewModel=!1;lastToolCallKey=null;toolCallRepetitionCount=0;lastToolName=null;consecutiveToolNameCount=0;streamContentHistory="";contentStats=new Map;lastContentIndex=0;loopDetected=!1;detectedLoopType=null;turnsInCurrentPrompt=0;llmCheckInterval=LXn;lastCheckTurn=0;constructor(t){this.config=t}getToolCallKey(t){let r=JSON.stringify(t.args),a=`${t.name}:${r}`;return HXn("sha256").update(a).digest("hex")}addAndCheck(t){if(this.loopDetected)return!0;switch(t.type){case pi.ToolCallRequest:this.resetContentTracking(),this.loopDetected=this.checkToolCallLoop(t.value);break;case pi.Content:this.loopDetected=this.checkContentLoop(t.value);break;default:break}return this.loopDetected}async turnStarted(t){return this.turnsInCurrentPrompt++,this.turnsInCurrentPrompt>=ZXa&&this.turnsInCurrentPrompt-this.lastCheckTurn>=this.llmCheckInterval?(this.lastCheckTurn=this.turnsInCurrentPrompt,await this.checkForLoopWithLLM(t)):!1}checkToolCallLoop(t){let r=this.getToolCallKey(t);return this.lastToolCallKey===r?this.toolCallRepetitionCount++:(this.lastToolCallKey=r,this.toolCallRepetitionCount=1),this.toolCallRepetitionCount>=GXa?(this.detectedLoopType=Z2.CONSECUTIVE_IDENTICAL_TOOL_CALLS,fse(this.config,new n6(Z2.CONSECUTIVE_IDENTICAL_TOOL_CALLS,this.promptId)),!0):this.isPreviewModel?this.checkPreviewModelToolNameLoop(t):!1}checkPreviewModelToolNameLoop(t){let r=t.name;return gXa.has(r)?(this.lastToolName===r?this.consecutiveToolNameCount++:(this.lastToolName=r,this.consecutiveToolNameCount=1),this.consecutiveToolNameCount>=kXn?(console.warn(`[LoopDetection] Preview model loop detected: tool '${r}' called consecutively ${this.consecutiveToolNameCount} times (threshold: ${kXn})`),this.detectedLoopType=Z2.CONSECUTIVE_IDENTICAL_TOOL_CALLS,fse(this.config,new n6(Z2.CONSECUTIVE_IDENTICAL_TOOL_CALLS,this.promptId)),!0):!1):(this.lastToolName=null,this.consecutiveToolNameCount=0,!1)}checkContentLoop(t){return this.streamContentHistory+=t,this.truncateAndUpdate(),this.analyzeContentChunksForLoop()}truncateAndUpdate(){if(this.streamContentHistory.length<=XXn)return;let t=this.streamContentHistory.length-XXn;this.streamContentHistory=this.streamContentHistory.slice(t),this.lastContentIndex=Math.max(0,this.lastContentIndex-t);for(let[r,a]of this.contentStats.entries()){let i=a.map(s=>s-t).filter(s=>s>=0);i.length>0?this.contentStats.set(r,i):this.contentStats.delete(r)}}analyzeContentChunksForLoop(){for(;this.hasMoreChunksToProcess();){let t=this.streamContentHistory.substring(this.lastContentIndex,this.lastContentIndex+Gz),r=HXn("sha256").update(t).digest("hex");if(this.isLoopDetectedForChunk(t,r))return this.detectedLoopType=Z2.CHANTING_IDENTICAL_SENTENCES,fse(this.config,new n6(Z2.CHANTING_IDENTICAL_SENTENCES,this.promptId)),!0;this.lastContentIndex++}return!1}hasMoreChunksToProcess(){return this.lastContentIndex+Gz<=this.streamContentHistory.length}hasSignificantContent(t){return!(t.trim().length<15||/^[\s\t\n\r]*$/.test(t)||/^[\s\-=*_+|#.`\/\\~]+$/.test(t)||/^[\s\u2500-\u257F┌┐└┘├┤┬┴┼]+$/.test(t))}isCommonPattern(t){return[/^[\s]*[-•*]\s+/,/^[\s]*(const|let|var|function|def|class|if|else|for|while)\s+/i,/^(Let me|I'll|I can|Here's|To |Please|Thanks|Note|import|from)\s+/i,/^[\s]*\/\//,/^[\s]*#/,/^[\s]*"(id|name|email|status|type|value|key|data|message|error|result|code)"\s*:/i,/^\s*\|\s+/,/\|\s*---\s*\|/,/\|\s*\d+[\d,.]*/,/\|\s*[一-龥]+\s*\|/].some(a=>a.test(t))}isTableContent(t){return(t.match(/\|/g)||[]).length>=2||/\|\s*---+\s*\|/.test(t)||/\|\s*\d+[\d,.]*\s*\|/.test(t)}isLoopDetectedForChunk(t,r){if(!this.hasSignificantContent(t))return!1;let a=this.contentStats.get(r);if(!a)return this.contentStats.set(r,[this.lastContentIndex]),!1;if(!this.isActualContentMatch(t,a[0])||(a.push(this.lastContentIndex),a.length<f0t))return!1;let i=a.slice(-f0t),e=(i[i.length-1]-i[0])/(f0t-1),o=Gz*1.5;return this.isTableContent(t)?o=Gz*6:this.isCommonPattern(t)&&(o=Gz*3),e<=o}isActualContentMatch(t,r){return this.streamContentHistory.substring(r,r+Gz)===t}async checkForLoopWithLLM(t){let i=[...this.config.getGeminiClient().getHistory().slice(-vXa),{role:Pr.USER,parts:[{text:`You are a sophisticated AI diagnostic agent specializing in identifying when a conversational AI is stuck in an unproductive state. Your task is to analyze the provided conversation history and determine if the assistant has ceased to make meaningful progress.
|
|
3125
|
+
`,(0,AFe.getConflictResolutionRecipe)(s,t))}return a}};WFe.MetricStorageRegistry=fut});var uYn=ve(yFe=>{"use strict";Object.defineProperty(yFe,"__esModule",{value:!0});yFe.MultiMetricStorage=void 0;var Gut=class{constructor(t){this._backingStorages=t}record(t,r,a,i){this._backingStorages.forEach(s=>{s.record(t,r,a,i)})}};yFe.MultiMetricStorage=Gut});var dYn=ve(YM=>{"use strict";Object.defineProperty(YM,"__esModule",{value:!0});YM.BatchObservableResultImpl=YM.ObservableResultImpl=void 0;var CM=(Qr(),dr(kr)),IYn=Xle(),rRa=bFe(),gut=class{constructor(t,r){this._instrumentName=t,this._valueType=r,this._buffer=new IYn.AttributeHashMap}observe(t,r={}){if(typeof t!="number"){CM.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===CM.ValueType.INT&&!Number.isInteger(t)&&(CM.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}};YM.ObservableResultImpl=gut;var vut=class{constructor(){this._buffer=new Map}observe(t,r,a={}){if(!(0,rRa.isObservableInstrument)(t))return;let i=this._buffer.get(t);if(i==null&&(i=new IYn.AttributeHashMap,this._buffer.set(t,i)),typeof r!="number"){CM.diag.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===CM.ValueType.INT&&!Number.isInteger(r)&&(CM.diag.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||i.set(a,r)}};YM.BatchObservableResultImpl=vut});var pYn=ve(FFe=>{"use strict";Object.defineProperty(FFe,"__esModule",{value:!0});FFe.ObservableRegistry=void 0;var aRa=(Qr(),dr(kr)),hYn=bFe(),mYn=dYn(),kle=GF(),Zut=class{constructor(){this._callbacks=[],this._batchCallbacks=[]}addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){let a=this._findCallback(t,r);a<0||this._callbacks.splice(a,1)}addBatchCallback(t,r){let a=new Set(r.filter(hYn.isObservableInstrument));if(a.size===0){aRa.diag.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,a)>=0||this._batchCallbacks.push({callback:t,instruments:a})}removeBatchCallback(t,r){let a=new Set(r.filter(hYn.isObservableInstrument)),i=this._findBatchCallback(t,a);i<0||this._batchCallbacks.splice(i,1)}async observe(t,r){let a=this._observeCallbacks(t,r),i=this._observeBatchCallbacks(t,r);return(await(0,kle.PromiseAllSettled)([...a,...i])).filter(kle.isPromiseAllSettledRejectionResult).map(o=>o.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:a,instrument:i})=>{let s=new mYn.ObservableResultImpl(i._descriptor.name,i._descriptor.valueType),e=Promise.resolve(a(s));r!=null&&(e=(0,kle.callWithTimeout)(e,r)),await e,i._metricStorages.forEach(o=>{o.record(s._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:a,instruments:i})=>{let s=new mYn.BatchObservableResultImpl,e=Promise.resolve(a(s));r!=null&&(e=(0,kle.callWithTimeout)(e,r)),await e,i.forEach(o=>{let u=s._buffer.get(o);u!=null&&o._metricStorages.forEach(d=>{d.record(u,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(a=>a.callback===t&&a.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(a=>a.callback===t&&(0,kle.setEquals)(a.instruments,r))}};FFe.ObservableRegistry=Zut});var bYn=ve(EFe=>{"use strict";Object.defineProperty(EFe,"__esModule",{value:!0});EFe.SyncMetricStorage=void 0;var iRa=cut(),lRa=hut(),sRa=put(),Nut=class extends iRa.MetricStorage{constructor(t,r,a,i){super(t),this._attributesProcessor=a,this._deltaMetricStorage=new lRa.DeltaMetricProcessor(r),this._temporalMetricStorage=new sRa.TemporalMetricProcessor(r,i)}record(t,r,a,i){r=this._attributesProcessor.process(r,a),this._deltaMetricStorage.record(t,r,a,i)}collect(t,r){let a=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,a,r)}};EFe.SyncMetricStorage=Nut});var Wut=ve(vx=>{"use strict";Object.defineProperty(vx,"__esModule",{value:!0});vx.FilteringAttributesProcessor=vx.NoopAttributesProcessor=vx.AttributesProcessor=void 0;var Lle=class{static Noop(){return oRa}};vx.AttributesProcessor=Lle;var RFe=class extends Lle{process(t,r){return t}};vx.NoopAttributesProcessor=RFe;var Aut=class extends Lle{constructor(t){super(),this._allowedAttributeNames=t}process(t,r){let a={};return Object.keys(t).filter(i=>this._allowedAttributeNames.includes(i)).forEach(i=>a[i]=t[i]),a}};vx.FilteringAttributesProcessor=Aut;var oRa=new RFe});var fYn=ve(wFe=>{"use strict";Object.defineProperty(wFe,"__esModule",{value:!0});wFe.MeterSharedState=void 0;var cRa=MR(),uRa=tYn(),IRa=GF(),dRa=nYn(),hRa=cYn(),mRa=uYn(),pRa=pYn(),bRa=bYn(),fRa=Wut(),yut=class{constructor(t,r){this._meterProviderSharedState=t,this._instrumentationScope=r,this.metricStorageRegistry=new hRa.MetricStorageRegistry,this.observableRegistry=new pRa.ObservableRegistry,this.meter=new uRa.Meter(this)}registerMetricStorage(t){let r=this._registerMetricStorage(t,bRa.SyncMetricStorage);return r.length===1?r[0]:new mRa.MultiMetricStorage(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,dRa.AsyncMetricStorage)}async collect(t,r,a){let i=await this.observableRegistry.observe(r,a?.timeoutMillis),s=this.metricStorageRegistry.getStorages(t);if(s.length===0)return null;let e=s.map(o=>o.collect(t,r)).filter(IRa.isNotNullish);return e.length===0?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:e},errors:i}}_registerMetricStorage(t,r){let i=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(s=>{let e=(0,cRa.createInstrumentDescriptorWithView)(s,t),o=this.metricStorageRegistry.findOrUpdateCompatibleStorage(e);if(o!=null)return o;let u=s.aggregation.createAggregator(e),d=new r(e,u,s.attributesProcessor,this._meterProviderSharedState.metricCollectors);return this.metricStorageRegistry.register(d),d});if(i.length===0){let e=this._meterProviderSharedState.selectAggregations(t.type).map(([o,u])=>{let d=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(o,t);if(d!=null)return d;let I=u.createAggregator(t),h=new r(t,I,fRa.AttributesProcessor.Noop(),[o]);return this.metricStorageRegistry.registerForCollector(o,h),h});i=i.concat(e)}return i}};wFe.MeterSharedState=yut});var GYn=ve(CFe=>{"use strict";Object.defineProperty(CFe,"__esModule",{value:!0});CFe.MeterProviderSharedState=void 0;var GRa=GF(),gRa=eYn(),vRa=fYn(),Fut=class{constructor(t){this.resource=t,this.viewRegistry=new gRa.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(t){let r=(0,GRa.instrumentationScopeId)(t),a=this.meterSharedStates.get(r);return a==null&&(a=new vRa.MeterSharedState(this,t),this.meterSharedStates.set(r,a)),a}selectAggregations(t){let r=[];for(let a of this.metricCollectors)r.push([a,a.selectAggregation(t)]);return r}};CFe.MeterProviderSharedState=Fut});var gYn=ve(YFe=>{"use strict";Object.defineProperty(YFe,"__esModule",{value:!0});YFe.MetricCollector=void 0;var ZRa=Va(),Eut=class{constructor(t,r){this._sharedState=t,this._metricReader=r}async collect(t){let r=(0,ZRa.millisToHrTime)(Date.now()),a=[],i=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async e=>{let o=await e.collect(this,r,t);o?.scopeMetrics!=null&&a.push(o.scopeMetrics),o?.errors!=null&&i.push(...o.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:a},errors:i}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}};YFe.MetricCollector=Eut});var ZYn=ve(VFe=>{"use strict";Object.defineProperty(VFe,"__esModule",{value:!0});VFe.MeterProvider=void 0;var xFe=(Qr(),dr(kr)),vYn=gx(),NRa=GYn(),ARa=gYn(),Rut=class{constructor(t){var r;this._shutdown=!1;let a=vYn.Resource.default().merge((r=t?.resource)!==null&&r!==void 0?r:vYn.Resource.empty());if(this._sharedState=new NRa.MeterProviderSharedState(a),t?.views!=null&&t.views.length>0)for(let i of t.views)this._sharedState.viewRegistry.addView(i);if(t?.readers!=null&&t.readers.length>0)for(let i of t.readers)this.addMetricReader(i)}getMeter(t,r="",a={}){return this._shutdown?(xFe.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,xFe.createNoopMeter)()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:a.schemaUrl}).meter}addMetricReader(t){let r=new ARa.MetricCollector(this._sharedState,t);t.setMetricProducer(r),this._sharedState.metricCollectors.push(r)}async shutdown(t){if(this._shutdown){xFe.diag.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){xFe.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}};VFe.MeterProvider=Rut});var QFe=ve(xM=>{"use strict";Object.defineProperty(xM,"__esModule",{value:!0});xM.ExactPredicate=xM.PatternPredicate=void 0;var WRa=/[\^$\\.+?()[\]{}|]/g,wut=class n{constructor(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(n.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(WRa,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}};xM.PatternPredicate=wut;var Cut=class{constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}};xM.ExactPredicate=Cut});var AYn=ve(HFe=>{"use strict";Object.defineProperty(HFe,"__esModule",{value:!0});HFe.InstrumentSelector=void 0;var NYn=QFe(),Yut=class{constructor(t){var r;this._nameFilter=new NYn.PatternPredicate((r=t?.name)!==null&&r!==void 0?r:"*"),this._type=t?.type,this._unitFilter=new NYn.ExactPredicate(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};HFe.InstrumentSelector=Yut});var WYn=ve(XFe=>{"use strict";Object.defineProperty(XFe,"__esModule",{value:!0});XFe.MeterSelector=void 0;var xut=QFe(),Vut=class{constructor(t){this._nameFilter=new xut.ExactPredicate(t?.name),this._versionFilter=new xut.ExactPredicate(t?.version),this._schemaUrlFilter=new xut.ExactPredicate(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};XFe.MeterSelector=Vut});var FYn=ve(kFe=>{"use strict";Object.defineProperty(kFe,"__esModule",{value:!0});kFe.View=void 0;var yRa=QFe(),yYn=Wut(),FRa=AYn(),ERa=WYn(),RRa=Lye();function wRa(n){return n.instrumentName==null&&n.instrumentType==null&&n.instrumentUnit==null&&n.meterName==null&&n.meterVersion==null&&n.meterSchemaUrl==null}var Qut=class{constructor(t){var r;if(wRa(t))throw new Error("Cannot create view with no selector arguments supplied");if(t.name!=null&&(t?.instrumentName==null||yRa.PatternPredicate.hasWildcard(t.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");t.attributeKeys!=null?this.attributesProcessor=new yYn.FilteringAttributesProcessor(t.attributeKeys):this.attributesProcessor=yYn.AttributesProcessor.Noop(),this.name=t.name,this.description=t.description,this.aggregation=(r=t.aggregation)!==null&&r!==void 0?r:RRa.Aggregation.Default(),this.instrumentSelector=new FRa.InstrumentSelector({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new ERa.MeterSelector({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl})}};kFe.View=Qut});var VM=ve(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.TimeoutError=Cl.View=Cl.Aggregation=Cl.SumAggregation=Cl.LastValueAggregation=Cl.HistogramAggregation=Cl.DropAggregation=Cl.ExponentialHistogramAggregation=Cl.ExplicitBucketHistogramAggregation=Cl.DefaultAggregation=Cl.MeterProvider=Cl.InstrumentType=Cl.ConsoleMetricExporter=Cl.InMemoryMetricExporter=Cl.PeriodicExportingMetricReader=Cl.MetricReader=Cl.DataPointType=Cl.AggregationTemporality=void 0;var CRa=Nye();Object.defineProperty(Cl,"AggregationTemporality",{enumerable:!0,get:function(){return CRa.AggregationTemporality}});var YRa=uM();Object.defineProperty(Cl,"DataPointType",{enumerable:!0,get:function(){return YRa.DataPointType}});var xRa=Rct();Object.defineProperty(Cl,"MetricReader",{enumerable:!0,get:function(){return xRa.MetricReader}});var VRa=NCn();Object.defineProperty(Cl,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return VRa.PeriodicExportingMetricReader}});var QRa=WCn();Object.defineProperty(Cl,"InMemoryMetricExporter",{enumerable:!0,get:function(){return QRa.InMemoryMetricExporter}});var HRa=FCn();Object.defineProperty(Cl,"ConsoleMetricExporter",{enumerable:!0,get:function(){return HRa.ConsoleMetricExporter}});var XRa=MR();Object.defineProperty(Cl,"InstrumentType",{enumerable:!0,get:function(){return XRa.InstrumentType}});var kRa=ZYn();Object.defineProperty(Cl,"MeterProvider",{enumerable:!0,get:function(){return kRa.MeterProvider}});var Zx=Lye();Object.defineProperty(Cl,"DefaultAggregation",{enumerable:!0,get:function(){return Zx.DefaultAggregation}});Object.defineProperty(Cl,"ExplicitBucketHistogramAggregation",{enumerable:!0,get:function(){return Zx.ExplicitBucketHistogramAggregation}});Object.defineProperty(Cl,"ExponentialHistogramAggregation",{enumerable:!0,get:function(){return Zx.ExponentialHistogramAggregation}});Object.defineProperty(Cl,"DropAggregation",{enumerable:!0,get:function(){return Zx.DropAggregation}});Object.defineProperty(Cl,"HistogramAggregation",{enumerable:!0,get:function(){return Zx.HistogramAggregation}});Object.defineProperty(Cl,"LastValueAggregation",{enumerable:!0,get:function(){return Zx.LastValueAggregation}});Object.defineProperty(Cl,"SumAggregation",{enumerable:!0,get:function(){return Zx.SumAggregation}});Object.defineProperty(Cl,"Aggregation",{enumerable:!0,get:function(){return Zx.Aggregation}});var LRa=FYn();Object.defineProperty(Cl,"View",{enumerable:!0,get:function(){return LRa.View}});var SRa=GF();Object.defineProperty(Cl,"TimeoutError",{enumerable:!0,get:function(){return SRa.TimeoutError}})});var YYn=ve(Nx=>{"use strict";Object.defineProperty(Nx,"__esModule",{value:!0});Nx.toMetric=Nx.toScopeMetrics=Nx.toResourceMetrics=void 0;var EYn=(Qr(),dr(kr)),QM=VM(),BRa=Wle(),LFe=cM(),JRa=gye();function TRa(n,t){let r=(0,BRa.getOtlpEncoder)(t);return{resource:(0,JRa.createResource)(n.resource),schemaUrl:void 0,scopeMetrics:wYn(n.scopeMetrics,r)}}Nx.toResourceMetrics=TRa;function wYn(n,t){return Array.from(n.map(r=>({scope:(0,LFe.createInstrumentationScope)(r.scope),metrics:r.metrics.map(a=>CYn(a,t)),schemaUrl:r.scope.schemaUrl})))}Nx.toScopeMetrics=wYn;function CYn(n,t){let r={name:n.descriptor.name,description:n.descriptor.description,unit:n.descriptor.unit},a=MRa(n.aggregationTemporality);switch(n.dataPointType){case QM.DataPointType.SUM:r.sum={aggregationTemporality:a,isMonotonic:n.isMonotonic,dataPoints:RYn(n,t)};break;case QM.DataPointType.GAUGE:r.gauge={dataPoints:RYn(n,t)};break;case QM.DataPointType.HISTOGRAM:r.histogram={aggregationTemporality:a,dataPoints:ORa(n,t)};break;case QM.DataPointType.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:a,dataPoints:URa(n,t)};break}return r}Nx.toMetric=CYn;function DRa(n,t,r){let a={attributes:(0,LFe.toAttributes)(n.attributes),startTimeUnixNano:r.encodeHrTime(n.startTime),timeUnixNano:r.encodeHrTime(n.endTime)};switch(t){case EYn.ValueType.INT:a.asInt=n.value;break;case EYn.ValueType.DOUBLE:a.asDouble=n.value;break}return a}function RYn(n,t){return n.dataPoints.map(r=>DRa(r,n.descriptor.valueType,t))}function ORa(n,t){return n.dataPoints.map(r=>{let a=r.value;return{attributes:(0,LFe.toAttributes)(r.attributes),bucketCounts:a.buckets.counts,explicitBounds:a.buckets.boundaries,count:a.count,sum:a.sum,min:a.min,max:a.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function URa(n,t){return n.dataPoints.map(r=>{let a=r.value;return{attributes:(0,LFe.toAttributes)(r.attributes),count:a.count,min:a.min,max:a.max,sum:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},scale:a.scale,zeroCount:a.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function MRa(n){switch(n){case QM.AggregationTemporality.DELTA:return 1;case QM.AggregationTemporality.CUMULATIVE:return 2}}});var BFe=ve(SFe=>{"use strict";Object.defineProperty(SFe,"__esModule",{value:!0});SFe.createExportMetricsServiceRequest=void 0;var zRa=YYn();function _Ra(n,t){return{resourceMetrics:n.map(r=>(0,zRa.toResourceMetrics)(r,t))}}SFe.createExportMetricsServiceRequest=_Ra});var JFe=ve(HM=>{"use strict";Object.defineProperty(HM,"__esModule",{value:!0});HM.toLogAttributes=HM.createExportLogsServiceRequest=void 0;var PRa=Wle(),Hut=cM(),jRa=gye();function KRa(n,t){let r=(0,PRa.getOtlpEncoder)(t);return{resourceLogs:$Ra(n,r)}}HM.createExportLogsServiceRequest=KRa;function qRa(n){let t=new Map;for(let r of n){let{resource:a,instrumentationScope:{name:i,version:s="",schemaUrl:e=""}}=r,o=t.get(a);o||(o=new Map,t.set(a,o));let u=`${i}@${s}:${e}`,d=o.get(u);d||(d=[],o.set(u,d)),d.push(r)}return t}function $Ra(n,t){let r=qRa(n);return Array.from(r,([a,i])=>({resource:(0,jRa.createResource)(a),scopeLogs:Array.from(i,([,s])=>({scope:(0,Hut.createInstrumentationScope)(s[0].instrumentationScope),logRecords:s.map(e=>e4a(e,t)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:void 0}))}function e4a(n,t){var r,a,i;return{timeUnixNano:t.encodeHrTime(n.hrTime),observedTimeUnixNano:t.encodeHrTime(n.hrTimeObserved),severityNumber:n.severityNumber,severityText:n.severityText,body:(0,Hut.toAnyValue)(n.body),attributes:xYn(n.attributes),droppedAttributesCount:n.droppedAttributesCount,flags:(r=n.spanContext)===null||r===void 0?void 0:r.traceFlags,traceId:t.encodeOptionalSpanContext((a=n.spanContext)===null||a===void 0?void 0:a.traceId),spanId:t.encodeOptionalSpanContext((i=n.spanContext)===null||i===void 0?void 0:i.spanId)}}function xYn(n){return Object.keys(n).map(t=>(0,Hut.toKeyValue)(t,n[t]))}HM.toLogAttributes=xYn});var QYn=ve((cji,VYn)=>{"use strict";VYn.exports=llt()});var XYn=ve((uji,HYn)=>{"use strict";var za=QYn(),wn=za.Reader,ji=za.Writer,Vt=za.util,Et=za.roots.default||(za.roots.default={});Et.opentelemetry=(function(){var n={};return n.proto=(function(){var t={};return t.common=(function(){var r={};return r.v1=(function(){var a={};return a.AnyValue=(function(){function i(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.stringValue=null,i.prototype.boolValue=null,i.prototype.intValue=null,i.prototype.doubleValue=null,i.prototype.arrayValue=null,i.prototype.kvlistValue=null,i.prototype.bytesValue=null;var s;return Object.defineProperty(i.prototype,"value",{get:Vt.oneOfGetter(s=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){return u||(u=ji.create()),o.stringValue!=null&&Object.hasOwnProperty.call(o,"stringValue")&&u.uint32(10).string(o.stringValue),o.boolValue!=null&&Object.hasOwnProperty.call(o,"boolValue")&&u.uint32(16).bool(o.boolValue),o.intValue!=null&&Object.hasOwnProperty.call(o,"intValue")&&u.uint32(24).int64(o.intValue),o.doubleValue!=null&&Object.hasOwnProperty.call(o,"doubleValue")&&u.uint32(33).double(o.doubleValue),o.arrayValue!=null&&Object.hasOwnProperty.call(o,"arrayValue")&&Et.opentelemetry.proto.common.v1.ArrayValue.encode(o.arrayValue,u.uint32(42).fork()).ldelim(),o.kvlistValue!=null&&Object.hasOwnProperty.call(o,"kvlistValue")&&Et.opentelemetry.proto.common.v1.KeyValueList.encode(o.kvlistValue,u.uint32(50).fork()).ldelim(),o.bytesValue!=null&&Object.hasOwnProperty.call(o,"bytesValue")&&u.uint32(58).bytes(o.bytesValue),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.common.v1.AnyValue;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.stringValue=o.string();break}case 2:{I.boolValue=o.bool();break}case 3:{I.intValue=o.int64();break}case 4:{I.doubleValue=o.double();break}case 5:{I.arrayValue=Et.opentelemetry.proto.common.v1.ArrayValue.decode(o,o.uint32());break}case 6:{I.kvlistValue=Et.opentelemetry.proto.common.v1.KeyValueList.decode(o,o.uint32());break}case 7:{I.bytesValue=o.bytes();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.stringValue!=null&&o.hasOwnProperty("stringValue")&&(u.value=1,!Vt.isString(o.stringValue)))return"stringValue: string expected";if(o.boolValue!=null&&o.hasOwnProperty("boolValue")){if(u.value===1)return"value: multiple values";if(u.value=1,typeof o.boolValue!="boolean")return"boolValue: boolean expected"}if(o.intValue!=null&&o.hasOwnProperty("intValue")){if(u.value===1)return"value: multiple values";if(u.value=1,!Vt.isInteger(o.intValue)&&!(o.intValue&&Vt.isInteger(o.intValue.low)&&Vt.isInteger(o.intValue.high)))return"intValue: integer|Long expected"}if(o.doubleValue!=null&&o.hasOwnProperty("doubleValue")){if(u.value===1)return"value: multiple values";if(u.value=1,typeof o.doubleValue!="number")return"doubleValue: number expected"}if(o.arrayValue!=null&&o.hasOwnProperty("arrayValue")){if(u.value===1)return"value: multiple values";u.value=1;{var d=Et.opentelemetry.proto.common.v1.ArrayValue.verify(o.arrayValue);if(d)return"arrayValue."+d}}if(o.kvlistValue!=null&&o.hasOwnProperty("kvlistValue")){if(u.value===1)return"value: multiple values";u.value=1;{var d=Et.opentelemetry.proto.common.v1.KeyValueList.verify(o.kvlistValue);if(d)return"kvlistValue."+d}}if(o.bytesValue!=null&&o.hasOwnProperty("bytesValue")){if(u.value===1)return"value: multiple values";if(u.value=1,!(o.bytesValue&&typeof o.bytesValue.length=="number"||Vt.isString(o.bytesValue)))return"bytesValue: buffer expected"}return null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.common.v1.AnyValue)return o;var u=new Et.opentelemetry.proto.common.v1.AnyValue;if(o.stringValue!=null&&(u.stringValue=String(o.stringValue)),o.boolValue!=null&&(u.boolValue=!!o.boolValue),o.intValue!=null&&(Vt.Long?(u.intValue=Vt.Long.fromValue(o.intValue)).unsigned=!1:typeof o.intValue=="string"?u.intValue=parseInt(o.intValue,10):typeof o.intValue=="number"?u.intValue=o.intValue:typeof o.intValue=="object"&&(u.intValue=new Vt.LongBits(o.intValue.low>>>0,o.intValue.high>>>0).toNumber())),o.doubleValue!=null&&(u.doubleValue=Number(o.doubleValue)),o.arrayValue!=null){if(typeof o.arrayValue!="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");u.arrayValue=Et.opentelemetry.proto.common.v1.ArrayValue.fromObject(o.arrayValue)}if(o.kvlistValue!=null){if(typeof o.kvlistValue!="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");u.kvlistValue=Et.opentelemetry.proto.common.v1.KeyValueList.fromObject(o.kvlistValue)}return o.bytesValue!=null&&(typeof o.bytesValue=="string"?Vt.base64.decode(o.bytesValue,u.bytesValue=Vt.newBuffer(Vt.base64.length(o.bytesValue)),0):o.bytesValue.length>=0&&(u.bytesValue=o.bytesValue)),u},i.toObject=function(o,u){u||(u={});var d={};return o.stringValue!=null&&o.hasOwnProperty("stringValue")&&(d.stringValue=o.stringValue,u.oneofs&&(d.value="stringValue")),o.boolValue!=null&&o.hasOwnProperty("boolValue")&&(d.boolValue=o.boolValue,u.oneofs&&(d.value="boolValue")),o.intValue!=null&&o.hasOwnProperty("intValue")&&(typeof o.intValue=="number"?d.intValue=u.longs===String?String(o.intValue):o.intValue:d.intValue=u.longs===String?Vt.Long.prototype.toString.call(o.intValue):u.longs===Number?new Vt.LongBits(o.intValue.low>>>0,o.intValue.high>>>0).toNumber():o.intValue,u.oneofs&&(d.value="intValue")),o.doubleValue!=null&&o.hasOwnProperty("doubleValue")&&(d.doubleValue=u.json&&!isFinite(o.doubleValue)?String(o.doubleValue):o.doubleValue,u.oneofs&&(d.value="doubleValue")),o.arrayValue!=null&&o.hasOwnProperty("arrayValue")&&(d.arrayValue=Et.opentelemetry.proto.common.v1.ArrayValue.toObject(o.arrayValue,u),u.oneofs&&(d.value="arrayValue")),o.kvlistValue!=null&&o.hasOwnProperty("kvlistValue")&&(d.kvlistValue=Et.opentelemetry.proto.common.v1.KeyValueList.toObject(o.kvlistValue,u),u.oneofs&&(d.value="kvlistValue")),o.bytesValue!=null&&o.hasOwnProperty("bytesValue")&&(d.bytesValue=u.bytes===String?Vt.base64.encode(o.bytesValue,0,o.bytesValue.length):u.bytes===Array?Array.prototype.slice.call(o.bytesValue):o.bytesValue,u.oneofs&&(d.value="bytesValue")),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.common.v1.AnyValue"},i})(),a.ArrayValue=(function(){function i(s){if(this.values=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.values=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.values!=null&&e.values.length)for(var u=0;u<e.values.length;++u)Et.opentelemetry.proto.common.v1.AnyValue.encode(e.values[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.common.v1.ArrayValue;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.values&&d.values.length||(d.values=[]),d.values.push(Et.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.values!=null&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var o=0;o<e.values.length;++o){var u=Et.opentelemetry.proto.common.v1.AnyValue.verify(e.values[o]);if(u)return"values."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.common.v1.ArrayValue)return e;var o=new Et.opentelemetry.proto.common.v1.ArrayValue;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");o.values=[];for(var u=0;u<e.values.length;++u){if(typeof e.values[u]!="object")throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");o.values[u]=Et.opentelemetry.proto.common.v1.AnyValue.fromObject(e.values[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.values=[]),e.values&&e.values.length){u.values=[];for(var d=0;d<e.values.length;++d)u.values[d]=Et.opentelemetry.proto.common.v1.AnyValue.toObject(e.values[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.common.v1.ArrayValue"},i})(),a.KeyValueList=(function(){function i(s){if(this.values=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.values=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.values!=null&&e.values.length)for(var u=0;u<e.values.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.values[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.common.v1.KeyValueList;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.values&&d.values.length||(d.values=[]),d.values.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.values!=null&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var o=0;o<e.values.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.values[o]);if(u)return"values."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.common.v1.KeyValueList)return e;var o=new Et.opentelemetry.proto.common.v1.KeyValueList;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");o.values=[];for(var u=0;u<e.values.length;++u){if(typeof e.values[u]!="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");o.values[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.values[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.values=[]),e.values&&e.values.length){u.values=[];for(var d=0;d<e.values.length;++d)u.values[d]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.values[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.common.v1.KeyValueList"},i})(),a.KeyValue=(function(){function i(s){if(s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.key=null,i.prototype.value=null,i.create=function(e){return new i(e)},i.encode=function(e,o){return o||(o=ji.create()),e.key!=null&&Object.hasOwnProperty.call(e,"key")&&o.uint32(10).string(e.key),e.value!=null&&Object.hasOwnProperty.call(e,"value")&&Et.opentelemetry.proto.common.v1.AnyValue.encode(e.value,o.uint32(18).fork()).ldelim(),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.common.v1.KeyValue;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.key=e.string();break}case 2:{d.value=Et.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.key!=null&&e.hasOwnProperty("key")&&!Vt.isString(e.key))return"key: string expected";if(e.value!=null&&e.hasOwnProperty("value")){var o=Et.opentelemetry.proto.common.v1.AnyValue.verify(e.value);if(o)return"value."+o}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.common.v1.KeyValue)return e;var o=new Et.opentelemetry.proto.common.v1.KeyValue;if(e.key!=null&&(o.key=String(e.key)),e.value!=null){if(typeof e.value!="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");o.value=Et.opentelemetry.proto.common.v1.AnyValue.fromObject(e.value)}return o},i.toObject=function(e,o){o||(o={});var u={};return o.defaults&&(u.key="",u.value=null),e.key!=null&&e.hasOwnProperty("key")&&(u.key=e.key),e.value!=null&&e.hasOwnProperty("value")&&(u.value=Et.opentelemetry.proto.common.v1.AnyValue.toObject(e.value,o)),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.common.v1.KeyValue"},i})(),a.InstrumentationScope=(function(){function i(s){if(this.attributes=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.name=null,i.prototype.version=null,i.prototype.attributes=Vt.emptyArray,i.prototype.droppedAttributesCount=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&o.uint32(10).string(e.name),e.version!=null&&Object.hasOwnProperty.call(e,"version")&&o.uint32(18).string(e.version),e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(26).fork()).ldelim();return e.droppedAttributesCount!=null&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&o.uint32(32).uint32(e.droppedAttributesCount),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.common.v1.InstrumentationScope;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.name=e.string();break}case 2:{d.version=e.string();break}case 3:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 4:{d.droppedAttributesCount=e.uint32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!Vt.isString(e.name))return"name: string expected";if(e.version!=null&&e.hasOwnProperty("version")&&!Vt.isString(e.version))return"version: string expected";if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var o=0;o<e.attributes.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[o]);if(u)return"attributes."+u}}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.common.v1.InstrumentationScope)return e;var o=new Et.opentelemetry.proto.common.v1.InstrumentationScope;if(e.name!=null&&(o.name=String(e.name)),e.version!=null&&(o.version=String(e.version)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}return e.droppedAttributesCount!=null&&(o.droppedAttributesCount=e.droppedAttributesCount>>>0),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.attributes=[]),o.defaults&&(u.name="",u.version="",u.droppedAttributesCount=0),e.name!=null&&e.hasOwnProperty("name")&&(u.name=e.name),e.version!=null&&e.hasOwnProperty("version")&&(u.version=e.version),e.attributes&&e.attributes.length){u.attributes=[];for(var d=0;d<e.attributes.length;++d)u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[d],o)}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&(u.droppedAttributesCount=e.droppedAttributesCount),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.common.v1.InstrumentationScope"},i})(),a})(),r})(),t.resource=(function(){var r={};return r.v1=(function(){var a={};return a.Resource=(function(){function i(s){if(this.attributes=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.attributes=Vt.emptyArray,i.prototype.droppedAttributesCount=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(10).fork()).ldelim();return e.droppedAttributesCount!=null&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&o.uint32(16).uint32(e.droppedAttributesCount),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.resource.v1.Resource;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 2:{d.droppedAttributesCount=e.uint32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var o=0;o<e.attributes.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[o]);if(u)return"attributes."+u}}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.resource.v1.Resource)return e;var o=new Et.opentelemetry.proto.resource.v1.Resource;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}return e.droppedAttributesCount!=null&&(o.droppedAttributesCount=e.droppedAttributesCount>>>0),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.attributes=[]),o.defaults&&(u.droppedAttributesCount=0),e.attributes&&e.attributes.length){u.attributes=[];for(var d=0;d<e.attributes.length;++d)u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[d],o)}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&(u.droppedAttributesCount=e.droppedAttributesCount),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.resource.v1.Resource"},i})(),a})(),r})(),t.trace=(function(){var r={};return r.v1=(function(){var a={};return a.TracesData=(function(){function i(s){if(this.resourceSpans=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resourceSpans=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resourceSpans!=null&&e.resourceSpans.length)for(var u=0;u<e.resourceSpans.length;++u)Et.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.TracesData;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resourceSpans&&d.resourceSpans.length||(d.resourceSpans=[]),d.resourceSpans.push(Et.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resourceSpans!=null&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var o=0;o<e.resourceSpans.length;++o){var u=Et.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[o]);if(u)return"resourceSpans."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.TracesData)return e;var o=new Et.opentelemetry.proto.trace.v1.TracesData;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");o.resourceSpans=[];for(var u=0;u<e.resourceSpans.length;++u){if(typeof e.resourceSpans[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");o.resourceSpans[u]=Et.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){u.resourceSpans=[];for(var d=0;d<e.resourceSpans.length;++d)u.resourceSpans[d]=Et.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.TracesData"},i})(),a.ResourceSpans=(function(){function i(s){if(this.scopeSpans=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resource=null,i.prototype.scopeSpans=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resource!=null&&Object.hasOwnProperty.call(e,"resource")&&Et.opentelemetry.proto.resource.v1.Resource.encode(e.resource,o.uint32(10).fork()).ldelim(),e.scopeSpans!=null&&e.scopeSpans.length)for(var u=0;u<e.scopeSpans.length;++u)Et.opentelemetry.proto.trace.v1.ScopeSpans.encode(e.scopeSpans[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.ResourceSpans;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resource=Et.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break}case 2:{d.scopeSpans&&d.scopeSpans.length||(d.scopeSpans=[]),d.scopeSpans.push(Et.opentelemetry.proto.trace.v1.ScopeSpans.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resource!=null&&e.hasOwnProperty("resource")){var o=Et.opentelemetry.proto.resource.v1.Resource.verify(e.resource);if(o)return"resource."+o}if(e.scopeSpans!=null&&e.hasOwnProperty("scopeSpans")){if(!Array.isArray(e.scopeSpans))return"scopeSpans: array expected";for(var u=0;u<e.scopeSpans.length;++u){var o=Et.opentelemetry.proto.trace.v1.ScopeSpans.verify(e.scopeSpans[u]);if(o)return"scopeSpans."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.ResourceSpans)return e;var o=new Et.opentelemetry.proto.trace.v1.ResourceSpans;if(e.resource!=null){if(typeof e.resource!="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");o.resource=Et.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeSpans){if(!Array.isArray(e.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");o.scopeSpans=[];for(var u=0;u<e.scopeSpans.length;++u){if(typeof e.scopeSpans[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");o.scopeSpans[u]=Et.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(e.scopeSpans[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.scopeSpans=[]),o.defaults&&(u.resource=null,u.schemaUrl=""),e.resource!=null&&e.hasOwnProperty("resource")&&(u.resource=Et.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,o)),e.scopeSpans&&e.scopeSpans.length){u.scopeSpans=[];for(var d=0;d<e.scopeSpans.length;++d)u.scopeSpans[d]=Et.opentelemetry.proto.trace.v1.ScopeSpans.toObject(e.scopeSpans[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.ResourceSpans"},i})(),a.ScopeSpans=(function(){function i(s){if(this.spans=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.scope=null,i.prototype.spans=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.scope!=null&&Object.hasOwnProperty.call(e,"scope")&&Et.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,o.uint32(10).fork()).ldelim(),e.spans!=null&&e.spans.length)for(var u=0;u<e.spans.length;++u)Et.opentelemetry.proto.trace.v1.Span.encode(e.spans[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.ScopeSpans;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break}case 2:{d.spans&&d.spans.length||(d.spans=[]),d.spans.push(Et.opentelemetry.proto.trace.v1.Span.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.scope!=null&&e.hasOwnProperty("scope")){var o=Et.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope);if(o)return"scope."+o}if(e.spans!=null&&e.hasOwnProperty("spans")){if(!Array.isArray(e.spans))return"spans: array expected";for(var u=0;u<e.spans.length;++u){var o=Et.opentelemetry.proto.trace.v1.Span.verify(e.spans[u]);if(o)return"spans."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.ScopeSpans)return e;var o=new Et.opentelemetry.proto.trace.v1.ScopeSpans;if(e.scope!=null){if(typeof e.scope!="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");o.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.spans){if(!Array.isArray(e.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");o.spans=[];for(var u=0;u<e.spans.length;++u){if(typeof e.spans[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");o.spans[u]=Et.opentelemetry.proto.trace.v1.Span.fromObject(e.spans[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.spans=[]),o.defaults&&(u.scope=null,u.schemaUrl=""),e.scope!=null&&e.hasOwnProperty("scope")&&(u.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,o)),e.spans&&e.spans.length){u.spans=[];for(var d=0;d<e.spans.length;++d)u.spans[d]=Et.opentelemetry.proto.trace.v1.Span.toObject(e.spans[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.ScopeSpans"},i})(),a.Span=(function(){function i(s){if(this.attributes=[],this.events=[],this.links=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.traceId=null,i.prototype.spanId=null,i.prototype.traceState=null,i.prototype.parentSpanId=null,i.prototype.name=null,i.prototype.kind=null,i.prototype.startTimeUnixNano=null,i.prototype.endTimeUnixNano=null,i.prototype.attributes=Vt.emptyArray,i.prototype.droppedAttributesCount=null,i.prototype.events=Vt.emptyArray,i.prototype.droppedEventsCount=null,i.prototype.links=Vt.emptyArray,i.prototype.droppedLinksCount=null,i.prototype.status=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.traceId!=null&&Object.hasOwnProperty.call(e,"traceId")&&o.uint32(10).bytes(e.traceId),e.spanId!=null&&Object.hasOwnProperty.call(e,"spanId")&&o.uint32(18).bytes(e.spanId),e.traceState!=null&&Object.hasOwnProperty.call(e,"traceState")&&o.uint32(26).string(e.traceState),e.parentSpanId!=null&&Object.hasOwnProperty.call(e,"parentSpanId")&&o.uint32(34).bytes(e.parentSpanId),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&o.uint32(42).string(e.name),e.kind!=null&&Object.hasOwnProperty.call(e,"kind")&&o.uint32(48).int32(e.kind),e.startTimeUnixNano!=null&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&o.uint32(57).fixed64(e.startTimeUnixNano),e.endTimeUnixNano!=null&&Object.hasOwnProperty.call(e,"endTimeUnixNano")&&o.uint32(65).fixed64(e.endTimeUnixNano),e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(74).fork()).ldelim();if(e.droppedAttributesCount!=null&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&o.uint32(80).uint32(e.droppedAttributesCount),e.events!=null&&e.events.length)for(var u=0;u<e.events.length;++u)Et.opentelemetry.proto.trace.v1.Span.Event.encode(e.events[u],o.uint32(90).fork()).ldelim();if(e.droppedEventsCount!=null&&Object.hasOwnProperty.call(e,"droppedEventsCount")&&o.uint32(96).uint32(e.droppedEventsCount),e.links!=null&&e.links.length)for(var u=0;u<e.links.length;++u)Et.opentelemetry.proto.trace.v1.Span.Link.encode(e.links[u],o.uint32(106).fork()).ldelim();return e.droppedLinksCount!=null&&Object.hasOwnProperty.call(e,"droppedLinksCount")&&o.uint32(112).uint32(e.droppedLinksCount),e.status!=null&&Object.hasOwnProperty.call(e,"status")&&Et.opentelemetry.proto.trace.v1.Status.encode(e.status,o.uint32(122).fork()).ldelim(),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.Span;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.traceId=e.bytes();break}case 2:{d.spanId=e.bytes();break}case 3:{d.traceState=e.string();break}case 4:{d.parentSpanId=e.bytes();break}case 5:{d.name=e.string();break}case 6:{d.kind=e.int32();break}case 7:{d.startTimeUnixNano=e.fixed64();break}case 8:{d.endTimeUnixNano=e.fixed64();break}case 9:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 10:{d.droppedAttributesCount=e.uint32();break}case 11:{d.events&&d.events.length||(d.events=[]),d.events.push(Et.opentelemetry.proto.trace.v1.Span.Event.decode(e,e.uint32()));break}case 12:{d.droppedEventsCount=e.uint32();break}case 13:{d.links&&d.links.length||(d.links=[]),d.links.push(Et.opentelemetry.proto.trace.v1.Span.Link.decode(e,e.uint32()));break}case 14:{d.droppedLinksCount=e.uint32();break}case 15:{d.status=Et.opentelemetry.proto.trace.v1.Status.decode(e,e.uint32());break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.traceId!=null&&e.hasOwnProperty("traceId")&&!(e.traceId&&typeof e.traceId.length=="number"||Vt.isString(e.traceId)))return"traceId: buffer expected";if(e.spanId!=null&&e.hasOwnProperty("spanId")&&!(e.spanId&&typeof e.spanId.length=="number"||Vt.isString(e.spanId)))return"spanId: buffer expected";if(e.traceState!=null&&e.hasOwnProperty("traceState")&&!Vt.isString(e.traceState))return"traceState: string expected";if(e.parentSpanId!=null&&e.hasOwnProperty("parentSpanId")&&!(e.parentSpanId&&typeof e.parentSpanId.length=="number"||Vt.isString(e.parentSpanId)))return"parentSpanId: buffer expected";if(e.name!=null&&e.hasOwnProperty("name")&&!Vt.isString(e.name))return"name: string expected";if(e.kind!=null&&e.hasOwnProperty("kind"))switch(e.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:break}if(e.startTimeUnixNano!=null&&e.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(e.startTimeUnixNano)&&!(e.startTimeUnixNano&&Vt.isInteger(e.startTimeUnixNano.low)&&Vt.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(e.endTimeUnixNano!=null&&e.hasOwnProperty("endTimeUnixNano")&&!Vt.isInteger(e.endTimeUnixNano)&&!(e.endTimeUnixNano&&Vt.isInteger(e.endTimeUnixNano.low)&&Vt.isInteger(e.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected";if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var o=0;o<e.attributes.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[o]);if(u)return"attributes."+u}}if(e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(e.events!=null&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(var o=0;o<e.events.length;++o){var u=Et.opentelemetry.proto.trace.v1.Span.Event.verify(e.events[o]);if(u)return"events."+u}}if(e.droppedEventsCount!=null&&e.hasOwnProperty("droppedEventsCount")&&!Vt.isInteger(e.droppedEventsCount))return"droppedEventsCount: integer expected";if(e.links!=null&&e.hasOwnProperty("links")){if(!Array.isArray(e.links))return"links: array expected";for(var o=0;o<e.links.length;++o){var u=Et.opentelemetry.proto.trace.v1.Span.Link.verify(e.links[o]);if(u)return"links."+u}}if(e.droppedLinksCount!=null&&e.hasOwnProperty("droppedLinksCount")&&!Vt.isInteger(e.droppedLinksCount))return"droppedLinksCount: integer expected";if(e.status!=null&&e.hasOwnProperty("status")){var u=Et.opentelemetry.proto.trace.v1.Status.verify(e.status);if(u)return"status."+u}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.Span)return e;var o=new Et.opentelemetry.proto.trace.v1.Span;switch(e.traceId!=null&&(typeof e.traceId=="string"?Vt.base64.decode(e.traceId,o.traceId=Vt.newBuffer(Vt.base64.length(e.traceId)),0):e.traceId.length>=0&&(o.traceId=e.traceId)),e.spanId!=null&&(typeof e.spanId=="string"?Vt.base64.decode(e.spanId,o.spanId=Vt.newBuffer(Vt.base64.length(e.spanId)),0):e.spanId.length>=0&&(o.spanId=e.spanId)),e.traceState!=null&&(o.traceState=String(e.traceState)),e.parentSpanId!=null&&(typeof e.parentSpanId=="string"?Vt.base64.decode(e.parentSpanId,o.parentSpanId=Vt.newBuffer(Vt.base64.length(e.parentSpanId)),0):e.parentSpanId.length>=0&&(o.parentSpanId=e.parentSpanId)),e.name!=null&&(o.name=String(e.name)),e.kind){default:if(typeof e.kind=="number"){o.kind=e.kind;break}break;case"SPAN_KIND_UNSPECIFIED":case 0:o.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:o.kind=1;break;case"SPAN_KIND_SERVER":case 2:o.kind=2;break;case"SPAN_KIND_CLIENT":case 3:o.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:o.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:o.kind=5;break}if(e.startTimeUnixNano!=null&&(Vt.Long?(o.startTimeUnixNano=Vt.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:typeof e.startTimeUnixNano=="string"?o.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):typeof e.startTimeUnixNano=="number"?o.startTimeUnixNano=e.startTimeUnixNano:typeof e.startTimeUnixNano=="object"&&(o.startTimeUnixNano=new Vt.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),e.endTimeUnixNano!=null&&(Vt.Long?(o.endTimeUnixNano=Vt.Long.fromValue(e.endTimeUnixNano)).unsigned=!1:typeof e.endTimeUnixNano=="string"?o.endTimeUnixNano=parseInt(e.endTimeUnixNano,10):typeof e.endTimeUnixNano=="number"?o.endTimeUnixNano=e.endTimeUnixNano:typeof e.endTimeUnixNano=="object"&&(o.endTimeUnixNano=new Vt.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber())),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}if(e.droppedAttributesCount!=null&&(o.droppedAttributesCount=e.droppedAttributesCount>>>0),e.events){if(!Array.isArray(e.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");o.events=[];for(var u=0;u<e.events.length;++u){if(typeof e.events[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");o.events[u]=Et.opentelemetry.proto.trace.v1.Span.Event.fromObject(e.events[u])}}if(e.droppedEventsCount!=null&&(o.droppedEventsCount=e.droppedEventsCount>>>0),e.links){if(!Array.isArray(e.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");o.links=[];for(var u=0;u<e.links.length;++u){if(typeof e.links[u]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");o.links[u]=Et.opentelemetry.proto.trace.v1.Span.Link.fromObject(e.links[u])}}if(e.droppedLinksCount!=null&&(o.droppedLinksCount=e.droppedLinksCount>>>0),e.status!=null){if(typeof e.status!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");o.status=Et.opentelemetry.proto.trace.v1.Status.fromObject(e.status)}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.attributes=[],u.events=[],u.links=[]),o.defaults){if(o.bytes===String?u.traceId="":(u.traceId=[],o.bytes!==Array&&(u.traceId=Vt.newBuffer(u.traceId))),o.bytes===String?u.spanId="":(u.spanId=[],o.bytes!==Array&&(u.spanId=Vt.newBuffer(u.spanId))),u.traceState="",o.bytes===String?u.parentSpanId="":(u.parentSpanId=[],o.bytes!==Array&&(u.parentSpanId=Vt.newBuffer(u.parentSpanId))),u.name="",u.kind=o.enums===String?"SPAN_KIND_UNSPECIFIED":0,Vt.Long){var d=new Vt.Long(0,0,!1);u.startTimeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.startTimeUnixNano=o.longs===String?"0":0;if(Vt.Long){var d=new Vt.Long(0,0,!1);u.endTimeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.endTimeUnixNano=o.longs===String?"0":0;u.droppedAttributesCount=0,u.droppedEventsCount=0,u.droppedLinksCount=0,u.status=null}if(e.traceId!=null&&e.hasOwnProperty("traceId")&&(u.traceId=o.bytes===String?Vt.base64.encode(e.traceId,0,e.traceId.length):o.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),e.spanId!=null&&e.hasOwnProperty("spanId")&&(u.spanId=o.bytes===String?Vt.base64.encode(e.spanId,0,e.spanId.length):o.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),e.traceState!=null&&e.hasOwnProperty("traceState")&&(u.traceState=e.traceState),e.parentSpanId!=null&&e.hasOwnProperty("parentSpanId")&&(u.parentSpanId=o.bytes===String?Vt.base64.encode(e.parentSpanId,0,e.parentSpanId.length):o.bytes===Array?Array.prototype.slice.call(e.parentSpanId):e.parentSpanId),e.name!=null&&e.hasOwnProperty("name")&&(u.name=e.name),e.kind!=null&&e.hasOwnProperty("kind")&&(u.kind=o.enums===String?Et.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]===void 0?e.kind:Et.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]:e.kind),e.startTimeUnixNano!=null&&e.hasOwnProperty("startTimeUnixNano")&&(typeof e.startTimeUnixNano=="number"?u.startTimeUnixNano=o.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:u.startTimeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.startTimeUnixNano):o.longs===Number?new Vt.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),e.endTimeUnixNano!=null&&e.hasOwnProperty("endTimeUnixNano")&&(typeof e.endTimeUnixNano=="number"?u.endTimeUnixNano=o.longs===String?String(e.endTimeUnixNano):e.endTimeUnixNano:u.endTimeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.endTimeUnixNano):o.longs===Number?new Vt.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber():e.endTimeUnixNano),e.attributes&&e.attributes.length){u.attributes=[];for(var I=0;I<e.attributes.length;++I)u.attributes[I]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[I],o)}if(e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&(u.droppedAttributesCount=e.droppedAttributesCount),e.events&&e.events.length){u.events=[];for(var I=0;I<e.events.length;++I)u.events[I]=Et.opentelemetry.proto.trace.v1.Span.Event.toObject(e.events[I],o)}if(e.droppedEventsCount!=null&&e.hasOwnProperty("droppedEventsCount")&&(u.droppedEventsCount=e.droppedEventsCount),e.links&&e.links.length){u.links=[];for(var I=0;I<e.links.length;++I)u.links[I]=Et.opentelemetry.proto.trace.v1.Span.Link.toObject(e.links[I],o)}return e.droppedLinksCount!=null&&e.hasOwnProperty("droppedLinksCount")&&(u.droppedLinksCount=e.droppedLinksCount),e.status!=null&&e.hasOwnProperty("status")&&(u.status=Et.opentelemetry.proto.trace.v1.Status.toObject(e.status,o)),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.Span"},i.SpanKind=(function(){var s={},e=Object.create(s);return e[s[0]="SPAN_KIND_UNSPECIFIED"]=0,e[s[1]="SPAN_KIND_INTERNAL"]=1,e[s[2]="SPAN_KIND_SERVER"]=2,e[s[3]="SPAN_KIND_CLIENT"]=3,e[s[4]="SPAN_KIND_PRODUCER"]=4,e[s[5]="SPAN_KIND_CONSUMER"]=5,e})(),i.Event=(function(){function s(e){if(this.attributes=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.timeUnixNano=null,s.prototype.name=null,s.prototype.attributes=Vt.emptyArray,s.prototype.droppedAttributesCount=null,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(9).fixed64(o.timeUnixNano),o.name!=null&&Object.hasOwnProperty.call(o,"name")&&u.uint32(18).string(o.name),o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(26).fork()).ldelim();return o.droppedAttributesCount!=null&&Object.hasOwnProperty.call(o,"droppedAttributesCount")&&u.uint32(32).uint32(o.droppedAttributesCount),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.trace.v1.Span.Event;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.timeUnixNano=o.fixed64();break}case 2:{I.name=o.string();break}case 3:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 4:{I.droppedAttributesCount=o.uint32();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.name!=null&&o.hasOwnProperty("name")&&!Vt.isString(o.name))return"name: string expected";if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var u=0;u<o.attributes.length;++u){var d=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[u]);if(d)return"attributes."+d}}return o.droppedAttributesCount!=null&&o.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(o.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.trace.v1.Span.Event)return o;var u=new Et.opentelemetry.proto.trace.v1.Span.Event;if(o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.name!=null&&(u.name=String(o.name)),o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}return o.droppedAttributesCount!=null&&(u.droppedAttributesCount=o.droppedAttributesCount>>>0),u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.attributes=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;d.name="",d.droppedAttributesCount=0}if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.name!=null&&o.hasOwnProperty("name")&&(d.name=o.name),o.attributes&&o.attributes.length){d.attributes=[];for(var h=0;h<o.attributes.length;++h)d.attributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[h],u)}return o.droppedAttributesCount!=null&&o.hasOwnProperty("droppedAttributesCount")&&(d.droppedAttributesCount=o.droppedAttributesCount),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.trace.v1.Span.Event"},s})(),i.Link=(function(){function s(e){if(this.attributes=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.traceId=null,s.prototype.spanId=null,s.prototype.traceState=null,s.prototype.attributes=Vt.emptyArray,s.prototype.droppedAttributesCount=null,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.traceId!=null&&Object.hasOwnProperty.call(o,"traceId")&&u.uint32(10).bytes(o.traceId),o.spanId!=null&&Object.hasOwnProperty.call(o,"spanId")&&u.uint32(18).bytes(o.spanId),o.traceState!=null&&Object.hasOwnProperty.call(o,"traceState")&&u.uint32(26).string(o.traceState),o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(34).fork()).ldelim();return o.droppedAttributesCount!=null&&Object.hasOwnProperty.call(o,"droppedAttributesCount")&&u.uint32(40).uint32(o.droppedAttributesCount),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.trace.v1.Span.Link;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.traceId=o.bytes();break}case 2:{I.spanId=o.bytes();break}case 3:{I.traceState=o.string();break}case 4:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 5:{I.droppedAttributesCount=o.uint32();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.traceId!=null&&o.hasOwnProperty("traceId")&&!(o.traceId&&typeof o.traceId.length=="number"||Vt.isString(o.traceId)))return"traceId: buffer expected";if(o.spanId!=null&&o.hasOwnProperty("spanId")&&!(o.spanId&&typeof o.spanId.length=="number"||Vt.isString(o.spanId)))return"spanId: buffer expected";if(o.traceState!=null&&o.hasOwnProperty("traceState")&&!Vt.isString(o.traceState))return"traceState: string expected";if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var u=0;u<o.attributes.length;++u){var d=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[u]);if(d)return"attributes."+d}}return o.droppedAttributesCount!=null&&o.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(o.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.trace.v1.Span.Link)return o;var u=new Et.opentelemetry.proto.trace.v1.Span.Link;if(o.traceId!=null&&(typeof o.traceId=="string"?Vt.base64.decode(o.traceId,u.traceId=Vt.newBuffer(Vt.base64.length(o.traceId)),0):o.traceId.length>=0&&(u.traceId=o.traceId)),o.spanId!=null&&(typeof o.spanId=="string"?Vt.base64.decode(o.spanId,u.spanId=Vt.newBuffer(Vt.base64.length(o.spanId)),0):o.spanId.length>=0&&(u.spanId=o.spanId)),o.traceState!=null&&(u.traceState=String(o.traceState)),o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}return o.droppedAttributesCount!=null&&(u.droppedAttributesCount=o.droppedAttributesCount>>>0),u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.attributes=[]),u.defaults&&(u.bytes===String?d.traceId="":(d.traceId=[],u.bytes!==Array&&(d.traceId=Vt.newBuffer(d.traceId))),u.bytes===String?d.spanId="":(d.spanId=[],u.bytes!==Array&&(d.spanId=Vt.newBuffer(d.spanId))),d.traceState="",d.droppedAttributesCount=0),o.traceId!=null&&o.hasOwnProperty("traceId")&&(d.traceId=u.bytes===String?Vt.base64.encode(o.traceId,0,o.traceId.length):u.bytes===Array?Array.prototype.slice.call(o.traceId):o.traceId),o.spanId!=null&&o.hasOwnProperty("spanId")&&(d.spanId=u.bytes===String?Vt.base64.encode(o.spanId,0,o.spanId.length):u.bytes===Array?Array.prototype.slice.call(o.spanId):o.spanId),o.traceState!=null&&o.hasOwnProperty("traceState")&&(d.traceState=o.traceState),o.attributes&&o.attributes.length){d.attributes=[];for(var I=0;I<o.attributes.length;++I)d.attributes[I]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[I],u)}return o.droppedAttributesCount!=null&&o.hasOwnProperty("droppedAttributesCount")&&(d.droppedAttributesCount=o.droppedAttributesCount),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.trace.v1.Span.Link"},s})(),i})(),a.Status=(function(){function i(s){if(s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.message=null,i.prototype.code=null,i.create=function(e){return new i(e)},i.encode=function(e,o){return o||(o=ji.create()),e.message!=null&&Object.hasOwnProperty.call(e,"message")&&o.uint32(18).string(e.message),e.code!=null&&Object.hasOwnProperty.call(e,"code")&&o.uint32(24).int32(e.code),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.trace.v1.Status;e.pos<u;){var I=e.uint32();switch(I>>>3){case 2:{d.message=e.string();break}case 3:{d.code=e.int32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.message!=null&&e.hasOwnProperty("message")&&!Vt.isString(e.message))return"message: string expected";if(e.code!=null&&e.hasOwnProperty("code"))switch(e.code){default:return"code: enum value expected";case 0:case 1:case 2:break}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.trace.v1.Status)return e;var o=new Et.opentelemetry.proto.trace.v1.Status;switch(e.message!=null&&(o.message=String(e.message)),e.code){default:if(typeof e.code=="number"){o.code=e.code;break}break;case"STATUS_CODE_UNSET":case 0:o.code=0;break;case"STATUS_CODE_OK":case 1:o.code=1;break;case"STATUS_CODE_ERROR":case 2:o.code=2;break}return o},i.toObject=function(e,o){o||(o={});var u={};return o.defaults&&(u.message="",u.code=o.enums===String?"STATUS_CODE_UNSET":0),e.message!=null&&e.hasOwnProperty("message")&&(u.message=e.message),e.code!=null&&e.hasOwnProperty("code")&&(u.code=o.enums===String?Et.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]===void 0?e.code:Et.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]:e.code),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.trace.v1.Status"},i.StatusCode=(function(){var s={},e=Object.create(s);return e[s[0]="STATUS_CODE_UNSET"]=0,e[s[1]="STATUS_CODE_OK"]=1,e[s[2]="STATUS_CODE_ERROR"]=2,e})(),i})(),a})(),r})(),t.collector=(function(){var r={};return r.trace=(function(){var a={};return a.v1=(function(){var i={};return i.TraceService=(function(){function s(e,o,u){za.rpc.Service.call(this,e,o,u)}return(s.prototype=Object.create(za.rpc.Service.prototype)).constructor=s,s.create=function(o,u,d){return new this(o,u,d)},Object.defineProperty(s.prototype.export=function e(o,u){return this.rpcCall(e,Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,o,u)},"name",{value:"Export"}),s})(),i.ExportTraceServiceRequest=(function(){function s(e){if(this.resourceSpans=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.resourceSpans=Vt.emptyArray,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.resourceSpans!=null&&o.resourceSpans.length)for(var d=0;d<o.resourceSpans.length;++d)Et.opentelemetry.proto.trace.v1.ResourceSpans.encode(o.resourceSpans[d],u.uint32(10).fork()).ldelim();return u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.resourceSpans&&I.resourceSpans.length||(I.resourceSpans=[]),I.resourceSpans.push(Et.opentelemetry.proto.trace.v1.ResourceSpans.decode(o,o.uint32()));break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.resourceSpans!=null&&o.hasOwnProperty("resourceSpans")){if(!Array.isArray(o.resourceSpans))return"resourceSpans: array expected";for(var u=0;u<o.resourceSpans.length;++u){var d=Et.opentelemetry.proto.trace.v1.ResourceSpans.verify(o.resourceSpans[u]);if(d)return"resourceSpans."+d}}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return o;var u=new Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if(o.resourceSpans){if(!Array.isArray(o.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");u.resourceSpans=[];for(var d=0;d<o.resourceSpans.length;++d){if(typeof o.resourceSpans[d]!="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");u.resourceSpans[d]=Et.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(o.resourceSpans[d])}}return u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.resourceSpans=[]),o.resourceSpans&&o.resourceSpans.length){d.resourceSpans=[];for(var I=0;I<o.resourceSpans.length;++I)d.resourceSpans[I]=Et.opentelemetry.proto.trace.v1.ResourceSpans.toObject(o.resourceSpans[I],u)}return d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},s})(),i.ExportTraceServiceResponse=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.partialSuccess=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.partialSuccess!=null&&Object.hasOwnProperty.call(o,"partialSuccess")&&Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(o.partialSuccess,u.uint32(10).fork()).ldelim(),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.partialSuccess=Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(o,o.uint32());break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")){var u=Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(o.partialSuccess);if(u)return"partialSuccess."+u}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return o;var u=new Et.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if(o.partialSuccess!=null){if(typeof o.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");u.partialSuccess=Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(o.partialSuccess)}return u},s.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.partialSuccess=null),o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")&&(d.partialSuccess=Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(o.partialSuccess,u)),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},s})(),i.ExportTracePartialSuccess=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.rejectedSpans=null,s.prototype.errorMessage=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.rejectedSpans!=null&&Object.hasOwnProperty.call(o,"rejectedSpans")&&u.uint32(8).int64(o.rejectedSpans),o.errorMessage!=null&&Object.hasOwnProperty.call(o,"errorMessage")&&u.uint32(18).string(o.errorMessage),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.rejectedSpans=o.int64();break}case 2:{I.errorMessage=o.string();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.rejectedSpans!=null&&o.hasOwnProperty("rejectedSpans")&&!Vt.isInteger(o.rejectedSpans)&&!(o.rejectedSpans&&Vt.isInteger(o.rejectedSpans.low)&&Vt.isInteger(o.rejectedSpans.high))?"rejectedSpans: integer|Long expected":o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&!Vt.isString(o.errorMessage)?"errorMessage: string expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess)return o;var u=new Et.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;return o.rejectedSpans!=null&&(Vt.Long?(u.rejectedSpans=Vt.Long.fromValue(o.rejectedSpans)).unsigned=!1:typeof o.rejectedSpans=="string"?u.rejectedSpans=parseInt(o.rejectedSpans,10):typeof o.rejectedSpans=="number"?u.rejectedSpans=o.rejectedSpans:typeof o.rejectedSpans=="object"&&(u.rejectedSpans=new Vt.LongBits(o.rejectedSpans.low>>>0,o.rejectedSpans.high>>>0).toNumber())),o.errorMessage!=null&&(u.errorMessage=String(o.errorMessage)),u},s.toObject=function(o,u){u||(u={});var d={};if(u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.rejectedSpans=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.rejectedSpans=u.longs===String?"0":0;d.errorMessage=""}return o.rejectedSpans!=null&&o.hasOwnProperty("rejectedSpans")&&(typeof o.rejectedSpans=="number"?d.rejectedSpans=u.longs===String?String(o.rejectedSpans):o.rejectedSpans:d.rejectedSpans=u.longs===String?Vt.Long.prototype.toString.call(o.rejectedSpans):u.longs===Number?new Vt.LongBits(o.rejectedSpans.low>>>0,o.rejectedSpans.high>>>0).toNumber():o.rejectedSpans),o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&(d.errorMessage=o.errorMessage),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},s})(),i})(),a})(),r.metrics=(function(){var a={};return a.v1=(function(){var i={};return i.MetricsService=(function(){function s(e,o,u){za.rpc.Service.call(this,e,o,u)}return(s.prototype=Object.create(za.rpc.Service.prototype)).constructor=s,s.create=function(o,u,d){return new this(o,u,d)},Object.defineProperty(s.prototype.export=function e(o,u){return this.rpcCall(e,Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,o,u)},"name",{value:"Export"}),s})(),i.ExportMetricsServiceRequest=(function(){function s(e){if(this.resourceMetrics=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.resourceMetrics=Vt.emptyArray,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.resourceMetrics!=null&&o.resourceMetrics.length)for(var d=0;d<o.resourceMetrics.length;++d)Et.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(o.resourceMetrics[d],u.uint32(10).fork()).ldelim();return u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.resourceMetrics&&I.resourceMetrics.length||(I.resourceMetrics=[]),I.resourceMetrics.push(Et.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(o,o.uint32()));break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.resourceMetrics!=null&&o.hasOwnProperty("resourceMetrics")){if(!Array.isArray(o.resourceMetrics))return"resourceMetrics: array expected";for(var u=0;u<o.resourceMetrics.length;++u){var d=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(o.resourceMetrics[u]);if(d)return"resourceMetrics."+d}}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return o;var u=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if(o.resourceMetrics){if(!Array.isArray(o.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");u.resourceMetrics=[];for(var d=0;d<o.resourceMetrics.length;++d){if(typeof o.resourceMetrics[d]!="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");u.resourceMetrics[d]=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(o.resourceMetrics[d])}}return u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.resourceMetrics=[]),o.resourceMetrics&&o.resourceMetrics.length){d.resourceMetrics=[];for(var I=0;I<o.resourceMetrics.length;++I)d.resourceMetrics[I]=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(o.resourceMetrics[I],u)}return d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},s})(),i.ExportMetricsServiceResponse=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.partialSuccess=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.partialSuccess!=null&&Object.hasOwnProperty.call(o,"partialSuccess")&&Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(o.partialSuccess,u.uint32(10).fork()).ldelim(),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.partialSuccess=Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(o,o.uint32());break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")){var u=Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(o.partialSuccess);if(u)return"partialSuccess."+u}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return o;var u=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if(o.partialSuccess!=null){if(typeof o.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");u.partialSuccess=Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(o.partialSuccess)}return u},s.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.partialSuccess=null),o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")&&(d.partialSuccess=Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(o.partialSuccess,u)),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},s})(),i.ExportMetricsPartialSuccess=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.rejectedDataPoints=null,s.prototype.errorMessage=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.rejectedDataPoints!=null&&Object.hasOwnProperty.call(o,"rejectedDataPoints")&&u.uint32(8).int64(o.rejectedDataPoints),o.errorMessage!=null&&Object.hasOwnProperty.call(o,"errorMessage")&&u.uint32(18).string(o.errorMessage),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.rejectedDataPoints=o.int64();break}case 2:{I.errorMessage=o.string();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.rejectedDataPoints!=null&&o.hasOwnProperty("rejectedDataPoints")&&!Vt.isInteger(o.rejectedDataPoints)&&!(o.rejectedDataPoints&&Vt.isInteger(o.rejectedDataPoints.low)&&Vt.isInteger(o.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&!Vt.isString(o.errorMessage)?"errorMessage: string expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess)return o;var u=new Et.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;return o.rejectedDataPoints!=null&&(Vt.Long?(u.rejectedDataPoints=Vt.Long.fromValue(o.rejectedDataPoints)).unsigned=!1:typeof o.rejectedDataPoints=="string"?u.rejectedDataPoints=parseInt(o.rejectedDataPoints,10):typeof o.rejectedDataPoints=="number"?u.rejectedDataPoints=o.rejectedDataPoints:typeof o.rejectedDataPoints=="object"&&(u.rejectedDataPoints=new Vt.LongBits(o.rejectedDataPoints.low>>>0,o.rejectedDataPoints.high>>>0).toNumber())),o.errorMessage!=null&&(u.errorMessage=String(o.errorMessage)),u},s.toObject=function(o,u){u||(u={});var d={};if(u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.rejectedDataPoints=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.rejectedDataPoints=u.longs===String?"0":0;d.errorMessage=""}return o.rejectedDataPoints!=null&&o.hasOwnProperty("rejectedDataPoints")&&(typeof o.rejectedDataPoints=="number"?d.rejectedDataPoints=u.longs===String?String(o.rejectedDataPoints):o.rejectedDataPoints:d.rejectedDataPoints=u.longs===String?Vt.Long.prototype.toString.call(o.rejectedDataPoints):u.longs===Number?new Vt.LongBits(o.rejectedDataPoints.low>>>0,o.rejectedDataPoints.high>>>0).toNumber():o.rejectedDataPoints),o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&(d.errorMessage=o.errorMessage),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},s})(),i})(),a})(),r.logs=(function(){var a={};return a.v1=(function(){var i={};return i.LogsService=(function(){function s(e,o,u){za.rpc.Service.call(this,e,o,u)}return(s.prototype=Object.create(za.rpc.Service.prototype)).constructor=s,s.create=function(o,u,d){return new this(o,u,d)},Object.defineProperty(s.prototype.export=function e(o,u){return this.rpcCall(e,Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,o,u)},"name",{value:"Export"}),s})(),i.ExportLogsServiceRequest=(function(){function s(e){if(this.resourceLogs=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.resourceLogs=Vt.emptyArray,s.create=function(o){return new s(o)},s.encode=function(o,u){if(u||(u=ji.create()),o.resourceLogs!=null&&o.resourceLogs.length)for(var d=0;d<o.resourceLogs.length;++d)Et.opentelemetry.proto.logs.v1.ResourceLogs.encode(o.resourceLogs[d],u.uint32(10).fork()).ldelim();return u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.resourceLogs&&I.resourceLogs.length||(I.resourceLogs=[]),I.resourceLogs.push(Et.opentelemetry.proto.logs.v1.ResourceLogs.decode(o,o.uint32()));break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.resourceLogs!=null&&o.hasOwnProperty("resourceLogs")){if(!Array.isArray(o.resourceLogs))return"resourceLogs: array expected";for(var u=0;u<o.resourceLogs.length;++u){var d=Et.opentelemetry.proto.logs.v1.ResourceLogs.verify(o.resourceLogs[u]);if(d)return"resourceLogs."+d}}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return o;var u=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if(o.resourceLogs){if(!Array.isArray(o.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");u.resourceLogs=[];for(var d=0;d<o.resourceLogs.length;++d){if(typeof o.resourceLogs[d]!="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");u.resourceLogs[d]=Et.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(o.resourceLogs[d])}}return u},s.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.resourceLogs=[]),o.resourceLogs&&o.resourceLogs.length){d.resourceLogs=[];for(var I=0;I<o.resourceLogs.length;++I)d.resourceLogs[I]=Et.opentelemetry.proto.logs.v1.ResourceLogs.toObject(o.resourceLogs[I],u)}return d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},s})(),i.ExportLogsServiceResponse=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.partialSuccess=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.partialSuccess!=null&&Object.hasOwnProperty.call(o,"partialSuccess")&&Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(o.partialSuccess,u.uint32(10).fork()).ldelim(),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.partialSuccess=Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(o,o.uint32());break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")){var u=Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(o.partialSuccess);if(u)return"partialSuccess."+u}return null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return o;var u=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if(o.partialSuccess!=null){if(typeof o.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");u.partialSuccess=Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(o.partialSuccess)}return u},s.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.partialSuccess=null),o.partialSuccess!=null&&o.hasOwnProperty("partialSuccess")&&(d.partialSuccess=Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(o.partialSuccess,u)),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},s})(),i.ExportLogsPartialSuccess=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.rejectedLogRecords=null,s.prototype.errorMessage=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.rejectedLogRecords!=null&&Object.hasOwnProperty.call(o,"rejectedLogRecords")&&u.uint32(8).int64(o.rejectedLogRecords),o.errorMessage!=null&&Object.hasOwnProperty.call(o,"errorMessage")&&u.uint32(18).string(o.errorMessage),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.rejectedLogRecords=o.int64();break}case 2:{I.errorMessage=o.string();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.rejectedLogRecords!=null&&o.hasOwnProperty("rejectedLogRecords")&&!Vt.isInteger(o.rejectedLogRecords)&&!(o.rejectedLogRecords&&Vt.isInteger(o.rejectedLogRecords.low)&&Vt.isInteger(o.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&!Vt.isString(o.errorMessage)?"errorMessage: string expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess)return o;var u=new Et.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;return o.rejectedLogRecords!=null&&(Vt.Long?(u.rejectedLogRecords=Vt.Long.fromValue(o.rejectedLogRecords)).unsigned=!1:typeof o.rejectedLogRecords=="string"?u.rejectedLogRecords=parseInt(o.rejectedLogRecords,10):typeof o.rejectedLogRecords=="number"?u.rejectedLogRecords=o.rejectedLogRecords:typeof o.rejectedLogRecords=="object"&&(u.rejectedLogRecords=new Vt.LongBits(o.rejectedLogRecords.low>>>0,o.rejectedLogRecords.high>>>0).toNumber())),o.errorMessage!=null&&(u.errorMessage=String(o.errorMessage)),u},s.toObject=function(o,u){u||(u={});var d={};if(u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.rejectedLogRecords=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.rejectedLogRecords=u.longs===String?"0":0;d.errorMessage=""}return o.rejectedLogRecords!=null&&o.hasOwnProperty("rejectedLogRecords")&&(typeof o.rejectedLogRecords=="number"?d.rejectedLogRecords=u.longs===String?String(o.rejectedLogRecords):o.rejectedLogRecords:d.rejectedLogRecords=u.longs===String?Vt.Long.prototype.toString.call(o.rejectedLogRecords):u.longs===Number?new Vt.LongBits(o.rejectedLogRecords.low>>>0,o.rejectedLogRecords.high>>>0).toNumber():o.rejectedLogRecords),o.errorMessage!=null&&o.hasOwnProperty("errorMessage")&&(d.errorMessage=o.errorMessage),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},s})(),i})(),a})(),r})(),t.metrics=(function(){var r={};return r.v1=(function(){var a={};return a.MetricsData=(function(){function i(s){if(this.resourceMetrics=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resourceMetrics=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resourceMetrics!=null&&e.resourceMetrics.length)for(var u=0;u<e.resourceMetrics.length;++u)Et.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.MetricsData;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resourceMetrics&&d.resourceMetrics.length||(d.resourceMetrics=[]),d.resourceMetrics.push(Et.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resourceMetrics!=null&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var o=0;o<e.resourceMetrics.length;++o){var u=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[o]);if(u)return"resourceMetrics."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.MetricsData)return e;var o=new Et.opentelemetry.proto.metrics.v1.MetricsData;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");o.resourceMetrics=[];for(var u=0;u<e.resourceMetrics.length;++u){if(typeof e.resourceMetrics[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");o.resourceMetrics[u]=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){u.resourceMetrics=[];for(var d=0;d<e.resourceMetrics.length;++d)u.resourceMetrics[d]=Et.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.MetricsData"},i})(),a.ResourceMetrics=(function(){function i(s){if(this.scopeMetrics=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resource=null,i.prototype.scopeMetrics=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resource!=null&&Object.hasOwnProperty.call(e,"resource")&&Et.opentelemetry.proto.resource.v1.Resource.encode(e.resource,o.uint32(10).fork()).ldelim(),e.scopeMetrics!=null&&e.scopeMetrics.length)for(var u=0;u<e.scopeMetrics.length;++u)Et.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(e.scopeMetrics[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.ResourceMetrics;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resource=Et.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break}case 2:{d.scopeMetrics&&d.scopeMetrics.length||(d.scopeMetrics=[]),d.scopeMetrics.push(Et.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resource!=null&&e.hasOwnProperty("resource")){var o=Et.opentelemetry.proto.resource.v1.Resource.verify(e.resource);if(o)return"resource."+o}if(e.scopeMetrics!=null&&e.hasOwnProperty("scopeMetrics")){if(!Array.isArray(e.scopeMetrics))return"scopeMetrics: array expected";for(var u=0;u<e.scopeMetrics.length;++u){var o=Et.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(e.scopeMetrics[u]);if(o)return"scopeMetrics."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.ResourceMetrics)return e;var o=new Et.opentelemetry.proto.metrics.v1.ResourceMetrics;if(e.resource!=null){if(typeof e.resource!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");o.resource=Et.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeMetrics){if(!Array.isArray(e.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");o.scopeMetrics=[];for(var u=0;u<e.scopeMetrics.length;++u){if(typeof e.scopeMetrics[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");o.scopeMetrics[u]=Et.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(e.scopeMetrics[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.scopeMetrics=[]),o.defaults&&(u.resource=null,u.schemaUrl=""),e.resource!=null&&e.hasOwnProperty("resource")&&(u.resource=Et.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,o)),e.scopeMetrics&&e.scopeMetrics.length){u.scopeMetrics=[];for(var d=0;d<e.scopeMetrics.length;++d)u.scopeMetrics[d]=Et.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(e.scopeMetrics[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},i})(),a.ScopeMetrics=(function(){function i(s){if(this.metrics=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.scope=null,i.prototype.metrics=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.scope!=null&&Object.hasOwnProperty.call(e,"scope")&&Et.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,o.uint32(10).fork()).ldelim(),e.metrics!=null&&e.metrics.length)for(var u=0;u<e.metrics.length;++u)Et.opentelemetry.proto.metrics.v1.Metric.encode(e.metrics[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.ScopeMetrics;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break}case 2:{d.metrics&&d.metrics.length||(d.metrics=[]),d.metrics.push(Et.opentelemetry.proto.metrics.v1.Metric.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.scope!=null&&e.hasOwnProperty("scope")){var o=Et.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope);if(o)return"scope."+o}if(e.metrics!=null&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var u=0;u<e.metrics.length;++u){var o=Et.opentelemetry.proto.metrics.v1.Metric.verify(e.metrics[u]);if(o)return"metrics."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.ScopeMetrics)return e;var o=new Et.opentelemetry.proto.metrics.v1.ScopeMetrics;if(e.scope!=null){if(typeof e.scope!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");o.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");o.metrics=[];for(var u=0;u<e.metrics.length;++u){if(typeof e.metrics[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");o.metrics[u]=Et.opentelemetry.proto.metrics.v1.Metric.fromObject(e.metrics[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.metrics=[]),o.defaults&&(u.scope=null,u.schemaUrl=""),e.scope!=null&&e.hasOwnProperty("scope")&&(u.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,o)),e.metrics&&e.metrics.length){u.metrics=[];for(var d=0;d<e.metrics.length;++d)u.metrics[d]=Et.opentelemetry.proto.metrics.v1.Metric.toObject(e.metrics[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},i})(),a.Metric=(function(){function i(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.name=null,i.prototype.description=null,i.prototype.unit=null,i.prototype.gauge=null,i.prototype.sum=null,i.prototype.histogram=null,i.prototype.exponentialHistogram=null,i.prototype.summary=null;var s;return Object.defineProperty(i.prototype,"data",{get:Vt.oneOfGetter(s=["gauge","sum","histogram","exponentialHistogram","summary"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){return u||(u=ji.create()),o.name!=null&&Object.hasOwnProperty.call(o,"name")&&u.uint32(10).string(o.name),o.description!=null&&Object.hasOwnProperty.call(o,"description")&&u.uint32(18).string(o.description),o.unit!=null&&Object.hasOwnProperty.call(o,"unit")&&u.uint32(26).string(o.unit),o.gauge!=null&&Object.hasOwnProperty.call(o,"gauge")&&Et.opentelemetry.proto.metrics.v1.Gauge.encode(o.gauge,u.uint32(42).fork()).ldelim(),o.sum!=null&&Object.hasOwnProperty.call(o,"sum")&&Et.opentelemetry.proto.metrics.v1.Sum.encode(o.sum,u.uint32(58).fork()).ldelim(),o.histogram!=null&&Object.hasOwnProperty.call(o,"histogram")&&Et.opentelemetry.proto.metrics.v1.Histogram.encode(o.histogram,u.uint32(74).fork()).ldelim(),o.exponentialHistogram!=null&&Object.hasOwnProperty.call(o,"exponentialHistogram")&&Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(o.exponentialHistogram,u.uint32(82).fork()).ldelim(),o.summary!=null&&Object.hasOwnProperty.call(o,"summary")&&Et.opentelemetry.proto.metrics.v1.Summary.encode(o.summary,u.uint32(90).fork()).ldelim(),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.Metric;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.name=o.string();break}case 2:{I.description=o.string();break}case 3:{I.unit=o.string();break}case 5:{I.gauge=Et.opentelemetry.proto.metrics.v1.Gauge.decode(o,o.uint32());break}case 7:{I.sum=Et.opentelemetry.proto.metrics.v1.Sum.decode(o,o.uint32());break}case 9:{I.histogram=Et.opentelemetry.proto.metrics.v1.Histogram.decode(o,o.uint32());break}case 10:{I.exponentialHistogram=Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(o,o.uint32());break}case 11:{I.summary=Et.opentelemetry.proto.metrics.v1.Summary.decode(o,o.uint32());break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.name!=null&&o.hasOwnProperty("name")&&!Vt.isString(o.name))return"name: string expected";if(o.description!=null&&o.hasOwnProperty("description")&&!Vt.isString(o.description))return"description: string expected";if(o.unit!=null&&o.hasOwnProperty("unit")&&!Vt.isString(o.unit))return"unit: string expected";if(o.gauge!=null&&o.hasOwnProperty("gauge")){u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.Gauge.verify(o.gauge);if(d)return"gauge."+d}}if(o.sum!=null&&o.hasOwnProperty("sum")){if(u.data===1)return"data: multiple values";u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.Sum.verify(o.sum);if(d)return"sum."+d}}if(o.histogram!=null&&o.hasOwnProperty("histogram")){if(u.data===1)return"data: multiple values";u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.Histogram.verify(o.histogram);if(d)return"histogram."+d}}if(o.exponentialHistogram!=null&&o.hasOwnProperty("exponentialHistogram")){if(u.data===1)return"data: multiple values";u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(o.exponentialHistogram);if(d)return"exponentialHistogram."+d}}if(o.summary!=null&&o.hasOwnProperty("summary")){if(u.data===1)return"data: multiple values";u.data=1;{var d=Et.opentelemetry.proto.metrics.v1.Summary.verify(o.summary);if(d)return"summary."+d}}return null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.Metric)return o;var u=new Et.opentelemetry.proto.metrics.v1.Metric;if(o.name!=null&&(u.name=String(o.name)),o.description!=null&&(u.description=String(o.description)),o.unit!=null&&(u.unit=String(o.unit)),o.gauge!=null){if(typeof o.gauge!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");u.gauge=Et.opentelemetry.proto.metrics.v1.Gauge.fromObject(o.gauge)}if(o.sum!=null){if(typeof o.sum!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");u.sum=Et.opentelemetry.proto.metrics.v1.Sum.fromObject(o.sum)}if(o.histogram!=null){if(typeof o.histogram!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");u.histogram=Et.opentelemetry.proto.metrics.v1.Histogram.fromObject(o.histogram)}if(o.exponentialHistogram!=null){if(typeof o.exponentialHistogram!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");u.exponentialHistogram=Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(o.exponentialHistogram)}if(o.summary!=null){if(typeof o.summary!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");u.summary=Et.opentelemetry.proto.metrics.v1.Summary.fromObject(o.summary)}return u},i.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.name="",d.description="",d.unit=""),o.name!=null&&o.hasOwnProperty("name")&&(d.name=o.name),o.description!=null&&o.hasOwnProperty("description")&&(d.description=o.description),o.unit!=null&&o.hasOwnProperty("unit")&&(d.unit=o.unit),o.gauge!=null&&o.hasOwnProperty("gauge")&&(d.gauge=Et.opentelemetry.proto.metrics.v1.Gauge.toObject(o.gauge,u),u.oneofs&&(d.data="gauge")),o.sum!=null&&o.hasOwnProperty("sum")&&(d.sum=Et.opentelemetry.proto.metrics.v1.Sum.toObject(o.sum,u),u.oneofs&&(d.data="sum")),o.histogram!=null&&o.hasOwnProperty("histogram")&&(d.histogram=Et.opentelemetry.proto.metrics.v1.Histogram.toObject(o.histogram,u),u.oneofs&&(d.data="histogram")),o.exponentialHistogram!=null&&o.hasOwnProperty("exponentialHistogram")&&(d.exponentialHistogram=Et.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(o.exponentialHistogram,u),u.oneofs&&(d.data="exponentialHistogram")),o.summary!=null&&o.hasOwnProperty("summary")&&(d.summary=Et.opentelemetry.proto.metrics.v1.Summary.toObject(o.summary,u),u.oneofs&&(d.data="summary")),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.Metric"},i})(),a.Gauge=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.Gauge;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.Gauge)return e;var o=new Et.opentelemetry.proto.metrics.v1.Gauge;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.Gauge"},i})(),a.Sum=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.prototype.aggregationTemporality=null,i.prototype.isMonotonic=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return e.aggregationTemporality!=null&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&o.uint32(16).int32(e.aggregationTemporality),e.isMonotonic!=null&&Object.hasOwnProperty.call(e,"isMonotonic")&&o.uint32(24).bool(e.isMonotonic),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.Sum;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()));break}case 2:{d.aggregationTemporality=e.int32();break}case 3:{d.isMonotonic=e.bool();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}if(e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return e.isMonotonic!=null&&e.hasOwnProperty("isMonotonic")&&typeof e.isMonotonic!="boolean"?"isMonotonic: boolean expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.Sum)return e;var o=new Et.opentelemetry.proto.metrics.v1.Sum;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[u])}}switch(e.aggregationTemporality){default:if(typeof e.aggregationTemporality=="number"){o.aggregationTemporality=e.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:o.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:o.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:o.aggregationTemporality=2;break}return e.isMonotonic!=null&&(o.isMonotonic=!!e.isMonotonic),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),o.defaults&&(u.aggregationTemporality=o.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,u.isMonotonic=!1),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[d],o)}return e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality")&&(u.aggregationTemporality=o.enums===String?Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]===void 0?e.aggregationTemporality:Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]:e.aggregationTemporality),e.isMonotonic!=null&&e.hasOwnProperty("isMonotonic")&&(u.isMonotonic=e.isMonotonic),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.Sum"},i})(),a.Histogram=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.prototype.aggregationTemporality=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return e.aggregationTemporality!=null&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&o.uint32(16).int32(e.aggregationTemporality),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.Histogram;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(e,e.uint32()));break}case 2:{d.aggregationTemporality=e.int32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}if(e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.Histogram)return e;var o=new Et.opentelemetry.proto.metrics.v1.Histogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(e.dataPoints[u])}}switch(e.aggregationTemporality){default:if(typeof e.aggregationTemporality=="number"){o.aggregationTemporality=e.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:o.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:o.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:o.aggregationTemporality=2;break}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),o.defaults&&(u.aggregationTemporality=o.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(e.dataPoints[d],o)}return e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality")&&(u.aggregationTemporality=o.enums===String?Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]===void 0?e.aggregationTemporality:Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]:e.aggregationTemporality),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.Histogram"},i})(),a.ExponentialHistogram=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.prototype.aggregationTemporality=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return e.aggregationTemporality!=null&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&o.uint32(16).int32(e.aggregationTemporality),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogram;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(e,e.uint32()));break}case 2:{d.aggregationTemporality=e.int32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}if(e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.ExponentialHistogram)return e;var o=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(e.dataPoints[u])}}switch(e.aggregationTemporality){default:if(typeof e.aggregationTemporality=="number"){o.aggregationTemporality=e.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:o.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:o.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:o.aggregationTemporality=2;break}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),o.defaults&&(u.aggregationTemporality=o.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(e.dataPoints[d],o)}return e.aggregationTemporality!=null&&e.hasOwnProperty("aggregationTemporality")&&(u.aggregationTemporality=o.enums===String?Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]===void 0?e.aggregationTemporality:Et.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]:e.aggregationTemporality),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},i})(),a.Summary=(function(){function i(s){if(this.dataPoints=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.dataPoints=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.dataPoints!=null&&e.dataPoints.length)for(var u=0;u<e.dataPoints.length;++u)Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(e.dataPoints[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.Summary;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.dataPoints&&d.dataPoints.length||(d.dataPoints=[]),d.dataPoints.push(Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dataPoints!=null&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var o=0;o<e.dataPoints.length;++o){var u=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(e.dataPoints[o]);if(u)return"dataPoints."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.Summary)return e;var o=new Et.opentelemetry.proto.metrics.v1.Summary;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");o.dataPoints=[];for(var u=0;u<e.dataPoints.length;++u){if(typeof e.dataPoints[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");o.dataPoints[u]=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(e.dataPoints[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.dataPoints=[]),e.dataPoints&&e.dataPoints.length){u.dataPoints=[];for(var d=0;d<e.dataPoints.length;++d)u.dataPoints[d]=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(e.dataPoints[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.Summary"},i})(),a.AggregationTemporality=(function(){var i={},s=Object.create(i);return s[i[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,s[i[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,s[i[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,s})(),a.DataPointFlags=(function(){var i={},s=Object.create(i);return s[i[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,s[i[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,s})(),a.NumberDataPoint=(function(){function i(e){if(this.attributes=[],this.exemplars=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.attributes=Vt.emptyArray,i.prototype.startTimeUnixNano=null,i.prototype.timeUnixNano=null,i.prototype.asDouble=null,i.prototype.asInt=null,i.prototype.exemplars=Vt.emptyArray,i.prototype.flags=null;var s;return Object.defineProperty(i.prototype,"value",{get:Vt.oneOfGetter(s=["asDouble","asInt"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){if(u||(u=ji.create()),o.startTimeUnixNano!=null&&Object.hasOwnProperty.call(o,"startTimeUnixNano")&&u.uint32(17).fixed64(o.startTimeUnixNano),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(25).fixed64(o.timeUnixNano),o.asDouble!=null&&Object.hasOwnProperty.call(o,"asDouble")&&u.uint32(33).double(o.asDouble),o.exemplars!=null&&o.exemplars.length)for(var d=0;d<o.exemplars.length;++d)Et.opentelemetry.proto.metrics.v1.Exemplar.encode(o.exemplars[d],u.uint32(42).fork()).ldelim();if(o.asInt!=null&&Object.hasOwnProperty.call(o,"asInt")&&u.uint32(49).sfixed64(o.asInt),o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(58).fork()).ldelim();return o.flags!=null&&Object.hasOwnProperty.call(o,"flags")&&u.uint32(64).uint32(o.flags),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.NumberDataPoint;o.pos<d;){var h=o.uint32();switch(h>>>3){case 7:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 2:{I.startTimeUnixNano=o.fixed64();break}case 3:{I.timeUnixNano=o.fixed64();break}case 4:{I.asDouble=o.double();break}case 6:{I.asInt=o.sfixed64();break}case 5:{I.exemplars&&I.exemplars.length||(I.exemplars=[]),I.exemplars.push(Et.opentelemetry.proto.metrics.v1.Exemplar.decode(o,o.uint32()));break}case 8:{I.flags=o.uint32();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var d=0;d<o.attributes.length;++d){var I=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[d]);if(I)return"attributes."+I}}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(o.startTimeUnixNano)&&!(o.startTimeUnixNano&&Vt.isInteger(o.startTimeUnixNano.low)&&Vt.isInteger(o.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.asDouble!=null&&o.hasOwnProperty("asDouble")&&(u.value=1,typeof o.asDouble!="number"))return"asDouble: number expected";if(o.asInt!=null&&o.hasOwnProperty("asInt")){if(u.value===1)return"value: multiple values";if(u.value=1,!Vt.isInteger(o.asInt)&&!(o.asInt&&Vt.isInteger(o.asInt.low)&&Vt.isInteger(o.asInt.high)))return"asInt: integer|Long expected"}if(o.exemplars!=null&&o.hasOwnProperty("exemplars")){if(!Array.isArray(o.exemplars))return"exemplars: array expected";for(var d=0;d<o.exemplars.length;++d){var I=Et.opentelemetry.proto.metrics.v1.Exemplar.verify(o.exemplars[d]);if(I)return"exemplars."+I}}return o.flags!=null&&o.hasOwnProperty("flags")&&!Vt.isInteger(o.flags)?"flags: integer expected":null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.NumberDataPoint)return o;var u=new Et.opentelemetry.proto.metrics.v1.NumberDataPoint;if(o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}if(o.startTimeUnixNano!=null&&(Vt.Long?(u.startTimeUnixNano=Vt.Long.fromValue(o.startTimeUnixNano)).unsigned=!1:typeof o.startTimeUnixNano=="string"?u.startTimeUnixNano=parseInt(o.startTimeUnixNano,10):typeof o.startTimeUnixNano=="number"?u.startTimeUnixNano=o.startTimeUnixNano:typeof o.startTimeUnixNano=="object"&&(u.startTimeUnixNano=new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber())),o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.asDouble!=null&&(u.asDouble=Number(o.asDouble)),o.asInt!=null&&(Vt.Long?(u.asInt=Vt.Long.fromValue(o.asInt)).unsigned=!1:typeof o.asInt=="string"?u.asInt=parseInt(o.asInt,10):typeof o.asInt=="number"?u.asInt=o.asInt:typeof o.asInt=="object"&&(u.asInt=new Vt.LongBits(o.asInt.low>>>0,o.asInt.high>>>0).toNumber())),o.exemplars){if(!Array.isArray(o.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");u.exemplars=[];for(var d=0;d<o.exemplars.length;++d){if(typeof o.exemplars[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");u.exemplars[d]=Et.opentelemetry.proto.metrics.v1.Exemplar.fromObject(o.exemplars[d])}}return o.flags!=null&&(u.flags=o.flags>>>0),u},i.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.exemplars=[],d.attributes=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.startTimeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.startTimeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;d.flags=0}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&(typeof o.startTimeUnixNano=="number"?d.startTimeUnixNano=u.longs===String?String(o.startTimeUnixNano):o.startTimeUnixNano:d.startTimeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.startTimeUnixNano):u.longs===Number?new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber():o.startTimeUnixNano),o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.asDouble!=null&&o.hasOwnProperty("asDouble")&&(d.asDouble=u.json&&!isFinite(o.asDouble)?String(o.asDouble):o.asDouble,u.oneofs&&(d.value="asDouble")),o.exemplars&&o.exemplars.length){d.exemplars=[];for(var h=0;h<o.exemplars.length;++h)d.exemplars[h]=Et.opentelemetry.proto.metrics.v1.Exemplar.toObject(o.exemplars[h],u)}if(o.asInt!=null&&o.hasOwnProperty("asInt")&&(typeof o.asInt=="number"?d.asInt=u.longs===String?String(o.asInt):o.asInt:d.asInt=u.longs===String?Vt.Long.prototype.toString.call(o.asInt):u.longs===Number?new Vt.LongBits(o.asInt.low>>>0,o.asInt.high>>>0).toNumber():o.asInt,u.oneofs&&(d.value="asInt")),o.attributes&&o.attributes.length){d.attributes=[];for(var h=0;h<o.attributes.length;++h)d.attributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[h],u)}return o.flags!=null&&o.hasOwnProperty("flags")&&(d.flags=o.flags),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},i})(),a.HistogramDataPoint=(function(){function i(e){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.attributes=Vt.emptyArray,i.prototype.startTimeUnixNano=null,i.prototype.timeUnixNano=null,i.prototype.count=null,i.prototype.sum=null,i.prototype.bucketCounts=Vt.emptyArray,i.prototype.explicitBounds=Vt.emptyArray,i.prototype.exemplars=Vt.emptyArray,i.prototype.flags=null,i.prototype.min=null,i.prototype.max=null;var s;return Object.defineProperty(i.prototype,"_sum",{get:Vt.oneOfGetter(s=["sum"]),set:Vt.oneOfSetter(s)}),Object.defineProperty(i.prototype,"_min",{get:Vt.oneOfGetter(s=["min"]),set:Vt.oneOfSetter(s)}),Object.defineProperty(i.prototype,"_max",{get:Vt.oneOfGetter(s=["max"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){if(u||(u=ji.create()),o.startTimeUnixNano!=null&&Object.hasOwnProperty.call(o,"startTimeUnixNano")&&u.uint32(17).fixed64(o.startTimeUnixNano),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(25).fixed64(o.timeUnixNano),o.count!=null&&Object.hasOwnProperty.call(o,"count")&&u.uint32(33).fixed64(o.count),o.sum!=null&&Object.hasOwnProperty.call(o,"sum")&&u.uint32(41).double(o.sum),o.bucketCounts!=null&&o.bucketCounts.length){u.uint32(50).fork();for(var d=0;d<o.bucketCounts.length;++d)u.fixed64(o.bucketCounts[d]);u.ldelim()}if(o.explicitBounds!=null&&o.explicitBounds.length){u.uint32(58).fork();for(var d=0;d<o.explicitBounds.length;++d)u.double(o.explicitBounds[d]);u.ldelim()}if(o.exemplars!=null&&o.exemplars.length)for(var d=0;d<o.exemplars.length;++d)Et.opentelemetry.proto.metrics.v1.Exemplar.encode(o.exemplars[d],u.uint32(66).fork()).ldelim();if(o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(74).fork()).ldelim();return o.flags!=null&&Object.hasOwnProperty.call(o,"flags")&&u.uint32(80).uint32(o.flags),o.min!=null&&Object.hasOwnProperty.call(o,"min")&&u.uint32(89).double(o.min),o.max!=null&&Object.hasOwnProperty.call(o,"max")&&u.uint32(97).double(o.max),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.HistogramDataPoint;o.pos<d;){var h=o.uint32();switch(h>>>3){case 9:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 2:{I.startTimeUnixNano=o.fixed64();break}case 3:{I.timeUnixNano=o.fixed64();break}case 4:{I.count=o.fixed64();break}case 5:{I.sum=o.double();break}case 6:{if(I.bucketCounts&&I.bucketCounts.length||(I.bucketCounts=[]),(h&7)===2)for(var c=o.uint32()+o.pos;o.pos<c;)I.bucketCounts.push(o.fixed64());else I.bucketCounts.push(o.fixed64());break}case 7:{if(I.explicitBounds&&I.explicitBounds.length||(I.explicitBounds=[]),(h&7)===2)for(var c=o.uint32()+o.pos;o.pos<c;)I.explicitBounds.push(o.double());else I.explicitBounds.push(o.double());break}case 8:{I.exemplars&&I.exemplars.length||(I.exemplars=[]),I.exemplars.push(Et.opentelemetry.proto.metrics.v1.Exemplar.decode(o,o.uint32()));break}case 10:{I.flags=o.uint32();break}case 11:{I.min=o.double();break}case 12:{I.max=o.double();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var d=0;d<o.attributes.length;++d){var I=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[d]);if(I)return"attributes."+I}}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(o.startTimeUnixNano)&&!(o.startTimeUnixNano&&Vt.isInteger(o.startTimeUnixNano.low)&&Vt.isInteger(o.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.count!=null&&o.hasOwnProperty("count")&&!Vt.isInteger(o.count)&&!(o.count&&Vt.isInteger(o.count.low)&&Vt.isInteger(o.count.high)))return"count: integer|Long expected";if(o.sum!=null&&o.hasOwnProperty("sum")&&(u._sum=1,typeof o.sum!="number"))return"sum: number expected";if(o.bucketCounts!=null&&o.hasOwnProperty("bucketCounts")){if(!Array.isArray(o.bucketCounts))return"bucketCounts: array expected";for(var d=0;d<o.bucketCounts.length;++d)if(!Vt.isInteger(o.bucketCounts[d])&&!(o.bucketCounts[d]&&Vt.isInteger(o.bucketCounts[d].low)&&Vt.isInteger(o.bucketCounts[d].high)))return"bucketCounts: integer|Long[] expected"}if(o.explicitBounds!=null&&o.hasOwnProperty("explicitBounds")){if(!Array.isArray(o.explicitBounds))return"explicitBounds: array expected";for(var d=0;d<o.explicitBounds.length;++d)if(typeof o.explicitBounds[d]!="number")return"explicitBounds: number[] expected"}if(o.exemplars!=null&&o.hasOwnProperty("exemplars")){if(!Array.isArray(o.exemplars))return"exemplars: array expected";for(var d=0;d<o.exemplars.length;++d){var I=Et.opentelemetry.proto.metrics.v1.Exemplar.verify(o.exemplars[d]);if(I)return"exemplars."+I}}return o.flags!=null&&o.hasOwnProperty("flags")&&!Vt.isInteger(o.flags)?"flags: integer expected":o.min!=null&&o.hasOwnProperty("min")&&(u._min=1,typeof o.min!="number")?"min: number expected":o.max!=null&&o.hasOwnProperty("max")&&(u._max=1,typeof o.max!="number")?"max: number expected":null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.HistogramDataPoint)return o;var u=new Et.opentelemetry.proto.metrics.v1.HistogramDataPoint;if(o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}if(o.startTimeUnixNano!=null&&(Vt.Long?(u.startTimeUnixNano=Vt.Long.fromValue(o.startTimeUnixNano)).unsigned=!1:typeof o.startTimeUnixNano=="string"?u.startTimeUnixNano=parseInt(o.startTimeUnixNano,10):typeof o.startTimeUnixNano=="number"?u.startTimeUnixNano=o.startTimeUnixNano:typeof o.startTimeUnixNano=="object"&&(u.startTimeUnixNano=new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber())),o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.count!=null&&(Vt.Long?(u.count=Vt.Long.fromValue(o.count)).unsigned=!1:typeof o.count=="string"?u.count=parseInt(o.count,10):typeof o.count=="number"?u.count=o.count:typeof o.count=="object"&&(u.count=new Vt.LongBits(o.count.low>>>0,o.count.high>>>0).toNumber())),o.sum!=null&&(u.sum=Number(o.sum)),o.bucketCounts){if(!Array.isArray(o.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");u.bucketCounts=[];for(var d=0;d<o.bucketCounts.length;++d)Vt.Long?(u.bucketCounts[d]=Vt.Long.fromValue(o.bucketCounts[d])).unsigned=!1:typeof o.bucketCounts[d]=="string"?u.bucketCounts[d]=parseInt(o.bucketCounts[d],10):typeof o.bucketCounts[d]=="number"?u.bucketCounts[d]=o.bucketCounts[d]:typeof o.bucketCounts[d]=="object"&&(u.bucketCounts[d]=new Vt.LongBits(o.bucketCounts[d].low>>>0,o.bucketCounts[d].high>>>0).toNumber())}if(o.explicitBounds){if(!Array.isArray(o.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");u.explicitBounds=[];for(var d=0;d<o.explicitBounds.length;++d)u.explicitBounds[d]=Number(o.explicitBounds[d])}if(o.exemplars){if(!Array.isArray(o.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");u.exemplars=[];for(var d=0;d<o.exemplars.length;++d){if(typeof o.exemplars[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");u.exemplars[d]=Et.opentelemetry.proto.metrics.v1.Exemplar.fromObject(o.exemplars[d])}}return o.flags!=null&&(u.flags=o.flags>>>0),o.min!=null&&(u.min=Number(o.min)),o.max!=null&&(u.max=Number(o.max)),u},i.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.bucketCounts=[],d.explicitBounds=[],d.exemplars=[],d.attributes=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.startTimeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.startTimeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.count=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.count=u.longs===String?"0":0;d.flags=0}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&(typeof o.startTimeUnixNano=="number"?d.startTimeUnixNano=u.longs===String?String(o.startTimeUnixNano):o.startTimeUnixNano:d.startTimeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.startTimeUnixNano):u.longs===Number?new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber():o.startTimeUnixNano),o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.count!=null&&o.hasOwnProperty("count")&&(typeof o.count=="number"?d.count=u.longs===String?String(o.count):o.count:d.count=u.longs===String?Vt.Long.prototype.toString.call(o.count):u.longs===Number?new Vt.LongBits(o.count.low>>>0,o.count.high>>>0).toNumber():o.count),o.sum!=null&&o.hasOwnProperty("sum")&&(d.sum=u.json&&!isFinite(o.sum)?String(o.sum):o.sum,u.oneofs&&(d._sum="sum")),o.bucketCounts&&o.bucketCounts.length){d.bucketCounts=[];for(var h=0;h<o.bucketCounts.length;++h)typeof o.bucketCounts[h]=="number"?d.bucketCounts[h]=u.longs===String?String(o.bucketCounts[h]):o.bucketCounts[h]:d.bucketCounts[h]=u.longs===String?Vt.Long.prototype.toString.call(o.bucketCounts[h]):u.longs===Number?new Vt.LongBits(o.bucketCounts[h].low>>>0,o.bucketCounts[h].high>>>0).toNumber():o.bucketCounts[h]}if(o.explicitBounds&&o.explicitBounds.length){d.explicitBounds=[];for(var h=0;h<o.explicitBounds.length;++h)d.explicitBounds[h]=u.json&&!isFinite(o.explicitBounds[h])?String(o.explicitBounds[h]):o.explicitBounds[h]}if(o.exemplars&&o.exemplars.length){d.exemplars=[];for(var h=0;h<o.exemplars.length;++h)d.exemplars[h]=Et.opentelemetry.proto.metrics.v1.Exemplar.toObject(o.exemplars[h],u)}if(o.attributes&&o.attributes.length){d.attributes=[];for(var h=0;h<o.attributes.length;++h)d.attributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[h],u)}return o.flags!=null&&o.hasOwnProperty("flags")&&(d.flags=o.flags),o.min!=null&&o.hasOwnProperty("min")&&(d.min=u.json&&!isFinite(o.min)?String(o.min):o.min,u.oneofs&&(d._min="min")),o.max!=null&&o.hasOwnProperty("max")&&(d.max=u.json&&!isFinite(o.max)?String(o.max):o.max,u.oneofs&&(d._max="max")),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},i})(),a.ExponentialHistogramDataPoint=(function(){function i(e){if(this.attributes=[],this.exemplars=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.attributes=Vt.emptyArray,i.prototype.startTimeUnixNano=null,i.prototype.timeUnixNano=null,i.prototype.count=null,i.prototype.sum=null,i.prototype.scale=null,i.prototype.zeroCount=null,i.prototype.positive=null,i.prototype.negative=null,i.prototype.flags=null,i.prototype.exemplars=Vt.emptyArray,i.prototype.min=null,i.prototype.max=null,i.prototype.zeroThreshold=null;var s;return Object.defineProperty(i.prototype,"_sum",{get:Vt.oneOfGetter(s=["sum"]),set:Vt.oneOfSetter(s)}),Object.defineProperty(i.prototype,"_min",{get:Vt.oneOfGetter(s=["min"]),set:Vt.oneOfSetter(s)}),Object.defineProperty(i.prototype,"_max",{get:Vt.oneOfGetter(s=["max"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){if(u||(u=ji.create()),o.attributes!=null&&o.attributes.length)for(var d=0;d<o.attributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.attributes[d],u.uint32(10).fork()).ldelim();if(o.startTimeUnixNano!=null&&Object.hasOwnProperty.call(o,"startTimeUnixNano")&&u.uint32(17).fixed64(o.startTimeUnixNano),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(25).fixed64(o.timeUnixNano),o.count!=null&&Object.hasOwnProperty.call(o,"count")&&u.uint32(33).fixed64(o.count),o.sum!=null&&Object.hasOwnProperty.call(o,"sum")&&u.uint32(41).double(o.sum),o.scale!=null&&Object.hasOwnProperty.call(o,"scale")&&u.uint32(48).sint32(o.scale),o.zeroCount!=null&&Object.hasOwnProperty.call(o,"zeroCount")&&u.uint32(57).fixed64(o.zeroCount),o.positive!=null&&Object.hasOwnProperty.call(o,"positive")&&Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(o.positive,u.uint32(66).fork()).ldelim(),o.negative!=null&&Object.hasOwnProperty.call(o,"negative")&&Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(o.negative,u.uint32(74).fork()).ldelim(),o.flags!=null&&Object.hasOwnProperty.call(o,"flags")&&u.uint32(80).uint32(o.flags),o.exemplars!=null&&o.exemplars.length)for(var d=0;d<o.exemplars.length;++d)Et.opentelemetry.proto.metrics.v1.Exemplar.encode(o.exemplars[d],u.uint32(90).fork()).ldelim();return o.min!=null&&Object.hasOwnProperty.call(o,"min")&&u.uint32(97).double(o.min),o.max!=null&&Object.hasOwnProperty.call(o,"max")&&u.uint32(105).double(o.max),o.zeroThreshold!=null&&Object.hasOwnProperty.call(o,"zeroThreshold")&&u.uint32(113).double(o.zeroThreshold),u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 2:{I.startTimeUnixNano=o.fixed64();break}case 3:{I.timeUnixNano=o.fixed64();break}case 4:{I.count=o.fixed64();break}case 5:{I.sum=o.double();break}case 6:{I.scale=o.sint32();break}case 7:{I.zeroCount=o.fixed64();break}case 8:{I.positive=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(o,o.uint32());break}case 9:{I.negative=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(o,o.uint32());break}case 10:{I.flags=o.uint32();break}case 11:{I.exemplars&&I.exemplars.length||(I.exemplars=[]),I.exemplars.push(Et.opentelemetry.proto.metrics.v1.Exemplar.decode(o,o.uint32()));break}case 12:{I.min=o.double();break}case 13:{I.max=o.double();break}case 14:{I.zeroThreshold=o.double();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.attributes!=null&&o.hasOwnProperty("attributes")){if(!Array.isArray(o.attributes))return"attributes: array expected";for(var d=0;d<o.attributes.length;++d){var I=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.attributes[d]);if(I)return"attributes."+I}}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(o.startTimeUnixNano)&&!(o.startTimeUnixNano&&Vt.isInteger(o.startTimeUnixNano.low)&&Vt.isInteger(o.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.count!=null&&o.hasOwnProperty("count")&&!Vt.isInteger(o.count)&&!(o.count&&Vt.isInteger(o.count.low)&&Vt.isInteger(o.count.high)))return"count: integer|Long expected";if(o.sum!=null&&o.hasOwnProperty("sum")&&(u._sum=1,typeof o.sum!="number"))return"sum: number expected";if(o.scale!=null&&o.hasOwnProperty("scale")&&!Vt.isInteger(o.scale))return"scale: integer expected";if(o.zeroCount!=null&&o.hasOwnProperty("zeroCount")&&!Vt.isInteger(o.zeroCount)&&!(o.zeroCount&&Vt.isInteger(o.zeroCount.low)&&Vt.isInteger(o.zeroCount.high)))return"zeroCount: integer|Long expected";if(o.positive!=null&&o.hasOwnProperty("positive")){var I=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(o.positive);if(I)return"positive."+I}if(o.negative!=null&&o.hasOwnProperty("negative")){var I=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(o.negative);if(I)return"negative."+I}if(o.flags!=null&&o.hasOwnProperty("flags")&&!Vt.isInteger(o.flags))return"flags: integer expected";if(o.exemplars!=null&&o.hasOwnProperty("exemplars")){if(!Array.isArray(o.exemplars))return"exemplars: array expected";for(var d=0;d<o.exemplars.length;++d){var I=Et.opentelemetry.proto.metrics.v1.Exemplar.verify(o.exemplars[d]);if(I)return"exemplars."+I}}return o.min!=null&&o.hasOwnProperty("min")&&(u._min=1,typeof o.min!="number")?"min: number expected":o.max!=null&&o.hasOwnProperty("max")&&(u._max=1,typeof o.max!="number")?"max: number expected":o.zeroThreshold!=null&&o.hasOwnProperty("zeroThreshold")&&typeof o.zeroThreshold!="number"?"zeroThreshold: number expected":null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return o;var u=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if(o.attributes){if(!Array.isArray(o.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");u.attributes=[];for(var d=0;d<o.attributes.length;++d){if(typeof o.attributes[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");u.attributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.attributes[d])}}if(o.startTimeUnixNano!=null&&(Vt.Long?(u.startTimeUnixNano=Vt.Long.fromValue(o.startTimeUnixNano)).unsigned=!1:typeof o.startTimeUnixNano=="string"?u.startTimeUnixNano=parseInt(o.startTimeUnixNano,10):typeof o.startTimeUnixNano=="number"?u.startTimeUnixNano=o.startTimeUnixNano:typeof o.startTimeUnixNano=="object"&&(u.startTimeUnixNano=new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber())),o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.count!=null&&(Vt.Long?(u.count=Vt.Long.fromValue(o.count)).unsigned=!1:typeof o.count=="string"?u.count=parseInt(o.count,10):typeof o.count=="number"?u.count=o.count:typeof o.count=="object"&&(u.count=new Vt.LongBits(o.count.low>>>0,o.count.high>>>0).toNumber())),o.sum!=null&&(u.sum=Number(o.sum)),o.scale!=null&&(u.scale=o.scale|0),o.zeroCount!=null&&(Vt.Long?(u.zeroCount=Vt.Long.fromValue(o.zeroCount)).unsigned=!1:typeof o.zeroCount=="string"?u.zeroCount=parseInt(o.zeroCount,10):typeof o.zeroCount=="number"?u.zeroCount=o.zeroCount:typeof o.zeroCount=="object"&&(u.zeroCount=new Vt.LongBits(o.zeroCount.low>>>0,o.zeroCount.high>>>0).toNumber())),o.positive!=null){if(typeof o.positive!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");u.positive=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(o.positive)}if(o.negative!=null){if(typeof o.negative!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");u.negative=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(o.negative)}if(o.flags!=null&&(u.flags=o.flags>>>0),o.exemplars){if(!Array.isArray(o.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");u.exemplars=[];for(var d=0;d<o.exemplars.length;++d){if(typeof o.exemplars[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");u.exemplars[d]=Et.opentelemetry.proto.metrics.v1.Exemplar.fromObject(o.exemplars[d])}}return o.min!=null&&(u.min=Number(o.min)),o.max!=null&&(u.max=Number(o.max)),o.zeroThreshold!=null&&(u.zeroThreshold=Number(o.zeroThreshold)),u},i.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.attributes=[],d.exemplars=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.startTimeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.startTimeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;if(Vt.Long){var I=new Vt.Long(0,0,!1);d.count=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.count=u.longs===String?"0":0;if(d.scale=0,Vt.Long){var I=new Vt.Long(0,0,!1);d.zeroCount=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.zeroCount=u.longs===String?"0":0;d.positive=null,d.negative=null,d.flags=0,d.zeroThreshold=0}if(o.attributes&&o.attributes.length){d.attributes=[];for(var h=0;h<o.attributes.length;++h)d.attributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.attributes[h],u)}if(o.startTimeUnixNano!=null&&o.hasOwnProperty("startTimeUnixNano")&&(typeof o.startTimeUnixNano=="number"?d.startTimeUnixNano=u.longs===String?String(o.startTimeUnixNano):o.startTimeUnixNano:d.startTimeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.startTimeUnixNano):u.longs===Number?new Vt.LongBits(o.startTimeUnixNano.low>>>0,o.startTimeUnixNano.high>>>0).toNumber():o.startTimeUnixNano),o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.count!=null&&o.hasOwnProperty("count")&&(typeof o.count=="number"?d.count=u.longs===String?String(o.count):o.count:d.count=u.longs===String?Vt.Long.prototype.toString.call(o.count):u.longs===Number?new Vt.LongBits(o.count.low>>>0,o.count.high>>>0).toNumber():o.count),o.sum!=null&&o.hasOwnProperty("sum")&&(d.sum=u.json&&!isFinite(o.sum)?String(o.sum):o.sum,u.oneofs&&(d._sum="sum")),o.scale!=null&&o.hasOwnProperty("scale")&&(d.scale=o.scale),o.zeroCount!=null&&o.hasOwnProperty("zeroCount")&&(typeof o.zeroCount=="number"?d.zeroCount=u.longs===String?String(o.zeroCount):o.zeroCount:d.zeroCount=u.longs===String?Vt.Long.prototype.toString.call(o.zeroCount):u.longs===Number?new Vt.LongBits(o.zeroCount.low>>>0,o.zeroCount.high>>>0).toNumber():o.zeroCount),o.positive!=null&&o.hasOwnProperty("positive")&&(d.positive=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(o.positive,u)),o.negative!=null&&o.hasOwnProperty("negative")&&(d.negative=Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(o.negative,u)),o.flags!=null&&o.hasOwnProperty("flags")&&(d.flags=o.flags),o.exemplars&&o.exemplars.length){d.exemplars=[];for(var h=0;h<o.exemplars.length;++h)d.exemplars[h]=Et.opentelemetry.proto.metrics.v1.Exemplar.toObject(o.exemplars[h],u)}return o.min!=null&&o.hasOwnProperty("min")&&(d.min=u.json&&!isFinite(o.min)?String(o.min):o.min,u.oneofs&&(d._min="min")),o.max!=null&&o.hasOwnProperty("max")&&(d.max=u.json&&!isFinite(o.max)?String(o.max):o.max,u.oneofs&&(d._max="max")),o.zeroThreshold!=null&&o.hasOwnProperty("zeroThreshold")&&(d.zeroThreshold=u.json&&!isFinite(o.zeroThreshold)?String(o.zeroThreshold):o.zeroThreshold),d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},i.Buckets=(function(){function e(o){if(this.bucketCounts=[],o)for(var u=Object.keys(o),d=0;d<u.length;++d)o[u[d]]!=null&&(this[u[d]]=o[u[d]])}return e.prototype.offset=null,e.prototype.bucketCounts=Vt.emptyArray,e.create=function(u){return new e(u)},e.encode=function(u,d){if(d||(d=ji.create()),u.offset!=null&&Object.hasOwnProperty.call(u,"offset")&&d.uint32(8).sint32(u.offset),u.bucketCounts!=null&&u.bucketCounts.length){d.uint32(18).fork();for(var I=0;I<u.bucketCounts.length;++I)d.uint64(u.bucketCounts[I]);d.ldelim()}return d},e.encodeDelimited=function(u,d){return this.encode(u,d).ldelim()},e.decode=function(u,d){u instanceof wn||(u=wn.create(u));for(var I=d===void 0?u.len:u.pos+d,h=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;u.pos<I;){var c=u.uint32();switch(c>>>3){case 1:{h.offset=u.sint32();break}case 2:{if(h.bucketCounts&&h.bucketCounts.length||(h.bucketCounts=[]),(c&7)===2)for(var G=u.uint32()+u.pos;u.pos<G;)h.bucketCounts.push(u.uint64());else h.bucketCounts.push(u.uint64());break}default:u.skipType(c&7);break}}return h},e.decodeDelimited=function(u){return u instanceof wn||(u=new wn(u)),this.decode(u,u.uint32())},e.verify=function(u){if(typeof u!="object"||u===null)return"object expected";if(u.offset!=null&&u.hasOwnProperty("offset")&&!Vt.isInteger(u.offset))return"offset: integer expected";if(u.bucketCounts!=null&&u.hasOwnProperty("bucketCounts")){if(!Array.isArray(u.bucketCounts))return"bucketCounts: array expected";for(var d=0;d<u.bucketCounts.length;++d)if(!Vt.isInteger(u.bucketCounts[d])&&!(u.bucketCounts[d]&&Vt.isInteger(u.bucketCounts[d].low)&&Vt.isInteger(u.bucketCounts[d].high)))return"bucketCounts: integer|Long[] expected"}return null},e.fromObject=function(u){if(u instanceof Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return u;var d=new Et.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;if(u.offset!=null&&(d.offset=u.offset|0),u.bucketCounts){if(!Array.isArray(u.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected");d.bucketCounts=[];for(var I=0;I<u.bucketCounts.length;++I)Vt.Long?(d.bucketCounts[I]=Vt.Long.fromValue(u.bucketCounts[I])).unsigned=!0:typeof u.bucketCounts[I]=="string"?d.bucketCounts[I]=parseInt(u.bucketCounts[I],10):typeof u.bucketCounts[I]=="number"?d.bucketCounts[I]=u.bucketCounts[I]:typeof u.bucketCounts[I]=="object"&&(d.bucketCounts[I]=new Vt.LongBits(u.bucketCounts[I].low>>>0,u.bucketCounts[I].high>>>0).toNumber(!0))}return d},e.toObject=function(u,d){d||(d={});var I={};if((d.arrays||d.defaults)&&(I.bucketCounts=[]),d.defaults&&(I.offset=0),u.offset!=null&&u.hasOwnProperty("offset")&&(I.offset=u.offset),u.bucketCounts&&u.bucketCounts.length){I.bucketCounts=[];for(var h=0;h<u.bucketCounts.length;++h)typeof u.bucketCounts[h]=="number"?I.bucketCounts[h]=d.longs===String?String(u.bucketCounts[h]):u.bucketCounts[h]:I.bucketCounts[h]=d.longs===String?Vt.Long.prototype.toString.call(u.bucketCounts[h]):d.longs===Number?new Vt.LongBits(u.bucketCounts[h].low>>>0,u.bucketCounts[h].high>>>0).toNumber(!0):u.bucketCounts[h]}return I},e.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},e.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},e})(),i})(),a.SummaryDataPoint=(function(){function i(s){if(this.attributes=[],this.quantileValues=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.attributes=Vt.emptyArray,i.prototype.startTimeUnixNano=null,i.prototype.timeUnixNano=null,i.prototype.count=null,i.prototype.sum=null,i.prototype.quantileValues=Vt.emptyArray,i.prototype.flags=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.startTimeUnixNano!=null&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&o.uint32(17).fixed64(e.startTimeUnixNano),e.timeUnixNano!=null&&Object.hasOwnProperty.call(e,"timeUnixNano")&&o.uint32(25).fixed64(e.timeUnixNano),e.count!=null&&Object.hasOwnProperty.call(e,"count")&&o.uint32(33).fixed64(e.count),e.sum!=null&&Object.hasOwnProperty.call(e,"sum")&&o.uint32(41).double(e.sum),e.quantileValues!=null&&e.quantileValues.length)for(var u=0;u<e.quantileValues.length;++u)Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(e.quantileValues[u],o.uint32(50).fork()).ldelim();if(e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(58).fork()).ldelim();return e.flags!=null&&Object.hasOwnProperty.call(e,"flags")&&o.uint32(64).uint32(e.flags),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.metrics.v1.SummaryDataPoint;e.pos<u;){var I=e.uint32();switch(I>>>3){case 7:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 2:{d.startTimeUnixNano=e.fixed64();break}case 3:{d.timeUnixNano=e.fixed64();break}case 4:{d.count=e.fixed64();break}case 5:{d.sum=e.double();break}case 6:{d.quantileValues&&d.quantileValues.length||(d.quantileValues=[]),d.quantileValues.push(Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(e,e.uint32()));break}case 8:{d.flags=e.uint32();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var o=0;o<e.attributes.length;++o){var u=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[o]);if(u)return"attributes."+u}}if(e.startTimeUnixNano!=null&&e.hasOwnProperty("startTimeUnixNano")&&!Vt.isInteger(e.startTimeUnixNano)&&!(e.startTimeUnixNano&&Vt.isInteger(e.startTimeUnixNano.low)&&Vt.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(e.timeUnixNano!=null&&e.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(e.timeUnixNano)&&!(e.timeUnixNano&&Vt.isInteger(e.timeUnixNano.low)&&Vt.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(e.count!=null&&e.hasOwnProperty("count")&&!Vt.isInteger(e.count)&&!(e.count&&Vt.isInteger(e.count.low)&&Vt.isInteger(e.count.high)))return"count: integer|Long expected";if(e.sum!=null&&e.hasOwnProperty("sum")&&typeof e.sum!="number")return"sum: number expected";if(e.quantileValues!=null&&e.hasOwnProperty("quantileValues")){if(!Array.isArray(e.quantileValues))return"quantileValues: array expected";for(var o=0;o<e.quantileValues.length;++o){var u=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(e.quantileValues[o]);if(u)return"quantileValues."+u}}return e.flags!=null&&e.hasOwnProperty("flags")&&!Vt.isInteger(e.flags)?"flags: integer expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.metrics.v1.SummaryDataPoint)return e;var o=new Et.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}if(e.startTimeUnixNano!=null&&(Vt.Long?(o.startTimeUnixNano=Vt.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:typeof e.startTimeUnixNano=="string"?o.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):typeof e.startTimeUnixNano=="number"?o.startTimeUnixNano=e.startTimeUnixNano:typeof e.startTimeUnixNano=="object"&&(o.startTimeUnixNano=new Vt.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),e.timeUnixNano!=null&&(Vt.Long?(o.timeUnixNano=Vt.Long.fromValue(e.timeUnixNano)).unsigned=!1:typeof e.timeUnixNano=="string"?o.timeUnixNano=parseInt(e.timeUnixNano,10):typeof e.timeUnixNano=="number"?o.timeUnixNano=e.timeUnixNano:typeof e.timeUnixNano=="object"&&(o.timeUnixNano=new Vt.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),e.count!=null&&(Vt.Long?(o.count=Vt.Long.fromValue(e.count)).unsigned=!1:typeof e.count=="string"?o.count=parseInt(e.count,10):typeof e.count=="number"?o.count=e.count:typeof e.count=="object"&&(o.count=new Vt.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),e.sum!=null&&(o.sum=Number(e.sum)),e.quantileValues){if(!Array.isArray(e.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");o.quantileValues=[];for(var u=0;u<e.quantileValues.length;++u){if(typeof e.quantileValues[u]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");o.quantileValues[u]=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(e.quantileValues[u])}}return e.flags!=null&&(o.flags=e.flags>>>0),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.quantileValues=[],u.attributes=[]),o.defaults){if(Vt.Long){var d=new Vt.Long(0,0,!1);u.startTimeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.startTimeUnixNano=o.longs===String?"0":0;if(Vt.Long){var d=new Vt.Long(0,0,!1);u.timeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.timeUnixNano=o.longs===String?"0":0;if(Vt.Long){var d=new Vt.Long(0,0,!1);u.count=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.count=o.longs===String?"0":0;u.sum=0,u.flags=0}if(e.startTimeUnixNano!=null&&e.hasOwnProperty("startTimeUnixNano")&&(typeof e.startTimeUnixNano=="number"?u.startTimeUnixNano=o.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:u.startTimeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.startTimeUnixNano):o.longs===Number?new Vt.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),e.timeUnixNano!=null&&e.hasOwnProperty("timeUnixNano")&&(typeof e.timeUnixNano=="number"?u.timeUnixNano=o.longs===String?String(e.timeUnixNano):e.timeUnixNano:u.timeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.timeUnixNano):o.longs===Number?new Vt.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),e.count!=null&&e.hasOwnProperty("count")&&(typeof e.count=="number"?u.count=o.longs===String?String(e.count):e.count:u.count=o.longs===String?Vt.Long.prototype.toString.call(e.count):o.longs===Number?new Vt.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),e.sum!=null&&e.hasOwnProperty("sum")&&(u.sum=o.json&&!isFinite(e.sum)?String(e.sum):e.sum),e.quantileValues&&e.quantileValues.length){u.quantileValues=[];for(var I=0;I<e.quantileValues.length;++I)u.quantileValues[I]=Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(e.quantileValues[I],o)}if(e.attributes&&e.attributes.length){u.attributes=[];for(var I=0;I<e.attributes.length;++I)u.attributes[I]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[I],o)}return e.flags!=null&&e.hasOwnProperty("flags")&&(u.flags=e.flags),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},i.ValueAtQuantile=(function(){function s(e){if(e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}return s.prototype.quantile=null,s.prototype.value=null,s.create=function(o){return new s(o)},s.encode=function(o,u){return u||(u=ji.create()),o.quantile!=null&&Object.hasOwnProperty.call(o,"quantile")&&u.uint32(9).double(o.quantile),o.value!=null&&Object.hasOwnProperty.call(o,"value")&&u.uint32(17).double(o.value),u},s.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},s.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;o.pos<d;){var h=o.uint32();switch(h>>>3){case 1:{I.quantile=o.double();break}case 2:{I.value=o.double();break}default:o.skipType(h&7);break}}return I},s.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.quantile!=null&&o.hasOwnProperty("quantile")&&typeof o.quantile!="number"?"quantile: number expected":o.value!=null&&o.hasOwnProperty("value")&&typeof o.value!="number"?"value: number expected":null},s.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile)return o;var u=new Et.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;return o.quantile!=null&&(u.quantile=Number(o.quantile)),o.value!=null&&(u.value=Number(o.value)),u},s.toObject=function(o,u){u||(u={});var d={};return u.defaults&&(d.quantile=0,d.value=0),o.quantile!=null&&o.hasOwnProperty("quantile")&&(d.quantile=u.json&&!isFinite(o.quantile)?String(o.quantile):o.quantile),o.value!=null&&o.hasOwnProperty("value")&&(d.value=u.json&&!isFinite(o.value)?String(o.value):o.value),d},s.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},s.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},s})(),i})(),a.Exemplar=(function(){function i(e){if(this.filteredAttributes=[],e)for(var o=Object.keys(e),u=0;u<o.length;++u)e[o[u]]!=null&&(this[o[u]]=e[o[u]])}i.prototype.filteredAttributes=Vt.emptyArray,i.prototype.timeUnixNano=null,i.prototype.asDouble=null,i.prototype.asInt=null,i.prototype.spanId=null,i.prototype.traceId=null;var s;return Object.defineProperty(i.prototype,"value",{get:Vt.oneOfGetter(s=["asDouble","asInt"]),set:Vt.oneOfSetter(s)}),i.create=function(o){return new i(o)},i.encode=function(o,u){if(u||(u=ji.create()),o.timeUnixNano!=null&&Object.hasOwnProperty.call(o,"timeUnixNano")&&u.uint32(17).fixed64(o.timeUnixNano),o.asDouble!=null&&Object.hasOwnProperty.call(o,"asDouble")&&u.uint32(25).double(o.asDouble),o.spanId!=null&&Object.hasOwnProperty.call(o,"spanId")&&u.uint32(34).bytes(o.spanId),o.traceId!=null&&Object.hasOwnProperty.call(o,"traceId")&&u.uint32(42).bytes(o.traceId),o.asInt!=null&&Object.hasOwnProperty.call(o,"asInt")&&u.uint32(49).sfixed64(o.asInt),o.filteredAttributes!=null&&o.filteredAttributes.length)for(var d=0;d<o.filteredAttributes.length;++d)Et.opentelemetry.proto.common.v1.KeyValue.encode(o.filteredAttributes[d],u.uint32(58).fork()).ldelim();return u},i.encodeDelimited=function(o,u){return this.encode(o,u).ldelim()},i.decode=function(o,u){o instanceof wn||(o=wn.create(o));for(var d=u===void 0?o.len:o.pos+u,I=new Et.opentelemetry.proto.metrics.v1.Exemplar;o.pos<d;){var h=o.uint32();switch(h>>>3){case 7:{I.filteredAttributes&&I.filteredAttributes.length||(I.filteredAttributes=[]),I.filteredAttributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(o,o.uint32()));break}case 2:{I.timeUnixNano=o.fixed64();break}case 3:{I.asDouble=o.double();break}case 6:{I.asInt=o.sfixed64();break}case 4:{I.spanId=o.bytes();break}case 5:{I.traceId=o.bytes();break}default:o.skipType(h&7);break}}return I},i.decodeDelimited=function(o){return o instanceof wn||(o=new wn(o)),this.decode(o,o.uint32())},i.verify=function(o){if(typeof o!="object"||o===null)return"object expected";var u={};if(o.filteredAttributes!=null&&o.hasOwnProperty("filteredAttributes")){if(!Array.isArray(o.filteredAttributes))return"filteredAttributes: array expected";for(var d=0;d<o.filteredAttributes.length;++d){var I=Et.opentelemetry.proto.common.v1.KeyValue.verify(o.filteredAttributes[d]);if(I)return"filteredAttributes."+I}}if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(o.timeUnixNano)&&!(o.timeUnixNano&&Vt.isInteger(o.timeUnixNano.low)&&Vt.isInteger(o.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(o.asDouble!=null&&o.hasOwnProperty("asDouble")&&(u.value=1,typeof o.asDouble!="number"))return"asDouble: number expected";if(o.asInt!=null&&o.hasOwnProperty("asInt")){if(u.value===1)return"value: multiple values";if(u.value=1,!Vt.isInteger(o.asInt)&&!(o.asInt&&Vt.isInteger(o.asInt.low)&&Vt.isInteger(o.asInt.high)))return"asInt: integer|Long expected"}return o.spanId!=null&&o.hasOwnProperty("spanId")&&!(o.spanId&&typeof o.spanId.length=="number"||Vt.isString(o.spanId))?"spanId: buffer expected":o.traceId!=null&&o.hasOwnProperty("traceId")&&!(o.traceId&&typeof o.traceId.length=="number"||Vt.isString(o.traceId))?"traceId: buffer expected":null},i.fromObject=function(o){if(o instanceof Et.opentelemetry.proto.metrics.v1.Exemplar)return o;var u=new Et.opentelemetry.proto.metrics.v1.Exemplar;if(o.filteredAttributes){if(!Array.isArray(o.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");u.filteredAttributes=[];for(var d=0;d<o.filteredAttributes.length;++d){if(typeof o.filteredAttributes[d]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");u.filteredAttributes[d]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(o.filteredAttributes[d])}}return o.timeUnixNano!=null&&(Vt.Long?(u.timeUnixNano=Vt.Long.fromValue(o.timeUnixNano)).unsigned=!1:typeof o.timeUnixNano=="string"?u.timeUnixNano=parseInt(o.timeUnixNano,10):typeof o.timeUnixNano=="number"?u.timeUnixNano=o.timeUnixNano:typeof o.timeUnixNano=="object"&&(u.timeUnixNano=new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber())),o.asDouble!=null&&(u.asDouble=Number(o.asDouble)),o.asInt!=null&&(Vt.Long?(u.asInt=Vt.Long.fromValue(o.asInt)).unsigned=!1:typeof o.asInt=="string"?u.asInt=parseInt(o.asInt,10):typeof o.asInt=="number"?u.asInt=o.asInt:typeof o.asInt=="object"&&(u.asInt=new Vt.LongBits(o.asInt.low>>>0,o.asInt.high>>>0).toNumber())),o.spanId!=null&&(typeof o.spanId=="string"?Vt.base64.decode(o.spanId,u.spanId=Vt.newBuffer(Vt.base64.length(o.spanId)),0):o.spanId.length>=0&&(u.spanId=o.spanId)),o.traceId!=null&&(typeof o.traceId=="string"?Vt.base64.decode(o.traceId,u.traceId=Vt.newBuffer(Vt.base64.length(o.traceId)),0):o.traceId.length>=0&&(u.traceId=o.traceId)),u},i.toObject=function(o,u){u||(u={});var d={};if((u.arrays||u.defaults)&&(d.filteredAttributes=[]),u.defaults){if(Vt.Long){var I=new Vt.Long(0,0,!1);d.timeUnixNano=u.longs===String?I.toString():u.longs===Number?I.toNumber():I}else d.timeUnixNano=u.longs===String?"0":0;u.bytes===String?d.spanId="":(d.spanId=[],u.bytes!==Array&&(d.spanId=Vt.newBuffer(d.spanId))),u.bytes===String?d.traceId="":(d.traceId=[],u.bytes!==Array&&(d.traceId=Vt.newBuffer(d.traceId)))}if(o.timeUnixNano!=null&&o.hasOwnProperty("timeUnixNano")&&(typeof o.timeUnixNano=="number"?d.timeUnixNano=u.longs===String?String(o.timeUnixNano):o.timeUnixNano:d.timeUnixNano=u.longs===String?Vt.Long.prototype.toString.call(o.timeUnixNano):u.longs===Number?new Vt.LongBits(o.timeUnixNano.low>>>0,o.timeUnixNano.high>>>0).toNumber():o.timeUnixNano),o.asDouble!=null&&o.hasOwnProperty("asDouble")&&(d.asDouble=u.json&&!isFinite(o.asDouble)?String(o.asDouble):o.asDouble,u.oneofs&&(d.value="asDouble")),o.spanId!=null&&o.hasOwnProperty("spanId")&&(d.spanId=u.bytes===String?Vt.base64.encode(o.spanId,0,o.spanId.length):u.bytes===Array?Array.prototype.slice.call(o.spanId):o.spanId),o.traceId!=null&&o.hasOwnProperty("traceId")&&(d.traceId=u.bytes===String?Vt.base64.encode(o.traceId,0,o.traceId.length):u.bytes===Array?Array.prototype.slice.call(o.traceId):o.traceId),o.asInt!=null&&o.hasOwnProperty("asInt")&&(typeof o.asInt=="number"?d.asInt=u.longs===String?String(o.asInt):o.asInt:d.asInt=u.longs===String?Vt.Long.prototype.toString.call(o.asInt):u.longs===Number?new Vt.LongBits(o.asInt.low>>>0,o.asInt.high>>>0).toNumber():o.asInt,u.oneofs&&(d.value="asInt")),o.filteredAttributes&&o.filteredAttributes.length){d.filteredAttributes=[];for(var h=0;h<o.filteredAttributes.length;++h)d.filteredAttributes[h]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(o.filteredAttributes[h],u)}return d},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(o){return o===void 0&&(o="type.googleapis.com"),o+"/opentelemetry.proto.metrics.v1.Exemplar"},i})(),a})(),r})(),t.logs=(function(){var r={};return r.v1=(function(){var a={};return a.LogsData=(function(){function i(s){if(this.resourceLogs=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resourceLogs=Vt.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resourceLogs!=null&&e.resourceLogs.length)for(var u=0;u<e.resourceLogs.length;++u)Et.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[u],o.uint32(10).fork()).ldelim();return o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.logs.v1.LogsData;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resourceLogs&&d.resourceLogs.length||(d.resourceLogs=[]),d.resourceLogs.push(Et.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()));break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resourceLogs!=null&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var o=0;o<e.resourceLogs.length;++o){var u=Et.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[o]);if(u)return"resourceLogs."+u}}return null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.logs.v1.LogsData)return e;var o=new Et.opentelemetry.proto.logs.v1.LogsData;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");o.resourceLogs=[];for(var u=0;u<e.resourceLogs.length;++u){if(typeof e.resourceLogs[u]!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");o.resourceLogs[u]=Et.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[u])}}return o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){u.resourceLogs=[];for(var d=0;d<e.resourceLogs.length;++d)u.resourceLogs[d]=Et.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[d],o)}return u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.logs.v1.LogsData"},i})(),a.ResourceLogs=(function(){function i(s){if(this.scopeLogs=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.resource=null,i.prototype.scopeLogs=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.resource!=null&&Object.hasOwnProperty.call(e,"resource")&&Et.opentelemetry.proto.resource.v1.Resource.encode(e.resource,o.uint32(10).fork()).ldelim(),e.scopeLogs!=null&&e.scopeLogs.length)for(var u=0;u<e.scopeLogs.length;++u)Et.opentelemetry.proto.logs.v1.ScopeLogs.encode(e.scopeLogs[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.logs.v1.ResourceLogs;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.resource=Et.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break}case 2:{d.scopeLogs&&d.scopeLogs.length||(d.scopeLogs=[]),d.scopeLogs.push(Et.opentelemetry.proto.logs.v1.ScopeLogs.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.resource!=null&&e.hasOwnProperty("resource")){var o=Et.opentelemetry.proto.resource.v1.Resource.verify(e.resource);if(o)return"resource."+o}if(e.scopeLogs!=null&&e.hasOwnProperty("scopeLogs")){if(!Array.isArray(e.scopeLogs))return"scopeLogs: array expected";for(var u=0;u<e.scopeLogs.length;++u){var o=Et.opentelemetry.proto.logs.v1.ScopeLogs.verify(e.scopeLogs[u]);if(o)return"scopeLogs."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.logs.v1.ResourceLogs)return e;var o=new Et.opentelemetry.proto.logs.v1.ResourceLogs;if(e.resource!=null){if(typeof e.resource!="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");o.resource=Et.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeLogs){if(!Array.isArray(e.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");o.scopeLogs=[];for(var u=0;u<e.scopeLogs.length;++u){if(typeof e.scopeLogs[u]!="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");o.scopeLogs[u]=Et.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(e.scopeLogs[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.scopeLogs=[]),o.defaults&&(u.resource=null,u.schemaUrl=""),e.resource!=null&&e.hasOwnProperty("resource")&&(u.resource=Et.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,o)),e.scopeLogs&&e.scopeLogs.length){u.scopeLogs=[];for(var d=0;d<e.scopeLogs.length;++d)u.scopeLogs[d]=Et.opentelemetry.proto.logs.v1.ScopeLogs.toObject(e.scopeLogs[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.logs.v1.ResourceLogs"},i})(),a.ScopeLogs=(function(){function i(s){if(this.logRecords=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.scope=null,i.prototype.logRecords=Vt.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.scope!=null&&Object.hasOwnProperty.call(e,"scope")&&Et.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,o.uint32(10).fork()).ldelim(),e.logRecords!=null&&e.logRecords.length)for(var u=0;u<e.logRecords.length;++u)Et.opentelemetry.proto.logs.v1.LogRecord.encode(e.logRecords[u],o.uint32(18).fork()).ldelim();return e.schemaUrl!=null&&Object.hasOwnProperty.call(e,"schemaUrl")&&o.uint32(26).string(e.schemaUrl),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.logs.v1.ScopeLogs;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break}case 2:{d.logRecords&&d.logRecords.length||(d.logRecords=[]),d.logRecords.push(Et.opentelemetry.proto.logs.v1.LogRecord.decode(e,e.uint32()));break}case 3:{d.schemaUrl=e.string();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.scope!=null&&e.hasOwnProperty("scope")){var o=Et.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope);if(o)return"scope."+o}if(e.logRecords!=null&&e.hasOwnProperty("logRecords")){if(!Array.isArray(e.logRecords))return"logRecords: array expected";for(var u=0;u<e.logRecords.length;++u){var o=Et.opentelemetry.proto.logs.v1.LogRecord.verify(e.logRecords[u]);if(o)return"logRecords."+o}}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&!Vt.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.logs.v1.ScopeLogs)return e;var o=new Et.opentelemetry.proto.logs.v1.ScopeLogs;if(e.scope!=null){if(typeof e.scope!="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");o.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.logRecords){if(!Array.isArray(e.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");o.logRecords=[];for(var u=0;u<e.logRecords.length;++u){if(typeof e.logRecords[u]!="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");o.logRecords[u]=Et.opentelemetry.proto.logs.v1.LogRecord.fromObject(e.logRecords[u])}}return e.schemaUrl!=null&&(o.schemaUrl=String(e.schemaUrl)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.logRecords=[]),o.defaults&&(u.scope=null,u.schemaUrl=""),e.scope!=null&&e.hasOwnProperty("scope")&&(u.scope=Et.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,o)),e.logRecords&&e.logRecords.length){u.logRecords=[];for(var d=0;d<e.logRecords.length;++d)u.logRecords[d]=Et.opentelemetry.proto.logs.v1.LogRecord.toObject(e.logRecords[d],o)}return e.schemaUrl!=null&&e.hasOwnProperty("schemaUrl")&&(u.schemaUrl=e.schemaUrl),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.logs.v1.ScopeLogs"},i})(),a.SeverityNumber=(function(){var i={},s=Object.create(i);return s[i[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,s[i[1]="SEVERITY_NUMBER_TRACE"]=1,s[i[2]="SEVERITY_NUMBER_TRACE2"]=2,s[i[3]="SEVERITY_NUMBER_TRACE3"]=3,s[i[4]="SEVERITY_NUMBER_TRACE4"]=4,s[i[5]="SEVERITY_NUMBER_DEBUG"]=5,s[i[6]="SEVERITY_NUMBER_DEBUG2"]=6,s[i[7]="SEVERITY_NUMBER_DEBUG3"]=7,s[i[8]="SEVERITY_NUMBER_DEBUG4"]=8,s[i[9]="SEVERITY_NUMBER_INFO"]=9,s[i[10]="SEVERITY_NUMBER_INFO2"]=10,s[i[11]="SEVERITY_NUMBER_INFO3"]=11,s[i[12]="SEVERITY_NUMBER_INFO4"]=12,s[i[13]="SEVERITY_NUMBER_WARN"]=13,s[i[14]="SEVERITY_NUMBER_WARN2"]=14,s[i[15]="SEVERITY_NUMBER_WARN3"]=15,s[i[16]="SEVERITY_NUMBER_WARN4"]=16,s[i[17]="SEVERITY_NUMBER_ERROR"]=17,s[i[18]="SEVERITY_NUMBER_ERROR2"]=18,s[i[19]="SEVERITY_NUMBER_ERROR3"]=19,s[i[20]="SEVERITY_NUMBER_ERROR4"]=20,s[i[21]="SEVERITY_NUMBER_FATAL"]=21,s[i[22]="SEVERITY_NUMBER_FATAL2"]=22,s[i[23]="SEVERITY_NUMBER_FATAL3"]=23,s[i[24]="SEVERITY_NUMBER_FATAL4"]=24,s})(),a.LogRecordFlags=(function(){var i={},s=Object.create(i);return s[i[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,s[i[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,s})(),a.LogRecord=(function(){function i(s){if(this.attributes=[],s)for(var e=Object.keys(s),o=0;o<e.length;++o)s[e[o]]!=null&&(this[e[o]]=s[e[o]])}return i.prototype.timeUnixNano=null,i.prototype.observedTimeUnixNano=null,i.prototype.severityNumber=null,i.prototype.severityText=null,i.prototype.body=null,i.prototype.attributes=Vt.emptyArray,i.prototype.droppedAttributesCount=null,i.prototype.flags=null,i.prototype.traceId=null,i.prototype.spanId=null,i.create=function(e){return new i(e)},i.encode=function(e,o){if(o||(o=ji.create()),e.timeUnixNano!=null&&Object.hasOwnProperty.call(e,"timeUnixNano")&&o.uint32(9).fixed64(e.timeUnixNano),e.severityNumber!=null&&Object.hasOwnProperty.call(e,"severityNumber")&&o.uint32(16).int32(e.severityNumber),e.severityText!=null&&Object.hasOwnProperty.call(e,"severityText")&&o.uint32(26).string(e.severityText),e.body!=null&&Object.hasOwnProperty.call(e,"body")&&Et.opentelemetry.proto.common.v1.AnyValue.encode(e.body,o.uint32(42).fork()).ldelim(),e.attributes!=null&&e.attributes.length)for(var u=0;u<e.attributes.length;++u)Et.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[u],o.uint32(50).fork()).ldelim();return e.droppedAttributesCount!=null&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&o.uint32(56).uint32(e.droppedAttributesCount),e.flags!=null&&Object.hasOwnProperty.call(e,"flags")&&o.uint32(69).fixed32(e.flags),e.traceId!=null&&Object.hasOwnProperty.call(e,"traceId")&&o.uint32(74).bytes(e.traceId),e.spanId!=null&&Object.hasOwnProperty.call(e,"spanId")&&o.uint32(82).bytes(e.spanId),e.observedTimeUnixNano!=null&&Object.hasOwnProperty.call(e,"observedTimeUnixNano")&&o.uint32(89).fixed64(e.observedTimeUnixNano),o},i.encodeDelimited=function(e,o){return this.encode(e,o).ldelim()},i.decode=function(e,o){e instanceof wn||(e=wn.create(e));for(var u=o===void 0?e.len:e.pos+o,d=new Et.opentelemetry.proto.logs.v1.LogRecord;e.pos<u;){var I=e.uint32();switch(I>>>3){case 1:{d.timeUnixNano=e.fixed64();break}case 11:{d.observedTimeUnixNano=e.fixed64();break}case 2:{d.severityNumber=e.int32();break}case 3:{d.severityText=e.string();break}case 5:{d.body=Et.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break}case 6:{d.attributes&&d.attributes.length||(d.attributes=[]),d.attributes.push(Et.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break}case 7:{d.droppedAttributesCount=e.uint32();break}case 8:{d.flags=e.fixed32();break}case 9:{d.traceId=e.bytes();break}case 10:{d.spanId=e.bytes();break}default:e.skipType(I&7);break}}return d},i.decodeDelimited=function(e){return e instanceof wn||(e=new wn(e)),this.decode(e,e.uint32())},i.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.timeUnixNano!=null&&e.hasOwnProperty("timeUnixNano")&&!Vt.isInteger(e.timeUnixNano)&&!(e.timeUnixNano&&Vt.isInteger(e.timeUnixNano.low)&&Vt.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(e.observedTimeUnixNano!=null&&e.hasOwnProperty("observedTimeUnixNano")&&!Vt.isInteger(e.observedTimeUnixNano)&&!(e.observedTimeUnixNano&&Vt.isInteger(e.observedTimeUnixNano.low)&&Vt.isInteger(e.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected";if(e.severityNumber!=null&&e.hasOwnProperty("severityNumber"))switch(e.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:break}if(e.severityText!=null&&e.hasOwnProperty("severityText")&&!Vt.isString(e.severityText))return"severityText: string expected";if(e.body!=null&&e.hasOwnProperty("body")){var o=Et.opentelemetry.proto.common.v1.AnyValue.verify(e.body);if(o)return"body."+o}if(e.attributes!=null&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var u=0;u<e.attributes.length;++u){var o=Et.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[u]);if(o)return"attributes."+o}}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&!Vt.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":e.flags!=null&&e.hasOwnProperty("flags")&&!Vt.isInteger(e.flags)?"flags: integer expected":e.traceId!=null&&e.hasOwnProperty("traceId")&&!(e.traceId&&typeof e.traceId.length=="number"||Vt.isString(e.traceId))?"traceId: buffer expected":e.spanId!=null&&e.hasOwnProperty("spanId")&&!(e.spanId&&typeof e.spanId.length=="number"||Vt.isString(e.spanId))?"spanId: buffer expected":null},i.fromObject=function(e){if(e instanceof Et.opentelemetry.proto.logs.v1.LogRecord)return e;var o=new Et.opentelemetry.proto.logs.v1.LogRecord;switch(e.timeUnixNano!=null&&(Vt.Long?(o.timeUnixNano=Vt.Long.fromValue(e.timeUnixNano)).unsigned=!1:typeof e.timeUnixNano=="string"?o.timeUnixNano=parseInt(e.timeUnixNano,10):typeof e.timeUnixNano=="number"?o.timeUnixNano=e.timeUnixNano:typeof e.timeUnixNano=="object"&&(o.timeUnixNano=new Vt.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),e.observedTimeUnixNano!=null&&(Vt.Long?(o.observedTimeUnixNano=Vt.Long.fromValue(e.observedTimeUnixNano)).unsigned=!1:typeof e.observedTimeUnixNano=="string"?o.observedTimeUnixNano=parseInt(e.observedTimeUnixNano,10):typeof e.observedTimeUnixNano=="number"?o.observedTimeUnixNano=e.observedTimeUnixNano:typeof e.observedTimeUnixNano=="object"&&(o.observedTimeUnixNano=new Vt.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber())),e.severityNumber){default:if(typeof e.severityNumber=="number"){o.severityNumber=e.severityNumber;break}break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:o.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:o.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:o.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:o.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:o.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:o.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:o.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:o.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:o.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:o.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:o.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:o.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:o.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:o.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:o.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:o.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:o.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:o.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:o.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:o.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:o.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:o.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:o.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:o.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:o.severityNumber=24;break}if(e.severityText!=null&&(o.severityText=String(e.severityText)),e.body!=null){if(typeof e.body!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");o.body=Et.opentelemetry.proto.common.v1.AnyValue.fromObject(e.body)}if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");o.attributes=[];for(var u=0;u<e.attributes.length;++u){if(typeof e.attributes[u]!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");o.attributes[u]=Et.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[u])}}return e.droppedAttributesCount!=null&&(o.droppedAttributesCount=e.droppedAttributesCount>>>0),e.flags!=null&&(o.flags=e.flags>>>0),e.traceId!=null&&(typeof e.traceId=="string"?Vt.base64.decode(e.traceId,o.traceId=Vt.newBuffer(Vt.base64.length(e.traceId)),0):e.traceId.length>=0&&(o.traceId=e.traceId)),e.spanId!=null&&(typeof e.spanId=="string"?Vt.base64.decode(e.spanId,o.spanId=Vt.newBuffer(Vt.base64.length(e.spanId)),0):e.spanId.length>=0&&(o.spanId=e.spanId)),o},i.toObject=function(e,o){o||(o={});var u={};if((o.arrays||o.defaults)&&(u.attributes=[]),o.defaults){if(Vt.Long){var d=new Vt.Long(0,0,!1);u.timeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.timeUnixNano=o.longs===String?"0":0;if(u.severityNumber=o.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,u.severityText="",u.body=null,u.droppedAttributesCount=0,u.flags=0,o.bytes===String?u.traceId="":(u.traceId=[],o.bytes!==Array&&(u.traceId=Vt.newBuffer(u.traceId))),o.bytes===String?u.spanId="":(u.spanId=[],o.bytes!==Array&&(u.spanId=Vt.newBuffer(u.spanId))),Vt.Long){var d=new Vt.Long(0,0,!1);u.observedTimeUnixNano=o.longs===String?d.toString():o.longs===Number?d.toNumber():d}else u.observedTimeUnixNano=o.longs===String?"0":0}if(e.timeUnixNano!=null&&e.hasOwnProperty("timeUnixNano")&&(typeof e.timeUnixNano=="number"?u.timeUnixNano=o.longs===String?String(e.timeUnixNano):e.timeUnixNano:u.timeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.timeUnixNano):o.longs===Number?new Vt.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),e.severityNumber!=null&&e.hasOwnProperty("severityNumber")&&(u.severityNumber=o.enums===String?Et.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]===void 0?e.severityNumber:Et.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]:e.severityNumber),e.severityText!=null&&e.hasOwnProperty("severityText")&&(u.severityText=e.severityText),e.body!=null&&e.hasOwnProperty("body")&&(u.body=Et.opentelemetry.proto.common.v1.AnyValue.toObject(e.body,o)),e.attributes&&e.attributes.length){u.attributes=[];for(var I=0;I<e.attributes.length;++I)u.attributes[I]=Et.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[I],o)}return e.droppedAttributesCount!=null&&e.hasOwnProperty("droppedAttributesCount")&&(u.droppedAttributesCount=e.droppedAttributesCount),e.flags!=null&&e.hasOwnProperty("flags")&&(u.flags=e.flags),e.traceId!=null&&e.hasOwnProperty("traceId")&&(u.traceId=o.bytes===String?Vt.base64.encode(e.traceId,0,e.traceId.length):o.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),e.spanId!=null&&e.hasOwnProperty("spanId")&&(u.spanId=o.bytes===String?Vt.base64.encode(e.spanId,0,e.spanId.length):o.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),e.observedTimeUnixNano!=null&&e.hasOwnProperty("observedTimeUnixNano")&&(typeof e.observedTimeUnixNano=="number"?u.observedTimeUnixNano=o.longs===String?String(e.observedTimeUnixNano):e.observedTimeUnixNano:u.observedTimeUnixNano=o.longs===String?Vt.Long.prototype.toString.call(e.observedTimeUnixNano):o.longs===Number?new Vt.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber():e.observedTimeUnixNano),u},i.prototype.toJSON=function(){return this.constructor.toObject(this,za.util.toJSONOptions)},i.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/opentelemetry.proto.logs.v1.LogRecord"},i})(),a})(),r})(),t})(),n})();HYn.exports=Et});var kYn=ve(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});Ax.ProtobufTraceSerializer=Ax.ProtobufMetricsSerializer=Ax.ProtobufLogsSerializer=void 0;var XM=XYn(),t4a=Zye(),n4a=BFe(),r4a=JFe(),a4a=XM.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,i4a=XM.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,l4a=XM.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,s4a=XM.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,o4a=XM.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,c4a=XM.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;Ax.ProtobufLogsSerializer={serializeRequest:n=>{let t=(0,r4a.createExportLogsServiceRequest)(n);return i4a.encode(t).finish()},deserializeResponse:n=>a4a.decode(n)};Ax.ProtobufMetricsSerializer={serializeRequest:n=>{let t=(0,n4a.createExportMetricsServiceRequest)(n);return s4a.encode(t).finish()},deserializeResponse:n=>l4a.decode(n)};Ax.ProtobufTraceSerializer={serializeRequest:n=>{let t=(0,t4a.createExportTraceServiceRequest)(n);return c4a.encode(t).finish()},deserializeResponse:n=>o4a.decode(n)}});var LYn=ve(Wx=>{"use strict";Object.defineProperty(Wx,"__esModule",{value:!0});Wx.JsonLogsSerializer=Wx.JsonMetricsSerializer=Wx.JsonTraceSerializer=void 0;var u4a=Zye(),I4a=BFe(),d4a=JFe();Wx.JsonTraceSerializer={serializeRequest:n=>{let t=(0,u4a.createExportTraceServiceRequest)(n,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:n=>{let t=new TextDecoder;return JSON.parse(t.decode(n))}};Wx.JsonMetricsSerializer={serializeRequest:n=>{let t=(0,I4a.createExportMetricsServiceRequest)(n,{useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:n=>{let t=new TextDecoder;return JSON.parse(t.decode(n))}};Wx.JsonLogsSerializer={serializeRequest:n=>{let t=(0,d4a.createExportLogsServiceRequest)(n,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:n=>{let t=new TextDecoder;return JSON.parse(t.decode(n))}}});var xk=ve(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.JsonMetricsSerializer=qs.JsonLogsSerializer=qs.JsonTraceSerializer=qs.ProtobufTraceSerializer=qs.ProtobufMetricsSerializer=qs.ProtobufLogsSerializer=qs.createExportLogsServiceRequest=qs.createExportMetricsServiceRequest=qs.createExportTraceServiceRequest=qs.ESpanKind=qs.hrTimeToNanos=qs.encodeAsString=qs.encodeAsLongBits=qs.getOtlpEncoder=qs.toLongBits=void 0;var Sle=Wle();Object.defineProperty(qs,"toLongBits",{enumerable:!0,get:function(){return Sle.toLongBits}});Object.defineProperty(qs,"getOtlpEncoder",{enumerable:!0,get:function(){return Sle.getOtlpEncoder}});Object.defineProperty(qs,"encodeAsLongBits",{enumerable:!0,get:function(){return Sle.encodeAsLongBits}});Object.defineProperty(qs,"encodeAsString",{enumerable:!0,get:function(){return Sle.encodeAsString}});Object.defineProperty(qs,"hrTimeToNanos",{enumerable:!0,get:function(){return Sle.hrTimeToNanos}});var h4a=Uwn();Object.defineProperty(qs,"ESpanKind",{enumerable:!0,get:function(){return h4a.ESpanKind}});var m4a=Zye();Object.defineProperty(qs,"createExportTraceServiceRequest",{enumerable:!0,get:function(){return m4a.createExportTraceServiceRequest}});var p4a=BFe();Object.defineProperty(qs,"createExportMetricsServiceRequest",{enumerable:!0,get:function(){return p4a.createExportMetricsServiceRequest}});var b4a=JFe();Object.defineProperty(qs,"createExportLogsServiceRequest",{enumerable:!0,get:function(){return b4a.createExportLogsServiceRequest}});var Xut=kYn();Object.defineProperty(qs,"ProtobufLogsSerializer",{enumerable:!0,get:function(){return Xut.ProtobufLogsSerializer}});Object.defineProperty(qs,"ProtobufMetricsSerializer",{enumerable:!0,get:function(){return Xut.ProtobufMetricsSerializer}});Object.defineProperty(qs,"ProtobufTraceSerializer",{enumerable:!0,get:function(){return Xut.ProtobufTraceSerializer}});var kut=LYn();Object.defineProperty(qs,"JsonTraceSerializer",{enumerable:!0,get:function(){return kut.JsonTraceSerializer}});Object.defineProperty(qs,"JsonLogsSerializer",{enumerable:!0,get:function(){return kut.JsonLogsSerializer}});Object.defineProperty(qs,"JsonMetricsSerializer",{enumerable:!0,get:function(){return kut.JsonMetricsSerializer}})});var SYn=ve(TFe=>{"use strict";Object.defineProperty(TFe,"__esModule",{value:!0});TFe.VERSION=void 0;TFe.VERSION="0.52.1"});var BYn=ve(OFe=>{"use strict";Object.defineProperty(OFe,"__esModule",{value:!0});OFe.OTLPTraceExporter=void 0;var DFe=Va(),Lut=bye(),f4a=xk(),G4a=SYn(),g4a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${G4a.VERSION}`},Sut=class extends Lut.OTLPGRPCExporterNodeBase{constructor(t={}){let r=Object.assign(Object.assign({},g4a),DFe.baggageUtils.parseKeyPairsIntoRecord((0,DFe.getEnv)().OTEL_EXPORTER_OTLP_TRACES_HEADERS));super(t,r,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export",f4a.ProtobufTraceSerializer)}getDefaultUrl(t){return(0,Lut.validateAndNormalizeUrl)(this.getUrlFromConfig(t))}getUrlFromConfig(t){return typeof t.url=="string"?t.url:(0,DFe.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||(0,DFe.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT||Lut.DEFAULT_COLLECTOR_URL}};OFe.OTLPTraceExporter=Sut});var But=ve(Vk=>{"use strict";var v4a=Vk&&Vk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),Z4a=Vk&&Vk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&v4a(t,n,r)};Object.defineProperty(Vk,"__esModule",{value:!0});Z4a(BYn(),Vk)});var JYn=ve(UFe=>{"use strict";Object.defineProperty(UFe,"__esModule",{value:!0});UFe.VERSION=void 0;UFe.VERSION="0.52.1"});var TYn=ve(zFe=>{"use strict";Object.defineProperty(zFe,"__esModule",{value:!0});zFe.OTLPLogExporter=void 0;var MFe=Va(),Jut=bye(),N4a=xk(),A4a=JYn(),W4a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${A4a.VERSION}`},Tut=class extends Jut.OTLPGRPCExporterNodeBase{constructor(t={}){let r=Object.assign(Object.assign({},W4a),MFe.baggageUtils.parseKeyPairsIntoRecord((0,MFe.getEnv)().OTEL_EXPORTER_OTLP_LOGS_HEADERS));super(t,r,"LogsExportService","/opentelemetry.proto.collector.logs.v1.LogsService/Export",N4a.ProtobufLogsSerializer)}getDefaultUrl(t){return(0,Jut.validateAndNormalizeUrl)(this.getUrlFromConfig(t))}getUrlFromConfig(t){return typeof t.url=="string"?t.url:(0,MFe.getEnv)().OTEL_EXPORTER_OTLP_LOGS_ENDPOINT||(0,MFe.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT||Jut.DEFAULT_COLLECTOR_URL}};zFe.OTLPLogExporter=Tut});var DYn=ve(Qk=>{"use strict";var y4a=Qk&&Qk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),F4a=Qk&&Qk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&y4a(t,n,r)};Object.defineProperty(Qk,"__esModule",{value:!0});F4a(TYn(),Qk)});var Dut=ve(Ble=>{"use strict";Object.defineProperty(Ble,"__esModule",{value:!0});Ble.AggregationTemporalityPreference=void 0;var E4a;(function(n){n[n.DELTA=0]="DELTA",n[n.CUMULATIVE=1]="CUMULATIVE",n[n.LOWMEMORY=2]="LOWMEMORY"})(E4a=Ble.AggregationTemporalityPreference||(Ble.AggregationTemporalityPreference={}))});var Uut=ve(Sm=>{"use strict";Object.defineProperty(Sm,"__esModule",{value:!0});Sm.OTLPMetricExporterBase=Sm.LowMemoryTemporalitySelector=Sm.DeltaTemporalitySelector=Sm.CumulativeTemporalitySelector=void 0;var R4a=Va(),qd=VM(),OYn=Dut(),w4a=(Qr(),dr(kr)),C4a=()=>qd.AggregationTemporality.CUMULATIVE;Sm.CumulativeTemporalitySelector=C4a;var Y4a=n=>{switch(n){case qd.InstrumentType.COUNTER:case qd.InstrumentType.OBSERVABLE_COUNTER:case qd.InstrumentType.GAUGE:case qd.InstrumentType.HISTOGRAM:case qd.InstrumentType.OBSERVABLE_GAUGE:return qd.AggregationTemporality.DELTA;case qd.InstrumentType.UP_DOWN_COUNTER:case qd.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:return qd.AggregationTemporality.CUMULATIVE}};Sm.DeltaTemporalitySelector=Y4a;var x4a=n=>{switch(n){case qd.InstrumentType.COUNTER:case qd.InstrumentType.HISTOGRAM:return qd.AggregationTemporality.DELTA;case qd.InstrumentType.GAUGE:case qd.InstrumentType.UP_DOWN_COUNTER:case qd.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:case qd.InstrumentType.OBSERVABLE_COUNTER:case qd.InstrumentType.OBSERVABLE_GAUGE:return qd.AggregationTemporality.CUMULATIVE}};Sm.LowMemoryTemporalitySelector=x4a;function V4a(){let n=(0,R4a.getEnv)(),t=n.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();return t==="cumulative"?Sm.CumulativeTemporalitySelector:t==="delta"?Sm.DeltaTemporalitySelector:t==="lowmemory"?Sm.LowMemoryTemporalitySelector:(w4a.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${n.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Sm.CumulativeTemporalitySelector)}function Q4a(n){return n!=null?n===OYn.AggregationTemporalityPreference.DELTA?Sm.DeltaTemporalitySelector:n===OYn.AggregationTemporalityPreference.LOWMEMORY?Sm.LowMemoryTemporalitySelector:Sm.CumulativeTemporalitySelector:V4a()}function H4a(n){return n?.aggregationPreference?n.aggregationPreference:t=>qd.Aggregation.Default()}var Out=class{constructor(t,r){this._otlpExporter=t,this._aggregationSelector=H4a(r),this._aggregationTemporalitySelector=Q4a(r?.temporalityPreference)}export(t,r){this._otlpExporter.export([t],r)}async shutdown(){await this._otlpExporter.shutdown()}forceFlush(){return Promise.resolve()}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}};Sm.OTLPMetricExporterBase=Out});var UYn=ve(_Fe=>{"use strict";Object.defineProperty(_Fe,"__esModule",{value:!0});_Fe.VERSION=void 0;_Fe.VERSION="0.52.1"});var zYn=ve(jFe=>{"use strict";Object.defineProperty(jFe,"__esModule",{value:!0});jFe.OTLPMetricExporter=void 0;var kM=Va(),X4a=Uut(),PFe=PY(),k4a=xk(),L4a=UYn(),MYn="v1/metrics",S4a=`http://localhost:4318/${MYn}`,B4a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${L4a.VERSION}`},Mut=class extends PFe.OTLPExporterNodeBase{constructor(t){super(t,k4a.JsonMetricsSerializer,"application/json"),this.headers=Object.assign(Object.assign(Object.assign(Object.assign({},this.headers),B4a),kM.baggageUtils.parseKeyPairsIntoRecord((0,kM.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS)),(0,PFe.parseHeaders)(t?.headers))}getDefaultUrl(t){return typeof t.url=="string"?t.url:(0,kM.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length>0?(0,PFe.appendRootPathToUrlIfNeeded)((0,kM.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT):(0,kM.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length>0?(0,PFe.appendResourcePathToUrl)((0,kM.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT,MYn):S4a}},zut=class extends X4a.OTLPMetricExporterBase{constructor(t){super(new Mut(t),t)}};jFe.OTLPMetricExporter=zut});var _Yn=ve(Hk=>{"use strict";var J4a=Hk&&Hk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),T4a=Hk&&Hk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&J4a(t,n,r)};Object.defineProperty(Hk,"__esModule",{value:!0});T4a(zYn(),Hk)});var PYn=ve(Xk=>{"use strict";var D4a=Xk&&Xk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),O4a=Xk&&Xk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&D4a(t,n,r)};Object.defineProperty(Xk,"__esModule",{value:!0});O4a(_Yn(),Xk)});var jYn=ve(jR=>{"use strict";var U4a=jR&&jR.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),_ut=jR&&jR.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&U4a(t,n,r)};Object.defineProperty(jR,"__esModule",{value:!0});_ut(PYn(),jR);_ut(Dut(),jR);_ut(Uut(),jR)});var KYn=ve(KFe=>{"use strict";Object.defineProperty(KFe,"__esModule",{value:!0});KFe.VERSION=void 0;KFe.VERSION="0.52.1"});var qYn=ve($Fe=>{"use strict";Object.defineProperty($Fe,"__esModule",{value:!0});$Fe.OTLPMetricExporter=void 0;var M4a=jYn(),Put=bye(),qFe=Va(),z4a=xk(),_4a=KYn(),P4a=PY(),j4a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${_4a.VERSION}`},jut=class extends Put.OTLPGRPCExporterNodeBase{constructor(t){let r=Object.assign(Object.assign(Object.assign({},j4a),qFe.baggageUtils.parseKeyPairsIntoRecord((0,qFe.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS)),(0,P4a.parseHeaders)(t?.headers));super(t,r,"MetricsExportService","/opentelemetry.proto.collector.metrics.v1.MetricsService/Export",z4a.ProtobufMetricsSerializer)}getDefaultUrl(t){return(0,Put.validateAndNormalizeUrl)(this.getUrlFromConfig(t))}getUrlFromConfig(t){return typeof t.url=="string"?t.url:(0,qFe.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT||(0,qFe.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT||Put.DEFAULT_COLLECTOR_URL}},Kut=class extends M4a.OTLPMetricExporterBase{constructor(t){super(new jut(t),t)}};$Fe.OTLPMetricExporter=Kut});var $Yn=ve(kk=>{"use strict";var K4a=kk&&kk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),q4a=kk&&kk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K4a(t,n,r)};Object.defineProperty(kk,"__esModule",{value:!0});q4a(qYn(),kk)});var $ut=ve(t5e=>{"use strict";Object.defineProperty(t5e,"__esModule",{value:!0});t5e.LogRecord=void 0;var $4a=(Qr(),dr(kr)),LM=(Qr(),dr(kr)),e5e=Va(),qut=class{constructor(t,r,a){this.attributes={},this.totalAttributesCount=0,this._isReadonly=!1;let{timestamp:i,observedTimestamp:s,severityNumber:e,severityText:o,body:u,attributes:d={},context:I}=a,h=Date.now();if(this.hrTime=(0,e5e.timeInputToHrTime)(i??h),this.hrTimeObserved=(0,e5e.timeInputToHrTime)(s??h),I){let c=LM.trace.getSpanContext(I);c&&LM.isSpanContextValid(c)&&(this.spanContext=c)}this.severityNumber=e,this.severityText=o,this.body=u,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this.setAttributes(d)}set severityText(t){this._isLogRecordReadonly()||(this._severityText=t)}get severityText(){return this._severityText}set severityNumber(t){this._isLogRecordReadonly()||(this._severityNumber=t)}get severityNumber(){return this._severityNumber}set body(t){this._isLogRecordReadonly()||(this._body=t)}get body(){return this._body}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}setAttribute(t,r){return this._isLogRecordReadonly()?this:r===null?this:t.length===0?(LM.diag.warn(`Invalid attribute key: ${t}`),this):!(0,e5e.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(LM.diag.warn(`Invalid attribute value set for key: ${t}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this.droppedAttributesCount===1&&LM.diag.warn("Dropping extra attributes."),this):((0,e5e.isAttributeValue)(r)?this.attributes[t]=this._truncateToSize(r):this.attributes[t]=r,this))}setAttributes(t){for(let[r,a]of Object.entries(t))this.setAttribute(r,a);return this}setBody(t){return this.body=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(t){let r=this._logRecordLimits.attributeValueLengthLimit;return r<=0?(LM.diag.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(a=>typeof a=="string"?this._truncateToLimitUtil(a,r):a):t}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&$4a.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};t5e.LogRecord=qut});var exn=ve(n5e=>{"use strict";Object.defineProperty(n5e,"__esModule",{value:!0});n5e.Logger=void 0;var ewa=(Qr(),dr(kr)),twa=$ut(),eIt=class{constructor(t,r){this.instrumentationScope=t,this._sharedState=r}emit(t){let r=t.context||ewa.context.active(),a=new twa.LogRecord(this._sharedState,this.instrumentationScope,Object.assign({context:r},t));this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}};n5e.Logger=eIt});var txn=ve(SM=>{"use strict";Object.defineProperty(SM,"__esModule",{value:!0});SM.reconfigureLimits=SM.loadDefaultConfig=void 0;var Jle=Va();function nwa(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,Jle.getEnv)().OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:(0,Jle.getEnv)().OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT},includeTraceContext:!0}}SM.loadDefaultConfig=nwa;function rwa(n){var t,r,a,i,s,e;let o=(0,Jle.getEnvWithoutDefaults)();return{attributeCountLimit:(a=(r=(t=n.attributeCountLimit)!==null&&t!==void 0?t:o.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT)!==null&&r!==void 0?r:o.OTEL_ATTRIBUTE_COUNT_LIMIT)!==null&&a!==void 0?a:Jle.DEFAULT_ATTRIBUTE_COUNT_LIMIT,attributeValueLengthLimit:(e=(s=(i=n.attributeValueLengthLimit)!==null&&i!==void 0?i:o.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&s!==void 0?s:o.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&e!==void 0?e:Jle.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT}}SM.reconfigureLimits=rwa});var nxn=ve(r5e=>{"use strict";Object.defineProperty(r5e,"__esModule",{value:!0});r5e.MultiLogRecordProcessor=void 0;var awa=Va(),tIt=class{constructor(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>(0,awa.callWithTimeout)(r.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(a=>a.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(t=>t.shutdown()))}};r5e.MultiLogRecordProcessor=tIt});var rIt=ve(a5e=>{"use strict";Object.defineProperty(a5e,"__esModule",{value:!0});a5e.NoopLogRecordProcessor=void 0;var nIt=class{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}};a5e.NoopLogRecordProcessor=nIt});var rxn=ve(i5e=>{"use strict";Object.defineProperty(i5e,"__esModule",{value:!0});i5e.LoggerProviderSharedState=void 0;var iwa=rIt(),aIt=class{constructor(t,r,a){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=a,this.loggers=new Map,this.registeredLogRecordProcessors=[],this.activeProcessor=new iwa.NoopLogRecordProcessor}};i5e.LoggerProviderSharedState=aIt});var sxn=ve(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});Lk.LoggerProvider=Lk.DEFAULT_LOGGER_NAME=void 0;var Tle=(Qr(),dr(kr)),lwa=pU(),axn=gx(),ixn=Va(),swa=exn(),lxn=txn(),owa=nxn(),cwa=rxn();Lk.DEFAULT_LOGGER_NAME="unknown";var iIt=class{constructor(t={}){var r;let a=(0,ixn.merge)({},(0,lxn.loadDefaultConfig)(),t),i=axn.Resource.default().merge((r=a.resource)!==null&&r!==void 0?r:axn.Resource.empty());this._sharedState=new cwa.LoggerProviderSharedState(i,a.forceFlushTimeoutMillis,(0,lxn.reconfigureLimits)(a.logRecordLimits)),this._shutdownOnce=new ixn.BindOnceFuture(this._shutdown,this)}getLogger(t,r,a){if(this._shutdownOnce.isCalled)return Tle.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),lwa.NOOP_LOGGER;t||Tle.diag.warn("Logger requested without instrumentation scope name.");let i=t||Lk.DEFAULT_LOGGER_NAME,s=`${i}@${r||""}:${a?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new swa.Logger({name:i,version:r,schemaUrl:a?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}addLogRecordProcessor(t){this._sharedState.registeredLogRecordProcessors.length===0&&this._sharedState.activeProcessor.shutdown().catch(r=>Tle.diag.error("Error while trying to shutdown current log record processor",r)),this._sharedState.registeredLogRecordProcessors.push(t),this._sharedState.activeProcessor=new owa.MultiLogRecordProcessor(this._sharedState.registeredLogRecordProcessors,this._sharedState.forceFlushTimeoutMillis)}forceFlush(){return this._shutdownOnce.isCalled?(Tle.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(Tle.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};Lk.LoggerProvider=iIt});var oxn=ve(l5e=>{"use strict";Object.defineProperty(l5e,"__esModule",{value:!0});l5e.ConsoleLogRecordExporter=void 0;var uwa=Va(),Iwa=Va(),lIt=class{export(t,r){this._sendLogRecords(t,r)}shutdown(){return Promise.resolve()}_exportInfo(t){var r,a,i;return{resource:{attributes:t.resource.attributes},timestamp:(0,uwa.hrTimeToMicroseconds)(t.hrTime),traceId:(r=t.spanContext)===null||r===void 0?void 0:r.traceId,spanId:(a=t.spanContext)===null||a===void 0?void 0:a.spanId,traceFlags:(i=t.spanContext)===null||i===void 0?void 0:i.traceFlags,severityText:t.severityText,severityNumber:t.severityNumber,body:t.body,attributes:t.attributes}}_sendLogRecords(t,r){for(let a of t)console.dir(this._exportInfo(a),{depth:3});r?.({code:Iwa.ExportResultCode.SUCCESS})}};l5e.ConsoleLogRecordExporter=lIt});var cxn=ve(s5e=>{"use strict";Object.defineProperty(s5e,"__esModule",{value:!0});s5e.SimpleLogRecordProcessor=void 0;var BM=Va(),sIt=class{constructor(t){this._exporter=t,this._shutdownOnce=new BM.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(t){var r,a;if(this._shutdownOnce.isCalled)return;let i=()=>BM.internal._export(this._exporter,[t]).then(s=>{var e;s.code!==BM.ExportResultCode.SUCCESS&&(0,BM.globalErrorHandler)((e=s.error)!==null&&e!==void 0?e:new Error(`SimpleLogRecordProcessor: log record export failed (status ${s})`))}).catch(BM.globalErrorHandler);if(t.resource.asyncAttributesPending){let s=(a=(r=t.resource).waitForAsyncAttributes)===null||a===void 0?void 0:a.call(r).then(()=>(this._unresolvedExports.delete(s),i()),BM.globalErrorHandler);s!=null&&this._unresolvedExports.add(s)}else i()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};s5e.SimpleLogRecordProcessor=sIt});var Ixn=ve(o5e=>{"use strict";Object.defineProperty(o5e,"__esModule",{value:!0});o5e.InMemoryLogRecordExporter=void 0;var uxn=Va(),oIt=class{constructor(){this._finishedLogRecords=[],this._stopped=!1}export(t,r){if(this._stopped)return r({code:uxn.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...t),r({code:uxn.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};o5e.InMemoryLogRecordExporter=oIt});var dxn=ve(c5e=>{"use strict";Object.defineProperty(c5e,"__esModule",{value:!0});c5e.BatchLogRecordProcessorBase=void 0;var dwa=(Qr(),dr(kr)),ZF=Va(),cIt=class{constructor(t,r){var a,i,s,e;this._exporter=t,this._finishedLogRecords=[];let o=(0,ZF.getEnv)();this._maxExportBatchSize=(a=r?.maxExportBatchSize)!==null&&a!==void 0?a:o.OTEL_BLRP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize=(i=r?.maxQueueSize)!==null&&i!==void 0?i:o.OTEL_BLRP_MAX_QUEUE_SIZE,this._scheduledDelayMillis=(s=r?.scheduledDelayMillis)!==null&&s!==void 0?s:o.OTEL_BLRP_SCHEDULE_DELAY,this._exportTimeoutMillis=(e=r?.exportTimeoutMillis)!==null&&e!==void 0?e:o.OTEL_BLRP_EXPORT_TIMEOUT,this._shutdownOnce=new ZF.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(dwa.diag.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(t){this._shutdownOnce.isCalled||this._addToBuffer(t)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())}_flushAll(){return new Promise((t,r)=>{let a=[],i=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let s=0;s<i;s++)a.push(this._flushOneBatch());Promise.all(a).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((t,r)=>{(0,ZF.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>t()).catch(r)})}_maybeStartTimer(){this._timer===void 0&&(this._timer=setTimeout(()=>{this._flushOneBatch().then(()=>{this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(t=>{(0,ZF.globalErrorHandler)(t)})},this._scheduledDelayMillis),(0,ZF.unrefTimer)(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(t){let r=()=>ZF.internal._export(this._exporter,t).then(i=>{var s;i.code!==ZF.ExportResultCode.SUCCESS&&(0,ZF.globalErrorHandler)((s=i.error)!==null&&s!==void 0?s:new Error(`BatchLogRecordProcessor: log record export failed (status ${i})`))}).catch(ZF.globalErrorHandler),a=t.map(i=>i.resource).filter(i=>i.asyncAttributesPending);return a.length===0?r():Promise.all(a.map(i=>{var s;return(s=i.waitForAsyncAttributes)===null||s===void 0?void 0:s.call(i)})).then(r,ZF.globalErrorHandler)}};c5e.BatchLogRecordProcessorBase=cIt});var hxn=ve(u5e=>{"use strict";Object.defineProperty(u5e,"__esModule",{value:!0});u5e.BatchLogRecordProcessor=void 0;var hwa=dxn(),uIt=class extends hwa.BatchLogRecordProcessorBase{onShutdown(){}};u5e.BatchLogRecordProcessor=uIt});var mxn=ve(I5e=>{"use strict";Object.defineProperty(I5e,"__esModule",{value:!0});I5e.BatchLogRecordProcessor=void 0;var mwa=hxn();Object.defineProperty(I5e,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return mwa.BatchLogRecordProcessor}})});var pxn=ve(d5e=>{"use strict";Object.defineProperty(d5e,"__esModule",{value:!0});d5e.BatchLogRecordProcessor=void 0;var pwa=mxn();Object.defineProperty(d5e,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return pwa.BatchLogRecordProcessor}})});var h5e=ve(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});rb.BatchLogRecordProcessor=rb.InMemoryLogRecordExporter=rb.SimpleLogRecordProcessor=rb.ConsoleLogRecordExporter=rb.NoopLogRecordProcessor=rb.LogRecord=rb.LoggerProvider=void 0;var bwa=sxn();Object.defineProperty(rb,"LoggerProvider",{enumerable:!0,get:function(){return bwa.LoggerProvider}});var fwa=$ut();Object.defineProperty(rb,"LogRecord",{enumerable:!0,get:function(){return fwa.LogRecord}});var Gwa=rIt();Object.defineProperty(rb,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return Gwa.NoopLogRecordProcessor}});var gwa=oxn();Object.defineProperty(rb,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return gwa.ConsoleLogRecordExporter}});var vwa=cxn();Object.defineProperty(rb,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return vwa.SimpleLogRecordProcessor}});var Zwa=Ixn();Object.defineProperty(rb,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return Zwa.InMemoryLogRecordExporter}});var Nwa=pxn();Object.defineProperty(rb,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return Nwa.BatchLogRecordProcessor}})});var dIt=ve(m5e=>{"use strict";Object.defineProperty(m5e,"__esModule",{value:!0});m5e.AbstractAsyncHooksContextManager=void 0;var Awa=vt("events"),Wwa=["addListener","on","once","prependListener","prependOnceListener"],IIt=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(t,r){return r instanceof Awa.EventEmitter?this._bindEventEmitter(t,r):typeof r=="function"?this._bindFunction(t,r):r}_bindFunction(t,r){let a=this,i=function(...s){return a.with(t,()=>r.apply(this,s))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),i}_bindEventEmitter(t,r){return this._getPatchMap(r)!==void 0||(this._createPatchMap(r),Wwa.forEach(i=>{r[i]!==void 0&&(r[i]=this._patchAddListener(r,r[i],t))}),typeof r.removeListener=="function"&&(r.removeListener=this._patchRemoveListener(r,r.removeListener)),typeof r.off=="function"&&(r.off=this._patchRemoveListener(r,r.off)),typeof r.removeAllListeners=="function"&&(r.removeAllListeners=this._patchRemoveAllListeners(r,r.removeAllListeners))),r}_patchRemoveListener(t,r){let a=this;return function(i,s){var e;let o=(e=a._getPatchMap(t))===null||e===void 0?void 0:e[i];if(o===void 0)return r.call(this,i,s);let u=o.get(s);return r.call(this,i,u||s)}}_patchRemoveAllListeners(t,r){let a=this;return function(i){let s=a._getPatchMap(t);return s!==void 0&&(arguments.length===0?a._createPatchMap(t):s[i]!==void 0&&delete s[i]),r.apply(this,arguments)}}_patchAddListener(t,r,a){let i=this;return function(s,e){if(i._wrapped)return r.call(this,s,e);let o=i._getPatchMap(t);o===void 0&&(o=i._createPatchMap(t));let u=o[s];u===void 0&&(u=new WeakMap,o[s]=u);let d=i.bind(a,e);u.set(e,d),i._wrapped=!0;try{return r.call(this,s,d)}finally{i._wrapped=!1}}}_createPatchMap(t){let r=Object.create(null);return t[this._kOtListeners]=r,r}_getPatchMap(t){return t[this._kOtListeners]}};m5e.AbstractAsyncHooksContextManager=IIt});var bxn=ve(p5e=>{"use strict";Object.defineProperty(p5e,"__esModule",{value:!0});p5e.AsyncHooksContextManager=void 0;var ywa=(Qr(),dr(kr)),Fwa=vt("async_hooks"),Ewa=dIt(),hIt=class extends Ewa.AbstractAsyncHooksContextManager{constructor(){super(),this._contexts=new Map,this._stack=[],this._asyncHook=Fwa.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){var t;return(t=this._stack[this._stack.length-1])!==null&&t!==void 0?t:ywa.ROOT_CONTEXT}with(t,r,a,...i){this._enterContext(t);try{return r.call(a,...i)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(t,r){if(r==="TIMERWRAP")return;let a=this._stack[this._stack.length-1];a!==void 0&&this._contexts.set(t,a)}_destroy(t){this._contexts.delete(t)}_before(t){let r=this._contexts.get(t);r!==void 0&&this._enterContext(r)}_after(){this._exitContext()}_enterContext(t){this._stack.push(t)}_exitContext(){this._stack.pop()}};p5e.AsyncHooksContextManager=hIt});var fxn=ve(b5e=>{"use strict";Object.defineProperty(b5e,"__esModule",{value:!0});b5e.AsyncLocalStorageContextManager=void 0;var Rwa=(Qr(),dr(kr)),wwa=vt("async_hooks"),Cwa=dIt(),mIt=class extends Cwa.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new wwa.AsyncLocalStorage}active(){var t;return(t=this._asyncLocalStorage.getStore())!==null&&t!==void 0?t:Rwa.ROOT_CONTEXT}with(t,r,a,...i){let s=a==null?r:r.bind(a);return this._asyncLocalStorage.run(t,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};b5e.AsyncLocalStorageContextManager=mIt});var Gxn=ve(JM=>{"use strict";Object.defineProperty(JM,"__esModule",{value:!0});JM.AsyncLocalStorageContextManager=JM.AsyncHooksContextManager=void 0;var Ywa=bxn();Object.defineProperty(JM,"AsyncHooksContextManager",{enumerable:!0,get:function(){return Ywa.AsyncHooksContextManager}});var xwa=fxn();Object.defineProperty(JM,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return xwa.AsyncLocalStorageContextManager}})});var pIt=ve(f5e=>{"use strict";Object.defineProperty(f5e,"__esModule",{value:!0});f5e.B3_DEBUG_FLAG_KEY=void 0;var Vwa=(Qr(),dr(kr));f5e.B3_DEBUG_FLAG_KEY=(0,Vwa.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var Dle=ve(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});cG.X_B3_FLAGS=cG.X_B3_PARENT_SPAN_ID=cG.X_B3_SAMPLED=cG.X_B3_SPAN_ID=cG.X_B3_TRACE_ID=cG.B3_CONTEXT_HEADER=void 0;cG.B3_CONTEXT_HEADER="b3";cG.X_B3_TRACE_ID="x-b3-traceid";cG.X_B3_SPAN_ID="x-b3-spanid";cG.X_B3_SAMPLED="x-b3-sampled";cG.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";cG.X_B3_FLAGS="x-b3-flags"});var Zxn=ve(g5e=>{"use strict";Object.defineProperty(g5e,"__esModule",{value:!0});g5e.B3MultiPropagator=void 0;var u3=(Qr(),dr(kr)),Qwa=Va(),gxn=pIt(),cg=Dle(),Hwa=new Set([!0,"true","True","1",1]),Xwa=new Set([!1,"false","False","0",0]);function kwa(n){return n===u3.TraceFlags.SAMPLED||n===u3.TraceFlags.NONE}function Lwa(n){return Array.isArray(n)?n[0]:n}function G5e(n,t,r){let a=t.get(n,r);return Lwa(a)}function Swa(n,t){let r=G5e(n,t,cg.X_B3_TRACE_ID);return typeof r=="string"?r.padStart(32,"0"):""}function Bwa(n,t){let r=G5e(n,t,cg.X_B3_SPAN_ID);return typeof r=="string"?r:""}function vxn(n,t){return G5e(n,t,cg.X_B3_FLAGS)==="1"?"1":void 0}function Jwa(n,t){let r=G5e(n,t,cg.X_B3_SAMPLED);if(vxn(n,t)==="1"||Hwa.has(r))return u3.TraceFlags.SAMPLED;if(r===void 0||Xwa.has(r))return u3.TraceFlags.NONE}var bIt=class{inject(t,r,a){let i=u3.trace.getSpanContext(t);if(!i||!(0,u3.isSpanContextValid)(i)||(0,Qwa.isTracingSuppressed)(t))return;let s=t.getValue(gxn.B3_DEBUG_FLAG_KEY);a.set(r,cg.X_B3_TRACE_ID,i.traceId),a.set(r,cg.X_B3_SPAN_ID,i.spanId),s==="1"?a.set(r,cg.X_B3_FLAGS,s):i.traceFlags!==void 0&&a.set(r,cg.X_B3_SAMPLED,(u3.TraceFlags.SAMPLED&i.traceFlags)===u3.TraceFlags.SAMPLED?"1":"0")}extract(t,r,a){let i=Swa(r,a),s=Bwa(r,a),e=Jwa(r,a),o=vxn(r,a);return(0,u3.isValidTraceId)(i)&&(0,u3.isValidSpanId)(s)&&kwa(e)?(t=t.setValue(gxn.B3_DEBUG_FLAG_KEY,o),u3.trace.setSpanContext(t,{traceId:i,spanId:s,isRemote:!0,traceFlags:e})):t}fields(){return[cg.X_B3_TRACE_ID,cg.X_B3_SPAN_ID,cg.X_B3_FLAGS,cg.X_B3_SAMPLED,cg.X_B3_PARENT_SPAN_ID]}};g5e.B3MultiPropagator=bIt});var Axn=ve(v5e=>{"use strict";Object.defineProperty(v5e,"__esModule",{value:!0});v5e.B3SinglePropagator=void 0;var Sk=(Qr(),dr(kr)),Twa=Va(),Nxn=pIt(),fIt=Dle(),Dwa=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,Owa="0".repeat(16),Uwa=new Set(["d","1"]),Mwa="d";function zwa(n){return n.length===32?n:`${Owa}${n}`}function _wa(n){return n&&Uwa.has(n)?Sk.TraceFlags.SAMPLED:Sk.TraceFlags.NONE}var GIt=class{inject(t,r,a){let i=Sk.trace.getSpanContext(t);if(!i||!(0,Sk.isSpanContextValid)(i)||(0,Twa.isTracingSuppressed)(t))return;let s=t.getValue(Nxn.B3_DEBUG_FLAG_KEY)||i.traceFlags&1,e=`${i.traceId}-${i.spanId}-${s}`;a.set(r,fIt.B3_CONTEXT_HEADER,e)}extract(t,r,a){let i=a.get(r,fIt.B3_CONTEXT_HEADER),s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return t;let e=s.match(Dwa);if(!e)return t;let[,o,u,d]=e,I=zwa(o);if(!(0,Sk.isValidTraceId)(I)||!(0,Sk.isValidSpanId)(u))return t;let h=_wa(d);return d===Mwa&&(t=t.setValue(Nxn.B3_DEBUG_FLAG_KEY,d)),Sk.trace.setSpanContext(t,{traceId:I,spanId:u,isRemote:!0,traceFlags:h})}fields(){return[fIt.B3_CONTEXT_HEADER]}};v5e.B3SinglePropagator=GIt});var gIt=ve(Ole=>{"use strict";Object.defineProperty(Ole,"__esModule",{value:!0});Ole.B3InjectEncoding=void 0;var Pwa;(function(n){n[n.SINGLE_HEADER=0]="SINGLE_HEADER",n[n.MULTI_HEADER=1]="MULTI_HEADER"})(Pwa=Ole.B3InjectEncoding||(Ole.B3InjectEncoding={}))});var Wxn=ve(Z5e=>{"use strict";Object.defineProperty(Z5e,"__esModule",{value:!0});Z5e.B3Propagator=void 0;var jwa=Va(),Kwa=Zxn(),qwa=Axn(),$wa=Dle(),eCa=gIt(),vIt=class{constructor(t={}){this._b3MultiPropagator=new Kwa.B3MultiPropagator,this._b3SinglePropagator=new qwa.B3SinglePropagator,t.injectEncoding===eCa.B3InjectEncoding.MULTI_HEADER?(this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields()):(this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields())}inject(t,r,a){(0,jwa.isTracingSuppressed)(t)||this._inject(t,r,a)}extract(t,r,a){let i=a.get(r,$wa.B3_CONTEXT_HEADER);return(Array.isArray(i)?i[0]:i)?this._b3SinglePropagator.extract(t,r,a):this._b3MultiPropagator.extract(t,r,a)}fields(){return this._fields}};Z5e.B3Propagator=vIt});var yxn=ve(KR=>{"use strict";var tCa=KR&&KR.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),ZIt=KR&&KR.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&tCa(t,n,r)};Object.defineProperty(KR,"__esModule",{value:!0});ZIt(Wxn(),KR);ZIt(Dle(),KR);ZIt(gIt(),KR)});var Fxn=ve(N5e=>{"use strict";Object.defineProperty(N5e,"__esModule",{value:!0});N5e.ExceptionEventName=void 0;N5e.ExceptionEventName="exception"});var AIt=ve(A5e=>{"use strict";Object.defineProperty(A5e,"__esModule",{value:!0});A5e.Span=void 0;var I3=(Qr(),dr(kr)),ab=Va(),Bk=Xm(),nCa=Fxn(),NIt=class{constructor(t,r,a,i,s,e,o=[],u,d,I){this.attributes={},this.links=[],this.events=[],this._droppedAttributesCount=0,this._droppedEventsCount=0,this._droppedLinksCount=0,this.status={code:I3.SpanStatusCode.UNSET},this.endTime=[0,0],this._ended=!1,this._duration=[-1,-1],this.name=a,this._spanContext=i,this.parentSpanId=e,this.kind=s,this.links=o;let h=Date.now();this._performanceStartTime=ab.otperformance.now(),this._performanceOffset=h-(this._performanceStartTime+(0,ab.getTimeOrigin)()),this._startTimeProvided=u!=null,this.startTime=this._getTime(u??h),this.resource=t.resource,this.instrumentationLibrary=t.instrumentationLibrary,this._spanLimits=t.getSpanLimits(),this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,I!=null&&this.setAttributes(I),this._spanProcessor=t.getActiveSpanProcessor(),this._spanProcessor.onStart(this,r)}spanContext(){return this._spanContext}setAttribute(t,r){return r==null||this._isSpanEnded()?this:t.length===0?(I3.diag.warn(`Invalid attribute key: ${t}`),this):(0,ab.isAttributeValue)(r)?Object.keys(this.attributes).length>=this._spanLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),this):(I3.diag.warn(`Invalid attribute value set for key: ${t}`),this)}setAttributes(t){for(let[r,a]of Object.entries(t))this.setAttribute(r,a);return this}addEvent(t,r,a){if(this._isSpanEnded())return this;if(this._spanLimits.eventCountLimit===0)return I3.diag.warn("No events allowed."),this._droppedEventsCount++,this;this.events.length>=this._spanLimits.eventCountLimit&&(this._droppedEventsCount===0&&I3.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,ab.isTimeInput)(r)&&((0,ab.isTimeInput)(a)||(a=r),r=void 0);let i=(0,ab.sanitizeAttributes)(r);return this.events.push({name:t,attributes:i,time:this._getTime(a),droppedAttributesCount:0}),this}addLink(t){return this.links.push(t),this}addLinks(t){return this.links.push(...t),this}setStatus(t){return this._isSpanEnded()?this:(this.status=t,this)}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){I3.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this._ended=!0,this.endTime=this._getTime(t),this._duration=(0,ab.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(I3.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&I3.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<ab.otperformance.now())return(0,ab.hrTime)(t+this._performanceOffset);if(typeof t=="number")return(0,ab.millisToHrTime)(t);if(t instanceof Date)return(0,ab.millisToHrTime)(t.getTime());if((0,ab.isTimeInputHrTime)(t))return t;if(this._startTimeProvided)return(0,ab.millisToHrTime)(Date.now());let r=ab.otperformance.now()-this._performanceStartTime;return(0,ab.addHrTimes)(this.startTime,(0,ab.millisToHrTime)(r))}isRecording(){return this._ended===!1}recordException(t,r){let a={};typeof t=="string"?a[Bk.SEMATTRS_EXCEPTION_MESSAGE]=t:t&&(t.code?a[Bk.SEMATTRS_EXCEPTION_TYPE]=t.code.toString():t.name&&(a[Bk.SEMATTRS_EXCEPTION_TYPE]=t.name),t.message&&(a[Bk.SEMATTRS_EXCEPTION_MESSAGE]=t.message),t.stack&&(a[Bk.SEMATTRS_EXCEPTION_STACKTRACE]=t.stack)),a[Bk.SEMATTRS_EXCEPTION_TYPE]||a[Bk.SEMATTRS_EXCEPTION_MESSAGE]?this.addEvent(nCa.ExceptionEventName,a,r):I3.diag.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){return this._ended&&I3.diag.warn(`Can not execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`),this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substr(0,r)}_truncateToSize(t){let r=this._attributeValueLengthLimit;return r<=0?(I3.diag.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(a=>typeof a=="string"?this._truncateToLimitUtil(a,r):a):t}};A5e.Span=NIt});var Mle=ve(Ule=>{"use strict";Object.defineProperty(Ule,"__esModule",{value:!0});Ule.SamplingDecision=void 0;var rCa;(function(n){n[n.NOT_RECORD=0]="NOT_RECORD",n[n.RECORD=1]="RECORD",n[n.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(rCa=Ule.SamplingDecision||(Ule.SamplingDecision={}))});var y5e=ve(W5e=>{"use strict";Object.defineProperty(W5e,"__esModule",{value:!0});W5e.AlwaysOffSampler=void 0;var aCa=Mle(),WIt=class{shouldSample(){return{decision:aCa.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};W5e.AlwaysOffSampler=WIt});var E5e=ve(F5e=>{"use strict";Object.defineProperty(F5e,"__esModule",{value:!0});F5e.AlwaysOnSampler=void 0;var iCa=Mle(),yIt=class{shouldSample(){return{decision:iCa.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};F5e.AlwaysOnSampler=yIt});var RIt=ve(w5e=>{"use strict";Object.defineProperty(w5e,"__esModule",{value:!0});w5e.ParentBasedSampler=void 0;var R5e=(Qr(),dr(kr)),lCa=Va(),Exn=y5e(),FIt=E5e(),EIt=class{constructor(t){var r,a,i,s;this._root=t.root,this._root||((0,lCa.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new FIt.AlwaysOnSampler),this._remoteParentSampled=(r=t.remoteParentSampled)!==null&&r!==void 0?r:new FIt.AlwaysOnSampler,this._remoteParentNotSampled=(a=t.remoteParentNotSampled)!==null&&a!==void 0?a:new Exn.AlwaysOffSampler,this._localParentSampled=(i=t.localParentSampled)!==null&&i!==void 0?i:new FIt.AlwaysOnSampler,this._localParentNotSampled=(s=t.localParentNotSampled)!==null&&s!==void 0?s:new Exn.AlwaysOffSampler}shouldSample(t,r,a,i,s,e){let o=R5e.trace.getSpanContext(t);return!o||!(0,R5e.isSpanContextValid)(o)?this._root.shouldSample(t,r,a,i,s,e):o.isRemote?o.traceFlags&R5e.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(t,r,a,i,s,e):this._remoteParentNotSampled.shouldSample(t,r,a,i,s,e):o.traceFlags&R5e.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(t,r,a,i,s,e):this._localParentNotSampled.shouldSample(t,r,a,i,s,e)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};w5e.ParentBasedSampler=EIt});var CIt=ve(C5e=>{"use strict";Object.defineProperty(C5e,"__esModule",{value:!0});C5e.TraceIdRatioBasedSampler=void 0;var sCa=(Qr(),dr(kr)),Rxn=Mle(),wIt=class{constructor(t=0){this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:(0,sCa.isValidTraceId)(r)&&this._accumulate(r)<this._upperBound?Rxn.SamplingDecision.RECORD_AND_SAMPLED:Rxn.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let a=0;a<t.length/8;a++){let i=a*8,s=parseInt(t.slice(i,i+8),16);r=(r^s)>>>0}return r}};C5e.TraceIdRatioBasedSampler=wIt});var VIt=ve(DM=>{"use strict";Object.defineProperty(DM,"__esModule",{value:!0});DM.buildSamplerFromEnv=DM.loadDefaultConfig=void 0;var Y5e=(Qr(),dr(kr)),Bm=Va(),wxn=y5e(),YIt=E5e(),xIt=RIt(),Cxn=CIt(),oCa=(0,Bm.getEnv)(),cCa=Bm.TracesSamplerValues.AlwaysOn,TM=1;function uCa(){return{sampler:xxn(oCa),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,Bm.getEnv)().OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:(0,Bm.getEnv)().OTEL_ATTRIBUTE_COUNT_LIMIT},spanLimits:{attributeValueLengthLimit:(0,Bm.getEnv)().OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:(0,Bm.getEnv)().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,linkCountLimit:(0,Bm.getEnv)().OTEL_SPAN_LINK_COUNT_LIMIT,eventCountLimit:(0,Bm.getEnv)().OTEL_SPAN_EVENT_COUNT_LIMIT,attributePerEventCountLimit:(0,Bm.getEnv)().OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,attributePerLinkCountLimit:(0,Bm.getEnv)().OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT}}}DM.loadDefaultConfig=uCa;function xxn(n=(0,Bm.getEnv)()){switch(n.OTEL_TRACES_SAMPLER){case Bm.TracesSamplerValues.AlwaysOn:return new YIt.AlwaysOnSampler;case Bm.TracesSamplerValues.AlwaysOff:return new wxn.AlwaysOffSampler;case Bm.TracesSamplerValues.ParentBasedAlwaysOn:return new xIt.ParentBasedSampler({root:new YIt.AlwaysOnSampler});case Bm.TracesSamplerValues.ParentBasedAlwaysOff:return new xIt.ParentBasedSampler({root:new wxn.AlwaysOffSampler});case Bm.TracesSamplerValues.TraceIdRatio:return new Cxn.TraceIdRatioBasedSampler(Yxn(n));case Bm.TracesSamplerValues.ParentBasedTraceIdRatio:return new xIt.ParentBasedSampler({root:new Cxn.TraceIdRatioBasedSampler(Yxn(n))});default:return Y5e.diag.error(`OTEL_TRACES_SAMPLER value "${n.OTEL_TRACES_SAMPLER} invalid, defaulting to ${cCa}".`),new YIt.AlwaysOnSampler}}DM.buildSamplerFromEnv=xxn;function Yxn(n){if(n.OTEL_TRACES_SAMPLER_ARG===void 0||n.OTEL_TRACES_SAMPLER_ARG==="")return Y5e.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${TM}.`),TM;let t=Number(n.OTEL_TRACES_SAMPLER_ARG);return isNaN(t)?(Y5e.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${TM}.`),TM):t<0||t>1?(Y5e.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${TM}.`),TM):t}});var HIt=ve(OM=>{"use strict";Object.defineProperty(OM,"__esModule",{value:!0});OM.reconfigureLimits=OM.mergeConfig=void 0;var Vxn=VIt(),QIt=Va();function ICa(n){let t={sampler:(0,Vxn.buildSamplerFromEnv)()},r=(0,Vxn.loadDefaultConfig)(),a=Object.assign({},r,t,n);return a.generalLimits=Object.assign({},r.generalLimits,n.generalLimits||{}),a.spanLimits=Object.assign({},r.spanLimits,n.spanLimits||{}),a}OM.mergeConfig=ICa;function dCa(n){var t,r,a,i,s,e,o,u,d,I,h,c;let G=Object.assign({},n.spanLimits),W=(0,QIt.getEnvWithoutDefaults)();return G.attributeCountLimit=(e=(s=(i=(r=(t=n.spanLimits)===null||t===void 0?void 0:t.attributeCountLimit)!==null&&r!==void 0?r:(a=n.generalLimits)===null||a===void 0?void 0:a.attributeCountLimit)!==null&&i!==void 0?i:W.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT)!==null&&s!==void 0?s:W.OTEL_ATTRIBUTE_COUNT_LIMIT)!==null&&e!==void 0?e:QIt.DEFAULT_ATTRIBUTE_COUNT_LIMIT,G.attributeValueLengthLimit=(c=(h=(I=(u=(o=n.spanLimits)===null||o===void 0?void 0:o.attributeValueLengthLimit)!==null&&u!==void 0?u:(d=n.generalLimits)===null||d===void 0?void 0:d.attributeValueLengthLimit)!==null&&I!==void 0?I:W.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&h!==void 0?h:W.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&c!==void 0?c:QIt.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},n,{spanLimits:G})}OM.reconfigureLimits=dCa});var Qxn=ve(x5e=>{"use strict";Object.defineProperty(x5e,"__esModule",{value:!0});x5e.BatchSpanProcessorBase=void 0;var UM=(Qr(),dr(kr)),Jk=Va(),XIt=class{constructor(t,r){this._exporter=t,this._isExporting=!1,this._finishedSpans=[],this._droppedSpansCount=0;let a=(0,Jk.getEnv)();this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:a.OTEL_BSP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:a.OTEL_BSP_MAX_QUEUE_SIZE,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:a.OTEL_BSP_SCHEDULE_DELAY,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:a.OTEL_BSP_EXPORT_TIMEOUT,this._shutdownOnce=new Jk.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(UM.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&UM.TraceFlags.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&UM.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(UM.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{let a=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let s=0,e=i;s<e;s++)a.push(this._flushOneBatch());Promise.all(a).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{let a=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);UM.context.with((0,Jk.suppressTracing)(UM.context.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(i,o=>{var u;clearTimeout(a),o.code===Jk.ExportResultCode.SUCCESS?t():r((u=o.error)!==null&&u!==void 0?u:new Error("BatchSpanProcessor: span export failed"))}),e=null;for(let o=0,u=i.length;o<u;o++){let d=i[o];d.resource.asyncAttributesPending&&d.resource.waitForAsyncAttributes&&(e??(e=[]),e.push(d.resource.waitForAsyncAttributes()))}e===null?s():Promise.all(e).then(s,o=>{(0,Jk.globalErrorHandler)(o),r(o)})})})}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,(0,Jk.globalErrorHandler)(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),(0,Jk.unrefTimer)(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};x5e.BatchSpanProcessorBase=XIt});var Hxn=ve(V5e=>{"use strict";Object.defineProperty(V5e,"__esModule",{value:!0});V5e.BatchSpanProcessor=void 0;var hCa=Qxn(),kIt=class extends hCa.BatchSpanProcessorBase{onShutdown(){}};V5e.BatchSpanProcessor=kIt});var Lxn=ve(H5e=>{"use strict";Object.defineProperty(H5e,"__esModule",{value:!0});H5e.RandomIdGenerator=void 0;var mCa=8,kxn=16,LIt=class{constructor(){this.generateTraceId=Xxn(kxn),this.generateSpanId=Xxn(mCa)}};H5e.RandomIdGenerator=LIt;var Q5e=Buffer.allocUnsafe(kxn);function Xxn(n){return function(){for(let r=0;r<n/4;r++)Q5e.writeUInt32BE(Math.random()*2**32>>>0,r*4);for(let r=0;r<n&&!(Q5e[r]>0);r++)r===n-1&&(Q5e[n-1]=1);return Q5e.toString("hex",0,n)}}});var Bxn=ve(yx=>{"use strict";var pCa=yx&&yx.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),Sxn=yx&&yx.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&pCa(t,n,r)};Object.defineProperty(yx,"__esModule",{value:!0});Sxn(Hxn(),yx);Sxn(Lxn(),yx)});var X5e=ve(Tk=>{"use strict";var bCa=Tk&&Tk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),fCa=Tk&&Tk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&bCa(t,n,r)};Object.defineProperty(Tk,"__esModule",{value:!0});fCa(Bxn(),Tk)});var Jxn=ve(L5e=>{"use strict";Object.defineProperty(L5e,"__esModule",{value:!0});L5e.Tracer=void 0;var Jm=(Qr(),dr(kr)),k5e=Va(),GCa=AIt(),gCa=HIt(),vCa=X5e(),SIt=class{constructor(t,r,a){this._tracerProvider=a;let i=(0,gCa.mergeConfig)(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new vCa.RandomIdGenerator,this.resource=a.resource,this.instrumentationLibrary=t}startSpan(t,r={},a=Jm.context.active()){var i,s,e;r.root&&(a=Jm.trace.deleteSpan(a));let o=Jm.trace.getSpan(a);if((0,k5e.isTracingSuppressed)(a))return Jm.diag.debug("Instrumentation suppressed, returning Noop Span"),Jm.trace.wrapSpanContext(Jm.INVALID_SPAN_CONTEXT);let u=o?.spanContext(),d=this._idGenerator.generateSpanId(),I,h,c;!u||!Jm.trace.isSpanContextValid(u)?I=this._idGenerator.generateTraceId():(I=u.traceId,h=u.traceState,c=u.spanId);let G=(i=r.kind)!==null&&i!==void 0?i:Jm.SpanKind.INTERNAL,W=((s=r.links)!==null&&s!==void 0?s:[]).map(f=>({context:f.context,attributes:(0,k5e.sanitizeAttributes)(f.attributes)})),y=(0,k5e.sanitizeAttributes)(r.attributes),R=this._sampler.shouldSample(a,I,t,G,y,W);h=(e=R.traceState)!==null&&e!==void 0?e:h;let F=R.decision===Jm.SamplingDecision.RECORD_AND_SAMPLED?Jm.TraceFlags.SAMPLED:Jm.TraceFlags.NONE,C={traceId:I,spanId:d,traceFlags:F,traceState:h};if(R.decision===Jm.SamplingDecision.NOT_RECORD)return Jm.diag.debug("Recording is off, propagating context in a non-recording span"),Jm.trace.wrapSpanContext(C);let A=(0,k5e.sanitizeAttributes)(Object.assign(y,R.attributes));return new GCa.Span(this,a,t,C,G,c,W,r.startTime,void 0,A)}startActiveSpan(t,r,a,i){let s,e,o;if(arguments.length<2)return;arguments.length===2?o=r:arguments.length===3?(s=r,o=a):(s=r,e=a,o=i);let u=e??Jm.context.active(),d=this.startSpan(t,s,u),I=Jm.trace.setSpan(u,d);return Jm.context.with(I,o,void 0,d)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}getActiveSpanProcessor(){return this._tracerProvider.getActiveSpanProcessor()}};L5e.Tracer=SIt});var Txn=ve(S5e=>{"use strict";Object.defineProperty(S5e,"__esModule",{value:!0});S5e.MultiSpanProcessor=void 0;var ZCa=Va(),BIt=class{constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(a=>{(0,ZCa.globalErrorHandler)(a||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(let a of this._spanProcessors)a.onStart(t,r)}onEnd(t){for(let r of this._spanProcessors)r.onEnd(t)}shutdown(){let t=[];for(let r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,a)=>{Promise.all(t).then(()=>{r()},a)})}};S5e.MultiSpanProcessor=BIt});var TIt=ve(B5e=>{"use strict";Object.defineProperty(B5e,"__esModule",{value:!0});B5e.NoopSpanProcessor=void 0;var JIt=class{onStart(t,r){}onEnd(t){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};B5e.NoopSpanProcessor=JIt});var Oxn=ve(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});Dk.BasicTracerProvider=Dk.ForceFlushState=void 0;var MM=(Qr(),dr(kr)),_M=Va(),Dxn=gx(),NCa=Ok(),ACa=VIt(),WCa=Txn(),yCa=TIt(),FCa=X5e(),ECa=HIt(),zM;(function(n){n[n.resolved=0]="resolved",n[n.timeout=1]="timeout",n[n.error=2]="error",n[n.unresolved=3]="unresolved"})(zM=Dk.ForceFlushState||(Dk.ForceFlushState={}));var zle=class{constructor(t={}){var r;this._registeredSpanProcessors=[],this._tracers=new Map;let a=(0,_M.merge)({},(0,ACa.loadDefaultConfig)(),(0,ECa.reconfigureLimits)(t));this.resource=(r=a.resource)!==null&&r!==void 0?r:Dxn.Resource.empty(),this.resource=Dxn.Resource.default().merge(this.resource),this._config=Object.assign({},a,{resource:this.resource});let i=this._buildExporterFromEnv();if(i!==void 0){let s=new FCa.BatchSpanProcessor(i);this.activeSpanProcessor=s}else this.activeSpanProcessor=new yCa.NoopSpanProcessor}getTracer(t,r,a){let i=`${t}@${r||""}:${a?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new NCa.Tracer({name:t,version:r,schemaUrl:a?.schemaUrl},this._config,this)),this._tracers.get(i)}addSpanProcessor(t){this._registeredSpanProcessors.length===0&&this.activeSpanProcessor.shutdown().catch(r=>MM.diag.error("Error while trying to shutdown current span processor",r)),this._registeredSpanProcessors.push(t),this.activeSpanProcessor=new WCa.MultiSpanProcessor(this._registeredSpanProcessors)}getActiveSpanProcessor(){return this.activeSpanProcessor}register(t={}){MM.trace.setGlobalTracerProvider(this),t.propagator===void 0&&(t.propagator=this._buildPropagatorFromEnv()),t.contextManager&&MM.context.setGlobalContextManager(t.contextManager),t.propagator&&MM.propagation.setGlobalPropagator(t.propagator)}forceFlush(){let t=this._config.forceFlushTimeoutMillis,r=this._registeredSpanProcessors.map(a=>new Promise(i=>{let s,e=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${t} ms`)),s=zM.timeout},t);a.forceFlush().then(()=>{clearTimeout(e),s!==zM.timeout&&(s=zM.resolved,i(s))}).catch(o=>{clearTimeout(e),s=zM.error,i(o)})}));return new Promise((a,i)=>{Promise.all(r).then(s=>{let e=s.filter(o=>o!==zM.resolved);e.length>0?i(e):a()}).catch(s=>i([s]))})}shutdown(){return this.activeSpanProcessor.shutdown()}_getPropagator(t){var r;return(r=this.constructor._registeredPropagators.get(t))===null||r===void 0?void 0:r()}_getSpanExporter(t){var r;return(r=this.constructor._registeredExporters.get(t))===null||r===void 0?void 0:r()}_buildPropagatorFromEnv(){let t=Array.from(new Set((0,_M.getEnv)().OTEL_PROPAGATORS)),a=t.map(i=>{let s=this._getPropagator(i);return s||MM.diag.warn(`Propagator "${i}" requested through environment variable is unavailable.`),s}).reduce((i,s)=>(s&&i.push(s),i),[]);if(a.length!==0)return t.length===1?a[0]:new _M.CompositePropagator({propagators:a})}_buildExporterFromEnv(){let t=(0,_M.getEnv)().OTEL_TRACES_EXPORTER;if(t==="none"||t==="")return;let r=this._getSpanExporter(t);return r||MM.diag.error(`Exporter "${t}" requested through environment variable is unavailable.`),r}};Dk.BasicTracerProvider=zle;zle._registeredPropagators=new Map([["tracecontext",()=>new _M.W3CTraceContextPropagator],["baggage",()=>new _M.W3CBaggagePropagator]]);zle._registeredExporters=new Map});var Uxn=ve(J5e=>{"use strict";Object.defineProperty(J5e,"__esModule",{value:!0});J5e.ConsoleSpanExporter=void 0;var DIt=Va(),OIt=class{export(t,r){return this._sendSpans(t,r)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(t){var r;return{resource:{attributes:t.resource.attributes},traceId:t.spanContext().traceId,parentId:t.parentSpanId,traceState:(r=t.spanContext().traceState)===null||r===void 0?void 0:r.serialize(),name:t.name,id:t.spanContext().spanId,kind:t.kind,timestamp:(0,DIt.hrTimeToMicroseconds)(t.startTime),duration:(0,DIt.hrTimeToMicroseconds)(t.duration),attributes:t.attributes,status:t.status,events:t.events,links:t.links}}_sendSpans(t,r){for(let a of t)console.dir(this._exportInfo(a),{depth:3});if(r)return r({code:DIt.ExportResultCode.SUCCESS})}};J5e.ConsoleSpanExporter=OIt});var zxn=ve(T5e=>{"use strict";Object.defineProperty(T5e,"__esModule",{value:!0});T5e.InMemorySpanExporter=void 0;var Mxn=Va(),UIt=class{constructor(){this._finishedSpans=[],this._stopped=!1}export(t,r){if(this._stopped)return r({code:Mxn.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...t),setTimeout(()=>r({code:Mxn.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};T5e.InMemorySpanExporter=UIt});var Pxn=ve(_xn=>{"use strict";Object.defineProperty(_xn,"__esModule",{value:!0})});var jxn=ve(D5e=>{"use strict";Object.defineProperty(D5e,"__esModule",{value:!0});D5e.SimpleSpanProcessor=void 0;var RCa=(Qr(),dr(kr)),PM=Va(),MIt=class{constructor(t){this._exporter=t,this._shutdownOnce=new PM.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(t,r){}onEnd(t){var r,a;if(this._shutdownOnce.isCalled||(t.spanContext().traceFlags&RCa.TraceFlags.SAMPLED)===0)return;let i=()=>PM.internal._export(this._exporter,[t]).then(s=>{var e;s.code!==PM.ExportResultCode.SUCCESS&&(0,PM.globalErrorHandler)((e=s.error)!==null&&e!==void 0?e:new Error(`SimpleSpanProcessor: span export failed (status ${s})`))}).catch(s=>{(0,PM.globalErrorHandler)(s)});if(t.resource.asyncAttributesPending){let s=(a=(r=t.resource).waitForAsyncAttributes)===null||a===void 0?void 0:a.call(r).then(()=>(s!=null&&this._unresolvedExports.delete(s),i()),e=>(0,PM.globalErrorHandler)(e));s!=null&&this._unresolvedExports.add(s)}else i()}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};D5e.SimpleSpanProcessor=MIt});var qxn=ve(Kxn=>{"use strict";Object.defineProperty(Kxn,"__esModule",{value:!0})});var eVn=ve($xn=>{"use strict";Object.defineProperty($xn,"__esModule",{value:!0})});var nVn=ve(tVn=>{"use strict";Object.defineProperty(tVn,"__esModule",{value:!0})});var aVn=ve(rVn=>{"use strict";Object.defineProperty(rVn,"__esModule",{value:!0})});var lVn=ve(iVn=>{"use strict";Object.defineProperty(iVn,"__esModule",{value:!0})});var Ok=ve(Iu=>{"use strict";var wCa=Iu&&Iu.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),L0=Iu&&Iu.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&wCa(t,n,r)};Object.defineProperty(Iu,"__esModule",{value:!0});L0(Jxn(),Iu);L0(Oxn(),Iu);L0(X5e(),Iu);L0(Uxn(),Iu);L0(zxn(),Iu);L0(Pxn(),Iu);L0(jxn(),Iu);L0(qxn(),Iu);L0(TIt(),Iu);L0(y5e(),Iu);L0(E5e(),Iu);L0(RIt(),Iu);L0(CIt(),Iu);L0(Mle(),Iu);L0(AIt(),Iu);L0(eVn(),Iu);L0(nVn(),Iu);L0(aVn(),Iu);L0(lVn(),Iu)});var _le=ve((CKi,sVn)=>{"use strict";var CCa="2.0.0",YCa=Number.MAX_SAFE_INTEGER||9007199254740991,xCa=16,VCa=250,QCa=["major","premajor","minor","preminor","patch","prepatch","prerelease"];sVn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:xCa,MAX_SAFE_BUILD_LENGTH:VCa,MAX_SAFE_INTEGER:YCa,RELEASE_TYPES:QCa,SEMVER_SPEC_VERSION:CCa,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Ple=ve((YKi,oVn)=>{"use strict";var HCa=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{};oVn.exports=HCa});var jM=ve((NF,cVn)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:zIt,MAX_SAFE_BUILD_LENGTH:XCa,MAX_LENGTH:kCa}=_le(),LCa=Ple();NF=cVn.exports={};var SCa=NF.re=[],BCa=NF.safeRe=[],aa=NF.src=[],JCa=NF.safeSrc=[],ia=NF.t={},TCa=0,_It="[a-zA-Z0-9-]",DCa=[["\\s",1],["\\d",kCa],[_It,XCa]],OCa=n=>{for(let[t,r]of DCa)n=n.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return n},Di=(n,t,r)=>{let a=OCa(t),i=TCa++;LCa(n,i,t),ia[n]=i,aa[i]=t,JCa[i]=a,SCa[i]=new RegExp(t,r?"g":void 0),BCa[i]=new RegExp(a,r?"g":void 0)};Di("NUMERICIDENTIFIER","0|[1-9]\\d*");Di("NUMERICIDENTIFIERLOOSE","\\d+");Di("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${_It}*`);Di("MAINVERSION",`(${aa[ia.NUMERICIDENTIFIER]})\\.(${aa[ia.NUMERICIDENTIFIER]})\\.(${aa[ia.NUMERICIDENTIFIER]})`);Di("MAINVERSIONLOOSE",`(${aa[ia.NUMERICIDENTIFIERLOOSE]})\\.(${aa[ia.NUMERICIDENTIFIERLOOSE]})\\.(${aa[ia.NUMERICIDENTIFIERLOOSE]})`);Di("PRERELEASEIDENTIFIER",`(?:${aa[ia.NONNUMERICIDENTIFIER]}|${aa[ia.NUMERICIDENTIFIER]})`);Di("PRERELEASEIDENTIFIERLOOSE",`(?:${aa[ia.NONNUMERICIDENTIFIER]}|${aa[ia.NUMERICIDENTIFIERLOOSE]})`);Di("PRERELEASE",`(?:-(${aa[ia.PRERELEASEIDENTIFIER]}(?:\\.${aa[ia.PRERELEASEIDENTIFIER]})*))`);Di("PRERELEASELOOSE",`(?:-?(${aa[ia.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${aa[ia.PRERELEASEIDENTIFIERLOOSE]})*))`);Di("BUILDIDENTIFIER",`${_It}+`);Di("BUILD",`(?:\\+(${aa[ia.BUILDIDENTIFIER]}(?:\\.${aa[ia.BUILDIDENTIFIER]})*))`);Di("FULLPLAIN",`v?${aa[ia.MAINVERSION]}${aa[ia.PRERELEASE]}?${aa[ia.BUILD]}?`);Di("FULL",`^${aa[ia.FULLPLAIN]}$`);Di("LOOSEPLAIN",`[v=\\s]*${aa[ia.MAINVERSIONLOOSE]}${aa[ia.PRERELEASELOOSE]}?${aa[ia.BUILD]}?`);Di("LOOSE",`^${aa[ia.LOOSEPLAIN]}$`);Di("GTLT","((?:<|>)?=?)");Di("XRANGEIDENTIFIERLOOSE",`${aa[ia.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Di("XRANGEIDENTIFIER",`${aa[ia.NUMERICIDENTIFIER]}|x|X|\\*`);Di("XRANGEPLAIN",`[v=\\s]*(${aa[ia.XRANGEIDENTIFIER]})(?:\\.(${aa[ia.XRANGEIDENTIFIER]})(?:\\.(${aa[ia.XRANGEIDENTIFIER]})(?:${aa[ia.PRERELEASE]})?${aa[ia.BUILD]}?)?)?`);Di("XRANGEPLAINLOOSE",`[v=\\s]*(${aa[ia.XRANGEIDENTIFIERLOOSE]})(?:\\.(${aa[ia.XRANGEIDENTIFIERLOOSE]})(?:\\.(${aa[ia.XRANGEIDENTIFIERLOOSE]})(?:${aa[ia.PRERELEASELOOSE]})?${aa[ia.BUILD]}?)?)?`);Di("XRANGE",`^${aa[ia.GTLT]}\\s*${aa[ia.XRANGEPLAIN]}$`);Di("XRANGELOOSE",`^${aa[ia.GTLT]}\\s*${aa[ia.XRANGEPLAINLOOSE]}$`);Di("COERCEPLAIN",`(^|[^\\d])(\\d{1,${zIt}})(?:\\.(\\d{1,${zIt}}))?(?:\\.(\\d{1,${zIt}}))?`);Di("COERCE",`${aa[ia.COERCEPLAIN]}(?:$|[^\\d])`);Di("COERCEFULL",aa[ia.COERCEPLAIN]+`(?:${aa[ia.PRERELEASE]})?(?:${aa[ia.BUILD]})?(?:$|[^\\d])`);Di("COERCERTL",aa[ia.COERCE],!0);Di("COERCERTLFULL",aa[ia.COERCEFULL],!0);Di("LONETILDE","(?:~>?)");Di("TILDETRIM",`(\\s*)${aa[ia.LONETILDE]}\\s+`,!0);NF.tildeTrimReplace="$1~";Di("TILDE",`^${aa[ia.LONETILDE]}${aa[ia.XRANGEPLAIN]}$`);Di("TILDELOOSE",`^${aa[ia.LONETILDE]}${aa[ia.XRANGEPLAINLOOSE]}$`);Di("LONECARET","(?:\\^)");Di("CARETTRIM",`(\\s*)${aa[ia.LONECARET]}\\s+`,!0);NF.caretTrimReplace="$1^";Di("CARET",`^${aa[ia.LONECARET]}${aa[ia.XRANGEPLAIN]}$`);Di("CARETLOOSE",`^${aa[ia.LONECARET]}${aa[ia.XRANGEPLAINLOOSE]}$`);Di("COMPARATORLOOSE",`^${aa[ia.GTLT]}\\s*(${aa[ia.LOOSEPLAIN]})$|^$`);Di("COMPARATOR",`^${aa[ia.GTLT]}\\s*(${aa[ia.FULLPLAIN]})$|^$`);Di("COMPARATORTRIM",`(\\s*)${aa[ia.GTLT]}\\s*(${aa[ia.LOOSEPLAIN]}|${aa[ia.XRANGEPLAIN]})`,!0);NF.comparatorTrimReplace="$1$2$3";Di("HYPHENRANGE",`^\\s*(${aa[ia.XRANGEPLAIN]})\\s+-\\s+(${aa[ia.XRANGEPLAIN]})\\s*$`);Di("HYPHENRANGELOOSE",`^\\s*(${aa[ia.XRANGEPLAINLOOSE]})\\s+-\\s+(${aa[ia.XRANGEPLAINLOOSE]})\\s*$`);Di("STAR","(<|>)?=?\\s*\\*");Di("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Di("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var O5e=ve((xKi,uVn)=>{"use strict";var UCa=Object.freeze({loose:!0}),MCa=Object.freeze({}),zCa=n=>n?typeof n!="object"?UCa:n:MCa;uVn.exports=zCa});var PIt=ve((VKi,hVn)=>{"use strict";var IVn=/^[0-9]+$/,dVn=(n,t)=>{if(typeof n=="number"&&typeof t=="number")return n===t?0:n<t?-1:1;let r=IVn.test(n),a=IVn.test(t);return r&&a&&(n=+n,t=+t),n===t?0:r&&!a?-1:a&&!r?1:n<t?-1:1},_Ca=(n,t)=>dVn(t,n);hVn.exports={compareIdentifiers:dVn,rcompareIdentifiers:_Ca}});var ib=ve((QKi,pVn)=>{"use strict";var U5e=Ple(),{MAX_LENGTH:mVn,MAX_SAFE_INTEGER:M5e}=_le(),{safeRe:z5e,t:_5e}=jM(),PCa=O5e(),{compareIdentifiers:jIt}=PIt(),KIt=class n{constructor(t,r){if(r=PCa(r),t instanceof n){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>mVn)throw new TypeError(`version is longer than ${mVn} characters`);U5e("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let a=t.trim().match(r.loose?z5e[_5e.LOOSE]:z5e[_5e.FULL]);if(!a)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>M5e||this.major<0)throw new TypeError("Invalid major version");if(this.minor>M5e||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>M5e||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<M5e)return s}return i}):this.prerelease=[],this.build=a[5]?a[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(U5e("SemVer.compare",this.version,this.options,t),!(t instanceof n)){if(typeof t=="string"&&t===this.version)return 0;t=new n(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof n||(t=new n(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof n||(t=new n(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let a=this.prerelease[r],i=t.prerelease[r];if(U5e("prerelease compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return jIt(a,i)}while(++r)}compareBuild(t){t instanceof n||(t=new n(t,this.options));let r=0;do{let a=this.build[r],i=t.build[r];if(U5e("build compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return jIt(a,i)}while(++r)}inc(t,r,a){if(t.startsWith("pre")){if(!r&&a===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?z5e[_5e.PRERELEASELOOSE]:z5e[_5e.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,a);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,a);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,a),this.inc("pre",r,a);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,a),this.inc("pre",r,a);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(a)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&a===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];a===!1&&(s=[r]),jIt(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};pVn.exports=KIt});var Uk=ve((HKi,fVn)=>{"use strict";var bVn=ib(),jCa=(n,t,r=!1)=>{if(n instanceof bVn)return n;try{return new bVn(n,t)}catch(a){if(!r)return null;throw a}};fVn.exports=jCa});var qIt=ve((XKi,GVn)=>{"use strict";var KCa=Uk(),qCa=(n,t)=>{let r=KCa(n,t);return r?r.version:null};GVn.exports=qCa});var $It=ve((kKi,gVn)=>{"use strict";var $Ca=Uk(),eYa=(n,t)=>{let r=$Ca(n.trim().replace(/^[=v]+/,""),t);return r?r.version:null};gVn.exports=eYa});var NVn=ve((LKi,ZVn)=>{"use strict";var vVn=ib(),tYa=(n,t,r,a,i)=>{typeof r=="string"&&(i=a,a=r,r=void 0);try{return new vVn(n instanceof vVn?n.version:n,r).inc(t,a,i).version}catch{return null}};ZVn.exports=tYa});var yVn=ve((SKi,WVn)=>{"use strict";var AVn=Uk(),nYa=(n,t)=>{let r=AVn(n,null,!0),a=AVn(t,null,!0),i=r.compare(a);if(i===0)return null;let s=i>0,e=s?r:a,o=s?a:r,u=!!e.prerelease.length;if(!!o.prerelease.length&&!u){if(!o.patch&&!o.minor)return"major";if(o.compareMain(e)===0)return o.minor&&!o.patch?"minor":"patch"}let I=u?"pre":"";return r.major!==a.major?I+"major":r.minor!==a.minor?I+"minor":r.patch!==a.patch?I+"patch":"prerelease"};WVn.exports=nYa});var EVn=ve((BKi,FVn)=>{"use strict";var rYa=ib(),aYa=(n,t)=>new rYa(n,t).major;FVn.exports=aYa});var wVn=ve((JKi,RVn)=>{"use strict";var iYa=ib(),lYa=(n,t)=>new iYa(n,t).minor;RVn.exports=lYa});var YVn=ve((TKi,CVn)=>{"use strict";var sYa=ib(),oYa=(n,t)=>new sYa(n,t).patch;CVn.exports=oYa});var VVn=ve((DKi,xVn)=>{"use strict";var cYa=Uk(),uYa=(n,t)=>{let r=cYa(n,t);return r&&r.prerelease.length?r.prerelease:null};xVn.exports=uYa});var AZ=ve((OKi,HVn)=>{"use strict";var QVn=ib(),IYa=(n,t,r)=>new QVn(n,r).compare(new QVn(t,r));HVn.exports=IYa});var kVn=ve((UKi,XVn)=>{"use strict";var dYa=AZ(),hYa=(n,t,r)=>dYa(t,n,r);XVn.exports=hYa});var SVn=ve((MKi,LVn)=>{"use strict";var mYa=AZ(),pYa=(n,t)=>mYa(n,t,!0);LVn.exports=pYa});var P5e=ve((zKi,JVn)=>{"use strict";var BVn=ib(),bYa=(n,t,r)=>{let a=new BVn(n,r),i=new BVn(t,r);return a.compare(i)||a.compareBuild(i)};JVn.exports=bYa});var DVn=ve((_Ki,TVn)=>{"use strict";var fYa=P5e(),GYa=(n,t)=>n.sort((r,a)=>fYa(r,a,t));TVn.exports=GYa});var UVn=ve((PKi,OVn)=>{"use strict";var gYa=P5e(),vYa=(n,t)=>n.sort((r,a)=>gYa(a,r,t));OVn.exports=vYa});var jle=ve((jKi,MVn)=>{"use strict";var ZYa=AZ(),NYa=(n,t,r)=>ZYa(n,t,r)>0;MVn.exports=NYa});var j5e=ve((KKi,zVn)=>{"use strict";var AYa=AZ(),WYa=(n,t,r)=>AYa(n,t,r)<0;zVn.exports=WYa});var edt=ve((qKi,_Vn)=>{"use strict";var yYa=AZ(),FYa=(n,t,r)=>yYa(n,t,r)===0;_Vn.exports=FYa});var tdt=ve(($Ki,PVn)=>{"use strict";var EYa=AZ(),RYa=(n,t,r)=>EYa(n,t,r)!==0;PVn.exports=RYa});var K5e=ve((eqi,jVn)=>{"use strict";var wYa=AZ(),CYa=(n,t,r)=>wYa(n,t,r)>=0;jVn.exports=CYa});var q5e=ve((tqi,KVn)=>{"use strict";var YYa=AZ(),xYa=(n,t,r)=>YYa(n,t,r)<=0;KVn.exports=xYa});var ndt=ve((nqi,qVn)=>{"use strict";var VYa=edt(),QYa=tdt(),HYa=jle(),XYa=K5e(),kYa=j5e(),LYa=q5e(),SYa=(n,t,r,a)=>{switch(t){case"===":return typeof n=="object"&&(n=n.version),typeof r=="object"&&(r=r.version),n===r;case"!==":return typeof n=="object"&&(n=n.version),typeof r=="object"&&(r=r.version),n!==r;case"":case"=":case"==":return VYa(n,r,a);case"!=":return QYa(n,r,a);case">":return HYa(n,r,a);case">=":return XYa(n,r,a);case"<":return kYa(n,r,a);case"<=":return LYa(n,r,a);default:throw new TypeError(`Invalid operator: ${t}`)}};qVn.exports=SYa});var eQn=ve((rqi,$Vn)=>{"use strict";var BYa=ib(),JYa=Uk(),{safeRe:$5e,t:eEe}=jM(),TYa=(n,t)=>{if(n instanceof BYa)return n;if(typeof n=="number"&&(n=String(n)),typeof n!="string")return null;t=t||{};let r=null;if(!t.rtl)r=n.match(t.includePrerelease?$5e[eEe.COERCEFULL]:$5e[eEe.COERCE]);else{let u=t.includePrerelease?$5e[eEe.COERCERTLFULL]:$5e[eEe.COERCERTL],d;for(;(d=u.exec(n))&&(!r||r.index+r[0].length!==n.length);)(!r||d.index+d[0].length!==r.index+r[0].length)&&(r=d),u.lastIndex=d.index+d[1].length+d[2].length;u.lastIndex=-1}if(r===null)return null;let a=r[2],i=r[3]||"0",s=r[4]||"0",e=t.includePrerelease&&r[5]?`-${r[5]}`:"",o=t.includePrerelease&&r[6]?`+${r[6]}`:"";return JYa(`${a}.${i}.${s}${e}${o}`,t)};$Vn.exports=TYa});var nQn=ve((aqi,tQn)=>{"use strict";var rdt=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}};tQn.exports=rdt});var WZ=ve((iqi,lQn)=>{"use strict";var DYa=/\s+/g,adt=class n{constructor(t,r){if(r=UYa(r),t instanceof n)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new n(t.raw,r);if(t instanceof idt)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(DYa," "),this.set=this.raw.split("||").map(a=>this.parseRange(a.trim())).filter(a=>a.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let a=this.set[0];if(this.set=this.set.filter(i=>!aQn(i[0])),this.set.length===0)this.set=[a];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&qYa(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let a=0;a<r.length;a++)a>0&&(this.formatted+=" "),this.formatted+=r[a].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let a=((this.options.includePrerelease&&jYa)|(this.options.loose&&KYa))+":"+t,i=rQn.get(a);if(i)return i;let s=this.options.loose,e=s?G2[lb.HYPHENRANGELOOSE]:G2[lb.HYPHENRANGE];t=t.replace(e,oxa(this.options.includePrerelease)),du("hyphen replace",t),t=t.replace(G2[lb.COMPARATORTRIM],zYa),du("comparator trim",t),t=t.replace(G2[lb.TILDETRIM],_Ya),du("tilde trim",t),t=t.replace(G2[lb.CARETTRIM],PYa),du("caret trim",t);let o=t.split(" ").map(h=>$Ya(h,this.options)).join(" ").split(/\s+/).map(h=>sxa(h,this.options));s&&(o=o.filter(h=>(du("loose invalid filter",h,this.options),!!h.match(G2[lb.COMPARATORLOOSE])))),du("range list",o);let u=new Map,d=o.map(h=>new idt(h,this.options));for(let h of d){if(aQn(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let I=[...u.values()];return rQn.set(a,I),I}intersects(t,r){if(!(t instanceof n))throw new TypeError("a Range is required");return this.set.some(a=>iQn(a,r)&&t.set.some(i=>iQn(i,r)&&a.every(s=>i.every(e=>s.intersects(e,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new MYa(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(cxa(this.set[r],t,this.options))return!0;return!1}};lQn.exports=adt;var OYa=nQn(),rQn=new OYa,UYa=O5e(),idt=Kle(),du=Ple(),MYa=ib(),{safeRe:G2,t:lb,comparatorTrimReplace:zYa,tildeTrimReplace:_Ya,caretTrimReplace:PYa}=jM(),{FLAG_INCLUDE_PRERELEASE:jYa,FLAG_LOOSE:KYa}=_le(),aQn=n=>n.value==="<0.0.0-0",qYa=n=>n.value==="",iQn=(n,t)=>{let r=!0,a=n.slice(),i=a.pop();for(;r&&a.length;)r=a.every(s=>i.intersects(s,t)),i=a.pop();return r},$Ya=(n,t)=>(n=n.replace(G2[lb.BUILD],""),du("comp",n,t),n=nxa(n,t),du("caret",n),n=exa(n,t),du("tildes",n),n=axa(n,t),du("xrange",n),n=lxa(n,t),du("stars",n),n),g2=n=>!n||n.toLowerCase()==="x"||n==="*",exa=(n,t)=>n.trim().split(/\s+/).map(r=>txa(r,t)).join(" "),txa=(n,t)=>{let r=t.loose?G2[lb.TILDELOOSE]:G2[lb.TILDE];return n.replace(r,(a,i,s,e,o)=>{du("tilde",n,a,i,s,e,o);let u;return g2(i)?u="":g2(s)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:g2(e)?u=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:o?(du("replaceTilde pr",o),u=`>=${i}.${s}.${e}-${o} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${e} <${i}.${+s+1}.0-0`,du("tilde return",u),u})},nxa=(n,t)=>n.trim().split(/\s+/).map(r=>rxa(r,t)).join(" "),rxa=(n,t)=>{du("caret",n,t);let r=t.loose?G2[lb.CARETLOOSE]:G2[lb.CARET],a=t.includePrerelease?"-0":"";return n.replace(r,(i,s,e,o,u)=>{du("caret",n,i,s,e,o,u);let d;return g2(s)?d="":g2(e)?d=`>=${s}.0.0${a} <${+s+1}.0.0-0`:g2(o)?s==="0"?d=`>=${s}.${e}.0${a} <${s}.${+e+1}.0-0`:d=`>=${s}.${e}.0${a} <${+s+1}.0.0-0`:u?(du("replaceCaret pr",u),s==="0"?e==="0"?d=`>=${s}.${e}.${o}-${u} <${s}.${e}.${+o+1}-0`:d=`>=${s}.${e}.${o}-${u} <${s}.${+e+1}.0-0`:d=`>=${s}.${e}.${o}-${u} <${+s+1}.0.0-0`):(du("no pr"),s==="0"?e==="0"?d=`>=${s}.${e}.${o}${a} <${s}.${e}.${+o+1}-0`:d=`>=${s}.${e}.${o}${a} <${s}.${+e+1}.0-0`:d=`>=${s}.${e}.${o} <${+s+1}.0.0-0`),du("caret return",d),d})},axa=(n,t)=>(du("replaceXRanges",n,t),n.split(/\s+/).map(r=>ixa(r,t)).join(" ")),ixa=(n,t)=>{n=n.trim();let r=t.loose?G2[lb.XRANGELOOSE]:G2[lb.XRANGE];return n.replace(r,(a,i,s,e,o,u)=>{du("xRange",n,a,i,s,e,o,u);let d=g2(s),I=d||g2(e),h=I||g2(o),c=h;return i==="="&&c&&(i=""),u=t.includePrerelease?"-0":"",d?i===">"||i==="<"?a="<0.0.0-0":a="*":i&&c?(I&&(e=0),o=0,i===">"?(i=">=",I?(s=+s+1,e=0,o=0):(e=+e+1,o=0)):i==="<="&&(i="<",I?s=+s+1:e=+e+1),i==="<"&&(u="-0"),a=`${i+s}.${e}.${o}${u}`):I?a=`>=${s}.0.0${u} <${+s+1}.0.0-0`:h&&(a=`>=${s}.${e}.0${u} <${s}.${+e+1}.0-0`),du("xRange return",a),a})},lxa=(n,t)=>(du("replaceStars",n,t),n.trim().replace(G2[lb.STAR],"")),sxa=(n,t)=>(du("replaceGTE0",n,t),n.trim().replace(G2[t.includePrerelease?lb.GTE0PRE:lb.GTE0],"")),oxa=n=>(t,r,a,i,s,e,o,u,d,I,h,c)=>(g2(a)?r="":g2(i)?r=`>=${a}.0.0${n?"-0":""}`:g2(s)?r=`>=${a}.${i}.0${n?"-0":""}`:e?r=`>=${r}`:r=`>=${r}${n?"-0":""}`,g2(d)?u="":g2(I)?u=`<${+d+1}.0.0-0`:g2(h)?u=`<${d}.${+I+1}.0-0`:c?u=`<=${d}.${I}.${h}-${c}`:n?u=`<${d}.${I}.${+h+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),cxa=(n,t,r)=>{for(let a=0;a<n.length;a++)if(!n[a].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let a=0;a<n.length;a++)if(du(n[a].semver),n[a].semver!==idt.ANY&&n[a].semver.prerelease.length>0){let i=n[a].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}});var Kle=ve((lqi,dQn)=>{"use strict";var qle=Symbol("SemVer ANY"),odt=class n{static get ANY(){return qle}constructor(t,r){if(r=sQn(r),t instanceof n){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),sdt("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===qle?this.value="":this.value=this.operator+this.semver.version,sdt("comp",this)}parse(t){let r=this.options.loose?oQn[cQn.COMPARATORLOOSE]:oQn[cQn.COMPARATOR],a=t.match(r);if(!a)throw new TypeError(`Invalid comparator: ${t}`);this.operator=a[1]!==void 0?a[1]:"",this.operator==="="&&(this.operator=""),a[2]?this.semver=new uQn(a[2],this.options.loose):this.semver=qle}toString(){return this.value}test(t){if(sdt("Comparator.test",t,this.options.loose),this.semver===qle||t===qle)return!0;if(typeof t=="string")try{t=new uQn(t,this.options)}catch{return!1}return ldt(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new IQn(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new IQn(this.value,r).test(t.semver):(r=sQn(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||ldt(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||ldt(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};dQn.exports=odt;var sQn=O5e(),{safeRe:oQn,t:cQn}=jM(),ldt=ndt(),sdt=Ple(),uQn=ib(),IQn=WZ()});var $le=ve((sqi,hQn)=>{"use strict";var uxa=WZ(),Ixa=(n,t,r)=>{try{t=new uxa(t,r)}catch{return!1}return t.test(n)};hQn.exports=Ixa});var pQn=ve((oqi,mQn)=>{"use strict";var dxa=WZ(),hxa=(n,t)=>new dxa(n,t).set.map(r=>r.map(a=>a.value).join(" ").trim().split(" "));mQn.exports=hxa});var fQn=ve((cqi,bQn)=>{"use strict";var mxa=ib(),pxa=WZ(),bxa=(n,t,r)=>{let a=null,i=null,s=null;try{s=new pxa(t,r)}catch{return null}return n.forEach(e=>{s.test(e)&&(!a||i.compare(e)===-1)&&(a=e,i=new mxa(a,r))}),a};bQn.exports=bxa});var gQn=ve((uqi,GQn)=>{"use strict";var fxa=ib(),Gxa=WZ(),gxa=(n,t,r)=>{let a=null,i=null,s=null;try{s=new Gxa(t,r)}catch{return null}return n.forEach(e=>{s.test(e)&&(!a||i.compare(e)===1)&&(a=e,i=new fxa(a,r))}),a};GQn.exports=gxa});var NQn=ve((Iqi,ZQn)=>{"use strict";var cdt=ib(),vxa=WZ(),vQn=jle(),Zxa=(n,t)=>{n=new vxa(n,t);let r=new cdt("0.0.0");if(n.test(r)||(r=new cdt("0.0.0-0"),n.test(r)))return r;r=null;for(let a=0;a<n.set.length;++a){let i=n.set[a],s=null;i.forEach(e=>{let o=new cdt(e.semver.version);switch(e.operator){case">":o.prerelease.length===0?o.patch++:o.prerelease.push(0),o.raw=o.format();case"":case">=":(!s||vQn(o,s))&&(s=o);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),s&&(!r||vQn(r,s))&&(r=s)}return r&&n.test(r)?r:null};ZQn.exports=Zxa});var WQn=ve((dqi,AQn)=>{"use strict";var Nxa=WZ(),Axa=(n,t)=>{try{return new Nxa(n,t).range||"*"}catch{return null}};AQn.exports=Axa});var tEe=ve((hqi,RQn)=>{"use strict";var Wxa=ib(),EQn=Kle(),{ANY:yxa}=EQn,Fxa=WZ(),Exa=$le(),yQn=jle(),FQn=j5e(),Rxa=q5e(),wxa=K5e(),Cxa=(n,t,r,a)=>{n=new Wxa(n,a),t=new Fxa(t,a);let i,s,e,o,u;switch(r){case">":i=yQn,s=Rxa,e=FQn,o=">",u=">=";break;case"<":i=FQn,s=wxa,e=yQn,o="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Exa(n,t,a))return!1;for(let d=0;d<t.set.length;++d){let I=t.set[d],h=null,c=null;if(I.forEach(G=>{G.semver===yxa&&(G=new EQn(">=0.0.0")),h=h||G,c=c||G,i(G.semver,h.semver,a)?h=G:e(G.semver,c.semver,a)&&(c=G)}),h.operator===o||h.operator===u||(!c.operator||c.operator===o)&&s(n,c.semver))return!1;if(c.operator===u&&e(n,c.semver))return!1}return!0};RQn.exports=Cxa});var CQn=ve((mqi,wQn)=>{"use strict";var Yxa=tEe(),xxa=(n,t,r)=>Yxa(n,t,">",r);wQn.exports=xxa});var xQn=ve((pqi,YQn)=>{"use strict";var Vxa=tEe(),Qxa=(n,t,r)=>Vxa(n,t,"<",r);YQn.exports=Qxa});var HQn=ve((bqi,QQn)=>{"use strict";var VQn=WZ(),Hxa=(n,t,r)=>(n=new VQn(n,r),t=new VQn(t,r),n.intersects(t,r));QQn.exports=Hxa});var kQn=ve((fqi,XQn)=>{"use strict";var Xxa=$le(),kxa=AZ();XQn.exports=(n,t,r)=>{let a=[],i=null,s=null,e=n.sort((I,h)=>kxa(I,h,r));for(let I of e)Xxa(I,t,r)?(s=I,i||(i=I)):(s&&a.push([i,s]),s=null,i=null);i&&a.push([i,null]);let o=[];for(let[I,h]of a)I===h?o.push(I):!h&&I===e[0]?o.push("*"):h?I===e[0]?o.push(`<=${h}`):o.push(`${I} - ${h}`):o.push(`>=${I}`);let u=o.join(" || "),d=typeof t.raw=="string"?t.raw:String(t);return u.length<d.length?u:t}});var DQn=ve((Gqi,TQn)=>{"use strict";var LQn=WZ(),Idt=Kle(),{ANY:udt}=Idt,ese=$le(),ddt=AZ(),Lxa=(n,t,r={})=>{if(n===t)return!0;n=new LQn(n,r),t=new LQn(t,r);let a=!1;e:for(let i of n.set){for(let s of t.set){let e=Bxa(i,s,r);if(a=a||e!==null,e)continue e}if(a)return!1}return!0},Sxa=[new Idt(">=0.0.0-0")],SQn=[new Idt(">=0.0.0")],Bxa=(n,t,r)=>{if(n===t)return!0;if(n.length===1&&n[0].semver===udt){if(t.length===1&&t[0].semver===udt)return!0;r.includePrerelease?n=Sxa:n=SQn}if(t.length===1&&t[0].semver===udt){if(r.includePrerelease)return!0;t=SQn}let a=new Set,i,s;for(let G of n)G.operator===">"||G.operator===">="?i=BQn(i,G,r):G.operator==="<"||G.operator==="<="?s=JQn(s,G,r):a.add(G.semver);if(a.size>1)return null;let e;if(i&&s){if(e=ddt(i.semver,s.semver,r),e>0)return null;if(e===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let G of a){if(i&&!ese(G,String(i),r)||s&&!ese(G,String(s),r))return null;for(let W of t)if(!ese(G,String(W),r))return!1;return!0}let o,u,d,I,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,c=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let G of t){if(I=I||G.operator===">"||G.operator===">=",d=d||G.operator==="<"||G.operator==="<=",i){if(c&&G.semver.prerelease&&G.semver.prerelease.length&&G.semver.major===c.major&&G.semver.minor===c.minor&&G.semver.patch===c.patch&&(c=!1),G.operator===">"||G.operator===">="){if(o=BQn(i,G,r),o===G&&o!==i)return!1}else if(i.operator===">="&&!ese(i.semver,String(G),r))return!1}if(s){if(h&&G.semver.prerelease&&G.semver.prerelease.length&&G.semver.major===h.major&&G.semver.minor===h.minor&&G.semver.patch===h.patch&&(h=!1),G.operator==="<"||G.operator==="<="){if(u=JQn(s,G,r),u===G&&u!==s)return!1}else if(s.operator==="<="&&!ese(s.semver,String(G),r))return!1}if(!G.operator&&(s||i)&&e!==0)return!1}return!(i&&d&&!s&&e!==0||s&&I&&!i&&e!==0||c||h)},BQn=(n,t,r)=>{if(!n)return t;let a=ddt(n.semver,t.semver,r);return a>0?n:a<0||t.operator===">"&&n.operator===">="?t:n},JQn=(n,t,r)=>{if(!n)return t;let a=ddt(n.semver,t.semver,r);return a<0?n:a>0||t.operator==="<"&&n.operator==="<="?t:n};TQn.exports=Lxa});var tse=ve((gqi,MQn)=>{"use strict";var hdt=jM(),OQn=_le(),Jxa=ib(),UQn=PIt(),Txa=Uk(),Dxa=qIt(),Oxa=$It(),Uxa=NVn(),Mxa=yVn(),zxa=EVn(),_xa=wVn(),Pxa=YVn(),jxa=VVn(),Kxa=AZ(),qxa=kVn(),$xa=SVn(),eVa=P5e(),tVa=DVn(),nVa=UVn(),rVa=jle(),aVa=j5e(),iVa=edt(),lVa=tdt(),sVa=K5e(),oVa=q5e(),cVa=ndt(),uVa=eQn(),IVa=Kle(),dVa=WZ(),hVa=$le(),mVa=pQn(),pVa=fQn(),bVa=gQn(),fVa=NQn(),GVa=WQn(),gVa=tEe(),vVa=CQn(),ZVa=xQn(),NVa=HQn(),AVa=kQn(),WVa=DQn();MQn.exports={parse:Txa,valid:Dxa,clean:Oxa,inc:Uxa,diff:Mxa,major:zxa,minor:_xa,patch:Pxa,prerelease:jxa,compare:Kxa,rcompare:qxa,compareLoose:$xa,compareBuild:eVa,sort:tVa,rsort:nVa,gt:rVa,lt:aVa,eq:iVa,neq:lVa,gte:sVa,lte:oVa,cmp:cVa,coerce:uVa,Comparator:IVa,Range:dVa,satisfies:hVa,toComparators:mVa,maxSatisfying:pVa,minSatisfying:bVa,minVersion:fVa,validRange:GVa,outside:gVa,gtr:vVa,ltr:ZVa,intersects:NVa,simplifyRange:AVa,subset:WVa,SemVer:Jxa,re:hdt.re,src:hdt.src,tokens:hdt.t,SEMVER_SPEC_VERSION:OQn.SEMVER_SPEC_VERSION,RELEASE_TYPES:OQn.RELEASE_TYPES,compareIdentifiers:UQn.compareIdentifiers,rcompareIdentifiers:UQn.rcompareIdentifiers}});var zQn=ve(d3=>{"use strict";Object.defineProperty(d3,"__esModule",{value:!0});d3.JaegerPropagator=d3.UBER_BAGGAGE_HEADER_PREFIX=d3.UBER_TRACE_ID_HEADER=void 0;var Mk=(Qr(),dr(kr)),yVa=Va();d3.UBER_TRACE_ID_HEADER="uber-trace-id";d3.UBER_BAGGAGE_HEADER_PREFIX="uberctx";var mdt=class{constructor(t){typeof t=="string"?(this._jaegerTraceHeader=t,this._jaegerBaggageHeaderPrefix=d3.UBER_BAGGAGE_HEADER_PREFIX):(this._jaegerTraceHeader=t?.customTraceHeader||d3.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=t?.customBaggageHeaderPrefix||d3.UBER_BAGGAGE_HEADER_PREFIX)}inject(t,r,a){let i=Mk.trace.getSpanContext(t),s=Mk.propagation.getBaggage(t);if(i&&(0,yVa.isTracingSuppressed)(t)===!1){let e=`0${(i.traceFlags||Mk.TraceFlags.NONE).toString(16)}`;a.set(r,this._jaegerTraceHeader,`${i.traceId}:${i.spanId}:0:${e}`)}if(s)for(let[e,o]of s.getAllEntries())a.set(r,`${this._jaegerBaggageHeaderPrefix}-${e}`,encodeURIComponent(o.value))}extract(t,r,a){var i;let s=a.get(r,this._jaegerTraceHeader),e=Array.isArray(s)?s[0]:s,o=a.keys(r).filter(I=>I.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map(I=>{let h=a.get(r,I);return{key:I.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(h)?h[0]:h}}),u=t;if(typeof e=="string"){let I=EVa(e);I&&(u=Mk.trace.setSpanContext(u,I))}if(o.length===0)return u;let d=(i=Mk.propagation.getBaggage(t))!==null&&i!==void 0?i:Mk.propagation.createBaggage();for(let I of o)I.value!==void 0&&(d=d.setEntry(I.key,{value:decodeURIComponent(I.value)}));return u=Mk.propagation.setBaggage(u,d),u}fields(){return[this._jaegerTraceHeader]}};d3.JaegerPropagator=mdt;var FVa=/^[0-9a-f]{1,2}$/i;function EVa(n){let t=decodeURIComponent(n).split(":");if(t.length!==4)return null;let[r,a,,i]=t,s=r.padStart(32,"0"),e=a.padStart(16,"0"),o=FVa.test(i)?parseInt(i,16)&1:1;return{traceId:s,spanId:e,isRemote:!0,traceFlags:o}}});var _Qn=ve(zk=>{"use strict";var RVa=zk&&zk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),wVa=zk&&zk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&RVa(t,n,r)};Object.defineProperty(zk,"__esModule",{value:!0});wVa(zQn(),zk)});var KQn=ve(aEe=>{"use strict";Object.defineProperty(aEe,"__esModule",{value:!0});aEe.NodeTracerProvider=void 0;var PQn=Gxn(),nEe=yxn(),jQn=Ok(),CVa=tse(),YVa=_Qn(),rEe=class extends jQn.BasicTracerProvider{constructor(t={}){super(t)}register(t={}){if(t.contextManager===void 0){let r=CVa.gte(process.version,"14.8.0")?PQn.AsyncLocalStorageContextManager:PQn.AsyncHooksContextManager;t.contextManager=new r,t.contextManager.enable()}super.register(t)}};aEe.NodeTracerProvider=rEe;rEe._registeredPropagators=new Map([...jQn.BasicTracerProvider._registeredPropagators,["b3",()=>new nEe.B3Propagator({injectEncoding:nEe.B3InjectEncoding.SINGLE_HEADER})],["b3multi",()=>new nEe.B3Propagator({injectEncoding:nEe.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new YVa.JaegerPropagator]])});var iEe=ve(Fx=>{"use strict";var xVa=Fx&&Fx.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),qQn=Fx&&Fx.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&xVa(t,n,r)};Object.defineProperty(Fx,"__esModule",{value:!0});qQn(KQn(),Fx);qQn(Ok(),Fx)});var $Qn=ve(KM=>{"use strict";Object.defineProperty(KM,"__esModule",{value:!0});KM.disableInstrumentations=KM.enableInstrumentations=void 0;function VVa(n,t,r,a){for(let i=0,s=n.length;i<s;i++){let e=n[i];t&&e.setTracerProvider(t),r&&e.setMeterProvider(r),a&&e.setLoggerProvider&&e.setLoggerProvider(a),e.getConfig().enabled||e.enable()}}KM.enableInstrumentations=VVa;function QVa(n){n.forEach(t=>t.disable())}KM.disableInstrumentations=QVa});var n9n=ve(lEe=>{"use strict";Object.defineProperty(lEe,"__esModule",{value:!0});lEe.registerInstrumentations=void 0;var e9n=(Qr(),dr(kr)),HVa=pU(),t9n=$Qn();function XVa(n){var t,r;let a=n.tracerProvider||e9n.trace.getTracerProvider(),i=n.meterProvider||e9n.metrics.getMeterProvider(),s=n.loggerProvider||HVa.logs.getLoggerProvider(),e=(r=(t=n.instrumentations)===null||t===void 0?void 0:t.flat())!==null&&r!==void 0?r:[];return(0,t9n.enableInstrumentations)(e,a,i,s),()=>{(0,t9n.disableInstrumentations)(e)}}lEe.registerInstrumentations=XVa});var bdt=ve((Fqi,i9n)=>{"use strict";function pdt(n){return typeof n=="function"}var v2=console.error.bind(console);function nse(n,t,r){var a=!!n[t]&&n.propertyIsEnumerable(t);Object.defineProperty(n,t,{configurable:!0,enumerable:a,writable:!0,value:r})}function rse(n){n&&n.logger&&(pdt(n.logger)?v2=n.logger:v2("new logger isn't a function, not replacing"))}function r9n(n,t,r){if(!n||!n[t]){v2("no original function "+t+" to wrap");return}if(!r){v2("no wrapper function"),v2(new Error().stack);return}if(!pdt(n[t])||!pdt(r)){v2("original object and wrapper must be functions");return}var a=n[t],i=r(a,t);return nse(i,"__original",a),nse(i,"__unwrap",function(){n[t]===i&&nse(n,t,a)}),nse(i,"__wrapped",!0),nse(n,t,i),i}function kVa(n,t,r){if(n)Array.isArray(n)||(n=[n]);else{v2("must provide one or more modules to patch"),v2(new Error().stack);return}if(!(t&&Array.isArray(t))){v2("must provide one or more functions to wrap on modules");return}n.forEach(function(a){t.forEach(function(i){r9n(a,i,r)})})}function a9n(n,t){if(!n||!n[t]){v2("no function to unwrap."),v2(new Error().stack);return}if(!n[t].__unwrap)v2("no original to unwrap to -- has "+t+" already been unwrapped?");else return n[t].__unwrap()}function LVa(n,t){if(n)Array.isArray(n)||(n=[n]);else{v2("must provide one or more modules to patch"),v2(new Error().stack);return}if(!(t&&Array.isArray(t))){v2("must provide one or more functions to unwrap on modules");return}n.forEach(function(r){t.forEach(function(a){a9n(r,a)})})}rse.wrap=r9n;rse.massWrap=kVa;rse.unwrap=a9n;rse.massUnwrap=LVa;i9n.exports=rse});var l9n=ve(oEe=>{"use strict";Object.defineProperty(oEe,"__esModule",{value:!0});oEe.InstrumentationAbstract=void 0;var fdt=(Qr(),dr(kr)),SVa=pU(),sEe=bdt(),Gdt=class{constructor(t,r,a){this.instrumentationName=t,this.instrumentationVersion=r,this._wrap=sEe.wrap,this._unwrap=sEe.unwrap,this._massWrap=sEe.massWrap,this._massUnwrap=sEe.massUnwrap,this._config=Object.assign({enabled:!0},a),this._diag=fdt.diag.createComponentLogger({namespace:t}),this._tracer=fdt.trace.getTracer(t,r),this._meter=fdt.metrics.getMeter(t,r),this._logger=SVa.logs.getLogger(t,r),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var t;let r=(t=this.init())!==null&&t!==void 0?t:[];return Array.isArray(r)?r:[r]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config=Object.assign({},t)}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,a,i){if(t)try{t(a,i)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},s)}}};oEe.InstrumentationAbstract=Gdt});var vdt=ve((Rqi,s9n)=>{"use strict";var gdt=vt("path").sep;s9n.exports=function(n){var t=n.split(gdt),r=t.lastIndexOf("node_modules");if(r!==-1&&t[r+1]){for(var a=t[r+1][0]==="@",i=a?t[r+1]+"/"+t[r+2]:t[r+1],s=a?3:2,e="",o=r+s-1,u=0;u<=o;u++)u===o?e+=t[u]:e+=t[u]+gdt;for(var d="",I=t.length-1,h=r+s;h<=I;h++)h===I?d+=t[h]:d+=t[h]+gdt;return{name:i,basedir:e,path:d}}}});var Zdt=ve((wqi,o9n)=>{"use strict";var BVa=vt("os");o9n.exports=BVa.homedir||function(){var t=process.env.HOME,r=process.env.LOGNAME||process.env.USER||process.env.LNAME||process.env.USERNAME;return process.platform==="win32"?process.env.USERPROFILE||process.env.HOMEDRIVE+process.env.HOMEPATH||t||null:process.platform==="darwin"?t||(r?"/Users/"+r:null):process.platform==="linux"?t||(process.getuid()===0?"/root":r?"/home/"+r:null):t||null}});var Ndt=ve((Cqi,c9n)=>{c9n.exports=function(){var n=Error.prepareStackTrace;Error.prepareStackTrace=function(r,a){return a};var t=new Error().stack;return Error.prepareStackTrace=n,t[2].getFileName()}});var u9n=ve((Yqi,ase)=>{"use strict";var JVa=process.platform==="win32",TVa=/^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/,Adt={};function DVa(n){return TVa.exec(n).slice(1)}Adt.parse=function(n){if(typeof n!="string")throw new TypeError("Parameter 'pathString' must be a string, not "+typeof n);var t=DVa(n);if(!t||t.length!==5)throw new TypeError("Invalid path '"+n+"'");return{root:t[1],dir:t[0]===t[1]?t[0]:t[0].slice(0,-1),base:t[2],ext:t[4],name:t[3]}};var OVa=/^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/,Wdt={};function UVa(n){return OVa.exec(n).slice(1)}Wdt.parse=function(n){if(typeof n!="string")throw new TypeError("Parameter 'pathString' must be a string, not "+typeof n);var t=UVa(n);if(!t||t.length!==5)throw new TypeError("Invalid path '"+n+"'");return{root:t[1],dir:t[0].slice(0,-1),base:t[2],ext:t[4],name:t[3]}};JVa?ase.exports=Adt.parse:ase.exports=Wdt.parse;ase.exports.posix=Wdt.parse;ase.exports.win32=Adt.parse});var ydt=ve((xqi,m9n)=>{var h9n=vt("path"),I9n=h9n.parse||u9n(),MVa=/^([A-Za-z]:)/,zVa=/^\\\\/,d9n=function(t,r){var a="/";MVa.test(t)?a="":zVa.test(t)&&(a="\\\\");for(var i=[t],s=I9n(t);s.dir!==i[i.length-1];)i.push(s.dir),s=I9n(s.dir);return i.reduce(function(e,o){return e.concat(r.map(function(u){return h9n.resolve(a,o,u)}))},[])};m9n.exports=function(t,r,a){var i=r&&r.moduleDirectory?[].concat(r.moduleDirectory):["node_modules"];if(r&&typeof r.paths=="function")return r.paths(a,t,function(){return d9n(t,i)},r);var s=d9n(t,i);return r&&r.paths?s.concat(r.paths):s}});var Fdt=ve((Vqi,p9n)=>{p9n.exports=function(n,t){return t||{}}});var G9n=ve((Qqi,f9n)=>{"use strict";var _Va="Function.prototype.bind called on incompatible ",PVa=Object.prototype.toString,jVa=Math.max,KVa="[object Function]",b9n=function(t,r){for(var a=[],i=0;i<t.length;i+=1)a[i]=t[i];for(var s=0;s<r.length;s+=1)a[s+t.length]=r[s];return a},qVa=function(t,r){for(var a=[],i=r||0,s=0;i<t.length;i+=1,s+=1)a[s]=t[i];return a},$Va=function(n,t){for(var r="",a=0;a<n.length;a+=1)r+=n[a],a+1<n.length&&(r+=t);return r};f9n.exports=function(t){var r=this;if(typeof r!="function"||PVa.apply(r)!==KVa)throw new TypeError(_Va+r);for(var a=qVa(arguments,1),i,s=function(){if(this instanceof i){var I=r.apply(this,b9n(a,arguments));return Object(I)===I?I:this}return r.apply(t,b9n(a,arguments))},e=jVa(0,r.length-a.length),o=[],u=0;u<e;u++)o[u]="$"+u;if(i=Function("binder","return function ("+$Va(o,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var d=function(){};d.prototype=r.prototype,i.prototype=new d,d.prototype=null}return i}});var v9n=ve((Hqi,g9n)=>{"use strict";var eQa=G9n();g9n.exports=Function.prototype.bind||eQa});var N9n=ve((Xqi,Z9n)=>{"use strict";var tQa=Function.prototype.call,nQa=Object.prototype.hasOwnProperty,rQa=v9n();Z9n.exports=rQa.call(tQa,nQa)});var A9n=ve((kqi,aQa)=>{aQa.exports={assert:!0,"node:assert":[">= 14.18 && < 15",">= 16"],"assert/strict":">= 15","node:assert/strict":">= 16",async_hooks:">= 8","node:async_hooks":[">= 14.18 && < 15",">= 16"],buffer_ieee754:">= 0.5 && < 0.9.7",buffer:!0,"node:buffer":[">= 14.18 && < 15",">= 16"],child_process:!0,"node:child_process":[">= 14.18 && < 15",">= 16"],cluster:">= 0.5","node:cluster":[">= 14.18 && < 15",">= 16"],console:!0,"node:console":[">= 14.18 && < 15",">= 16"],constants:!0,"node:constants":[">= 14.18 && < 15",">= 16"],crypto:!0,"node:crypto":[">= 14.18 && < 15",">= 16"],_debug_agent:">= 1 && < 8",_debugger:"< 8",dgram:!0,"node:dgram":[">= 14.18 && < 15",">= 16"],diagnostics_channel:[">= 14.17 && < 15",">= 15.1"],"node:diagnostics_channel":[">= 14.18 && < 15",">= 16"],dns:!0,"node:dns":[">= 14.18 && < 15",">= 16"],"dns/promises":">= 15","node:dns/promises":">= 16",domain:">= 0.7.12","node:domain":[">= 14.18 && < 15",">= 16"],events:!0,"node:events":[">= 14.18 && < 15",">= 16"],freelist:"< 6",fs:!0,"node:fs":[">= 14.18 && < 15",">= 16"],"fs/promises":[">= 10 && < 10.1",">= 14"],"node:fs/promises":[">= 14.18 && < 15",">= 16"],_http_agent:">= 0.11.1","node:_http_agent":[">= 14.18 && < 15",">= 16"],_http_client:">= 0.11.1","node:_http_client":[">= 14.18 && < 15",">= 16"],_http_common:">= 0.11.1","node:_http_common":[">= 14.18 && < 15",">= 16"],_http_incoming:">= 0.11.1","node:_http_incoming":[">= 14.18 && < 15",">= 16"],_http_outgoing:">= 0.11.1","node:_http_outgoing":[">= 14.18 && < 15",">= 16"],_http_server:">= 0.11.1","node:_http_server":[">= 14.18 && < 15",">= 16"],http:!0,"node:http":[">= 14.18 && < 15",">= 16"],http2:">= 8.8","node:http2":[">= 14.18 && < 15",">= 16"],https:!0,"node:https":[">= 14.18 && < 15",">= 16"],inspector:">= 8","node:inspector":[">= 14.18 && < 15",">= 16"],"inspector/promises":[">= 19"],"node:inspector/promises":[">= 19"],_linklist:"< 8",module:!0,"node:module":[">= 14.18 && < 15",">= 16"],net:!0,"node:net":[">= 14.18 && < 15",">= 16"],"node-inspect/lib/_inspect":">= 7.6 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6 && < 12",os:!0,"node:os":[">= 14.18 && < 15",">= 16"],path:!0,"node:path":[">= 14.18 && < 15",">= 16"],"path/posix":">= 15.3","node:path/posix":">= 16","path/win32":">= 15.3","node:path/win32":">= 16",perf_hooks:">= 8.5","node:perf_hooks":[">= 14.18 && < 15",">= 16"],process:">= 1","node:process":[">= 14.18 && < 15",">= 16"],punycode:">= 0.5","node:punycode":[">= 14.18 && < 15",">= 16"],querystring:!0,"node:querystring":[">= 14.18 && < 15",">= 16"],readline:!0,"node:readline":[">= 14.18 && < 15",">= 16"],"readline/promises":">= 17","node:readline/promises":">= 17",repl:!0,"node:repl":[">= 14.18 && < 15",">= 16"],"node:sea":[">= 20.12 && < 21",">= 21.7"],smalloc:">= 0.11.5 && < 3","node:sqlite":[">= 22.13 && < 23",">= 23.4"],_stream_duplex:">= 0.9.4","node:_stream_duplex":[">= 14.18 && < 15",">= 16"],_stream_transform:">= 0.9.4","node:_stream_transform":[">= 14.18 && < 15",">= 16"],_stream_wrap:">= 1.4.1","node:_stream_wrap":[">= 14.18 && < 15",">= 16"],_stream_passthrough:">= 0.9.4","node:_stream_passthrough":[">= 14.18 && < 15",">= 16"],_stream_readable:">= 0.9.4","node:_stream_readable":[">= 14.18 && < 15",">= 16"],_stream_writable:">= 0.9.4","node:_stream_writable":[">= 14.18 && < 15",">= 16"],stream:!0,"node:stream":[">= 14.18 && < 15",">= 16"],"stream/consumers":">= 16.7","node:stream/consumers":">= 16.7","stream/promises":">= 15","node:stream/promises":">= 16","stream/web":">= 16.5","node:stream/web":">= 16.5",string_decoder:!0,"node:string_decoder":[">= 14.18 && < 15",">= 16"],sys:[">= 0.4 && < 0.7",">= 0.8"],"node:sys":[">= 14.18 && < 15",">= 16"],"test/reporters":">= 19.9 && < 20.2","node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:!0,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common:">= 0.11.13","node:_tls_common":[">= 14.18 && < 15",">= 16"],_tls_legacy:">= 0.11.3 && < 10",_tls_wrap:">= 0.11.3","node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls:!0,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events:">= 10","node:trace_events":[">= 14.18 && < 15",">= 16"],tty:!0,"node:tty":[">= 14.18 && < 15",">= 16"],url:!0,"node:url":[">= 14.18 && < 15",">= 16"],util:!0,"node:util":[">= 14.18 && < 15",">= 16"],"util/types":">= 15.3","node:util/types":">= 16","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/consarray":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/csvparser":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/logreader":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/profile_view":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/splaytree":[">= 4.4 && < 5",">= 5.2 && < 12"],v8:">= 1","node:v8":[">= 14.18 && < 15",">= 16"],vm:!0,"node:vm":[">= 14.18 && < 15",">= 16"],wasi:[">= 13.4 && < 13.5",">= 18.17 && < 19",">= 20"],"node:wasi":[">= 18.17 && < 19",">= 20"],worker_threads:">= 11.7","node:worker_threads":[">= 14.18 && < 15",">= 16"],zlib:">= 0.5","node:zlib":[">= 14.18 && < 15",">= 16"]}});var ise=ve((Lqi,F9n)=>{"use strict";var iQa=N9n();function lQa(n,t){for(var r=n.split("."),a=t.split(" "),i=a.length>1?a[0]:"=",s=(a.length>1?a[1]:a[0]).split("."),e=0;e<3;++e){var o=parseInt(r[e]||0,10),u=parseInt(s[e]||0,10);if(o!==u)return i==="<"?o<u:i===">="?o>=u:!1}return i===">="}function W9n(n,t){var r=t.split(/ ?&& ?/);if(r.length===0)return!1;for(var a=0;a<r.length;++a)if(!lQa(n,r[a]))return!1;return!0}function sQa(n,t){if(typeof t=="boolean")return t;var r=typeof n>"u"?process.versions&&process.versions.node:n;if(typeof r!="string")throw new TypeError(typeof n>"u"?"Unable to determine current node version":"If provided, a valid node version is required");if(t&&typeof t=="object"){for(var a=0;a<t.length;++a)if(W9n(r,t[a]))return!0;return!1}return W9n(r,t)}var y9n=A9n();F9n.exports=function(t,r){return iQa(y9n,t)&&sQa(r,y9n[t])}});var w9n=ve((Sqi,R9n)=>{var _k=vt("fs"),oQa=Zdt(),$d=vt("path"),cQa=Ndt(),uQa=ydt(),IQa=Fdt(),dQa=ise(),hQa=process.platform!=="win32"&&_k.realpath&&typeof _k.realpath.native=="function"?_k.realpath.native:_k.realpath,mQa=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,pQa=/^\w:[/\\]*$/,bQa=/[/\\]node_modules[/\\]*$/,E9n=oQa(),fQa=function(){return[$d.join(E9n,".node_modules"),$d.join(E9n,".node_libraries")]},GQa=function(t,r){_k.stat(t,function(a,i){return a?a.code==="ENOENT"||a.code==="ENOTDIR"?r(null,!1):r(a):r(null,i.isFile()||i.isFIFO())})},gQa=function(t,r){_k.stat(t,function(a,i){return a?a.code==="ENOENT"||a.code==="ENOTDIR"?r(null,!1):r(a):r(null,i.isDirectory())})},vQa=function(t,r){hQa(t,function(a,i){a&&a.code!=="ENOENT"?r(a):r(null,a?t:i)})},lse=function(t,r,a,i){a&&a.preserveSymlinks===!1?t(r,i):i(null,r)},ZQa=function(t,r,a){t(r,function(i,s){if(i)a(i);else try{var e=JSON.parse(s);a(null,e)}catch{a(null)}})},NQa=function(t,r,a){for(var i=uQa(r,a,t),s=0;s<i.length;s++)i[s]=$d.join(i[s],t);return i};R9n.exports=function(t,r,a){var i=a,s=r;if(typeof r=="function"&&(i=s,s={}),typeof t!="string"){var e=new TypeError("Path must be a string.");return process.nextTick(function(){i(e)})}s=IQa(t,s);var o=s.isFile||GQa,u=s.isDirectory||gQa,d=s.readFile||_k.readFile,I=s.realpath||vQa,h=s.readPackage||ZQa;if(s.readFile&&s.readPackage){var c=new TypeError("`readFile` and `readPackage` are mutually exclusive.");return process.nextTick(function(){i(c)})}var G=s.packageIterator,W=s.extensions||[".js"],y=s.includeCoreModules!==!1,R=s.basedir||$d.dirname(cQa()),F=s.filename||R;s.paths=s.paths||fQa();var C=$d.resolve(R);lse(I,C,s,function(b,Z){b?i(b):E(Z)});var A;function E(b){if(mQa.test(t))A=$d.resolve(b,t),(t==="."||t===".."||t.slice(-1)==="/")&&(A+="/"),t.slice(-1)==="/"&&A===b?N(A,s.package,f):g(A,s.package,f);else{if(y&&dQa(t))return i(null,t);p(t,b,function(Z,Y,S){if(Z)i(Z);else{if(Y)return lse(I,Y,s,function(L,T){L?i(L):i(null,T,S)});var H=new Error("Cannot find module '"+t+"' from '"+F+"'");H.code="MODULE_NOT_FOUND",i(H)}})}}function f(b,Z,Y){b?i(b):Z?i(null,Z,Y):N(A,function(S,H,L){if(S)i(S);else if(H)lse(I,H,s,function(k,X){k?i(k):i(null,X,L)});else{var T=new Error("Cannot find module '"+t+"' from '"+F+"'");T.code="MODULE_NOT_FOUND",i(T)}})}function g(b,Z,Y){var S=Z,H=Y;typeof S=="function"&&(H=S,S=void 0);var L=[""].concat(W);T(L,b,S);function T(k,X,Q){if(k.length===0)return H(null,void 0,Q);var V=X+k[0],w=Q;w?x(null,w):v($d.dirname(V),x);function x(U,O,B){if(w=O,U)return H(U);if(B&&w&&s.pathFilter){var D=$d.relative(B,V),M=D.slice(0,D.length-k[0].length),z=s.pathFilter(w,X,M);if(z)return T([""].concat(W.slice()),$d.resolve(B,z),w)}o(V,J)}function J(U,O){if(U)return H(U);if(O)return H(null,V,w);T(k.slice(1),X,w)}}}function v(b,Z){if(b===""||b==="/"||process.platform==="win32"&&pQa.test(b)||bQa.test(b))return Z(null);lse(I,b,s,function(Y,S){if(Y)return v($d.dirname(b),Z);var H=$d.join(S,"package.json");o(H,function(L,T){if(!T)return v($d.dirname(b),Z);h(d,H,function(k,X){k&&Z(k);var Q=X;Q&&s.packageFilter&&(Q=s.packageFilter(Q,H)),Z(null,Q,b)})})})}function N(b,Z,Y){var S=Y,H=Z;typeof H=="function"&&(S=H,H=s.package),lse(I,b,s,function(L,T){if(L)return S(L);var k=$d.join(T,"package.json");o(k,function(X,Q){if(X)return S(X);if(!Q)return g($d.join(b,"index"),H,S);h(d,k,function(V,w){if(V)return S(V);var x=w;if(x&&s.packageFilter&&(x=s.packageFilter(x,k)),x&&x.main){if(typeof x.main!="string"){var J=new TypeError("package \u201C"+x.name+"\u201D `main` must be a string");return J.code="INVALID_PACKAGE_MAIN",S(J)}(x.main==="."||x.main==="./")&&(x.main="index"),g($d.resolve(b,x.main),x,function(U,O,B){if(U)return S(U);if(O)return S(null,O,B);if(!B)return g($d.join(b,"index"),B,S);var D=$d.resolve(b,B.main);N(D,B,function(M,z,_){if(M)return S(M);if(z)return S(null,z,_);g($d.join(b,"index"),_,S)})});return}g($d.join(b,"/index"),x,S)})})})}function m(b,Z){if(Z.length===0)return b(null,void 0);var Y=Z[0];u($d.dirname(Y),S);function S(T,k){if(T)return b(T);if(!k)return m(b,Z.slice(1));g(Y,s.package,H)}function H(T,k,X){if(T)return b(T);if(k)return b(null,k,X);N(Y,s.package,L)}function L(T,k,X){if(T)return b(T);if(k)return b(null,k,X);m(b,Z.slice(1))}}function p(b,Z,Y){var S=function(){return NQa(b,Z,s)};m(Y,G?G(b,Z,S,s):S())}}});var C9n=ve((Bqi,AQa)=>{AQa.exports={assert:!0,"node:assert":[">= 14.18 && < 15",">= 16"],"assert/strict":">= 15","node:assert/strict":">= 16",async_hooks:">= 8","node:async_hooks":[">= 14.18 && < 15",">= 16"],buffer_ieee754:">= 0.5 && < 0.9.7",buffer:!0,"node:buffer":[">= 14.18 && < 15",">= 16"],child_process:!0,"node:child_process":[">= 14.18 && < 15",">= 16"],cluster:">= 0.5","node:cluster":[">= 14.18 && < 15",">= 16"],console:!0,"node:console":[">= 14.18 && < 15",">= 16"],constants:!0,"node:constants":[">= 14.18 && < 15",">= 16"],crypto:!0,"node:crypto":[">= 14.18 && < 15",">= 16"],_debug_agent:">= 1 && < 8",_debugger:"< 8",dgram:!0,"node:dgram":[">= 14.18 && < 15",">= 16"],diagnostics_channel:[">= 14.17 && < 15",">= 15.1"],"node:diagnostics_channel":[">= 14.18 && < 15",">= 16"],dns:!0,"node:dns":[">= 14.18 && < 15",">= 16"],"dns/promises":">= 15","node:dns/promises":">= 16",domain:">= 0.7.12","node:domain":[">= 14.18 && < 15",">= 16"],events:!0,"node:events":[">= 14.18 && < 15",">= 16"],freelist:"< 6",fs:!0,"node:fs":[">= 14.18 && < 15",">= 16"],"fs/promises":[">= 10 && < 10.1",">= 14"],"node:fs/promises":[">= 14.18 && < 15",">= 16"],_http_agent:">= 0.11.1","node:_http_agent":[">= 14.18 && < 15",">= 16"],_http_client:">= 0.11.1","node:_http_client":[">= 14.18 && < 15",">= 16"],_http_common:">= 0.11.1","node:_http_common":[">= 14.18 && < 15",">= 16"],_http_incoming:">= 0.11.1","node:_http_incoming":[">= 14.18 && < 15",">= 16"],_http_outgoing:">= 0.11.1","node:_http_outgoing":[">= 14.18 && < 15",">= 16"],_http_server:">= 0.11.1","node:_http_server":[">= 14.18 && < 15",">= 16"],http:!0,"node:http":[">= 14.18 && < 15",">= 16"],http2:">= 8.8","node:http2":[">= 14.18 && < 15",">= 16"],https:!0,"node:https":[">= 14.18 && < 15",">= 16"],inspector:">= 8","node:inspector":[">= 14.18 && < 15",">= 16"],"inspector/promises":[">= 19"],"node:inspector/promises":[">= 19"],_linklist:"< 8",module:!0,"node:module":[">= 14.18 && < 15",">= 16"],net:!0,"node:net":[">= 14.18 && < 15",">= 16"],"node-inspect/lib/_inspect":">= 7.6 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6 && < 12",os:!0,"node:os":[">= 14.18 && < 15",">= 16"],path:!0,"node:path":[">= 14.18 && < 15",">= 16"],"path/posix":">= 15.3","node:path/posix":">= 16","path/win32":">= 15.3","node:path/win32":">= 16",perf_hooks:">= 8.5","node:perf_hooks":[">= 14.18 && < 15",">= 16"],process:">= 1","node:process":[">= 14.18 && < 15",">= 16"],punycode:">= 0.5","node:punycode":[">= 14.18 && < 15",">= 16"],querystring:!0,"node:querystring":[">= 14.18 && < 15",">= 16"],readline:!0,"node:readline":[">= 14.18 && < 15",">= 16"],"readline/promises":">= 17","node:readline/promises":">= 17",repl:!0,"node:repl":[">= 14.18 && < 15",">= 16"],"node:sea":[">= 20.12 && < 21",">= 21.7"],smalloc:">= 0.11.5 && < 3","node:sqlite":[">= 22.13 && < 23",">= 23.4"],_stream_duplex:">= 0.9.4","node:_stream_duplex":[">= 14.18 && < 15",">= 16"],_stream_transform:">= 0.9.4","node:_stream_transform":[">= 14.18 && < 15",">= 16"],_stream_wrap:">= 1.4.1","node:_stream_wrap":[">= 14.18 && < 15",">= 16"],_stream_passthrough:">= 0.9.4","node:_stream_passthrough":[">= 14.18 && < 15",">= 16"],_stream_readable:">= 0.9.4","node:_stream_readable":[">= 14.18 && < 15",">= 16"],_stream_writable:">= 0.9.4","node:_stream_writable":[">= 14.18 && < 15",">= 16"],stream:!0,"node:stream":[">= 14.18 && < 15",">= 16"],"stream/consumers":">= 16.7","node:stream/consumers":">= 16.7","stream/promises":">= 15","node:stream/promises":">= 16","stream/web":">= 16.5","node:stream/web":">= 16.5",string_decoder:!0,"node:string_decoder":[">= 14.18 && < 15",">= 16"],sys:[">= 0.4 && < 0.7",">= 0.8"],"node:sys":[">= 14.18 && < 15",">= 16"],"test/reporters":">= 19.9 && < 20.2","node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:!0,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common:">= 0.11.13","node:_tls_common":[">= 14.18 && < 15",">= 16"],_tls_legacy:">= 0.11.3 && < 10",_tls_wrap:">= 0.11.3","node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls:!0,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events:">= 10","node:trace_events":[">= 14.18 && < 15",">= 16"],tty:!0,"node:tty":[">= 14.18 && < 15",">= 16"],url:!0,"node:url":[">= 14.18 && < 15",">= 16"],util:!0,"node:util":[">= 14.18 && < 15",">= 16"],"util/types":">= 15.3","node:util/types":">= 16","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/consarray":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/csvparser":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/logreader":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/profile_view":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/splaytree":[">= 4.4 && < 5",">= 5.2 && < 12"],v8:">= 1","node:v8":[">= 14.18 && < 15",">= 16"],vm:!0,"node:vm":[">= 14.18 && < 15",">= 16"],wasi:[">= 13.4 && < 13.5",">= 18.17 && < 19",">= 20"],"node:wasi":[">= 18.17 && < 19",">= 20"],worker_threads:">= 11.7","node:worker_threads":[">= 14.18 && < 15",">= 16"],zlib:">= 0.5","node:zlib":[">= 14.18 && < 15",">= 16"]}});var Q9n=ve((Jqi,V9n)=>{"use strict";var WQa=ise(),Y9n=C9n(),x9n={};for(cEe in Y9n)Object.prototype.hasOwnProperty.call(Y9n,cEe)&&(x9n[cEe]=WQa(cEe));var cEe;V9n.exports=x9n});var X9n=ve((Tqi,H9n)=>{var yQa=ise();H9n.exports=function(t){return yQa(t)}});var S9n=ve((Dqi,L9n)=>{var FQa=ise(),Pk=vt("fs"),sb=vt("path"),EQa=Zdt(),RQa=Ndt(),wQa=ydt(),CQa=Fdt(),YQa=process.platform!=="win32"&&Pk.realpathSync&&typeof Pk.realpathSync.native=="function"?Pk.realpathSync.native:Pk.realpathSync,xQa=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,VQa=/^\w:[/\\]*$/,QQa=/[/\\]node_modules[/\\]*$/,k9n=EQa(),HQa=function(){return[sb.join(k9n,".node_modules"),sb.join(k9n,".node_libraries")]},XQa=function(t){try{var r=Pk.statSync(t,{throwIfNoEntry:!1})}catch(a){if(a&&(a.code==="ENOENT"||a.code==="ENOTDIR"))return!1;throw a}return!!r&&(r.isFile()||r.isFIFO())},kQa=function(t){try{var r=Pk.statSync(t,{throwIfNoEntry:!1})}catch(a){if(a&&(a.code==="ENOENT"||a.code==="ENOTDIR"))return!1;throw a}return!!r&&r.isDirectory()},LQa=function(t){try{return YQa(t)}catch(r){if(r.code!=="ENOENT")throw r}return t},sse=function(t,r,a){return a&&a.preserveSymlinks===!1?t(r):r},SQa=function(t,r){var a=t(r);try{var i=JSON.parse(a);return i}catch{}},BQa=function(t,r,a){for(var i=wQa(r,a,t),s=0;s<i.length;s++)i[s]=sb.join(i[s],t);return i};L9n.exports=function(t,r){if(typeof t!="string")throw new TypeError("Path must be a string.");var a=CQa(t,r),i=a.isFile||XQa,s=a.readFileSync||Pk.readFileSync,e=a.isDirectory||kQa,o=a.realpathSync||LQa,u=a.readPackageSync||SQa;if(a.readFileSync&&a.readPackageSync)throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");var d=a.packageIterator,I=a.extensions||[".js"],h=a.includeCoreModules!==!1,c=a.basedir||sb.dirname(RQa()),G=a.filename||c;a.paths=a.paths||HQa();var W=sse(o,sb.resolve(c),a);if(xQa.test(t)){var y=sb.resolve(W,t);(t==="."||t===".."||t.slice(-1)==="/")&&(y+="/");var R=A(y)||f(y);if(R)return sse(o,R,a)}else{if(h&&FQa(t))return t;var F=g(t,W);if(F)return sse(o,F,a)}var C=new Error("Cannot find module '"+t+"' from '"+G+"'");throw C.code="MODULE_NOT_FOUND",C;function A(v){var N=E(sb.dirname(v));if(N&&N.dir&&N.pkg&&a.pathFilter){var m=sb.relative(N.dir,v),p=a.pathFilter(N.pkg,v,m);p&&(v=sb.resolve(N.dir,p))}if(i(v))return v;for(var b=0;b<I.length;b++){var Z=v+I[b];if(i(Z))return Z}}function E(v){if(!(v===""||v==="/")&&!(process.platform==="win32"&&VQa.test(v))&&!QQa.test(v)){var N=sb.join(sse(o,v,a),"package.json");if(!i(N))return E(sb.dirname(v));var m=u(s,N);return m&&a.packageFilter&&(m=a.packageFilter(m,v)),{pkg:m,dir:v}}}function f(v){var N=sb.join(sse(o,v,a),"/package.json");if(i(N)){try{var m=u(s,N)}catch{}if(m&&a.packageFilter&&(m=a.packageFilter(m,v)),m&&m.main){if(typeof m.main!="string"){var p=new TypeError("package \u201C"+m.name+"\u201D `main` must be a string");throw p.code="INVALID_PACKAGE_MAIN",p}(m.main==="."||m.main==="./")&&(m.main="index");try{var b=A(sb.resolve(v,m.main));if(b)return b;var Z=f(sb.resolve(v,m.main));if(Z)return Z}catch{}}}return A(sb.join(v,"/index"))}function g(v,N){for(var m=function(){return BQa(v,N,a)},p=d?d(v,N,m,a):m(),b=0;b<p.length;b++){var Z=p[b];if(e(sb.dirname(Z))){var Y=A(Z);if(Y)return Y;var S=f(Z);if(S)return S}}}}});var Edt=ve((Oqi,B9n)=>{var uEe=w9n();uEe.core=Q9n();uEe.isCore=X9n();uEe.sync=S9n();B9n.exports=uEe});var J9n=ve((Uqi,JQa)=>{JQa.exports={name:"require-in-the-middle",version:"7.5.2",description:"Module to hook into the Node.js require function",main:"index.js",types:"types/index.d.ts",dependencies:{debug:"^4.3.5","module-details-from-path":"^1.0.3",resolve:"^1.22.8"},devDependencies:{"@babel/core":"^7.9.0","@babel/preset-env":"^7.9.5","@babel/preset-typescript":"^7.9.0","@babel/register":"^7.9.0","ipp-printer":"^1.0.0",patterns:"^1.0.3",roundround:"^0.2.0",semver:"^6.3.0",standard:"^14.3.1",tape:"^4.11.0"},scripts:{test:"npm run test:lint && npm run test:tape && npm run test:babel","test:lint":"standard","test:tape":"tape test/*.js","test:babel":"node test/babel/babel-register.js"},repository:{type:"git",url:"git+https://github.com/nodejs/require-in-the-middle.git"},keywords:["require","hook","shim","shimmer","shimming","patch","monkey","monkeypatch","module","load"],files:["types"],author:"Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",license:"MIT",bugs:{url:"https://github.com/nodejs/require-in-the-middle/issues"},homepage:"https://github.com/nodejs/require-in-the-middle#readme",engines:{node:">=8.6.0"}}});var Ydt=ve((Mqi,Cdt)=>{"use strict";var $M=vt("path"),h3=vt("module"),od=iQ()("require-in-the-middle"),TQa=vdt();Cdt.exports=ose;Cdt.exports.Hook=ose;var Rdt,qM;if(h3.isBuiltin)qM=h3.isBuiltin;else if(h3.builtinModules)qM=n=>n.startsWith("node:")?!0:(Rdt===void 0&&(Rdt=new Set(h3.builtinModules)),Rdt.has(n));else{let n=Edt(),[t,r]=process.versions.node.split(".").map(Number);t===8&&r<8?qM=a=>a==="http2"?!0:!!n.core[a]:qM=a=>!!n.core[a]}var IEe;function DQa(n,t){if(!IEe)if(vt.resolve&&vt.resolve.paths)IEe=function(r,a){return vt.resolve(r,{paths:[a]})};else{let r=Edt();IEe=function(a,i){return r.sync(a,{basedir:i})}}return IEe(n,t)}var OQa=/([/\\]index)?(\.js)?$/,wdt=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(t,r){if(this._localCache.has(t))return!0;if(r)return!1;{let a=vt.cache[t];return!!(a&&this._kRitmExports in a)}}get(t,r){let a=this._localCache.get(t);if(a!==void 0)return a;if(!r){let i=vt.cache[t];return i&&i[this._kRitmExports]}}set(t,r,a){a?this._localCache.set(t,r):t in vt.cache?vt.cache[t][this._kRitmExports]=r:(od('non-core module is unexpectedly not in require.cache: "%s"',t),this._localCache.set(t,r))}};function ose(n,t,r){if(!(this instanceof ose))return new ose(n,t,r);if(typeof n=="function"?(r=n,n=null,t=null):typeof t=="function"&&(r=t,t=null),typeof h3._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof h3._resolveFilename),console.error("Please report this error as an issue related to Node.js %s at %s",process.version,J9n().bugs.url);return}this._cache=new wdt,this._unhooked=!1,this._origRequire=h3.prototype.require;let a=this,i=new Set,s=t?t.internals===!0:!1,e=Array.isArray(n);od("registering require hook"),this._require=h3.prototype.require=function(u){return a._unhooked===!0?(od("ignoring require call - module is soft-unhooked"),a._origRequire.apply(this,arguments)):o.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(u){return a._unhooked===!0?(od("ignoring process.getBuiltinModule call - module is soft-unhooked"),a._origGetBuiltinModule.apply(this,arguments)):o.call(this,arguments,!0)});function o(u,d){let I=u[0],h=qM(I),c;if(h){if(c=I,I.startsWith("node:")){let C=I.slice(5);qM(C)&&(c=C)}}else{if(d)return od("call to process.getBuiltinModule with unknown built-in id"),a._origGetBuiltinModule.apply(this,u);try{c=h3._resolveFilename(I,this)}catch(C){return od('Module._resolveFilename("%s") threw %j, calling original Module.require',I,C.message),a._origRequire.apply(this,u)}}let G,W;if(od("processing %s module require('%s'): %s",h===!0?"core":"non-core",I,c),a._cache.has(c,h)===!0)return od("returning already patched cached module: %s",c),a._cache.get(c,h);let y=i.has(c);y===!1&&i.add(c);let R=d?a._origGetBuiltinModule.apply(this,u):a._origRequire.apply(this,u);if(y===!0)return od("module is in the process of being patched already - ignoring: %s",c),R;if(i.delete(c),h===!0){if(e===!0&&n.includes(c)===!1)return od("ignoring core module not on whitelist: %s",c),R;G=c}else if(e===!0&&n.includes(c)){let C=$M.parse(c);G=C.name,W=C.dir}else{let C=TQa(c);if(C===void 0)return od("could not parse filename: %s",c),R;G=C.name,W=C.basedir;let A=UQa(C);od("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",G,I,A,W);let E=!1;if(e){if(!I.startsWith(".")&&n.includes(I)&&(G=I,E=!0),!n.includes(G)&&!n.includes(A))return R;n.includes(A)&&A!==G&&(G=A,E=!0)}if(!E){let f;try{f=DQa(G,W)}catch{return od("could not resolve module: %s",G),a._cache.set(c,R,h),R}if(f!==c)if(s===!0)G=G+$M.sep+$M.relative(W,c),od("preparing to process require of internal file: %s",G);else return od("ignoring require of non-main module file: %s",f),a._cache.set(c,R,h),R}}a._cache.set(c,R,h),od("calling require hook: %s",G);let F=r(R,G,W);return a._cache.set(c,F,h),od("returning module: %s",G),F}}ose.prototype.unhook=function(){this._unhooked=!0,this._require===h3.prototype.require?(h3.prototype.require=this._origRequire,od("require unhook successful")):od("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,od("process.getBuiltinModule unhook successful")):od("process.getBuiltinModule unhook unsuccessful"))};function UQa(n){let t=$M.sep!=="/"?n.path.split($M.sep).join("/"):n.path;return $M.posix.join(n.name,t).replace(OQa,"")}});var T9n=ve(Ex=>{"use strict";Object.defineProperty(Ex,"__esModule",{value:!0});Ex.ModuleNameTrie=Ex.ModuleNameSeparator=void 0;Ex.ModuleNameSeparator="/";var dEe=class{constructor(){this.hooks=[],this.children=new Map}},xdt=class{constructor(){this._trie=new dEe,this._counter=0}insert(t){let r=this._trie;for(let a of t.moduleName.split(Ex.ModuleNameSeparator)){let i=r.children.get(a);i||(i=new dEe,r.children.set(a,i)),r=i}r.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:r,fullOnly:a}={}){let i=this._trie,s=[],e=!0;for(let o of t.split(Ex.ModuleNameSeparator)){let u=i.children.get(o);if(!u){e=!1;break}a||s.push(...u.hooks),i=u}return a&&e&&s.push(...i.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(r&&s.sort((o,u)=>o.insertedId-u.insertedId),s.map(({hook:o})=>o))}};Ex.ModuleNameTrie=xdt});var O9n=ve(hEe=>{"use strict";Object.defineProperty(hEe,"__esModule",{value:!0});hEe.RequireInTheMiddleSingleton=void 0;var MQa=Ydt(),D9n=vt("path"),Vdt=T9n(),zQa=["afterEach","after","beforeEach","before","describe","it"].every(n=>typeof global[n]=="function"),Qdt=class n{constructor(){this._moduleNameTrie=new Vdt.ModuleNameTrie,this._initialize()}_initialize(){new MQa.Hook(null,{internals:!0},(t,r,a)=>{let i=_Qa(r),s=this._moduleNameTrie.search(i,{maintainInsertionOrder:!0,fullOnly:a===void 0});for(let{onRequire:e}of s)t=e(t,r,a);return t})}register(t,r){let a={moduleName:t,onRequire:r};return this._moduleNameTrie.insert(a),a}static getInstance(){var t;return zQa?new n:this._instance=(t=this._instance)!==null&&t!==void 0?t:new n}};hEe.RequireInTheMiddleSingleton=Qdt;function _Qa(n){return D9n.sep!==Vdt.ModuleNameSeparator?n.split(D9n.sep).join(Vdt.ModuleNameSeparator):n}});var j9n=ve(jk=>{var U9n=[],Hdt=new WeakMap,M9n=new WeakMap,z9n=new Map,_9n=[],PQa={set(n,t,r){return Hdt.get(n)[t](r)},get(n,t){if(t===Symbol.toStringTag)return"Module";let r=M9n.get(n)[t];if(typeof r=="function")return r()},defineProperty(n,t,r){if(!("value"in r))throw new Error("Getters/setters are not supported for exports property descriptors.");return Hdt.get(n)[t](r.value)}};function jQa(n,t,r,a,i){z9n.set(n,i),Hdt.set(t,r),M9n.set(t,a);let s=new Proxy(t,PQa);U9n.forEach(e=>e(n,s)),_9n.push([n,s])}var P9n=!1;function KQa(){return P9n}function qQa(n){P9n=n}jk.register=jQa;jk.importHooks=U9n;jk.specifiers=z9n;jk.toHook=_9n;jk.getExperimentalPatchInternals=KQa;jk.setExperimentalPatchInternals=qQa});var nHn=ve((Kqi,ez)=>{var K9n=vt("path"),$Qa=vdt(),{fileURLToPath:q9n}=vt("url"),{MessageChannel:e9a}=vt("worker_threads"),{importHooks:Xdt,specifiers:t9a,toHook:n9a,getExperimentalPatchInternals:r9a}=j9n();function eHn(n){Xdt.push(n),n9a.forEach(([t,r])=>n(t,r))}function tHn(n){let t=Xdt.indexOf(n);t>-1&&Xdt.splice(t,1)}function $9n(n,t,r,a){let i=n(t,r,a);i&&i!==t&&(t.default=i)}var kdt;function a9a(){let{port1:n,port2:t}=new e9a,r=0,a;kdt=o=>{r++,n.postMessage(o)},n.on("message",()=>{r--,a&&r<=0&&a()}).unref();function i(){let o=setInterval(()=>{},1e3),u=new Promise(d=>{a=d}).then(()=>{clearInterval(o)});return r===0&&a(),u}let s=t;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:i}}function cse(n,t,r){if(!(this instanceof cse))return new cse(n,t,r);typeof n=="function"?(r=n,n=null,t=null):typeof t=="function"&&(r=t,t=null);let a=t?t.internals===!0:!1;kdt&&Array.isArray(n)&&kdt(n),this._iitmHook=(i,s)=>{let e=i,o=i.startsWith("node:"),u;if(o)i=i.replace(/^node:/,"");else{if(i.startsWith("file://"))try{i=q9n(i)}catch{}let d=$Qa(i);d&&(i=d.name,u=d.basedir)}if(n){for(let d of n)if(d===i){if(u){if(a)i=i+K9n.sep+K9n.relative(u,q9n(e));else if(!r9a()&&!u.endsWith(t9a.get(e)))continue}$9n(r,s,i,u)}}else $9n(r,s,i,u)},eHn(this._iitmHook)}cse.prototype.unhook=function(){tHn(this._iitmHook)};ez.exports=cse;ez.exports.Hook=cse;ez.exports.addHook=eHn;ez.exports.removeHook=tHn;ez.exports.createAddHookMessageChannel=a9a});var Ldt=ve(Rx=>{"use strict";Object.defineProperty(Rx,"__esModule",{value:!0});Rx.isWrapped=Rx.safeExecuteInTheMiddleAsync=Rx.safeExecuteInTheMiddle=void 0;function i9a(n,t,r){let a,i;try{i=n()}catch(s){a=s}finally{if(t(a,i),a&&!r)throw a;return i}}Rx.safeExecuteInTheMiddle=i9a;async function l9a(n,t,r){let a,i;try{i=await n()}catch(s){a=s}finally{if(t(a,i),a&&!r)throw a;return i}}Rx.safeExecuteInTheMiddleAsync=l9a;function s9a(n){return typeof n=="function"&&typeof n.__original=="function"&&typeof n.__unwrap=="function"&&n.__wrapped===!0}Rx.isWrapped=s9a});var iHn=ve(mEe=>{"use strict";Object.defineProperty(mEe,"__esModule",{value:!0});mEe.InstrumentationBase=void 0;var Sdt=vt("path"),rHn=vt("util"),o9a=tse(),Bdt=bdt(),c9a=l9n(),u9a=O9n(),I9a=nHn(),tz=(Qr(),dr(kr)),d9a=Ydt(),h9a=vt("fs"),m9a=Ldt(),Jdt=class extends c9a.InstrumentationAbstract{constructor(t,r,a){super(t,r,a),this._hooks=[],this._requireInTheMiddleSingleton=u9a.RequireInTheMiddleSingleton.getInstance(),this._enabled=!1,this._wrap=(s,e,o)=>{if((0,m9a.isWrapped)(s[e])&&this._unwrap(s,e),rHn.types.isProxy(s)){let u=(0,Bdt.wrap)(Object.assign({},s),e,o);return Object.defineProperty(s,e,{value:u})}else return(0,Bdt.wrap)(s,e,o)},this._unwrap=(s,e)=>rHn.types.isProxy(s)?Object.defineProperty(s,e,{value:s[e]}):(0,Bdt.unwrap)(s,e),this._massWrap=(s,e,o)=>{if(s)Array.isArray(s)||(s=[s]);else{tz.diag.error("must provide one or more modules to patch");return}if(!(e&&Array.isArray(e))){tz.diag.error("must provide one or more functions to wrap on modules");return}s.forEach(u=>{e.forEach(d=>{this._wrap(u,d,o)})})},this._massUnwrap=(s,e)=>{if(s)Array.isArray(s)||(s=[s]);else{tz.diag.error("must provide one or more modules to patch");return}if(!(e&&Array.isArray(e))){tz.diag.error("must provide one or more functions to wrap on modules");return}s.forEach(o=>{e.forEach(u=>{this._unwrap(o,u)})})};let i=this.init();i&&!Array.isArray(i)&&(i=[i]),this._modules=i||[],this._modules.length===0&&tz.diag.debug(`No modules instrumentation has been defined for '${this.instrumentationName}@${this.instrumentationVersion}', nothing will be patched`),this._config.enabled&&this.enable()}_warnOnPreloadedModules(){this._modules.forEach(t=>{let{name:r}=t;try{let a=vt.resolve(r);vt.cache[a]&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(t){try{let r=(0,h9a.readFileSync)(Sdt.join(t,"package.json"),{encoding:"utf8"}),a=JSON.parse(r).version;return typeof a=="string"?a:void 0}catch{tz.diag.warn("Failed extracting version",t)}}_onRequire(t,r,a,i){var s;if(!i)return typeof t.patch=="function"&&(t.moduleExports=r,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:t.name}),t.patch(r)):r;let e=this._extractPackageVersion(i);if(t.moduleVersion=e,t.name===a)return aHn(t.supportedVersions,e,t.includePrerelease)&&typeof t.patch=="function"&&(t.moduleExports=r,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:t.name,version:t.moduleVersion,baseDir:i}),t.patch(r,t.moduleVersion)):r;let o=(s=t.files)!==null&&s!==void 0?s:[],u=Sdt.normalize(a);return o.filter(I=>I.name===u).filter(I=>aHn(I.supportedVersions,e,t.includePrerelease)).reduce((I,h)=>(h.moduleExports=I,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:t.name,version:t.moduleVersion,fileName:h.name,baseDir:i}),h.patch(I,t.moduleVersion)):I),r)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let t of this._modules){typeof t.patch=="function"&&t.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:t.name,version:t.moduleVersion}),t.patch(t.moduleExports,t.moduleVersion));for(let r of t.files)r.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:t.name,version:t.moduleVersion,fileName:r.name}),r.patch(r.moduleExports,t.moduleVersion))}return}this._warnOnPreloadedModules();for(let t of this._modules){let r=(e,o,u)=>this._onRequire(t,e,o,u),a=(e,o,u)=>this._onRequire(t,e,o,u),i=Sdt.isAbsolute(t.name)?new d9a.Hook([t.name],{internals:!0},a):this._requireInTheMiddleSingleton.register(t.name,a);this._hooks.push(i);let s=new I9a.Hook([t.name],{internals:!1},r);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let t of this._modules){typeof t.unpatch=="function"&&t.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:t.name,version:t.moduleVersion}),t.unpatch(t.moduleExports,t.moduleVersion));for(let r of t.files)r.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:t.name,version:t.moduleVersion,fileName:r.name}),r.unpatch(r.moduleExports,t.moduleVersion))}}}isEnabled(){return this._enabled}};mEe.InstrumentationBase=Jdt;function aHn(n,t,r){return typeof t>"u"?n.includes("*"):n.some(a=>(0,o9a.satisfies)(t,a,{includePrerelease:r}))}});var lHn=ve(pEe=>{"use strict";Object.defineProperty(pEe,"__esModule",{value:!0});pEe.normalize=void 0;var p9a=vt("path");Object.defineProperty(pEe,"normalize",{enumerable:!0,get:function(){return p9a.normalize}})});var sHn=ve(nz=>{"use strict";Object.defineProperty(nz,"__esModule",{value:!0});nz.normalize=nz.InstrumentationBase=void 0;var b9a=iHn();Object.defineProperty(nz,"InstrumentationBase",{enumerable:!0,get:function(){return b9a.InstrumentationBase}});var f9a=lHn();Object.defineProperty(nz,"normalize",{enumerable:!0,get:function(){return f9a.normalize}})});var Tdt=ve(rz=>{"use strict";Object.defineProperty(rz,"__esModule",{value:!0});rz.normalize=rz.InstrumentationBase=void 0;var oHn=sHn();Object.defineProperty(rz,"InstrumentationBase",{enumerable:!0,get:function(){return oHn.InstrumentationBase}});Object.defineProperty(rz,"normalize",{enumerable:!0,get:function(){return oHn.normalize}})});var cHn=ve(bEe=>{"use strict";Object.defineProperty(bEe,"__esModule",{value:!0});bEe.InstrumentationNodeModuleDefinition=void 0;var Ddt=class{constructor(t,r,a,i,s){this.name=t,this.supportedVersions=r,this.patch=a,this.unpatch=i,this.files=s||[]}};bEe.InstrumentationNodeModuleDefinition=Ddt});var uHn=ve(fEe=>{"use strict";Object.defineProperty(fEe,"__esModule",{value:!0});fEe.InstrumentationNodeModuleFile=void 0;var G9a=Tdt(),Odt=class{constructor(t,r,a,i){this.supportedVersions=r,this.patch=a,this.unpatch=i,this.name=(0,G9a.normalize)(t)}};fEe.InstrumentationNodeModuleFile=Odt});var dHn=ve(IHn=>{"use strict";Object.defineProperty(IHn,"__esModule",{value:!0})});var mHn=ve(hHn=>{"use strict";Object.defineProperty(hHn,"__esModule",{value:!0})});var Mdt=ve(Tm=>{"use strict";var g9a=Tm&&Tm.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),Udt=Tm&&Tm.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&g9a(t,n,r)};Object.defineProperty(Tm,"__esModule",{value:!0});Tm.InstrumentationNodeModuleFile=Tm.InstrumentationNodeModuleDefinition=Tm.InstrumentationBase=Tm.registerInstrumentations=void 0;var v9a=n9n();Object.defineProperty(Tm,"registerInstrumentations",{enumerable:!0,get:function(){return v9a.registerInstrumentations}});var Z9a=Tdt();Object.defineProperty(Tm,"InstrumentationBase",{enumerable:!0,get:function(){return Z9a.InstrumentationBase}});var N9a=cHn();Object.defineProperty(Tm,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return N9a.InstrumentationNodeModuleDefinition}});var A9a=uHn();Object.defineProperty(Tm,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return A9a.InstrumentationNodeModuleFile}});Udt(dHn(),Tm);Udt(mHn(),Tm);Udt(Ldt(),Tm)});var pHn=ve(GEe=>{"use strict";Object.defineProperty(GEe,"__esModule",{value:!0});GEe.VERSION=void 0;GEe.VERSION="0.52.1"});var fHn=ve(vEe=>{"use strict";Object.defineProperty(vEe,"__esModule",{value:!0});vEe.OTLPTraceExporter=void 0;var az=Va(),gEe=PY(),W9a=xk(),y9a=pHn(),bHn="v1/traces",F9a=`http://localhost:4318/${bHn}`,E9a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${y9a.VERSION}`},zdt=class extends gEe.OTLPExporterNodeBase{constructor(t={}){super(t,W9a.ProtobufTraceSerializer,"application/x-protobuf"),this.headers=Object.assign(Object.assign(Object.assign(Object.assign({},this.headers),E9a),az.baggageUtils.parseKeyPairsIntoRecord((0,az.getEnv)().OTEL_EXPORTER_OTLP_TRACES_HEADERS)),(0,gEe.parseHeaders)(t?.headers))}getDefaultUrl(t){return typeof t.url=="string"?t.url:(0,az.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length>0?(0,gEe.appendRootPathToUrlIfNeeded)((0,az.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT):(0,az.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length>0?(0,gEe.appendResourcePathToUrl)((0,az.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT,bHn):F9a}};vEe.OTLPTraceExporter=zdt});var GHn=ve(ZEe=>{"use strict";Object.defineProperty(ZEe,"__esModule",{value:!0});ZEe.OTLPTraceExporter=void 0;var R9a=fHn();Object.defineProperty(ZEe,"OTLPTraceExporter",{enumerable:!0,get:function(){return R9a.OTLPTraceExporter}})});var gHn=ve(NEe=>{"use strict";Object.defineProperty(NEe,"__esModule",{value:!0});NEe.OTLPTraceExporter=void 0;var w9a=GHn();Object.defineProperty(NEe,"OTLPTraceExporter",{enumerable:!0,get:function(){return w9a.OTLPTraceExporter}})});var vHn=ve(AEe=>{"use strict";Object.defineProperty(AEe,"__esModule",{value:!0});AEe.OTLPTraceExporter=void 0;var C9a=gHn();Object.defineProperty(AEe,"OTLPTraceExporter",{enumerable:!0,get:function(){return C9a.OTLPTraceExporter}})});var ZHn=ve(WEe=>{"use strict";Object.defineProperty(WEe,"__esModule",{value:!0});WEe.VERSION=void 0;WEe.VERSION="0.52.1"});var yHn=ve(yEe=>{"use strict";Object.defineProperty(yEe,"__esModule",{value:!0});yEe.OTLPTraceExporter=void 0;var iz=Va(),NHn=PY(),AHn=PY(),Y9a=ZHn(),x9a=xk(),WHn="v1/traces",V9a=`http://localhost:4318/${WHn}`,Q9a={"User-Agent":`OTel-OTLP-Exporter-JavaScript/${Y9a.VERSION}`},_dt=class extends NHn.OTLPExporterNodeBase{constructor(t={}){super(t,x9a.JsonTraceSerializer,"application/json"),this.headers=Object.assign(Object.assign(Object.assign(Object.assign({},this.headers),Q9a),iz.baggageUtils.parseKeyPairsIntoRecord((0,iz.getEnv)().OTEL_EXPORTER_OTLP_TRACES_HEADERS)),(0,NHn.parseHeaders)(t?.headers))}getDefaultUrl(t){return typeof t.url=="string"?t.url:(0,iz.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length>0?(0,AHn.appendRootPathToUrlIfNeeded)((0,iz.getEnv)().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT):(0,iz.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length>0?(0,AHn.appendResourcePathToUrl)((0,iz.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT,WHn):V9a}};yEe.OTLPTraceExporter=_dt});var FHn=ve(Kk=>{"use strict";var H9a=Kk&&Kk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),X9a=Kk&&Kk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&H9a(t,n,r)};Object.defineProperty(Kk,"__esModule",{value:!0});X9a(yHn(),Kk)});var EHn=ve(qk=>{"use strict";var k9a=qk&&qk.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),L9a=qk&&qk.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&k9a(t,n,r)};Object.defineProperty(qk,"__esModule",{value:!0});L9a(FHn(),qk)});var RHn=ve($k=>{"use strict";var S9a=$k&&$k.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),B9a=$k&&$k.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&S9a(t,n,r)};Object.defineProperty($k,"__esModule",{value:!0});B9a(EHn(),$k)});var wHn=ve(EEe=>{"use strict";Object.defineProperty(EEe,"__esModule",{value:!0});EEe.prepareSend=void 0;var Pdt=(Qr(),dr(kr)),FEe=Va(),J9a=vt("http"),T9a=vt("https"),D9a=vt("url");function O9a(n,t){let r=D9a.parse(n),a=Object.assign({method:"POST",headers:Object.assign({"Content-Type":"application/json"},t)},r);return function(s,e){if(s.length===0)return Pdt.diag.debug("Zipkin send with empty spans"),e({code:FEe.ExportResultCode.SUCCESS});let{request:o}=a.protocol==="http:"?J9a:T9a,u=o(a,I=>{let h="";I.on("data",c=>{h+=c}),I.on("end",()=>{let c=I.statusCode||0;return Pdt.diag.debug(`Zipkin response status code: ${c}, body: ${h}`),c<400?e({code:FEe.ExportResultCode.SUCCESS}):e({code:FEe.ExportResultCode.FAILED,error:new Error(`Got unexpected status code from zipkin: ${c}`)})})});u.on("error",I=>e({code:FEe.ExportResultCode.FAILED,error:I}));let d=JSON.stringify(s);Pdt.diag.debug(`Zipkin request payload: ${d}`),u.write(d,"utf8"),u.end()}}EEe.prepareSend=O9a});var CHn=ve(e6=>{"use strict";var U9a=e6&&e6.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),M9a=e6&&e6.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&U9a(t,n,r)};Object.defineProperty(e6,"__esModule",{value:!0});M9a(wHn(),e6)});var jdt=ve(t6=>{"use strict";var z9a=t6&&t6.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),_9a=t6&&t6.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&z9a(t,n,r)};Object.defineProperty(t6,"__esModule",{value:!0});_9a(CHn(),t6)});var YHn=ve(use=>{"use strict";Object.defineProperty(use,"__esModule",{value:!0});use.SpanKind=void 0;var P9a;(function(n){n.CLIENT="CLIENT",n.SERVER="SERVER",n.CONSUMER="CONSUMER",n.PRODUCER="PRODUCER"})(P9a=use.SpanKind||(use.SpanKind={}))});var QHn=ve(yZ=>{"use strict";Object.defineProperty(yZ,"__esModule",{value:!0});yZ._toZipkinAnnotations=yZ._toZipkinTags=yZ.toZipkinSpan=yZ.defaultStatusErrorTagName=yZ.defaultStatusCodeTagName=void 0;var wx=(Qr(),dr(kr)),Kdt=Va(),REe=YHn(),j9a={[wx.SpanKind.CLIENT]:REe.SpanKind.CLIENT,[wx.SpanKind.SERVER]:REe.SpanKind.SERVER,[wx.SpanKind.CONSUMER]:REe.SpanKind.CONSUMER,[wx.SpanKind.PRODUCER]:REe.SpanKind.PRODUCER,[wx.SpanKind.INTERNAL]:void 0};yZ.defaultStatusCodeTagName="otel.status_code";yZ.defaultStatusErrorTagName="error";function K9a(n,t,r,a){return{traceId:n.spanContext().traceId,parentId:n.parentSpanId,name:n.name,id:n.spanContext().spanId,kind:j9a[n.kind],timestamp:(0,Kdt.hrTimeToMicroseconds)(n.startTime),duration:Math.round((0,Kdt.hrTimeToMicroseconds)(n.duration)),localEndpoint:{serviceName:t},tags:xHn(n,r,a),annotations:n.events.length?VHn(n.events):void 0}}yZ.toZipkinSpan=K9a;function xHn({attributes:n,resource:t,status:r,droppedAttributesCount:a,droppedEventsCount:i,droppedLinksCount:s},e,o){let u={};for(let d of Object.keys(n))u[d]=String(n[d]);return r.code!==wx.SpanStatusCode.UNSET&&(u[e]=String(wx.SpanStatusCode[r.code])),r.code===wx.SpanStatusCode.ERROR&&r.message&&(u[o]=r.message),a&&(u["otel.dropped_attributes_count"]=String(a)),i&&(u["otel.dropped_events_count"]=String(i)),s&&(u["otel.dropped_links_count"]=String(s)),Object.keys(t.attributes).forEach(d=>u[d]=String(t.attributes[d])),u}yZ._toZipkinTags=xHn;function VHn(n){return n.map(t=>({timestamp:Math.round((0,Kdt.hrTimeToMicroseconds)(t.time)),value:t.name}))}yZ._toZipkinAnnotations=VHn});var HHn=ve(wEe=>{"use strict";Object.defineProperty(wEe,"__esModule",{value:!0});wEe.prepareGetHeaders=void 0;function q9a(n){return function(){return n()}}wEe.prepareGetHeaders=q9a});var SHn=ve(CEe=>{"use strict";Object.defineProperty(CEe,"__esModule",{value:!0});CEe.ZipkinExporter=void 0;var XHn=(Qr(),dr(kr)),kHn=Va(),LHn=jdt(),qdt=QHn(),$dt=Xm(),$9a=HHn(),e0t=class{constructor(t={}){this.DEFAULT_SERVICE_NAME="OpenTelemetry Service",this._sendingPromises=[],this._urlStr=t.url||(0,kHn.getEnv)().OTEL_EXPORTER_ZIPKIN_ENDPOINT,this._send=(0,LHn.prepareSend)(this._urlStr,t.headers),this._serviceName=t.serviceName,this._statusCodeTagName=t.statusCodeTagName||qdt.defaultStatusCodeTagName,this._statusDescriptionTagName=t.statusDescriptionTagName||qdt.defaultStatusErrorTagName,this._isShutdown=!1,typeof t.getExportRequestHeaders=="function"?this._getHeaders=(0,$9a.prepareGetHeaders)(t.getExportRequestHeaders):this._beforeSend=function(){}}export(t,r){let a=String(this._serviceName||t[0].resource.attributes[$dt.SEMRESATTRS_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(XHn.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>r({code:kHn.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")}));return}let i=new Promise(e=>{this._sendSpans(t,a,o=>{e(),r(o)})});this._sendingPromises.push(i);let s=()=>{let e=this._sendingPromises.indexOf(i);this._sendingPromises.splice(e,1)};i.then(s,s)}shutdown(){return XHn.diag.debug("Zipkin exporter shutdown"),this._isShutdown=!0,this.forceFlush()}forceFlush(){return new Promise((t,r)=>{Promise.all(this._sendingPromises).then(()=>{t()},r)})}_beforeSend(){this._getHeaders&&(this._send=(0,LHn.prepareSend)(this._urlStr,this._getHeaders()))}_sendSpans(t,r,a){let i=t.map(s=>(0,qdt.toZipkinSpan)(s,String(s.attributes[$dt.SEMRESATTRS_SERVICE_NAME]||s.resource.attributes[$dt.SEMRESATTRS_SERVICE_NAME]||r),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(i,s=>{if(a)return a(s)})}};CEe.ZipkinExporter=e0t});var JHn=ve(Cx=>{"use strict";var eHa=Cx&&Cx.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),BHn=Cx&&Cx.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&eHa(t,n,r)};Object.defineProperty(Cx,"__esModule",{value:!0});BHn(jdt(),Cx);BHn(SHn(),Cx)});var DHn=ve(VEe=>{"use strict";var t0t;Object.defineProperty(VEe,"__esModule",{value:!0});VEe.TracerProviderWithEnvExporters=void 0;var lz=(Qr(),dr(kr)),YEe=Va(),xEe=Ok(),tHa=iEe(),THn=vHn(),nHa=RHn(),rHa=But(),aHa=JHn(),Ise=class extends tHa.NodeTracerProvider{constructor(t={}){super(t),this._configuredExporters=[],this._hasSpanProcessors=!1;let r=this.filterBlanksAndNulls(Array.from(new Set((0,YEe.getEnv)().OTEL_TRACES_EXPORTER.split(","))));r[0]==="none"?lz.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'):r.length===0?(lz.diag.warn("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),r=["otlp"],this.createExportersFromList(r),this._spanProcessors=this.configureSpanProcessors(this._configuredExporters),this._spanProcessors.forEach(a=>{this.addSpanProcessor(a)})):(r.length>1&&r.includes("none")&&(lz.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),r=["otlp"]),this.createExportersFromList(r),this._configuredExporters.length>0?(this._spanProcessors=this.configureSpanProcessors(this._configuredExporters),this._spanProcessors.forEach(a=>{this.addSpanProcessor(a)})):lz.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values."))}static configureOtlp(){let t=this.getOtlpProtocol();switch(t){case"grpc":return new rHa.OTLPTraceExporter;case"http/json":return new nHa.OTLPTraceExporter;case"http/protobuf":return new THn.OTLPTraceExporter;default:return lz.diag.warn(`Unsupported OTLP traces protocol: ${t}. Using http/protobuf.`),new THn.OTLPTraceExporter}}static getOtlpProtocol(){var t,r,a;let i=(0,YEe.getEnvWithoutDefaults)();return(a=(r=(t=i.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL)!==null&&t!==void 0?t:i.OTEL_EXPORTER_OTLP_PROTOCOL)!==null&&r!==void 0?r:(0,YEe.getEnv)().OTEL_EXPORTER_OTLP_TRACES_PROTOCOL)!==null&&a!==void 0?a:(0,YEe.getEnv)().OTEL_EXPORTER_OTLP_PROTOCOL}static configureJaeger(){try{let{JaegerExporter:t}=vt("@opentelemetry/exporter-jaeger");return new t}catch(t){throw new Error(`Could not instantiate JaegerExporter. This could be due to the JaegerExporter's lack of support for bundling. If possible, use @opentelemetry/exporter-trace-otlp-proto instead. Original Error: ${t}`)}}addSpanProcessor(t){super.addSpanProcessor(t),this._hasSpanProcessors=!0}register(t){this._hasSpanProcessors&&super.register(t)}createExportersFromList(t){t.forEach(r=>{let a=this._getSpanExporter(r);a?this._configuredExporters.push(a):lz.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${r}.`)})}configureSpanProcessors(t){return t.map(r=>r instanceof xEe.ConsoleSpanExporter?new xEe.SimpleSpanProcessor(r):new xEe.BatchSpanProcessor(r))}filterBlanksAndNulls(t){return t.map(r=>r.trim()).filter(r=>r!=="null"&&r!=="")}};VEe.TracerProviderWithEnvExporters=Ise;t0t=Ise;Ise._registeredExporters=new Map([["otlp",()=>t0t.configureOtlp()],["zipkin",()=>new aHa.ZipkinExporter],["jaeger",()=>t0t.configureJaeger()],["console",()=>new xEe.ConsoleSpanExporter]])});var OHn=ve(QEe=>{"use strict";Object.defineProperty(QEe,"__esModule",{value:!0});QEe.getResourceDetectorsFromEnv=void 0;var iHa=(Qr(),dr(kr)),dse=gx(),lHa="env",sHa="host",oHa="os",cHa="process",uHa="serviceinstance";function IHa(){var n,t;let r=new Map([[lHa,dse.envDetectorSync],[sHa,dse.hostDetectorSync],[oHa,dse.osDetectorSync],[uHa,dse.serviceInstanceIdDetectorSync],[cHa,dse.processDetectorSync]]),a=(t=(n=process.env.OTEL_NODE_RESOURCE_DETECTORS)===null||n===void 0?void 0:n.split(","))!==null&&t!==void 0?t:["all"];return a.includes("all")?[...r.values()].flat():a.includes("none")?[]:a.flatMap(i=>{let s=r.get(i);return s||iHa.diag.error(`Invalid resource detector "${i}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`),s||[]})}QEe.getResourceDetectorsFromEnv=IHa});var MHn=ve(HEe=>{"use strict";Object.defineProperty(HEe,"__esModule",{value:!0});HEe.NodeSDK=void 0;var hse=(Qr(),dr(kr)),dHa=pU(),hHa=Mdt(),sz=gx(),mHa=h5e(),pHa=VM(),bHa=Ok(),fHa=iEe(),GHa=Xm(),gHa=DHn(),UHn=Va(),vHa=OHn(),n0t=class{constructor(t={}){var r,a,i,s,e,o,u;let d=(0,UHn.getEnv)(),I=(0,UHn.getEnvWithoutDefaults)();d.OTEL_SDK_DISABLED&&(this._disabled=!0),I.OTEL_LOG_LEVEL&&hse.diag.setLogger(new hse.DiagConsoleLogger,{logLevel:I.OTEL_LOG_LEVEL}),this._configuration=t,this._resource=(r=t.resource)!==null&&r!==void 0?r:new sz.Resource({});let h=[];if(process.env.OTEL_NODE_RESOURCE_DETECTORS!=null?h=(0,vHa.getResourceDetectorsFromEnv)():h=[sz.envDetector,sz.processDetector,sz.hostDetector],this._resourceDetectors=(a=t.resourceDetectors)!==null&&a!==void 0?a:h,this._serviceName=t.serviceName,this._autoDetectResources=(i=t.autoDetectResources)!==null&&i!==void 0?i:!0,t.traceExporter||t.spanProcessor||t.spanProcessors){let c={};t.sampler&&(c.sampler=t.sampler),t.spanLimits&&(c.spanLimits=t.spanLimits),t.idGenerator&&(c.idGenerator=t.idGenerator),t.spanProcessor&&hse.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let G=(s=t.spanProcessor)!==null&&s!==void 0?s:new bHa.BatchSpanProcessor(t.traceExporter),W=(e=t.spanProcessors)!==null&&e!==void 0?e:[G];this._tracerProviderConfig={tracerConfig:c,spanProcessors:W,contextManager:t.contextManager,textMapPropagator:t.textMapPropagator}}if(t.logRecordProcessor&&(this._loggerProviderConfig={logRecordProcessor:t.logRecordProcessor}),t.metricReader||t.views){let c={};t.metricReader&&(c.reader=t.metricReader),t.views&&(c.views=t.views),this._meterProviderConfig=c}this._instrumentations=(u=(o=t.instrumentations)===null||o===void 0?void 0:o.flat())!==null&&u!==void 0?u:[]}start(){var t,r,a,i,s,e;if(this._disabled)return;if((0,hHa.registerInstrumentations)({instrumentations:this._instrumentations}),this._autoDetectResources){let d={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,sz.detectResourcesSync)(d))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge(new sz.Resource({[GHa.SEMRESATTRS_SERVICE_NAME]:this._serviceName}));let o=this._tracerProviderConfig?fHa.NodeTracerProvider:gHa.TracerProviderWithEnvExporters,u=new o(Object.assign(Object.assign({},this._configuration),{resource:this._resource}));if(this._tracerProvider=u,this._tracerProviderConfig)for(let d of this._tracerProviderConfig.spanProcessors)u.addSpanProcessor(d);if(u.register({contextManager:(r=(t=this._tracerProviderConfig)===null||t===void 0?void 0:t.contextManager)!==null&&r!==void 0?r:(a=this._configuration)===null||a===void 0?void 0:a.contextManager,propagator:(i=this._tracerProviderConfig)===null||i===void 0?void 0:i.textMapPropagator}),this._loggerProviderConfig){let d=new mHa.LoggerProvider({resource:this._resource});d.addLogRecordProcessor(this._loggerProviderConfig.logRecordProcessor),this._loggerProvider=d,dHa.logs.setGlobalLoggerProvider(d)}if(this._meterProviderConfig){let d=[];this._meterProviderConfig.reader&&d.push(this._meterProviderConfig.reader);let I=new pHa.MeterProvider({resource:this._resource,views:(e=(s=this._meterProviderConfig)===null||s===void 0?void 0:s.views)!==null&&e!==void 0?e:[],readers:d});this._meterProvider=I,hse.metrics.setGlobalMeterProvider(I);for(let h of this._instrumentations)h.setMeterProvider(hse.metrics.getMeterProvider())}}shutdown(){let t=[];return this._tracerProvider&&t.push(this._tracerProvider.shutdown()),this._loggerProvider&&t.push(this._loggerProvider.shutdown()),this._meterProvider&&t.push(this._meterProvider.shutdown()),Promise.all(t).then(()=>{})}};HEe.NodeSDK=n0t});var _Hn=ve(zHn=>{"use strict";Object.defineProperty(zHn,"__esModule",{value:!0})});var jHn=ve(Du=>{"use strict";var ZHa=Du&&Du.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),PHn=Du&&Du.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ZHa(t,n,r)};Object.defineProperty(Du,"__esModule",{value:!0});Du.tracing=Du.resources=Du.node=Du.metrics=Du.logs=Du.core=Du.contextBase=Du.api=void 0;Du.api=(Qr(),dr(kr));Du.contextBase=(Qr(),dr(kr));Du.core=Va();Du.logs=h5e();Du.metrics=VM();Du.node=iEe();Du.resources=gx();Du.tracing=Ok();PHn(MHn(),Du);PHn(_Hn(),Du)});var KHn=ve(mse=>{"use strict";Object.defineProperty(mse,"__esModule",{value:!0});mse.AttributeNames=void 0;var NHa;(function(n){n.HTTP_ERROR_NAME="http.error_name",n.HTTP_ERROR_MESSAGE="http.error_message",n.HTTP_STATUS_TEXT="http.status_text"})(NHa=mse.AttributeNames||(mse.AttributeNames={}))});var r0t=ve(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.headerCapture=_a.getIncomingRequestMetricAttributesOnResponse=_a.getIncomingRequestAttributesOnResponse=_a.getIncomingRequestMetricAttributes=_a.getIncomingRequestAttributes=_a.getOutgoingRequestMetricAttributesOnResponse=_a.getOutgoingRequestAttributesOnResponse=_a.setAttributesFromHttpKind=_a.getOutgoingRequestMetricAttributes=_a.getOutgoingRequestAttributes=_a.extractHostnameAndPort=_a.isValidOptionsType=_a.getRequestInfo=_a.isCompressed=_a.setResponseContentLengthAttribute=_a.setRequestContentLengthAttribute=_a.setSpanWithError=_a.isIgnored=_a.satisfiesPattern=_a.parseResponseStatus=_a.getAbsoluteUrl=void 0;var pse=(Qr(),dr(kr)),Ca=Xm(),qHn=Va(),XEe=vt("url"),kEe=KHn(),AHa=(n,t,r="http:")=>{let a=n||{},i=a.protocol||r,s=(a.port||"").toString(),e=a.path||"/",o=a.host||a.hostname||t.host||"localhost";return o.indexOf(":")===-1&&s&&s!=="80"&&s!=="443"&&(o+=`:${s}`),`${i}//${o}${e}`};_a.getAbsoluteUrl=AHa;var WHa=(n,t)=>{let r=n===pse.SpanKind.CLIENT?400:500;return t&&t>=100&&t<r?pse.SpanStatusCode.UNSET:pse.SpanStatusCode.ERROR};_a.parseResponseStatus=WHa;var yHa=(n,t)=>{if(typeof t=="string")return t===n;if(t instanceof RegExp)return t.test(n);if(typeof t=="function")return t(n);throw new TypeError("Pattern is in unsupported datatype")};_a.satisfiesPattern=yHa;var FHa=(n,t,r)=>{if(!t)return!1;try{for(let a of t)if((0,_a.satisfiesPattern)(n,a))return!0}catch(a){r&&r(a)}return!1};_a.isIgnored=FHa;var EHa=(n,t)=>{let r=t.message;n.setAttribute(kEe.AttributeNames.HTTP_ERROR_NAME,t.name),n.setAttribute(kEe.AttributeNames.HTTP_ERROR_MESSAGE,r),n.setStatus({code:pse.SpanStatusCode.ERROR,message:r}),n.recordException(t)};_a.setSpanWithError=EHa;var RHa=(n,t)=>{let r=$Hn(n.headers);r!==null&&((0,_a.isCompressed)(n.headers)?t[Ca.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH]=r:t[Ca.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=r)};_a.setRequestContentLengthAttribute=RHa;var wHa=(n,t)=>{let r=$Hn(n.headers);r!==null&&((0,_a.isCompressed)(n.headers)?t[Ca.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH]=r:t[Ca.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=r)};_a.setResponseContentLengthAttribute=wHa;function $Hn(n){let t=n["content-length"];if(t===void 0)return null;let r=parseInt(t,10);return isNaN(r)?null:r}var CHa=n=>{let t=n["content-encoding"];return!!t&&t!=="identity"};_a.isCompressed=CHa;var YHa=(n,t)=>{let r="/",a="",i;if(typeof n=="string")i=XEe.parse(n),r=i.pathname||"/",a=`${i.protocol||"http:"}//${i.host}`,t!==void 0&&Object.assign(i,t);else if(n instanceof XEe.URL)i={protocol:n.protocol,hostname:typeof n.hostname=="string"&&n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,path:`${n.pathname||""}${n.search||""}`},n.port!==""&&(i.port=Number(n.port)),(n.username||n.password)&&(i.auth=`${n.username}:${n.password}`),r=n.pathname,a=n.origin,t!==void 0&&Object.assign(i,t);else{i=Object.assign({protocol:n.host?"http:":void 0},n),r=n.pathname,!r&&i.path&&(r=XEe.parse(i.path).pathname||"/");let e=i.host||(i.port!=null?`${i.hostname}${i.port}`:i.hostname);a=`${i.protocol||"http:"}//${e}`}let s=i.method?i.method.toUpperCase():"GET";return{origin:a,pathname:r,method:s,optionsParsed:i}};_a.getRequestInfo=YHa;var xHa=n=>{if(!n)return!1;let t=typeof n;return t==="string"||t==="object"&&!Array.isArray(n)};_a.isValidOptionsType=xHa;var VHa=n=>{var t;if(n.hostname&&n.port)return{hostname:n.hostname,port:n.port};let r=((t=n.host)===null||t===void 0?void 0:t.match(/^([^:/ ]+)(:\d{1,5})?/))||null,a=n.hostname||(r===null?"localhost":r[1]),i=n.port;return i||(r&&r[2]?i=r[2].substring(1):i=n.protocol==="https:"?"443":"80"),{hostname:a,port:i}};_a.extractHostnameAndPort=VHa;var QHa=(n,t)=>{var r;let a=t.hostname,i=t.port,s=n.method,e=s?s.toUpperCase():"GET",o=n.headers||{},u=o["user-agent"],d={[Ca.SEMATTRS_HTTP_URL]:(0,_a.getAbsoluteUrl)(n,o,`${t.component}:`),[Ca.SEMATTRS_HTTP_METHOD]:e,[Ca.SEMATTRS_HTTP_TARGET]:n.path||"/",[Ca.SEMATTRS_NET_PEER_NAME]:a,[Ca.SEMATTRS_HTTP_HOST]:(r=o.host)!==null&&r!==void 0?r:`${a}:${i}`};return u!==void 0&&(d[Ca.SEMATTRS_HTTP_USER_AGENT]=u),Object.assign(d,t.hookAttributes)};_a.getOutgoingRequestAttributes=QHa;var HHa=n=>{let t={};return t[Ca.SEMATTRS_HTTP_METHOD]=n[Ca.SEMATTRS_HTTP_METHOD],t[Ca.SEMATTRS_NET_PEER_NAME]=n[Ca.SEMATTRS_NET_PEER_NAME],t};_a.getOutgoingRequestMetricAttributes=HHa;var XHa=(n,t)=>{n&&(t[Ca.SEMATTRS_HTTP_FLAVOR]=n,n.toUpperCase()!=="QUIC"?t[Ca.SEMATTRS_NET_TRANSPORT]=Ca.NETTRANSPORTVALUES_IP_TCP:t[Ca.SEMATTRS_NET_TRANSPORT]=Ca.NETTRANSPORTVALUES_IP_UDP)};_a.setAttributesFromHttpKind=XHa;var kHa=n=>{let{statusCode:t,statusMessage:r,httpVersion:a,socket:i}=n,s={};if(i){let{remoteAddress:e,remotePort:o}=i;s[Ca.SEMATTRS_NET_PEER_IP]=e,s[Ca.SEMATTRS_NET_PEER_PORT]=o}return(0,_a.setResponseContentLengthAttribute)(n,s),t&&(s[Ca.SEMATTRS_HTTP_STATUS_CODE]=t,s[kEe.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,_a.setAttributesFromHttpKind)(a,s),s};_a.getOutgoingRequestAttributesOnResponse=kHa;var LHa=n=>{let t={};return t[Ca.SEMATTRS_NET_PEER_PORT]=n[Ca.SEMATTRS_NET_PEER_PORT],t[Ca.SEMATTRS_HTTP_STATUS_CODE]=n[Ca.SEMATTRS_HTTP_STATUS_CODE],t[Ca.SEMATTRS_HTTP_FLAVOR]=n[Ca.SEMATTRS_HTTP_FLAVOR],t};_a.getOutgoingRequestMetricAttributesOnResponse=LHa;var SHa=(n,t)=>{let r=n.headers,a=r["user-agent"],i=r["x-forwarded-for"],s=n.method||"GET",e=n.httpVersion,o=n.url?XEe.parse(n.url):null,u=o?.host||r.host,d=o?.hostname||u?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",I=t.serverName,h={[Ca.SEMATTRS_HTTP_URL]:(0,_a.getAbsoluteUrl)(o,r,`${t.component}:`),[Ca.SEMATTRS_HTTP_HOST]:u,[Ca.SEMATTRS_NET_HOST_NAME]:d,[Ca.SEMATTRS_HTTP_METHOD]:s,[Ca.SEMATTRS_HTTP_SCHEME]:t.component};return typeof i=="string"&&(h[Ca.SEMATTRS_HTTP_CLIENT_IP]=i.split(",")[0]),typeof I=="string"&&(h[Ca.SEMATTRS_HTTP_SERVER_NAME]=I),o&&(h[Ca.SEMATTRS_HTTP_TARGET]=o.path||"/"),a!==void 0&&(h[Ca.SEMATTRS_HTTP_USER_AGENT]=a),(0,_a.setRequestContentLengthAttribute)(n,h),(0,_a.setAttributesFromHttpKind)(e,h),Object.assign(h,t.hookAttributes)};_a.getIncomingRequestAttributes=SHa;var BHa=n=>{let t={};return t[Ca.SEMATTRS_HTTP_SCHEME]=n[Ca.SEMATTRS_HTTP_SCHEME],t[Ca.SEMATTRS_HTTP_METHOD]=n[Ca.SEMATTRS_HTTP_METHOD],t[Ca.SEMATTRS_NET_HOST_NAME]=n[Ca.SEMATTRS_NET_HOST_NAME],t[Ca.SEMATTRS_HTTP_FLAVOR]=n[Ca.SEMATTRS_HTTP_FLAVOR],t};_a.getIncomingRequestMetricAttributes=BHa;var JHa=(n,t)=>{let{socket:r}=n,{statusCode:a,statusMessage:i}=t,s=(0,qHn.getRPCMetadata)(pse.context.active()),e={};if(r){let{localAddress:o,localPort:u,remoteAddress:d,remotePort:I}=r;e[Ca.SEMATTRS_NET_HOST_IP]=o,e[Ca.SEMATTRS_NET_HOST_PORT]=u,e[Ca.SEMATTRS_NET_PEER_IP]=d,e[Ca.SEMATTRS_NET_PEER_PORT]=I}return e[Ca.SEMATTRS_HTTP_STATUS_CODE]=a,e[kEe.AttributeNames.HTTP_STATUS_TEXT]=(i||"").toUpperCase(),s?.type===qHn.RPCType.HTTP&&s.route!==void 0&&(e[Ca.SEMATTRS_HTTP_ROUTE]=s.route),e};_a.getIncomingRequestAttributesOnResponse=JHa;var THa=n=>{let t={};return t[Ca.SEMATTRS_HTTP_STATUS_CODE]=n[Ca.SEMATTRS_HTTP_STATUS_CODE],t[Ca.SEMATTRS_NET_HOST_PORT]=n[Ca.SEMATTRS_NET_HOST_PORT],n[Ca.SEMATTRS_HTTP_ROUTE]!==void 0&&(t[Ca.SEMATTRS_HTTP_ROUTE]=n[Ca.SEMATTRS_HTTP_ROUTE]),t};_a.getIncomingRequestMetricAttributesOnResponse=THa;function DHa(n,t){let r=new Map;for(let a=0,i=t.length;a<i;a++){let s=t[a].toLowerCase();r.set(s,s.replace(/-/g,"_"))}return(a,i)=>{for(let s of r.keys()){let e=i(s);if(e===void 0)continue;let o=r.get(s),u=`http.${n}.header.${o}`;typeof e=="string"?a.setAttribute(u,[e]):Array.isArray(e)?a.setAttribute(u,e):a.setAttribute(u,[e])}}}_a.headerCapture=DHa});var eXn=ve(LEe=>{"use strict";Object.defineProperty(LEe,"__esModule",{value:!0});LEe.VERSION=void 0;LEe.VERSION="0.52.1"});var aXn=ve(SEe=>{"use strict";Object.defineProperty(SEe,"__esModule",{value:!0});SEe.HttpInstrumentation=void 0;var xi=(Qr(),dr(kr)),oz=Va(),tXn=tse(),nXn=vt("url"),Ou=r0t(),OHa=eXn(),FZ=Mdt(),rXn=Va(),a0t=vt("events"),UHa=Xm(),i0t=class extends FZ.InstrumentationBase{constructor(t={}){super("@opentelemetry/instrumentation-http",OHa.VERSION,t),this._spanNotEnded=new WeakSet,this._headerCapture=this._createHeaderCapture()}_updateMetricInstruments(){this._httpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:xi.ValueType.DOUBLE}),this._httpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:xi.ValueType.DOUBLE})}setConfig(t={}){super.setConfig(t),this._headerCapture=this._createHeaderCapture()}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new FZ.InstrumentationNodeModuleDefinition("http",["*"],t=>(this._wrap(t,"request",this._getPatchOutgoingRequestFunction("http")),this._wrap(t,"get",this._getPatchOutgoingGetFunction(t.request)),this._wrap(t.Server.prototype,"emit",this._getPatchIncomingRequestFunction("http")),t),t=>{t!==void 0&&(this._unwrap(t,"request"),this._unwrap(t,"get"),this._unwrap(t.Server.prototype,"emit"))})}_getHttpsInstrumentation(){return new FZ.InstrumentationNodeModuleDefinition("https",["*"],t=>(this._wrap(t,"request",this._getPatchHttpsOutgoingRequestFunction("https")),this._wrap(t,"get",this._getPatchHttpsOutgoingGetFunction(t.request)),this._wrap(t.Server.prototype,"emit",this._getPatchIncomingRequestFunction("https")),t),t=>{t!==void 0&&(this._unwrap(t,"request"),this._unwrap(t,"get"),this._unwrap(t.Server.prototype,"emit"))})}_getPatchIncomingRequestFunction(t){return r=>this._incomingRequestFunction(t,r)}_getPatchOutgoingRequestFunction(t){return r=>this._outgoingRequestFunction(t,r)}_getPatchOutgoingGetFunction(t){return r=>function(i,...s){let e=t(i,...s);return e.end(),e}}_getPatchHttpsOutgoingRequestFunction(t){return r=>{let a=this;return function(s,...e){var o;return t==="https"&&typeof s=="object"&&((o=s?.constructor)===null||o===void 0?void 0:o.name)!=="URL"&&(s=Object.assign({},s),a._setDefaultOptions(s)),a._getPatchOutgoingRequestFunction(t)(r)(s,...e)}}}_setDefaultOptions(t){t.protocol=t.protocol||"https:",t.port=t.port||443}_getPatchHttpsOutgoingGetFunction(t){return r=>{let a=this;return function(s,...e){return a._getPatchOutgoingGetFunction(t)(r)(s,...e)}}}_traceClientRequest(t,r,a,i){this.getConfig().requestHook&&this._callRequestHook(r,t);let s=!1;return t.prependListener("response",e=>{this._diag.debug("outgoingRequest on response()"),t.listenerCount("response")<=1&&e.resume();let o=Ou.getOutgoingRequestAttributesOnResponse(e);r.setAttributes(o),i=Object.assign(i,Ou.getOutgoingRequestMetricAttributesOnResponse(o)),this.getConfig().responseHook&&this._callResponseHook(r,e),this._headerCapture.client.captureRequestHeaders(r,d=>t.getHeader(d)),this._headerCapture.client.captureResponseHeaders(r,d=>e.headers[d]),xi.context.bind(xi.context.active(),e);let u=()=>{if(this._diag.debug("outgoingRequest on end()"),s)return;s=!0;let d;e.aborted&&!e.complete?d={code:xi.SpanStatusCode.ERROR}:d={code:Ou.parseResponseStatus(xi.SpanKind.CLIENT,e.statusCode)},r.setStatus(d),this.getConfig().applyCustomAttributesOnSpan&&(0,FZ.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,t,e),()=>{},!0),this._closeHttpSpan(r,xi.SpanKind.CLIENT,a,i)};e.on("end",u),tXn.lt(process.version,"16.0.0")&&e.on("close",u),e.on(a0t.errorMonitor,d=>{this._diag.debug("outgoingRequest on error()",d),!s&&(s=!0,Ou.setSpanWithError(r,d),r.setStatus({code:xi.SpanStatusCode.ERROR,message:d.message}),this._closeHttpSpan(r,xi.SpanKind.CLIENT,a,i))})}),t.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(t.aborted||s)&&(s=!0,this._closeHttpSpan(r,xi.SpanKind.CLIENT,a,i))}),t.on(a0t.errorMonitor,e=>{this._diag.debug("outgoingRequest on request error()",e),!s&&(s=!0,Ou.setSpanWithError(r,e),this._closeHttpSpan(r,xi.SpanKind.CLIENT,a,i))}),this._diag.debug("http.ClientRequest return request"),t}_incomingRequestFunction(t,r){let a=this;return function(s,...e){if(s!=="request")return r.apply(this,[s,...e]);let o=e[0],u=e[1],d=o.url&&nXn.parse(o.url).pathname||"/",I=o.method||"GET";if(a._diag.debug(`${t} instrumentation incomingRequest`),Ou.isIgnored(d,a.getConfig().ignoreIncomingPaths,A=>a._diag.error("caught ignoreIncomingPaths error: ",A))||(0,FZ.safeExecuteInTheMiddle)(()=>{var A,E;return(E=(A=a.getConfig()).ignoreIncomingRequestHook)===null||E===void 0?void 0:E.call(A,o)},A=>{A!=null&&a._diag.error("caught ignoreIncomingRequestHook error: ",A)},!0))return xi.context.with((0,oz.suppressTracing)(xi.context.active()),()=>(xi.context.bind(xi.context.active(),o),xi.context.bind(xi.context.active(),u),r.apply(this,[s,...e])));let h=o.headers,c=Ou.getIncomingRequestAttributes(o,{component:t,serverName:a.getConfig().serverName,hookAttributes:a._callStartSpanHook(o,a.getConfig().startIncomingSpanHook)}),G={kind:xi.SpanKind.SERVER,attributes:c},W=(0,oz.hrTime)(),y=Ou.getIncomingRequestMetricAttributes(c),R=xi.propagation.extract(xi.ROOT_CONTEXT,h),F=a._startHttpSpan(I,G,R),C={type:rXn.RPCType.HTTP,span:F};return xi.context.with((0,rXn.setRPCMetadata)(xi.trace.setSpan(R,F),C),()=>{xi.context.bind(xi.context.active(),o),xi.context.bind(xi.context.active(),u),a.getConfig().requestHook&&a._callRequestHook(F,o),a.getConfig().responseHook&&a._callResponseHook(F,u),a._headerCapture.server.captureRequestHeaders(F,E=>o.headers[E]);let A=!1;return u.on("close",()=>{A||a._onServerResponseFinish(o,u,F,y,W)}),u.on(a0t.errorMonitor,E=>{A=!0,a._onServerResponseError(F,y,W,E)}),(0,FZ.safeExecuteInTheMiddle)(()=>r.apply(this,[s,...e]),E=>{if(E)throw Ou.setSpanWithError(F,E),a._closeHttpSpan(F,xi.SpanKind.SERVER,W,y),E})})}}_outgoingRequestFunction(t,r){let a=this;return function(s,...e){if(!Ou.isValidOptionsType(s))return r.apply(this,[s,...e]);let o=typeof e[0]=="object"&&(typeof s=="string"||s instanceof nXn.URL)?e.shift():void 0,{origin:u,pathname:d,method:I,optionsParsed:h}=Ou.getRequestInfo(s,o);if(t==="http"&&tXn.lt(process.version,"9.0.0")&&h.protocol==="https:")return r.apply(this,[h,...e]);if(Ou.isIgnored(u+d,a.getConfig().ignoreOutgoingUrls,f=>a._diag.error("caught ignoreOutgoingUrls error: ",f))||(0,FZ.safeExecuteInTheMiddle)(()=>{var f,g;return(g=(f=a.getConfig()).ignoreOutgoingRequestHook)===null||g===void 0?void 0:g.call(f,h)},f=>{f!=null&&a._diag.error("caught ignoreOutgoingRequestHook error: ",f)},!0))return r.apply(this,[h,...e]);let{hostname:c,port:G}=Ou.extractHostnameAndPort(h),W=Ou.getOutgoingRequestAttributes(h,{component:t,port:G,hostname:c,hookAttributes:a._callStartSpanHook(h,a.getConfig().startOutgoingSpanHook)}),y=(0,oz.hrTime)(),R=Ou.getOutgoingRequestMetricAttributes(W),F={kind:xi.SpanKind.CLIENT,attributes:W},C=a._startHttpSpan(I,F),A=xi.context.active(),E=xi.trace.setSpan(A,C);return h.headers?h.headers=Object.assign({},h.headers):h.headers={},xi.propagation.inject(E,h.headers),xi.context.with(E,()=>{let f=e[e.length-1];typeof f=="function"&&(e[e.length-1]=xi.context.bind(A,f));let g=(0,FZ.safeExecuteInTheMiddle)(()=>r.apply(this,[h,...e]),v=>{if(v)throw Ou.setSpanWithError(C,v),a._closeHttpSpan(C,xi.SpanKind.CLIENT,y,R),v});return a._diag.debug(`${t} instrumentation outgoingRequest`),xi.context.bind(A,g),a._traceClientRequest(g,C,y,R)})}}_onServerResponseFinish(t,r,a,i,s){let e=Ou.getIncomingRequestAttributesOnResponse(t,r);i=Object.assign(i,Ou.getIncomingRequestMetricAttributesOnResponse(e)),this._headerCapture.server.captureResponseHeaders(a,u=>r.getHeader(u)),a.setAttributes(e).setStatus({code:Ou.parseResponseStatus(xi.SpanKind.SERVER,r.statusCode)});let o=e[UHa.SEMATTRS_HTTP_ROUTE];o&&a.updateName(`${t.method||"GET"} ${o}`),this.getConfig().applyCustomAttributesOnSpan&&(0,FZ.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(a,t,r),()=>{},!0),this._closeHttpSpan(a,xi.SpanKind.SERVER,s,i)}_onServerResponseError(t,r,a,i){Ou.setSpanWithError(t,i),this._closeHttpSpan(t,xi.SpanKind.SERVER,a,r)}_startHttpSpan(t,r,a=xi.context.active()){let i=r.kind===xi.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,e=xi.trace.getSpan(a);return i===!0&&e===void 0?s=xi.trace.wrapSpanContext(xi.INVALID_SPAN_CONTEXT):i===!0&&e?.spanContext().isRemote?s=e:s=this.tracer.startSpan(t,r,a),this._spanNotEnded.add(s),s}_closeHttpSpan(t,r,a,i){if(!this._spanNotEnded.has(t))return;t.end(),this._spanNotEnded.delete(t);let s=(0,oz.hrTimeToMilliseconds)((0,oz.hrTimeDuration)(a,(0,oz.hrTime)()));r===xi.SpanKind.SERVER?this._httpServerDurationHistogram.record(s,i):r===xi.SpanKind.CLIENT&&this._httpClientDurationHistogram.record(s,i)}_callResponseHook(t,r){(0,FZ.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(t,r),()=>{},!0)}_callRequestHook(t,r){(0,FZ.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(t,r),()=>{},!0)}_callStartSpanHook(t,r){if(typeof r=="function")return(0,FZ.safeExecuteInTheMiddle)(()=>r(t),()=>{},!0)}_createHeaderCapture(){var t,r,a,i,s,e,o,u,d,I,h,c;let G=this.getConfig();return{client:{captureRequestHeaders:Ou.headerCapture("request",(a=(r=(t=G.headersToSpanAttributes)===null||t===void 0?void 0:t.client)===null||r===void 0?void 0:r.requestHeaders)!==null&&a!==void 0?a:[]),captureResponseHeaders:Ou.headerCapture("response",(e=(s=(i=G.headersToSpanAttributes)===null||i===void 0?void 0:i.client)===null||s===void 0?void 0:s.responseHeaders)!==null&&e!==void 0?e:[])},server:{captureRequestHeaders:Ou.headerCapture("request",(d=(u=(o=G.headersToSpanAttributes)===null||o===void 0?void 0:o.server)===null||u===void 0?void 0:u.requestHeaders)!==null&&d!==void 0?d:[]),captureResponseHeaders:Ou.headerCapture("response",(c=(h=(I=G.headersToSpanAttributes)===null||I===void 0?void 0:I.server)===null||h===void 0?void 0:h.responseHeaders)!==null&&c!==void 0?c:[])}}}};SEe.HttpInstrumentation=i0t});var lXn=ve(iXn=>{"use strict";Object.defineProperty(iXn,"__esModule",{value:!0})});var sXn=ve(qR=>{"use strict";var MHa=qR&&qR.__createBinding||(Object.create?(function(n,t,r,a){a===void 0&&(a=r),Object.defineProperty(n,a,{enumerable:!0,get:function(){return t[r]}})}):(function(n,t,r,a){a===void 0&&(a=r),n[a]=t[r]})),l0t=qR&&qR.__exportStar||function(n,t){for(var r in n)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&MHa(t,n,r)};Object.defineProperty(qR,"__esModule",{value:!0});l0t(aXn(),qR);l0t(lXn(),qR);l0t(r0t(),qR)});function zHa(n){switch(n){case Mr.ProceedOnce:case Mr.ProceedAlways:case Mr.ProceedAlwaysServer:case Mr.ProceedAlwaysTool:case Mr.ProceedAlwaysProject:return EZ.ACCEPT;case Mr.ModifyWithEditor:return EZ.MODIFY;case Mr.Cancel:default:return EZ.REJECT}}function _Ha(n){if(!n)return 0;let t=0,r=Array.isArray(n)?n:[n];for(let a of r)a&&typeof a=="object"?a.text&&typeof a.text=="string"?t+=a.text.length:a.functionResponse?t+=JSON.stringify(a.functionResponse).length:typeof a=="string"&&(t+=a.length):typeof a=="string"&&(t+=a.length);return t}var EZ,cz,uz,Iz,FO,dz,hz,mz,pz,Z2,n6,BEe,r6=It(()=>{"use strict";Ll();(function(n){n.ACCEPT="accept",n.REJECT="reject",n.MODIFY="modify"})(EZ||(EZ={}));cz=class{"event.name";"event.timestamp";model;embedding_model;sandbox_enabled;core_tools_enabled;approval_mode;api_key_enabled;vertex_ai_enabled;debug_enabled;mcp_servers;telemetry_enabled;telemetry_log_user_prompts_enabled;file_filtering_respect_git_ignore;constructor(t){let r=t.getContentGeneratorConfig(),a=t.getMcpServers(),i=!1,s=!1;r&&r.authType&&(i=!1,s=!1),this["event.name"]="cli_config",this.model=t.getModel(),this.embedding_model=t.getEmbeddingModel(),this.sandbox_enabled=typeof t.getSandbox()=="string"||!!t.getSandbox(),this.core_tools_enabled=(t.getCoreTools()??[]).join(","),this.approval_mode=t.getApprovalMode(),this.api_key_enabled=i||s,this.vertex_ai_enabled=s,this.debug_enabled=t.getDebugMode(),this.mcp_servers=a?Object.keys(a).join(","):"",this.telemetry_enabled=t.getTelemetryEnabled(),this.telemetry_log_user_prompts_enabled=t.getTelemetryLogPromptsEnabled(),this.file_filtering_respect_git_ignore=t.getFileFilteringRespectGitIgnore()}},uz=class{"event.name";"event.timestamp";session_id;constructor(t){this["event.name"]="end_session",this["event.timestamp"]=new Date().toISOString(),this.session_id=t?.getSessionId()}},Iz=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(t,r,a,i){this["event.name"]="user_prompt",this["event.timestamp"]=new Date().toISOString(),this.prompt_length=t,this.prompt_id=r,this.auth_type=a,this.prompt=i}};FO=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;response_length;constructor(t){this["event.name"]="tool_call",this["event.timestamp"]=new Date().toISOString(),this.function_name=t.request.name,this.function_args=t.request.args,this.duration_ms=t.durationMs??0,this.success=t.status==="success",this.decision=t.outcome?zHa(t.outcome):void 0,this.error=t.response.error?.message,this.error_type=t.response.error?.name,this.prompt_id=t.request.prompt_id,this.response_length=_Ha(t.response.responseParts)}},dz=class{"event.name";"event.timestamp";model;prompt_id;request_text;constructor(t,r,a){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=t,this.prompt_id=r,this.request_text=a}},hz=class{"event.name";"event.timestamp";model;error;error_type;status_code;duration_ms;prompt_id;auth_type;agent_context;constructor(t,r,a,i,s,e,o,u){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=t,this.error=r,this.error_type=e,this.status_code=o,this.duration_ms=a,this.prompt_id=i,this.auth_type=s,this.agent_context=u}},mz=class{"event.name";"event.timestamp";model;status_code;duration_ms;error;input_token_count;output_token_count;cached_content_token_count;cache_write_input_tokens;cache_read_input_tokens;thoughts_token_count;tool_token_count;total_token_count;credits_usage;response_text;prompt_id;auth_type;agent_context;constructor(t,r,a,i,s,e,o,u){this["event.name"]="api_response",this["event.timestamp"]=new Date().toISOString(),this.model=t,this.duration_ms=r,this.status_code=200,this.input_token_count=s?.promptTokenCount??0,this.output_token_count=s?.candidatesTokenCount??0,this.cached_content_token_count=s?.cachedContentTokenCount??0,this.cache_write_input_tokens=s?.cacheWriteInputTokens??0,this.cache_read_input_tokens=s?.cacheReadInputTokens??0,this.thoughts_token_count=s?.thoughtsTokenCount??0,this.tool_token_count=s?.toolUsePromptTokenCount??0,this.total_token_count=s?.totalTokenCount??0,this.credits_usage=s?.creditsUsage??0,this.response_text=e,this.error=o,this.prompt_id=a,this.auth_type=i,this.agent_context=u}},pz=class{"event.name";"event.timestamp";auth_type;constructor(t){this["event.name"]="flash_fallback",this["event.timestamp"]=new Date().toISOString(),this.auth_type=t}};(function(n){n.CONSECUTIVE_IDENTICAL_TOOL_CALLS="consecutive_identical_tool_calls",n.CHANTING_IDENTICAL_SENTENCES="chanting_identical_sentences",n.LLM_DETECTED_LOOP="llm_detected_loop"})(Z2||(Z2={}));n6=class{"event.name";"event.timestamp";loop_type;prompt_id;constructor(t,r){this["event.name"]="loop_detected",this["event.timestamp"]=new Date().toISOString(),this.loop_type=t,this.prompt_id=r}},BEe=class{"event.name";"event.timestamp";prompt_id;constructor(t){this["event.name"]="flash_decided_to_continue",this["event.timestamp"]=new Date().toISOString(),this.prompt_id=t}}});var Sa,oXn=It(()=>{"use strict";(function(n){n[n.GEMINI_CLI_KEY_UNKNOWN=0]="GEMINI_CLI_KEY_UNKNOWN",n[n.GEMINI_CLI_START_SESSION_MODEL=1]="GEMINI_CLI_START_SESSION_MODEL",n[n.GEMINI_CLI_START_SESSION_EMBEDDING_MODEL=2]="GEMINI_CLI_START_SESSION_EMBEDDING_MODEL",n[n.GEMINI_CLI_START_SESSION_SANDBOX=3]="GEMINI_CLI_START_SESSION_SANDBOX",n[n.GEMINI_CLI_START_SESSION_CORE_TOOLS=4]="GEMINI_CLI_START_SESSION_CORE_TOOLS",n[n.GEMINI_CLI_START_SESSION_APPROVAL_MODE=5]="GEMINI_CLI_START_SESSION_APPROVAL_MODE",n[n.GEMINI_CLI_START_SESSION_API_KEY_ENABLED=6]="GEMINI_CLI_START_SESSION_API_KEY_ENABLED",n[n.GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED=7]="GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED",n[n.GEMINI_CLI_START_SESSION_DEBUG_MODE_ENABLED=8]="GEMINI_CLI_START_SESSION_DEBUG_MODE_ENABLED",n[n.GEMINI_CLI_START_SESSION_MCP_SERVERS=9]="GEMINI_CLI_START_SESSION_MCP_SERVERS",n[n.GEMINI_CLI_START_SESSION_TELEMETRY_ENABLED=10]="GEMINI_CLI_START_SESSION_TELEMETRY_ENABLED",n[n.GEMINI_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED=11]="GEMINI_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED",n[n.GEMINI_CLI_START_SESSION_RESPECT_GITIGNORE=12]="GEMINI_CLI_START_SESSION_RESPECT_GITIGNORE",n[n.GEMINI_CLI_USER_PROMPT_LENGTH=13]="GEMINI_CLI_USER_PROMPT_LENGTH",n[n.GEMINI_CLI_TOOL_CALL_NAME=14]="GEMINI_CLI_TOOL_CALL_NAME",n[n.GEMINI_CLI_TOOL_CALL_DECISION=15]="GEMINI_CLI_TOOL_CALL_DECISION",n[n.GEMINI_CLI_TOOL_CALL_SUCCESS=16]="GEMINI_CLI_TOOL_CALL_SUCCESS",n[n.GEMINI_CLI_TOOL_CALL_DURATION_MS=17]="GEMINI_CLI_TOOL_CALL_DURATION_MS",n[n.GEMINI_CLI_TOOL_ERROR_MESSAGE=18]="GEMINI_CLI_TOOL_ERROR_MESSAGE",n[n.GEMINI_CLI_TOOL_CALL_ERROR_TYPE=19]="GEMINI_CLI_TOOL_CALL_ERROR_TYPE",n[n.GEMINI_CLI_API_REQUEST_MODEL=20]="GEMINI_CLI_API_REQUEST_MODEL",n[n.GEMINI_CLI_API_RESPONSE_MODEL=21]="GEMINI_CLI_API_RESPONSE_MODEL",n[n.GEMINI_CLI_API_RESPONSE_STATUS_CODE=22]="GEMINI_CLI_API_RESPONSE_STATUS_CODE",n[n.GEMINI_CLI_API_RESPONSE_DURATION_MS=23]="GEMINI_CLI_API_RESPONSE_DURATION_MS",n[n.GEMINI_CLI_API_ERROR_MESSAGE=24]="GEMINI_CLI_API_ERROR_MESSAGE",n[n.GEMINI_CLI_API_RESPONSE_INPUT_TOKEN_COUNT=25]="GEMINI_CLI_API_RESPONSE_INPUT_TOKEN_COUNT",n[n.GEMINI_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT=26]="GEMINI_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT",n[n.GEMINI_CLI_API_RESPONSE_CACHED_TOKEN_COUNT=27]="GEMINI_CLI_API_RESPONSE_CACHED_TOKEN_COUNT",n[n.GEMINI_CLI_API_RESPONSE_THINKING_TOKEN_COUNT=28]="GEMINI_CLI_API_RESPONSE_THINKING_TOKEN_COUNT",n[n.GEMINI_CLI_API_RESPONSE_TOOL_TOKEN_COUNT=29]="GEMINI_CLI_API_RESPONSE_TOOL_TOKEN_COUNT",n[n.GEMINI_CLI_API_ERROR_MODEL=30]="GEMINI_CLI_API_ERROR_MODEL",n[n.GEMINI_CLI_API_ERROR_TYPE=31]="GEMINI_CLI_API_ERROR_TYPE",n[n.GEMINI_CLI_API_ERROR_STATUS_CODE=32]="GEMINI_CLI_API_ERROR_STATUS_CODE",n[n.GEMINI_CLI_API_ERROR_DURATION_MS=33]="GEMINI_CLI_API_ERROR_DURATION_MS",n[n.GEMINI_CLI_END_SESSION_ID=34]="GEMINI_CLI_END_SESSION_ID",n[n.GEMINI_CLI_PROMPT_ID=35]="GEMINI_CLI_PROMPT_ID",n[n.GEMINI_CLI_AUTH_TYPE=36]="GEMINI_CLI_AUTH_TYPE",n[n.GEMINI_CLI_GOOGLE_ACCOUNTS_COUNT=37]="GEMINI_CLI_GOOGLE_ACCOUNTS_COUNT",n[n.GEMINI_CLI_SURFACE=39]="GEMINI_CLI_SURFACE",n[n.GEMINI_CLI_SESSION_ID=40]="GEMINI_CLI_SESSION_ID",n[n.GEMINI_CLI_LOOP_DETECTED_TYPE=38]="GEMINI_CLI_LOOP_DETECTED_TYPE"})(Sa||(Sa={}))});import*as cXn from"os";import*as $R from"fs";import*as c0t from"path";import{randomUUID as PHa}from"crypto";function KHa(){$R.existsSync(s0t)||$R.mkdirSync(s0t,{recursive:!0})}function qHa(){return $R.existsSync(o0t)&&$R.readFileSync(o0t,"utf-8").trim()||null}function $Ha(n){$R.writeFileSync(o0t,n,"utf-8")}function uXn(){try{KHa();let n=qHa();return n||(n=PHa(),$Ha(n)),n}catch(n){return console.error("Error accessing installation ID file, generating ephemeral ID:",n),"123456789"}}var jHa,s0t,o0t,IXn=It(()=>{"use strict";ch();jHa=cXn.homedir()??"",s0t=c0t.join(jHa,lA),o0t=c0t.join(s0t,"installation_id")});import eXa from"node:path";import{promises as M$i,existsSync as dXn,readFileSync as hXn}from"node:fs";import*as mXn from"os";function pXn(){return eXa.join(mXn.homedir(),lA,EDe)}function bXn(){try{let n=pXn();if(dXn(n)){let t=hXn(n,"utf-8").trim();return t?JSON.parse(t).active:null}return null}catch(n){return console.debug("Error reading cached Google Account:",n),null}}function fXn(){try{let n=pXn();if(!dXn(n))return 0;let t=hXn(n,"utf-8").trim();if(!t)return 0;let r=JSON.parse(t),a=r.old.length;return r.active&&a++,a}catch(n){return console.debug("Error reading lifetime Google Accounts:",n),0}}var GXn=It(()=>{"use strict";ch();});function JEe(n,t){let r=new WeakSet;return JSON.stringify(n,(a,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},t)}var u0t=It(()=>{"use strict";});var gXn,tXa,nXa,rXa,aXa,iXa,lXa,sXa,oXa,cXa,uXa,ob,TEe=It(()=>{"use strict";gXn=Qt(HQe(),1);r6();oXn();IXn();GXn();u0t();tXa="start_session",nXa="new_prompt",rXa="tool_call",aXa="api_request",iXa="api_response",lXa="api_error",sXa="end_session",oXa="flash_fallback",cXa="loop_detected",uXa="flash_decided_to_continue",ob=class{static instance;config;events=[];last_flush_time=Date.now();flush_interval_ms=1e3*60;constructor(t){this.config=t}static getInstance(t){}enqueueLogEvent(t){this.events.push([{event_time_ms:Date.now(),source_extension_json:JEe(t)}])}createLogEvent(t,r){let a=bXn(),i=fXn();r.push({gemini_cli_key:Sa.GEMINI_CLI_GOOGLE_ACCOUNTS_COUNT,value:i.toString()});let s={console_type:"GEMINI_CLI",application:102,event_name:t,event_metadata:[r]};return a?s.client_email=a:s.client_install_id=uXn(),s}flushIfNeeded(){Date.now()-this.last_flush_time<this.flush_interval_ms||this.flushToClearcut().catch(t=>{console.debug("Error flushing to Clearcut:",t)})}flushToClearcut(){return this.events.length=0,this.last_flush_time=Date.now(),Promise.resolve({})}decodeLogResponse(t){if(t.length<1||t.readUInt8(0)!==8)return;let r=BigInt(0),a=!0;for(let s=1;a&&s<t.length;s++){let e=t.readUInt8(s);r|=BigInt(e&127)<<BigInt(7*(s-1)),a=(e&128)!==0}return a?void 0:{nextRequestWaitMs:Number(r)}}logStartSessionEvent(t){let r=process.env.SURFACE||"SURFACE_NOT_SET",a=[{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_MODEL,value:t.model},{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_EMBEDDING_MODEL,value:t.embedding_model},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_SANDBOX,value:t.sandbox_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_CORE_TOOLS,value:t.core_tools_enabled},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_APPROVAL_MODE,value:t.approval_mode},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_API_KEY_ENABLED,value:t.api_key_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED,value:t.vertex_ai_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:t.debug_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED,value:t.vertex_ai_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_MCP_SERVERS,value:t.mcp_servers},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_VERTEX_API_ENABLED,value:t.vertex_ai_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_TELEMETRY_ENABLED,value:t.telemetry_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:t.telemetry_log_user_prompts_enabled.toString()},{gemini_cli_key:Sa.GEMINI_CLI_SURFACE,value:r}];this.enqueueLogEvent(this.createLogEvent(tXa,a)),this.flushToClearcut().catch(i=>{console.debug("Error flushing to Clearcut:",i)})}logNewPromptEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(t.prompt_length)},{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_AUTH_TYPE,value:JSON.stringify(t.auth_type)}];this.enqueueLogEvent(this.createLogEvent(nXa,r)),this.flushIfNeeded()}logToolCallEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_NAME,value:JSON.stringify(t.function_name)},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_DECISION,value:JSON.stringify(t.decision)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(t.success)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(t.duration_ms)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(t.error)},{gemini_cli_key:Sa.GEMINI_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(t.error_type)}],a=this.createLogEvent(rXa,r);this.enqueueLogEvent(a),this.flushIfNeeded()}logApiRequestEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_API_REQUEST_MODEL,value:JSON.stringify(t.model)},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)}];this.enqueueLogEvent(this.createLogEvent(aXa,r)),this.flushIfNeeded()}logApiResponseEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_MODEL,value:JSON.stringify(t.model)},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(t.status_code)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(t.duration_ms)},{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_MESSAGE,value:JSON.stringify(t.error)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(t.input_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(t.output_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(t.cached_content_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(t.thoughts_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(t.tool_token_count)},{gemini_cli_key:Sa.GEMINI_CLI_AUTH_TYPE,value:JSON.stringify(t.auth_type)}];this.enqueueLogEvent(this.createLogEvent(iXa,r)),this.flushIfNeeded()}logApiErrorEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_MODEL,value:JSON.stringify(t.model)},{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_TYPE,value:JSON.stringify(t.error_type)},{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(t.status_code)},{gemini_cli_key:Sa.GEMINI_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(t.duration_ms)},{gemini_cli_key:Sa.GEMINI_CLI_AUTH_TYPE,value:JSON.stringify(t.auth_type)}];this.enqueueLogEvent(this.createLogEvent(lXa,r)),this.flushIfNeeded()}logFlashFallbackEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_AUTH_TYPE,value:JSON.stringify(t.auth_type)},{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(oXa,r)),this.flushToClearcut().catch(a=>{console.debug("Error flushing to Clearcut:",a)})}logLoopDetectedEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(t.loop_type)}];this.enqueueLogEvent(this.createLogEvent(cXa,r)),this.flushIfNeeded()}logFlashDecidedToContinueEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_PROMPT_ID,value:JSON.stringify(t.prompt_id)},{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(uXa,r)),this.flushIfNeeded()}logEndSessionEvent(t){let r=[{gemini_cli_key:Sa.GEMINI_CLI_SESSION_ID,value:t?.session_id?.toString()??""}];this.enqueueLogEvent(this.createLogEvent(sXa,r)),this.flushToClearcut().catch(a=>{console.debug("Error flushing to Clearcut:",a)})}getProxyAgent(){let t=this.config?.getProxy();if(t){if(t.startsWith("http"))return new gXn.HttpsProxyAgent(t);throw new Error("Unsupported proxy type")}}shutdown(){let t=new uz(this.config);this.logEndSessionEvent(t)}}});function uG(){return bse}function IXa(n){if(!n)return;let t=n.replace(/^["']|["']$/g,"");try{return new URL(t).origin}catch(r){Y7.error("Invalid OTLP endpoint URL provided:",t,r);return}}function OEe(n){if(bse)return;let t=n.getTelemetryEnabled(),r=IXa(n.getTelemetryOtlpEndpoint());if(t&&r){DEe=new AXn.NodeSDK({resource:new yXn.Resource({[WXn.SemanticResourceAttributes.SERVICE_NAME]:D1,"session.id":n.getSessionId()}),traceExporter:new vXn.OTLPTraceExporter({url:`${r}/v1/traces`}),metricReader:new EXn.PeriodicExportingMetricReader({exporter:new NXn.OTLPMetricExporter({url:`${r}/v1/metrics`})}),logRecordProcessor:new FXn.BatchLogRecordProcessor(new ZXn.OTLPLogExporter({url:`${r}/v1/logs`})),instrumentations:[new RXn.HttpInstrumentation]});try{DEe.start(),console.log("OpenTelemetry SDK initialized successfully.")}catch(a){console.error("Failed to start OpenTelemetry SDK:",a)}}bse=!0}async function UEe(){if(!(!bse||!DEe))try{ob.getInstance()?.shutdown(),await DEe.shutdown(),console.log("OpenTelemetry SDK shut down successfully.")}catch(n){console.error("Error shutting down SDK:",n)}finally{bse=!1}}var vXn,ZXn,NXn,AXn,WXn,yXn,FXn,EXn,RXn,DEe,bse,I0t=It(()=>{"use strict";Qr();vXn=Qt(But(),1),ZXn=Qt(DYn(),1),NXn=Qt($Yn(),1),AXn=Qt(jHn(),1),WXn=Qt(Xm(),1),yXn=Qt(gx(),1),FXn=Qt(h5e(),1),EXn=Qt(VM(),1),RXn=Qt(sXn(),1);Wre();TEe();Y7.setLogger(new tve,x0.INFO);bse=!1});import{EventEmitter as dXa}from"events";var hXa,mXa,MEe,cd,d0t=It(()=>{"use strict";Wre();r6();hXa=()=>({api:{totalRequests:0,totalErrors:0,totalLatencyMs:0},tokens:{prompt:0,candidates:0,total:0,cached:0,cacheWrite:0,cacheRead:0,thoughts:0,tool:0},credits:{total:0},subAgents:{api:{totalRequests:0,totalErrors:0,totalLatencyMs:0},tokens:{prompt:0,candidates:0,total:0,cached:0,cacheWrite:0,cacheRead:0,thoughts:0,tool:0},credits:{total:0}}}),mXa=()=>({models:{},tools:{totalCalls:0,totalSuccess:0,totalFail:0,totalDurationMs:0,totalDecisions:{[EZ.ACCEPT]:0,[EZ.REJECT]:0,[EZ.MODIFY]:0},byName:{}}}),MEe=class extends dXa{#e=mXa();#t=0;addEvent(t){switch(t["event.name"]){case Are:this.processApiResponse(t);break;case Nre:this.processApiError(t);break;case Zre:this.processToolCall(t);break;default:return}this.emit("update",{metrics:this.#e,lastPromptTokenCount:this.#t})}getMetrics(){return this.#e}getLastPromptTokenCount(){return this.#t}resetLastPromptTokenCount(){this.#t=0,this.emit("update",{metrics:this.#e,lastPromptTokenCount:this.#t})}getOrCreateModelMetrics(t){return this.#e.models[t]||(this.#e.models[t]=hXa()),this.#e.models[t]}processApiResponse(t){let r=this.getOrCreateModelMetrics(t.model);t.agent_context?.type==="sub"?(r.subAgents.api.totalRequests++,r.subAgents.api.totalLatencyMs+=t.duration_ms,r.subAgents.tokens.prompt+=t.input_token_count,r.subAgents.tokens.candidates+=t.output_token_count,r.subAgents.tokens.total+=t.total_token_count,r.subAgents.tokens.cached+=t.cached_content_token_count+t.cache_write_input_tokens,r.subAgents.tokens.cacheWrite+=t.cache_write_input_tokens,r.subAgents.tokens.cacheRead+=t.cache_read_input_tokens,r.subAgents.tokens.thoughts+=t.thoughts_token_count,r.subAgents.tokens.tool+=t.tool_token_count,r.subAgents.credits.total+=t.credits_usage):this.#t=t.input_token_count,r.api.totalRequests++,r.api.totalLatencyMs+=t.duration_ms,r.tokens.prompt+=t.input_token_count,r.tokens.candidates+=t.output_token_count,r.tokens.total+=t.total_token_count,r.tokens.cached+=t.cached_content_token_count,r.tokens.cacheWrite+=t.cache_write_input_tokens,r.tokens.cacheRead+=t.cache_read_input_tokens,r.tokens.thoughts+=t.thoughts_token_count,r.tokens.tool+=t.tool_token_count,r.credits.total+=t.credits_usage}processApiError(t){let r=this.getOrCreateModelMetrics(t.model);t.agent_context?.type==="sub"?(r.subAgents.api.totalRequests++,r.subAgents.api.totalErrors++,r.subAgents.api.totalLatencyMs+=t.duration_ms):(r.api.totalRequests++,r.api.totalErrors++,r.api.totalLatencyMs+=t.duration_ms)}processToolCall(t){let{tools:r}=this.#e;r.totalCalls++,r.totalDurationMs+=t.duration_ms,t.success?r.totalSuccess++:r.totalFail++,r.byName[t.function_name]||(r.byName[t.function_name]={count:0,success:0,fail:0,durationMs:0,responseLength:0,decisions:{[EZ.ACCEPT]:0,[EZ.REJECT]:0,[EZ.MODIFY]:0}});let a=r.byName[t.function_name];a.count++,a.durationMs+=t.duration_ms,a.responseLength+=t.response_length,t.success?a.success++:a.fail++,t.decision&&(r.totalDecisions[t.decision]++,a.decisions[t.decision]++)}},cd=new MEe});function e4(n){return{"session.id":n.getSessionId()}}function wXn(n,t){if(ob.getInstance(n)?.logStartSessionEvent(t),!uG())return;let r={...e4(n),"event.name":iIn,"event.timestamp":new Date().toISOString(),model:t.model,embedding_model:t.embedding_model,sandbox_enabled:t.sandbox_enabled,core_tools_enabled:t.core_tools_enabled,approval_mode:t.approval_mode,api_key_enabled:t.api_key_enabled,vertex_ai_enabled:t.vertex_ai_enabled,log_user_prompts_enabled:t.telemetry_log_user_prompts_enabled,file_filtering_respect_git_ignore:t.file_filtering_respect_git_ignore,debug_mode:t.debug_enabled,mcp_servers:t.mcp_servers},a=AF.logs.getLogger(D1),i={body:"CLI configuration loaded.",attributes:r};a.emit(i)}function bz(n,t){if(ob.getInstance(n)?.logNewPromptEvent(t),!uG())return;let r={...e4(n),"event.name":rIn,"event.timestamp":new Date().toISOString(),prompt_length:t.prompt_length};pXa(n)&&(r.prompt=t.prompt);let a=AF.logs.getLogger(D1),i={body:`User prompt. Length: ${t.prompt_length}.`,attributes:r};a.emit(i)}function cZ(n,t){let r={...t,"event.name":Zre,"event.timestamp":new Date().toISOString()};if(cd.addEvent(r),ob.getInstance(n)?.logToolCallEvent(t),!uG())return;let a={...e4(n),...t,"event.name":Zre,"event.timestamp":new Date().toISOString(),function_args:JEe(t.function_args,2)};t.error&&(a["error.message"]=t.error,t.error_type&&(a["error.type"]=t.error_type));let i=AF.logs.getLogger(D1),s={body:`Tool call: ${t.function_name}${t.decision?`. Decision: ${t.decision}`:""}. Success: ${t.success}. Duration: ${t.duration_ms}ms.`,attributes:a};i.emit(s),dIn(n,t.function_name,t.duration_ms,t.success,t.decision)}function zEe(n,t){if(ob.getInstance(n)?.logApiRequestEvent(t),!uG())return;let r={...e4(n),...t,"event.name":aIn,"event.timestamp":new Date().toISOString()},a=AF.logs.getLogger(D1),i={body:`API request to ${t.model}.`,attributes:r};a.emit(i)}function _Ee(n,t){if(ob.getInstance(n)?.logFlashFallbackEvent(t),!uG())return;let r={...e4(n),...t,"event.name":lIn,"event.timestamp":new Date().toISOString()},a=AF.logs.getLogger(D1),i={body:"Switching to flash as Fallback.",attributes:r};a.emit(i)}function PEe(n,t){let r={...t,"event.name":Nre,"event.timestamp":new Date().toISOString()};if(cd.addEvent(r),ob.getInstance(n)?.logApiErrorEvent(t),!uG())return;let a={...e4(n),"event.name":Nre,"event.timestamp":new Date().toISOString(),"error.message":t.error,model_name:t.model,model:t.model,error:t.error,duration:t.duration_ms,duration_ms:t.duration_ms,prompt_id:t.prompt_id,auth_type:t.auth_type};t.agent_context&&(a.agent_type=t.agent_context.type,t.agent_context.agentId&&(a.agent_id=t.agent_context.agentId),t.agent_context.taskDescription&&(a.task_description=t.agent_context.taskDescription)),t.error_type&&(a["error.type"]=t.error_type),typeof t.status_code=="number"&&(a[h0t.SemanticAttributes.HTTP_STATUS_CODE]=t.status_code);let i=AF.logs.getLogger(D1),s={body:`API error for ${t.model}. Error: ${t.error}. Duration: ${t.duration_ms}ms.`,attributes:a};i.emit(s),mIn(n,t.model,t.duration_ms,t.status_code,t.error_type)}function jEe(n,t){let r={...t,"event.name":Are,"event.timestamp":new Date().toISOString()};if(cd.addEvent(r),ob.getInstance(n)?.logApiResponseEvent(t),!uG())return;let a={...e4(n),"event.name":Are,"event.timestamp":new Date().toISOString(),model:t.model,status_code:t.status_code,duration_ms:t.duration_ms,input_token_count:t.input_token_count,output_token_count:t.output_token_count,cached_content_token_count:t.cached_content_token_count,thoughts_token_count:t.thoughts_token_count,tool_token_count:t.tool_token_count,total_token_count:t.total_token_count,prompt_id:t.prompt_id,auth_type:t.auth_type};t.agent_context&&(a.agent_type=t.agent_context.type,t.agent_context.agentId&&(a.agent_id=t.agent_context.agentId),t.agent_context.taskDescription&&(a.task_description=t.agent_context.taskDescription)),t.response_text&&(a.response_text=t.response_text),t.error?a["error.message"]=t.error:t.status_code&&typeof t.status_code=="number"&&(a[h0t.SemanticAttributes.HTTP_STATUS_CODE]=t.status_code);let i=AF.logs.getLogger(D1),s={body:`API response from ${t.model}. Status: ${t.status_code||"N/A"}. Duration: ${t.duration_ms}ms.`,attributes:a};i.emit(s),hIn(n,t.model,t.duration_ms,t.status_code,t.error),x7(n,t.model,t.input_token_count,"input"),x7(n,t.model,t.output_token_count,"output"),x7(n,t.model,t.cached_content_token_count,"cache"),x7(n,t.model,t.thoughts_token_count,"thought"),x7(n,t.model,t.tool_token_count,"tool")}function fse(n,t){if(ob.getInstance(n)?.logLoopDetectedEvent(t),!uG())return;let r={...e4(n),...t},a=AF.logs.getLogger(D1),i={body:`Loop detected. Type: ${t.loop_type}.`,attributes:r};a.emit(i)}function CXn(n,t){if(ob.getInstance(n)?.logFlashDecidedToContinueEvent(t),!uG())return;let r={...e4(n),...t,"event.name":sIn},a=AF.logs.getLogger(D1),i={body:"Flash decided to continue.",attributes:r};a.emit(i)}var AF,h0t,pXa,Gse=It(()=>{"use strict";AF=Qt(pU(),1),h0t=Qt(Xm(),1);Wre();V7();I0t();d0t();TEe();u0t();pXa=n=>n.getTelemetryLogPromptsEnabled()});import{EventEmitter as bXa}from"events";var m0t,a6,p0t=It(()=>{"use strict";m0t=class n extends bXa{static instance=null;static getInstance(){return n.instance||(n.instance=new n),n.instance}emitTokenUsage(t){this.emit("tokenUsage",t)}onTokenUsage(t){this.on("tokenUsage",t)}offTokenUsage(t){this.off("tokenUsage",t)}},a6=m0t.getInstance()});function YXn(n){if(n.candidates===void 0||n.candidates.length===0)return!1;let t=n.candidates[0]?.content;return t===void 0?!1:VXn(t)}function VXn(n){if(n.parts===void 0||n.parts.length===0)return!1;for(let t of n.parts)if(t===void 0||Object.keys(t).length===0||!t.thought&&t.text!==void 0&&t.text==="")return!1;return!0}function fXa(n){for(let t of n)if(t.role!==Pr.USER&&t.role!==Pr.MODEL)throw new Error(`Role must be user or model, but got ${t.role}.`)}function QXn(n){return!!(n&&n.role==="model"&&n.parts&&n.parts.length>0&&"reasoning"in n.parts[0])}function xXn(n){if(n===void 0||n.length===0)return[];let t=[],r=n.length,a=0;for(;a<r;)if(n[a].role===Pr.USER)t.push(n[a]),a++;else{let i=[],s=!0;for(;a<r&&n[a].role===Pr.MODEL;){let e=n[a];QXn(e)||(i.push(e),s&&!VXn(e)&&(s=!1)),a++}s&&i.length>0?t.push(...i):s||t.pop()}return t}var fz,b0t=It(()=>{"use strict";Ci();A0e();XB();Y$e();av();QB();Gse();r6();K7();p0t();E0e();KZe();fz=class{config;contentGenerator;generationConfig;history;agentContext;sendPromise=Promise.resolve();specifiedModel;constructor(t,r,a={},i=[],s={type:"main"},e){this.config=t,this.contentGenerator=r,this.generationConfig=a,this.history=i,this.agentContext=s,fXa(i),this.specifiedModel=e||this.config.getModel()}_getRequestTextFromContents(t){return JSON.stringify(t)}setSpecifiedModel(t){this.specifiedModel=t}async _logApiRequest(t,r,a){let i=this._getRequestTextFromContents(t);zEe(this.config,new dz(r,a,i))}async _logApiResponse(t,r,a,i,s){if(jEe(this.config,new mz(this.config.getModel(),t,r,this.config.getContentGeneratorConfig()?.authType,a,i,void 0,s)),a&&this.config.getProjectRoot()){try{await new Eo(this.config.getProjectRoot()).updateTokenStats(this.config.getSessionId(),this.config.getModel(),{input_token_count:a.promptTokenCount||0,output_token_count:a.candidatesTokenCount||0,total_token_count:a.totalTokenCount||0,cached_content_token_count:a.cachedContentTokenCount||0,thoughts_token_count:0,tool_token_count:0,cache_creation_input_tokens:a.cacheCreationInputTokens||0,cache_read_input_tokens:a.cacheReadInputTokens||0})}catch(e){console.warn("[SessionManager] Failed to update token stats:",e)}a6.emitTokenUsage({cache_creation_input_tokens:a.cacheCreationInputTokens||0,cache_read_input_tokens:a.cacheReadInputTokens||0,input_tokens:a.promptTokenCount||0,output_tokens:a.candidatesTokenCount||0,credits_usage:a.creditsUsage||0,model:this.config.getModel(),timestamp:Date.now()}),of.clearRealTimeToken()}}_logApiError(t,r,a,i){let s=r instanceof Error?r.message:String(r),e=r instanceof Error?r.name:"unknown";PEe(this.config,new hz(this.config.getModel(),s,t,a,this.config.getContentGeneratorConfig()?.authType,e,void 0,i))}async handleFlashFallback(t,r){return null}async sendMessage(t,r,a){await this.sendPromise;let s={...KHe(t.message),prompt_id:r},e=this.getHistory(!0).concat(s),o=this.fixRequestContents(e);this._logApiRequest(o,this.config.getModel(),r);let u=Date.now(),d;try{d=await Hb(()=>{let c=this.specifiedModel||nZ;if(this.config.getQuotaErrorOccurred()&&c===td)throw new Error("Please submit a new query to continue with the Flash model.");return this.contentGenerator.generateContent({model:c,contents:bQ(o),config:{...this.generationConfig,...t.config}},a)},{shouldRetry:c=>!!(c&&c.message&&(c.message.includes("429")||c.message.match(/5\d{2}/))),onPersistent429:async(c,G)=>await this.handleFlashFallback(c,G),authType:this.config.getContentGeneratorConfig()?.authType});let h=Date.now()-u;return await this._logApiResponse(h,r,d.usageMetadata,JSON.stringify(d),this.agentContext),this.sendPromise=(async()=>{let c=d.candidates?.[0]?.content,G=d.automaticFunctionCallingHistory,W=this.getHistory(!0).length,y=[];G!=null&&(y=G.slice(W)??[]);let R=c?[c]:[];this.recordHistory(s,R,y)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),d}catch(I){let h=Date.now()-u;throw this._logApiError(h,I,r,this.agentContext),of.clearRealTimeToken(),this.sendPromise=Promise.resolve(),I}}fixRequestContents(t){let r=[],a=(c,G)=>!c||!G||c.name!==G.name?!1:c.id&&G.id?c.id===G.id:!0,i=[];for(let c=0;c<t.length;c++){let G=t[c];G.role===Pr.MODEL&&G.parts&&G.parts.forEach(W=>{W.functionCall&&i.push({call:W.functionCall,messageIndex:c})})}let s=new Map,e=c=>c.functionResponse?.response?.result==="user cancel"?10:100;for(let c=0;c<t.length;c++){let G=t[c];if(G.role===Pr.USER&&G.parts){for(let W of G.parts)if(W.functionResponse){let y=W.functionResponse,R=e(W),F=y.id||`name:${y.name}`,C=s.get(F);if((!C||R>C.priority)&&s.set(F,{part:W,priority:R,originalIndex:c}),y.id){let A=`name:${y.name}`,E=s.get(A);E&&R>=E.priority&&s.delete(A)}}}}let o=[],u=new Set;for(let c=0;c<t.length;c++){let G=t[c];if(G.role===Pr.USER&&G.parts){let W=[];for(let y of G.parts)if(y.functionResponse){let R=y.functionResponse,F=R.id||`name:${R.name}`,C=s.get(F);if(C&&C.part===y&&!u.has(F)){let A=i.find(E=>a(E.call,R));A&&A.call.id!==R.id&&(console.log(`[fixRequestContents] \u{1F527} ID \u5BF9\u9F50\uFF1A\u5C06\u54CD\u5E94 ${R.name} \u7684 ID \u4ECE "${R.id||"unnamed"}" \u540C\u6B65\u4E3A\u8C03\u7528\u65B9\u7684 ID "${A.call.id||"unnamed"}"`),R.id=A.call.id),W.push(y),u.add(F)}else console.warn(`[fixRequestContents] \u{1F5D1}\uFE0F \u79FB\u9664\u6B21\u4F18\u6216\u91CD\u590D\u7684 functionResponse\uFF1A${R.name} (id: ${R.id||"unnamed"})\u3002\u4FDD\u7559\u4F18\u5148\u7EA7\u66F4\u9AD8\u6216\u66F4\u7CBE\u51C6\u7684\u54CD\u5E94\u3002`)}else W.push(y);W.length>0&&o.push({...G,parts:W})}else o.push(G)}for(let c=0;c<o.length;c++){let G=o[c];if(r.push(G),G.role===Pr.USER&&G.parts){let y=G.parts.filter(R=>R.functionResponse);if(y.length>0){let R=y.filter(F=>{let C=F.functionResponse;return!i.some(({call:A})=>a(A,C))});R.length>0&&console.log(`[fixRequestContents] \u68C0\u6D4B\u5230\u7B2C${c+1}\u6761\u6D88\u606F\u4E2D\u6709 ${R.length} \u4E2A\u5B64\u7ACB\u7684 function response:`,R.map(F=>({name:F.functionResponse.name,id:F.functionResponse.id,result:F.functionResponse.response?.result})))}}if(G.role===Pr.MODEL&&G.parts?.some(y=>y.functionCall)){let y=o[c+1],R=G.parts?.filter(F=>F.functionCall)||[];if(R.length>0){let F=y?.role===Pr.USER&&y.parts?y.parts.filter(E=>E.functionResponse):[],A=R.filter(E=>{let f=E.functionCall;return!F.some(g=>{let v=g.functionResponse;return a(f,v)})}).filter(E=>{let f=E.functionCall,g=f.id||`name:${f.name}`,v=s.get(g);return v&&v.priority===100&&v.originalIndex>c+1?(console.log(`[fixRequestContents] \u23ED\uFE0F \u8DF3\u8FC7\u8865\u5168 cancel\uFF1A${f.name} (id: ${f.id||"unnamed"})\uFF0C\u771F\u5B9E\u7ED3\u679C\u5C06\u5728\u540E\u7EED\u6D88\u606F\u4E2D\u5230\u8FBE`),!1):!0});if(A.length>0){let E=A.map(f=>{let g=f.functionCall;return{functionResponse:{name:g.name,response:{result:"user cancel"},...g.id&&{id:g.id}}}});r.push({role:Pr.USER,parts:E}),console.log(`[fixRequestContents] \u4E3A\u7B2C${c+1}\u6761\u6D88\u606F\u8865\u5168\u4E86 ${A.length} \u4E2A\u672A\u5339\u914D\u7684 function call`)}if(y&&F.length>0){let E=y.parts?.filter(f=>!f.functionResponse)||[];E.length>0&&(o[c+1]={...y,parts:[...F,...E]},console.log(`[fixRequestContents] \u8C03\u6574\u4E86\u7B2C${c+2}\u6761\u6D88\u606F\u7684\u5185\u5BB9\u987A\u5E8F\uFF0Cfunction-response \u5728\u524D`))}}}}let d=[],I={},h={};for(let c of r)if(c.role===Pr.MODEL&&c.parts)c.parts.forEach(G=>{G.functionCall&&(G.functionCall.id&&(I[G.functionCall.id]=!0),G.functionCall.name&&(h[G.functionCall.name]=!0))}),d.push(c);else if(c.role===Pr.USER&&c.parts){let G=c.parts.filter(W=>{if(!W.functionResponse)return!0;let y=W.functionResponse,R=y.id&&I[y.id],F=y.name&&h[y.name];return R||F?!0:(console.warn(`[fixRequestContents] \u274C \u79FB\u9664\u5B64\u7ACB\u7684 functionResponse\uFF1A${y.name} (id: ${y.id})\u3002\u8FD9\u4E2A response \u6CA1\u6709\u5BF9\u5E94\u7684 function call\u3002`),!1)});G.length>0?d.push({...c,parts:G}):console.warn("[fixRequestContents] \u79FB\u9664\u7A7A\u7684\u7528\u6237\u6D88\u606F\uFF08\u6240\u6709 functionResponse \u90FD\u88AB\u8FC7\u6EE4\uFF09")}else d.push(c);return d}async sendMessageStream(t,r,a){await this.sendPromise;let s={...KHe(t.message),prompt_id:r},e=this.getHistory(!0).concat(s),o=this.fixRequestContents(e);this._logApiRequest(o,this.config.getModel(),r);let u=Date.now();try{let I=await Hb(()=>{let c=this.specifiedModel||nZ;if(this.config.getQuotaErrorOccurred()&&c===td)throw new Error("Please submit a new query to continue with the Flash model.");return this.contentGenerator.generateContentStream({model:c,contents:bQ(o),config:{...this.generationConfig,...t.config}},a)},{shouldRetry:c=>{if(sf(c))return!1;if(c&&c.message){if(c.message.includes("429"))return!0;if(c.message.includes("REGION_BLOCKED_451")||c.message.includes("451"))return!1;if(c.message.match(/5\d{2}/))return!0}return!1},onPersistent429:async(c,G)=>await this.handleFlashFallback(c,G),authType:this.config.getContentGeneratorConfig()?.authType});return this.sendPromise=Promise.resolve(I).then(()=>{}).catch(()=>{}),this.processStreamResponse(I,s,u,r)}catch(d){let I=Date.now()-u;throw this._logApiError(I,d,r,this.agentContext),of.clearRealTimeToken(),this.sendPromise=Promise.resolve(),d}}getHistory(t=!1){let r=t?xXn(this.history):this.history;return structuredClone(r)}clearHistory(){this.history=[]}addHistory(t){this.history.push(t)}setHistory(t){this.history=t}setTools(t){this.generationConfig.tools=t}getTools(){return this.generationConfig.tools}setSystemInstruction(t){this.generationConfig.systemInstruction=t}getSystemInstruction(){return this.generationConfig.systemInstruction}getFinalUsageMetadata(t){return t.slice().reverse().find(a=>a.usageMetadata)?.usageMetadata}async*processStreamResponse(t,r,a,i){let s=[],e=[],o=!1;try{for await(let u of t){let d=u.candidates?.[0]?.content,I=d&&this.isReasoningContent(d),h=d&&this.isThoughtContent(d);if((YXn(u)||u.usageMetadata)&&!I&&!h&&e.push(u),YXn(u)&&d!==void 0){if(h||I){yield u;continue}if(d.parts?.every(G=>G.text!==void 0&&G.text.trim()==="")){yield u;continue}s.push(d)}yield u}}catch(u){o=!0;let d=Date.now()-a;throw this._logApiError(d,u,i,this.agentContext),of.clearRealTimeToken(),s.length>0&&this.recordHistory(r,s),u}if(!o){let u=Date.now()-a,d=[];for(let I of s)I.parts&&d.push(...I.parts);await this._logApiResponse(u,i,this.getFinalUsageMetadata(e),JSON.stringify(e),this.agentContext),this.recordHistory(r,s)}}recordHistory(t,r,a){let i=r.filter(o=>!this.isThoughtContent(o)&&!this.isReasoningContent(o)),s=[];i.length>0&&i.every(o=>o.role!==void 0)?s=i:i.length===0&&r.length>0||C$e(t)||s.push({role:Pr.MODEL,parts:[]}),a&&a.length>0?this.history.push(...xXn(a)):this.history.push(t);let e=[];for(let o of s){if(this.isThoughtContent(o)||this.isReasoningContent(o))continue;let u=e[e.length-1],d=o.parts?.some(h=>h.functionCall),I=u?.parts?.some(h=>h.functionCall);this.isTextContent(u)&&this.isTextContent(o)?(u.parts[0].text+=o.parts[0].text||"",o.parts.length>1&&u.parts.push(...o.parts.slice(1))):d&&I&&u.role===Pr.MODEL?(console.log("[recordHistory] Merging consecutive function calls into single message"),u.parts?.push(...o.parts||[])):e.push(o)}if(e.length>0){let o=this.history[this.history.length-1];(!a||a.length===0)&&this.isTextContent(o)&&this.isTextContent(e[0])&&(o.parts[0].text+=e[0].parts[0].text||"",e[0].parts.length>1&&o.parts.push(...e[0].parts.slice(1)),e.shift()),this.history.push(...e)}}isTextContent(t){return!!(t&&t.role==="model"&&t.parts&&t.parts.length>0&&typeof t.parts[0].text=="string"&&t.parts[0].text!=="")}isThoughtContent(t){return!!(t&&t.role==="model"&&t.parts&&t.parts.length>0&&typeof t.parts[0].thought=="boolean"&&t.parts[0].thought===!0)}isReasoningContent(t){return QXn(t)}}});import{createHash as HXn}from"crypto";async function AXa(n,t,r,a){let i=a.getGeminiClient()?.getContentGenerator();if(!i)throw new Error("DeepVServerAdapter not available");console.log("[LoopDetection] Calling unified interface for loop detection");let s=await i.generateContent({contents:n,config:{responseMimeType:"application/json",abortSignal:r,httpOptions:{headers:{"X-Scene-Type":"json_generation","X-Request-ID":`loop-detection-${Date.now()}`}}}},"json_generation");return console.log("[LoopDetection] Loop detection completed successfully"),s}var GXa,f0t,Gz,XXn,gXa,kXn,vXa,ZXa,LXn,SXn,NXa,KEe,BXn=It(()=>{"use strict";gAe();Gse();r6();av();Ci();GXa=10,f0t=20,Gz=500,XXn=1e4,gXa=new Set(["read_file","read_many_files","glob","search_file_content","ls","replace","write_file","delete_file","shell"]),kXn=32,vXa=20,ZXa=30,LXn=3,SXn=5,NXa=15;KEe=class{config;promptId="";isPreviewModel=!1;lastToolCallKey=null;toolCallRepetitionCount=0;lastToolName=null;consecutiveToolNameCount=0;streamContentHistory="";contentStats=new Map;lastContentIndex=0;loopDetected=!1;detectedLoopType=null;turnsInCurrentPrompt=0;llmCheckInterval=LXn;lastCheckTurn=0;constructor(t){this.config=t}getToolCallKey(t){let r=JSON.stringify(t.args),a=`${t.name}:${r}`;return HXn("sha256").update(a).digest("hex")}addAndCheck(t){if(this.loopDetected)return!0;switch(t.type){case pi.ToolCallRequest:this.resetContentTracking(),this.loopDetected=this.checkToolCallLoop(t.value);break;case pi.Content:this.loopDetected=this.checkContentLoop(t.value);break;default:break}return this.loopDetected}async turnStarted(t){return this.turnsInCurrentPrompt++,this.turnsInCurrentPrompt>=ZXa&&this.turnsInCurrentPrompt-this.lastCheckTurn>=this.llmCheckInterval?(this.lastCheckTurn=this.turnsInCurrentPrompt,await this.checkForLoopWithLLM(t)):!1}checkToolCallLoop(t){let r=this.getToolCallKey(t);return this.lastToolCallKey===r?this.toolCallRepetitionCount++:(this.lastToolCallKey=r,this.toolCallRepetitionCount=1),this.toolCallRepetitionCount>=GXa?(this.detectedLoopType=Z2.CONSECUTIVE_IDENTICAL_TOOL_CALLS,fse(this.config,new n6(Z2.CONSECUTIVE_IDENTICAL_TOOL_CALLS,this.promptId)),!0):this.isPreviewModel?this.checkPreviewModelToolNameLoop(t):!1}checkPreviewModelToolNameLoop(t){let r=t.name;return gXa.has(r)?(this.lastToolName===r?this.consecutiveToolNameCount++:(this.lastToolName=r,this.consecutiveToolNameCount=1),this.consecutiveToolNameCount>=kXn?(console.warn(`[LoopDetection] Preview model loop detected: tool '${r}' called consecutively ${this.consecutiveToolNameCount} times (threshold: ${kXn})`),this.detectedLoopType=Z2.CONSECUTIVE_IDENTICAL_TOOL_CALLS,fse(this.config,new n6(Z2.CONSECUTIVE_IDENTICAL_TOOL_CALLS,this.promptId)),!0):!1):(this.lastToolName=null,this.consecutiveToolNameCount=0,!1)}checkContentLoop(t){return this.streamContentHistory+=t,this.truncateAndUpdate(),this.analyzeContentChunksForLoop()}truncateAndUpdate(){if(this.streamContentHistory.length<=XXn)return;let t=this.streamContentHistory.length-XXn;this.streamContentHistory=this.streamContentHistory.slice(t),this.lastContentIndex=Math.max(0,this.lastContentIndex-t);for(let[r,a]of this.contentStats.entries()){let i=a.map(s=>s-t).filter(s=>s>=0);i.length>0?this.contentStats.set(r,i):this.contentStats.delete(r)}}analyzeContentChunksForLoop(){for(;this.hasMoreChunksToProcess();){let t=this.streamContentHistory.substring(this.lastContentIndex,this.lastContentIndex+Gz),r=HXn("sha256").update(t).digest("hex");if(this.isLoopDetectedForChunk(t,r))return this.detectedLoopType=Z2.CHANTING_IDENTICAL_SENTENCES,fse(this.config,new n6(Z2.CHANTING_IDENTICAL_SENTENCES,this.promptId)),!0;this.lastContentIndex++}return!1}hasMoreChunksToProcess(){return this.lastContentIndex+Gz<=this.streamContentHistory.length}hasSignificantContent(t){return!(t.trim().length<15||/^[\s\t\n\r]*$/.test(t)||/^[\s\-=*_+|#.`\/\\~]+$/.test(t)||/^[\s\u2500-\u257F┌┐└┘├┤┬┴┼]+$/.test(t))}isCommonPattern(t){return[/^[\s]*[-•*]\s+/,/^[\s]*(const|let|var|function|def|class|if|else|for|while)\s+/i,/^(Let me|I'll|I can|Here's|To |Please|Thanks|Note|import|from)\s+/i,/^[\s]*\/\//,/^[\s]*#/,/^[\s]*"(id|name|email|status|type|value|key|data|message|error|result|code)"\s*:/i,/^\s*\|\s+/,/\|\s*---\s*\|/,/\|\s*\d+[\d,.]*/,/\|\s*[一-龥]+\s*\|/].some(a=>a.test(t))}isTableContent(t){return(t.match(/\|/g)||[]).length>=2||/\|\s*---+\s*\|/.test(t)||/\|\s*\d+[\d,.]*\s*\|/.test(t)}isLoopDetectedForChunk(t,r){if(!this.hasSignificantContent(t))return!1;let a=this.contentStats.get(r);if(!a)return this.contentStats.set(r,[this.lastContentIndex]),!1;if(!this.isActualContentMatch(t,a[0])||(a.push(this.lastContentIndex),a.length<f0t))return!1;let i=a.slice(-f0t),e=(i[i.length-1]-i[0])/(f0t-1),o=Gz*1.5;return this.isTableContent(t)?o=Gz*6:this.isCommonPattern(t)&&(o=Gz*3),e<=o}isActualContentMatch(t,r){return this.streamContentHistory.substring(r,r+Gz)===t}async checkForLoopWithLLM(t){let i=[...this.config.getGeminiClient().getHistory().slice(-vXa),{role:Pr.USER,parts:[{text:`You are a sophisticated AI diagnostic agent specializing in identifying when a conversational AI is stuck in an unproductive state. Your task is to analyze the provided conversation history and determine if the assistant has ceased to make meaningful progress.
|
|
3126
3126
|
|
|
3127
3127
|
An unproductive state is characterized by one or more of the following patterns over the last 5 or more assistant turns:
|
|
3128
3128
|
|
|
@@ -4551,7 +4551,7 @@ The DEEPV.md file already exists with content. You MUST follow these steps:
|
|
|
4551
4551
|
`,t-1),[i,s]=G8a(r);return{line:a===-1?i:n.slice(0,a+1).match(/\n/g).length+i,column:t-a-1+s}}function Emt(n,t,r){if(typeof n!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(t))throw new TypeError("Index parameter should be an integer");if(t<0||t>n.length)throw new RangeError("Index out of bounds");return g8a(n,t,r)}var v8a=n=>`\\u{${n.codePointAt(0).toString(16)}}`,Rmt=class n extends Error{name="JSONError";fileName;#e;#t;#n;#r;#a;constructor(t){if(typeof t=="string")super(),this.#n=t;else{let{jsonParseError:r,fileName:a,input:i}=t;super(void 0,{cause:r}),this.#e=i,this.#t=r,this.fileName=a}Error.captureStackTrace?.(this,n)}get message(){this.#n??=`${N8a(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:t}=this;return`${this.#n}${this.fileName?` in ${this.fileName}`:""}${t?`
|
|
4552
4552
|
|
|
4553
4553
|
${t}
|
|
4554
|
-
`:""}`}set message(t){this.#n=t}#i(t){if(!this.#t)return;let r=this.#e,a=Z8a(r,this.#t.message);if(a)return(0,PJn.codeFrameColumns)(r,{start:a},{highlightCode:t})}get codeFrame(){return this.#r??=this.#i(!0),this.#r}get rawCodeFrame(){return this.#a??=this.#i(!1),this.#a}},Z8a=(n,t)=>{let r=t.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:a,line:i,column:s}=r.groups;return i&&s?{line:Number(i),column:Number(s)}:Emt(n,Number(a),{oneBased:!0})},N8a=n=>n.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(t,r,a)=>`"${a}"(${v8a(a)})`);function wmt(n,t,r){typeof t=="string"&&(r=t,t=void 0);try{return JSON.parse(n,t)}catch(a){throw new Rmt({jsonParseError:a,fileName:r,input:n})}}var M8n=Qt(O8n(),1);import{fileURLToPath as vTa}from"node:url";function U8n(n){return n instanceof URL?vTa(n):n}var ATa=n=>NTa.resolve(U8n(n)??".","package.json"),WTa=(n,t)=>{let r=typeof n=="string"?wmt(n):n;return t&&(0,M8n.default)(r),r};async function z8n({cwd:n,normalize:t=!0}={}){let r=await ZTa.readFile(ATa(n),"utf8");return WTa(r,t)}async function _8n(n){let t=await WJn("package.json",n);if(t)return{packageJson:await z8n({...n,cwd:yTa.dirname(t)}),path:t}}import{fileURLToPath as FTa}from"url";import ETa from"path";var RTa=FTa(import.meta.url),wTa=ETa.dirname(RTa),X4e;async function Kz(){if(X4e)return X4e;let n=await _8n({cwd:wTa});if(n)return X4e=n.packageJson,X4e}async function Mx(){let n=await Kz();return"1.0.
|
|
4554
|
+
`:""}`}set message(t){this.#n=t}#i(t){if(!this.#t)return;let r=this.#e,a=Z8a(r,this.#t.message);if(a)return(0,PJn.codeFrameColumns)(r,{start:a},{highlightCode:t})}get codeFrame(){return this.#r??=this.#i(!0),this.#r}get rawCodeFrame(){return this.#a??=this.#i(!1),this.#a}},Z8a=(n,t)=>{let r=t.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:a,line:i,column:s}=r.groups;return i&&s?{line:Number(i),column:Number(s)}:Emt(n,Number(a),{oneBased:!0})},N8a=n=>n.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(t,r,a)=>`"${a}"(${v8a(a)})`);function wmt(n,t,r){typeof t=="string"&&(r=t,t=void 0);try{return JSON.parse(n,t)}catch(a){throw new Rmt({jsonParseError:a,fileName:r,input:n})}}var M8n=Qt(O8n(),1);import{fileURLToPath as vTa}from"node:url";function U8n(n){return n instanceof URL?vTa(n):n}var ATa=n=>NTa.resolve(U8n(n)??".","package.json"),WTa=(n,t)=>{let r=typeof n=="string"?wmt(n):n;return t&&(0,M8n.default)(r),r};async function z8n({cwd:n,normalize:t=!0}={}){let r=await ZTa.readFile(ATa(n),"utf8");return WTa(r,t)}async function _8n(n){let t=await WJn("package.json",n);if(t)return{packageJson:await z8n({...n,cwd:yTa.dirname(t)}),path:t}}import{fileURLToPath as FTa}from"url";import ETa from"path";var RTa=FTa(import.meta.url),wTa=ETa.dirname(RTa),X4e;async function Kz(){if(X4e)return X4e;let n=await _8n({cwd:wTa});if(n)return X4e=n.packageJson,X4e}async function Mx(){let n=await Kz();return"1.0.304"}Zi();import E6 from"node:process";or();var P8n={name:"about",description:He("command.about.description"),kind:"built-in",action:async n=>{let t=E6.platform,r="no sandbox";E6.env.SANDBOX&&E6.env.SANDBOX!=="sandbox-exec"?r=E6.env.SANDBOX:E6.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${E6.env.SEATBELT_PROFILE||"unknown"})`);let a=n.services.config?.getModel()||"Unknown",i=await Mx(),s=n.services.settings.merged.selectedAuthType||"",e=E6.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:t,sandboxEnv:r,modelVersion:a,selectedAuthType:s,gcpProject:e};n.ui.addItem(o,Date.now())}};Zi();or();var j8n={name:"auth",description:He("command.auth.description"),kind:"built-in",action:(n,t)=>({type:"dialog",dialog:"auth"})};Zi();or();var K8n={name:"clear",description:He("command.clear.description"),kind:"built-in",action:async(n,t)=>{n.ui.setDebugMessage("Clearing terminal screen."),n.ui.clear()}};Zi();or();var q8n={name:"compress",altNames:["summarize"],description:He("command.compress.description"),kind:"built-in",action:async n=>{let{ui:t}=n,r=n.services.config?.getGeminiClient();if(t.pendingItem){t.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){t.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}t.addItem({type:"info",text:He("command.compress.starting")},Date.now());let a={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{t.setPendingItem(a);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?t.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):t.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){t.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{t.setPendingItem(null)}}};Zi();or();ur();mu();var iTn={name:"config",altNames:["settings","preferences"],description:He("command.config.description"),kind:"built-in",action:async(n,t)=>{let{config:r,settings:a}=n.services,i=t.trim().toLowerCase();if(!r||!a)return{type:"message",messageType:"error",content:He("error.config.not.loaded")};if(!i)return{type:"dialog",dialog:"settings-menu"};let[s,...e]=i.split(/\s+/),o=e.join(" ");switch(s){case"theme":case"t":return{type:"dialog",dialog:"theme"};case"editor":case"e":return{type:"dialog",dialog:"editor"};case"model":case"m":return $8n(n,o);case"vim":case"v":return await eTn(n);case"agent-style":case"agent":case"a":return await tTn(n,o);case"yolo":case"y":return nTn(n,o);case"healthy-use":case"healthy":case"h":return rTn(n,o);case"language":case"lang":case"l":return await aTn(n,o);case"help":return CTa(n);default:return{type:"message",messageType:"error",content:jt("command.config.unknown.subcommand",{subcommand:s})+`
|
|
4555
4555
|
|
|
4556
4556
|
`+k4e()}}},subCommands:[{name:"theme",altNames:["t"],description:He("theme.name"),kind:"built-in",action:()=>({type:"dialog",dialog:"theme"})},{name:"editor",altNames:["e"],description:He("command.editor.description"),kind:"built-in",action:()=>({type:"dialog",dialog:"editor"})},{name:"model",altNames:["m"],description:He("model.command.description"),kind:"built-in",action:async(n,t)=>$8n(n,t)},{name:"vim",altNames:["v"],description:He("command.vim.description"),kind:"built-in",action:async n=>eTn(n)},{name:"agent-style",altNames:["agent","a"],description:He("command.agentStyle.description"),kind:"built-in",action:async(n,t)=>tTn(n,t)},{name:"yolo",altNames:["y"],description:He("command.yolo.description"),kind:"built-in",action:(n,t)=>nTn(n,t)},{name:"healthy-use",altNames:["healthy","h"],description:He("command.healthyUse.description"),kind:"built-in",action:(n,t)=>rTn(n,t)},{name:"language",altNames:["lang","l"],description:He("config.menu.language"),kind:"built-in",action:async(n,t)=>aTn(n,t)}],completion:async(n,t)=>["theme","editor","model","vim","agent-style","yolo","healthy-use","language","help","t","e","m","v","a","y","h","l"].filter(a=>a.toLowerCase().startsWith(t.toLowerCase()))};async function CTa(n){let{config:t,settings:r}=n.services;if(!t||!r)return{type:"message",messageType:"error",content:He("error.config.not.loaded")};let a=r.merged.vimMode||!1,i=t.getAgentStyle(),s=t.getApprovalMode(),e=t.getHealthyUseEnabled(),o=r.merged.preferredLanguage||He("config.value.default"),u=I=>{switch(I){case"codex":return"\u26A1";case"cursor":return"\u2197\uFE0F";case"augment":return"\u{1F680}";case"claude-code":return"\u2733\uFE0F";case"antigravity":return"\u{1F308}";case"windsurf":return"\u{1F30A}";default:return"\u{1D4E5}"}};return{type:"message",messageType:"info",content:`\u2699\uFE0F ${He("command.config.description")}
|
|
4557
4557
|
|