@iflow-ai/iflow-cli 0.3.10-beta.0 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bundle/iflow.js +5 -5
  2. package/package.json +1 -1
package/bundle/iflow.js CHANGED
@@ -384,7 +384,7 @@ ${n.authUrl}
384
384
 
385
385
  `);try{(await XA(n.authUrl)).on("error",o=>{throw new Error(`BROWSER_LAUNCH_FAILED: ${L.t("oauth2.errors.browserLaunchFailed")}`)})}catch(i){throw new Error(`BROWSER_LAUNCH_FAILED: ${L.t("oauth2.errors.browserLaunchUnexpectedError",{error:i})}`)}return console.log(L.t("oauth2.messages.waitingForAuthentication")),await n.loginCompletePromise,r}async function UP(t,e){return Zae.has(t)||Zae.set(t,B6i(t,e)),Zae.get(t)}async function N6i(t){let e=await rit(),r=process.env.OAUTH_CALLBACK_HOST||"localhost",n=`http://localhost:${e}/oauth2callback`,i=I6i.randomBytes(32).toString("hex"),o="https://iflow.cn/oauth",s=`${encodeURIComponent(n)}&state=${i}`,a=`${o}?loginMethod=phone&type=phone&redirect=${s}&client_id=${UW}`,c=new Promise((u,d)=>{let f=zar.createServer(async(p,h)=>{try{p.url.indexOf("/oauth2callback")===-1&&(h.writeHead(tit,{Location:War}),h.end(),d(new Error(L.t("oauth2.errors.unexpectedRequest",{url:p.url}))));let m=new T6i.URL(p.url,"http://localhost:3000").searchParams;if(m.get("error"))h.writeHead(tit,{Location:War}),h.end(),d(new Error(L.t("oauth2.errors.authenticationError",{error:m.get("error")})));else if(m.get("state")!==i)h.end("State mismatch. Possible CSRF attack"),d(new Error(L.t("oauth2.errors.stateMismatch")));else if(m.get("code")){let A=await fetch("https://iflow.cn/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Basic ${Buffer.from(`${UW}:${ece}`).toString("base64")}`},body:new URLSearchParams({grant_type:"authorization_code",code:m.get("code"),redirect_uri:n,client_id:UW,client_secret:ece}).toString()});if(!A.ok)throw new Error(L.t("oauth2.errors.tokenRequestFailed",{status:A.status,statusText:A.statusText}));let g=await A.json(),y={access_token:g.access_token,refresh_token:g.refresh_token,expiry_date:Date.now()+g.expires_in*1e3,token_type:g.token_type,scope:g.scope};t.setCredentials(y);let{apiKey:E}=await Zar(g.access_token);E&&(y.apiKey=E,await WI.cacheIFlowApiKey(E)),await Kar(y),h.writeHead(tit,{Location:R6i}),h.end(),u()}else d(new Error(L.t("oauth2.errors.noCodeFound")))}catch(m){d(m)}finally{f.close()}});f.listen(e,r)});return{authUrl:a,loginCompletePromise:c}}function rit(){return new Promise((t,e)=>{let r=0;try{let n=process.env.OAUTH_CALLBACK_PORT;if(n)return r=parseInt(n,10),isNaN(r)||r<=0||r>65535?e(new Error(`Invalid value for OAUTH_CALLBACK_PORT: "${n}"`)):t(r);let i=Yar.createServer();i.listen(0,()=>{r=i.address().port}),i.on("listening",()=>{i.close(),i.unref()}),i.on("error",o=>e(o)),i.on("close",()=>t(r))}catch(n){e(n)}})}async function O6i(t,e){let r=[I1.getOAuthCredsPath()].filter(n=>!!n);for(let n of r)try{let i=await tb.readFile(n,"utf-8");t.setCredentials(JSON.parse(i));let{token:o}=await t.getAccessToken();if(!o)continue;if(e!==Zt.LOGIN_WITH_IFLOW)await t.getTokenInfo(o);else{let s=JSON.parse(i);if(s.expiry_date&&Date.now()>s.expiry_date){console.warn(L.t("oauth2.errors.tokenExpired"));continue}}return!0}catch{}return!1}async function Kar(t){let e=I1.getOAuthCredsPath();await tb.mkdir(D6i.dirname(e),{recursive:!0});let r=JSON.stringify(t,null,2);await tb.writeFile(e,r,{mode:384})}function nit(){Zae.clear()}async function xw(){try{await tb.rm(I1.getOAuthCredsPath(),{force:!0}),await WI.clearCachedIFlowAccount(),await WI.clearCachedIFlowApiKey(),nit()}catch(t){console.error(L.t("oauth2.messages.failedToClearCredentials"),t)}}async function k6i(t){try{let{token:e}=await t.getAccessToken();if(!e)return;let r=await fetch("https://www.googleapis.com/oauth2/v2/userinfo",{headers:{Authorization:`Bearer ${e}`}});if(!r.ok){console.error(L.t("oauth2.messages.failedToFetchUserInfo",{status:r.status,statusText:r.statusText}));return}let n=await r.json();await WI.cacheIFlowAccount(n.email)}catch(e){console.error(L.t("oauth2.messages.errorRetrievingUserInfo"),e)}}async function P6i(t){try{let{token:e}=await t.getAccessToken();if(!e)return;let{apiKey:r}=await Zar(e);if(r){await WI.cacheIFlowApiKey(r);let n=I1.getOAuthCredsPath(),i=await tb.readFile(n,"utf-8"),o=JSON.parse(i);o.apiKey=r,await tb.writeFile(n,JSON.stringify(o,null,2),{mode:384})}}catch(e){console.error(L.t("oauth2.messages.errorRetrievingIflowUserInfo"),e)}}function Jar(){Zae.clear()}async function Xar(){try{let t=I1.getOAuthCredsPath(),e=await tb.readFile(t,"utf-8");return JSON.parse(e).access_token}catch{return}}async function rb(){let t=WI.getCachedIFlowApiKey();if(t)return t;try{let e=I1.getOAuthCredsPath(),r=await tb.readFile(e,"utf-8");return JSON.parse(r).apiKey}catch{return}}async function Zar(t){let r=[1e3,2e3,3e3];for(let n=0;n<3;n++)try{let i=await fetch(`https://iflow.cn/api/oauth/getUserInfo?accessToken=${t}`,{method:"GET"});if(!i.ok){let s=`Failed to fetch iFlow user info: ${i.status} ${i.statusText}`;if((i.status>=500||i.status===408||i.status===429)&&n<2){console.warn(L.t("oauth2.messages.retryingRequest",{errorMessage:s,delay:r[n],attempt:n+1,maxRetries:3})),await new Promise(a=>setTimeout(a,r[n]));continue}return console.error(s),{}}let o=await i.json();if(o.success&&o.data?.apiKey)return{apiKey:o.data.apiKey};continue}catch(i){if(n===2)return console.error(L.t("oauth2.messages.errorAfterAllRetries"),i),{};console.warn(L.t("oauth2.messages.errorWithRetryInfo",{attempt:n+1,maxRetries:3,error:i,delay:r[n]})),await new Promise(s=>setTimeout(s,r[n]))}return{}}async function iit(t){let e=await fetch("https://iflow.cn/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Basic ${Buffer.from(`${UW}:${ece}`).toString("base64")}`},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t,client_id:UW,client_secret:ece}).toString()});if(!e.ok)throw new Error(L.t("oauth2.errors.tokenRefreshFailed",{status:e.status,statusText:e.statusText}));return await e.json()}async function QW(){try{let t=I1.getOAuthCredsPath(),e=await tb.readFile(t,"utf-8"),r=JSON.parse(e);return!!(r.access_token&&r.refresh_token&&r.expiry_date)}catch{return!1}}async function ecr(t={}){let{throwOnExpired:e=!1,silentMode:r=!1}=t;try{let n=I1.getOAuthCredsPath(),i=await tb.readFile(n,"utf-8"),o=JSON.parse(i),s=1440*60*1e3,a=o.expiry_date-Date.now();if(a<0){let c=L.t("oauth2.errors.iflowLoginExpired");if(e)throw new Error(c);return r||console.log(L.t("oauth2.messages.tokenExpiredClearing")),await xw(),{isValid:!1,isExpired:!0,wasRefreshed:!1,error:c}}if(a>0&&a<s){if(!o.refresh_token){let c=L.t("oauth2.errors.tokenExpiresWarningSoon");if(e)throw new Error(c);return r||console.log(L.t("oauth2.messages.tokenExpiresSoonClearing")),await xw(),{isValid:!1,isExpired:!1,wasRefreshed:!1,error:c}}try{let c=await iit(o.refresh_token),u={...o,access_token:c.access_token,refresh_token:c.refresh_token,expiry_date:Date.now()+c.expires_in*1e3,token_type:c.token_type,scope:c.scope};return await tb.writeFile(n,JSON.stringify(u,null,2),{mode:384}),r||console.log(L.t("oauth2.messages.tokenRefreshedSuccessfully")),{isValid:!0,isExpired:!1,wasRefreshed:!0}}catch(c){let u="Token refresh failed";if(e)throw c instanceof Error&&(c.message.includes("expired")||c.message.includes("refresh"))?new Error(L.t("oauth2.errors.iflowLoginExpired")):c;return r||console.log(L.t("oauth2.messages.tokenRefreshFailedClearing")),await xw(),{isValid:!1,isExpired:!1,wasRefreshed:!1,error:u}}}return{isValid:!0,isExpired:!1,wasRefreshed:!1}}catch(n){if(e)throw n;return{isValid:!0,isExpired:!1,wasRefreshed:!1}}}async function vCe(){await ecr({throwOnExpired:!0,silentMode:!1})}async function CCe(){return(await ecr({throwOnExpired:!1,silentMode:!0})).isValid}var jar,WI,UW,ece,tit,R6i,War,Zae,jI=Z(()=>{"use strict";jar=Ne(Wae(),1);$I();bar();jv();fCe();di();WI=new pCe,UW="10009311001",ece="4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",tit=301,R6i="https://iflow.cn/oauth/success",War="https://iflow.cn/oauth/error",Zae=new Map});var sit,qy,ait,cit=Z(()=>{"use strict";(function(t){t.DASHER_USER="DASHER_USER",t.INELIGIBLE_ACCOUNT="INELIGIBLE_ACCOUNT",t.NON_USER_ACCOUNT="NON_USER_ACCOUNT",t.RESTRICTED_AGE="RESTRICTED_AGE",t.RESTRICTED_NETWORK="RESTRICTED_NETWORK",t.UNKNOWN="UNKNOWN",t.UNKNOWN_LOCATION="UNKNOWN_LOCATION",t.UNSUPPORTED_LOCATION="UNSUPPORTED_LOCATION"})(sit||(sit={}));(function(t){t.FREE="free-tier",t.LEGACY="legacy-tier",t.STANDARD="standard-tier"})(qy||(qy={}));(function(t){t.Default="DEFAULT",t.Notice="NOTICE",t.Warning="WARNING",t.Error="ERROR"})(ait||(ait={}))});function tcr(t){return{request:{model:"models/"+t.model,contents:ncr(t.contents)}}}function rcr(t){return{totalTokens:t.totalTokens}}function uit(t,e,r,n){return{model:t.model,project:r,user_prompt_id:e,request:M6i(t,n)}}function dit(t){let e=t.response,r=new eb;return r.candidates=e.candidates,r.automaticFunctionCallingHistory=e.automaticFunctionCallingHistory,r.promptFeedback=e.promptFeedback,r.usageMetadata=e.usageMetadata,r}function M6i(t,e){return{contents:ncr(t.contents),systemInstruction:L6i(t.config?.systemInstruction),cachedContent:t.config?.cachedContent,tools:t.config?.tools,toolConfig:t.config?.toolConfig,labels:t.config?.labels,safetySettings:t.config?.safetySettings,generationConfig:Q6i(t.config),session_id:e}}function ncr(t){return Array.isArray(t)?t.map(lit):[lit(t)]}function L6i(t){if(t)return lit(t)}function lit(t){return Array.isArray(t)?{role:"user",parts:F6i(t)}:typeof t=="string"?{role:"user",parts:[{text:t}]}:"parts"in t?t:{role:"user",parts:[t]}}function F6i(t){return t.map(U6i)}function U6i(t){return typeof t=="string"?{text:t}:t}function Q6i(t){if(t)return{temperature:t.temperature,topP:t.topP,topK:t.topK,candidateCount:t.candidateCount,maxOutputTokens:t.maxOutputTokens,stopSequences:t.stopSequences,responseLogprobs:t.responseLogprobs,logprobs:t.logprobs,presencePenalty:t.presencePenalty,frequencyPenalty:t.frequencyPenalty,seed:t.seed,responseMimeType:t.responseMimeType,responseSchema:t.responseSchema,routingConfig:t.routingConfig,modelSelectionConfig:t.modelSelectionConfig,responseModalities:t.responseModalities,mediaResolution:t.mediaResolution,speechConfig:t.speechConfig,audioTimestamp:t.audioTimestamp,thinkingConfig:t.thinkingConfig}}var icr=Z(()=>{"use strict";ul();});import*as ocr from"readline";var scr,acr,ww,bCe=Z(()=>{"use strict";icr();scr="https://cloudcode-pa.googleapis.com",acr="v1internal",ww=class{client;projectId;httpOptions;sessionId;userTier;constructor(e,r,n={},i,o){this.client=e,this.projectId=r,this.httpOptions=n,this.sessionId=i,this.userTier=o}async generateContentStream(e,r){let n=await this.requestStreamingPost("streamGenerateContent",uit(e,r,this.projectId,this.sessionId),e.config?.abortSignal);return(async function*(){for await(let i of n)yield dit(i)})()}async generateContent(e,r){let n=await this.requestPost("generateContent",uit(e,r,this.projectId,this.sessionId),e.config?.abortSignal);return dit(n)}async onboardUser(e){return await this.requestPost("onboardUser",e)}async loadCodeAssist(e){return await this.requestPost("loadCodeAssist",e)}async getCodeAssistGlobalUserSetting(){return await this.requestGet("getCodeAssistGlobalUserSetting")}async setCodeAssistGlobalUserSetting(e){return await this.requestPost("setCodeAssistGlobalUserSetting",e)}async countTokens(e,r){let n=await this.requestPost("countTokens",tcr(e));return rcr(n)}async embedContent(e){throw Error()}async requestPost(e,r,n){return(await this.client.request({url:this.getMethodUrl(e),method:"POST",headers:{"Content-Type":"application/json",...this.httpOptions.headers},responseType:"json",body:JSON.stringify(r),signal:n})).data}async requestGet(e,r){return(await this.client.request({url:this.getMethodUrl(e),method:"GET",headers:{"Content-Type":"application/json",...this.httpOptions.headers},responseType:"json",signal:r})).data}async requestStreamingPost(e,r,n){let i=await this.client.request({url:this.getMethodUrl(e),method:"POST",params:{alt:"sse"},headers:{"Content-Type":"application/json",...this.httpOptions.headers},responseType:"stream",body:JSON.stringify(r),signal:n});return(async function*(){let o=ocr.createInterface({input:i.data,crlfDelay:1/0}),s=[];for await(let a of o)if(a===""){if(s.length===0)continue;yield JSON.parse(s.join(`
386
386
  `)),s=[]}else if(a.startsWith("data: "))s.push(a.slice(6).trim());else throw new Error(`Unexpected line format in response: ${a}`)})()}getMethodUrl(e){return`${process.env.CODE_ASSIST_ENDPOINT??scr}/${acr}:${e}`}}});async function ccr(t){let e=process.env.GOOGLE_CLOUD_PROJECT||void 0,r=new ww(t,e,{},"",void 0),n={ideType:"IDE_UNSPECIFIED",platform:"PLATFORM_UNSPECIFIED",pluginType:"IFLOW",duetProject:e},i=await r.loadCodeAssist({cloudaicompanionProject:e,metadata:n});!e&&i.cloudaicompanionProject&&(e=i.cloudaicompanionProject);let o=q6i(i);if(o.userDefinedCloudaicompanionProject&&!e)throw new fit;let s={tierId:o.id,cloudaicompanionProject:e,metadata:n},a=await r.onboardUser(s);for(;!a.done;)await new Promise(c=>setTimeout(c,5e3)),a=await r.onboardUser(s);return{projectId:a.response?.cloudaicompanionProject?.id||"",userTier:o.id}}function q6i(t){if(t.currentTier)return t.currentTier;for(let e of t.allowedTiers||[])if(e.isDefault)return e;return{name:"",description:"",id:qy.LEGACY,userDefinedCloudaicompanionProject:!0}}var fit,lcr=Z(()=>{"use strict";cit();bCe();fit=class extends Error{constructor(){super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://goo.gle/iflow-cli-auth-docs#workspace-gca")}}});function H6i(t){qW={...qW,...t}}function G6i(){return qW}async function ucr(t){try{let{event_name:e,payload:r}=t,n={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)},i=await fetch(`${qW.endpoint}/${e}`,n);return i.ok?{success:!0}:{success:!1,error:`upload failed: ${i.status} ${i.statusText}`}}catch(e){return{success:!1,error:`Failed to upload data to ${qW.endpoint}: ${e instanceof Error?e.message:String(e)}`}}}async function tce(t,e){return V6i.record(t,e)}var qW,_Ce,V6i,pit=Z(()=>{"use strict";qW={endpoint:"https://gm.mmstat.com"};_Ce=class{async record(e,r){return await ucr({event_name:e,payload:r})}},V6i=new _Ce});import{randomUUID as $6i}from"crypto";function W6i(){function t(a,c){return Math.floor(Math.random()*(c-a+1))+a}var e,r,n,i=[{first:[1,9],second:[0,255],third:[0,255],fourth:[1,254]},{first:[11,126],second:[0,255],third:[0,255],fourth:[1,254]},{first:[128,169],second:[0,253],third:[0,255],fourth:[1,254]},{first:[169,169],second:[255,255],third:[0,255],fourth:[1,254]},{first:[170,172],second:[0,15],third:[0,255],fourth:[1,254]},{first:[172,172],second:[32,255],third:[0,255],fourth:[1,254]},{first:[173,192],second:[0,167],third:[0,255],fourth:[1,254]},{first:[192,192],second:[169,255],third:[0,255],fourth:[1,254]},{first:[193,223],second:[0,255],third:[0,255],fourth:[1,254]}],o=i[Math.floor(Math.random()*i.length)],s=t(o.first[0],o.first[1]);return e=s===169?o.second[0]===255?255:t(o.second[0],o.second[1]):s===172?o.second[0]===32?t(32,255):t(o.second[0],o.second[1]):s===192&&o.second[0]===169?t(169,255):t(o.second[0],o.second[1]),r=t(o.third[0],o.third[1]),n=t(o.fourth[0],o.fourth[1]),[s,e,r,n].join(".")}function j6i(t){for(var e=t.split("."),r="",n=0;n<e.length;n++){var i=e[n],o=parseInt(i).toString(16);r+=o.length===1?"0"+o:o}return r}function z6i(){return new Date().getTime()}function Y6i(){var t=9e3,e=1e3,r=e,n=W6i(),i=z6i(),o=j6i(n),s="d",a="51fc",c=o+i+r+s+a;return r++,r>t&&(r=e),c}function K6i(t){for(var e=new Array(t),r="0123456789abcdef",n=0;n<t;n++)e[n]===void 0&&(e[n]=r[Math.floor(Math.random()*r.length)]);return e.join("")}function SCe(){return Y6i()+"00"}function HW(){return K6i(16)}function xCe(){return $6i()}function dcr(t,e){return`00-${t}-${e}-00`}var hit=Z(()=>{"use strict"});var wCe,QP,TCe=Z(()=>{"use strict";pit();hit();wCe=class{currentSession=null;async startSession(e,r,n,i){let{model:o,tool:s}=i||{},a="iflow",c="cli",u=SCe(),d=HW(),f=`${a}.${c}.${n}.${u}`,p=dcr(u,d),h=Date.now();this.currentSession={traceId:u,parent_observation_id:d,conversationId:n,sessionId:e,userId:r,pid:a,sceneId:c,sam:f,traceparent:p,startTime:h,model:o,tool:s};let m={gmkey:"AI",gokey:this.stringifyGokey({pid:a,sam:f,trace_id:u,observation_id:d,model:o,tool:s,sessionId:e,user_id:r})};return await tce("/aitrack.lifecycle.run_started",m),this.currentSession}async endSession(){if(!this.currentSession)return;let{pid:e,sam:r,traceId:n,startTime:i,parent_observation_id:o,model:s,tool:a,sessionId:c,userId:u}=this.currentSession,d=Date.now()-i,f=HW(),p={gmkey:"AI",gokey:this.stringifyGokey({pid:e,sam:r,trace_id:n,observation_id:f,parent_observation_id:o,duration:d,model:s,tool:a,sessionId:c,user_id:u})};await tce("/aitrack.lifecycle.run_finished",p),this.currentSession=null}async recordError(e){if(!this.currentSession)throw new Error("No active session to record error");let{pid:r,sam:n,traceId:i,startTime:o,parent_observation_id:s,model:a,tool:c,sessionId:u,userId:d}=this.currentSession,f=HW(),p="",h="";e instanceof Error?(p=e.cause?`${e.message}:${e.cause.message}`:e.message,h=e.cause?e.cause.stack:e.stack):p=String(e);let m={gmkey:"AI",gokey:this.stringifyGokey({pid:r,sam:n,trace_id:i,observation_id:f,parent_observation_id:s,error_msg:`${p}
387
- ${h.slice(0,500)}`,model:a,tool:c,sessionId:u,cliVer:"0.3.10-beta.0",user_id:d})};await tce("/aitrack.lifecycle.run_error",m)}getCurrentSession(){return this.currentSession}stringifyGokey(e){return Object.entries(e).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(String(n))}`).join("&")}},QP=new wCe});import M_,{dirname as J6i,join as X6i}from"node:path";import ICe from"os";import*as fcr from"crypto";import{fileURLToPath as Z6i}from"node:url";function L_(t){let e=ICe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Yc(t,e=35){if(t.length<=e)return t;let n=M_.parse(t).root,i=M_.sep,s=t.substring(n.length).split(i).filter(h=>h!=="");if(s.length<=1){let h=Math.floor((e-3)/2);if(h<=0)return t.substring(0,e-3)+"...";let m=t.substring(0,h),A=t.substring(t.length-h);return`${m}...${A}`}let a=s[0],c=s[s.length-1],u=n+a,d=[],f=i.length+c.length;for(let h=s.length-2;h>=0;h--){let m=s[h],A=f+i.length+m.length;if(A<=e)d.unshift(m),f=A;else break}let p=d.join(i)+i+c;return f>e?p:(p=u+i+p,p.length>e?"..."+p.substring(p.length-e-3):p)}function Ld(t,e){let r=M_.resolve(t),n=M_.resolve(e);return M_.relative(n,r)||"."}function rce(t){let e="";for(let r=0;r<t.length;r++)t[r]===" "&&(r===0||t[r-1]!=="\\")?e+="\\ ":e+=t[r];return e}function qP(t){return t.replace(/\\ /g," ")}function DCe(t){return fcr.createHash("sha256").update(t).digest("hex")}function D1(t){let e=DCe(t);return M_.join(ICe.homedir(),Mm,eCi,e)}function RCe(){return M_.join(ICe.homedir(),Mm,pcr)}function BCe(t){return M_.join(t,Mm,pcr)}function NCe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=J6i(Z6i(import.meta.url));return X6i(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)}function nce(t,e){let n=ICe.platform()==="win32"?M_.win32:M_,i=n.relative(t,e);return!i.startsWith(`..${n.sep}`)&&i!==".."&&!n.isAbsolute(i)}var Mm,mit,eCi,pcr,ff=Z(()=>{"use strict";Mm=".iflow",mit="google_accounts.json",eCi="tmp",pcr="commands"});import*as hcr from"os";import*as Tw from"fs";import*as yit from"path";import{randomUUID as tCi}from"crypto";function nCi(){Tw.existsSync(git)||Tw.mkdirSync(git,{recursive:!0})}function iCi(){return Tw.existsSync(Ait)&&Tw.readFileSync(Ait,"utf-8").trim()||null}function oCi(t){Tw.writeFileSync(Ait,t,"utf-8")}function OCe(){try{nCi();let t=iCi();return t||(t=tCi(),oCi(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var rCi,git,Ait,Eit=Z(()=>{"use strict";ff();rCi=hcr.homedir()??"",git=yit.join(rCi,Mm),Ait=yit.join(git,"installation_id")});var mcr=T((Zna,sCi)=>{sCi.exports={name:"systeminformation",version:"5.27.10",description:"Advanced, lightweight system and OS information library",license:"MIT",author:"Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",homepage:"https://systeminformation.io",main:"./lib/index.js",type:"commonjs",bin:{systeminformation:"lib/cli.js"},types:"./lib/index.d.ts",scripts:{test:"node ./test/test.js",testDeno:"deno run -A ./test/test.js"},files:["lib/"],keywords:["system information","sysinfo","monitor","monitoring","os","linux","osx","windows","freebsd","openbsd","netbsd","cpu","cpuload","physical cores","logical cores","processor","cores","threads","socket type","memory","file system","fsstats","diskio","block devices","netstats","network","network interfaces","network connections","network stats","iface","printer","processes","users","internet","battery","docker","docker stats","docker processes","graphics","graphic card","graphic controller","gpu","display","smart","disk layout","usb","audio","bluetooth","wifi","wifinetworks","virtual box","virtualbox","vm","backend","hardware","BIOS","chassis"],repository:{type:"git",url:"https://github.com/sebhildebrandt/systeminformation.git"},funding:{type:"Buy me a coffee",url:"https://www.buymeacoffee.com/systeminfo"},os:["darwin","linux","win32","freebsd","openbsd","netbsd","sunos","android"],engines:{node:">=8.0.0"}}});var ih=T(ki=>{"use strict";var VW=ve("os"),ob=ve("fs"),aCi=ve("path"),wit=ve("child_process").spawn,cCi=ve("child_process").exec,$W=ve("child_process").execSync,lCi=ve("util"),GP=process.platform,Tit=GP==="linux"||GP==="android",ycr=GP==="darwin",LCe=GP==="win32",Ecr=GP==="freebsd",vcr=GP==="openbsd",Ccr=GP==="netbsd",vit=0,HP="",nb="",zI=null,ib=null,Iit=process.env.WINDIR||"C:\\Windows",qh,GW="",ice=[],Dit=!1,PCe="",uCi="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",bit="--###START###--",gcr="--ERROR--",MCe="--###ENDCMD###--",_it="--##ID##--",oce={windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},FCe={maxBuffer:1024*2e4,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function dCi(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function fCi(t){let e=!1,r="",n="";for(let i of t)i>="0"&&i<="9"||e?(e=!0,r+=i):n+=i;return[n,r]}var kCe=new String,Sit=new String().replace,xit=new String().toLowerCase,bcr=new String().toString,_cr=new String().substr,Scr=new String().substring,xcr=new String().trim,wcr=new String().startsWith,Tcr=Math.min;function pCi(t){return t&&{}.toString.call(t)==="[object Function]"}function hCi(t){let e=[],r={};for(let n=0;n<t.length;n++){let i=Object.keys(t[n]);i.sort(function(s,a){return s-a});let o="";for(let s=0;s<i.length;s++)o+=JSON.stringify(i[s]),o+=JSON.stringify(t[n][i[s]]);({}).hasOwnProperty.call(r,o)||(e.push(t[n]),r[o]=!0)}return e}function mCi(t,e){return t.sort(function(r,n){let i="",o="";return e.forEach(function(s){i=i+r[s],o=o+n[s]}),i<o?-1:i>o?1:0})}function gCi(){return vit===0&&(vit=VW.cpus().length),vit}function YI(t,e,r,n,i){r=r||":",e=e.toLowerCase(),n=n||!1,i=i||!1;let o="";return t.some(s=>{let a=s.toLowerCase().replace(/\t/g,"");if(n&&(a=a.trim()),a.startsWith(e)&&(!i||a.match(e+r)||a.match(e+" "+r))){let c=n?s.trim().split(r):s.split(r);if(c.length>=2)return c.shift(),o=c.join(r).trim(),!0}}),o}function ACi(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function yCi(t){let e="",r=0;return t.split("").forEach(n=>{n>="0"&&n<="9"?r===1&&r++:(r===0&&r++,r===1&&(e+=n))}),e}function ECi(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,i=yCi(t),o=t.split(i);if(o.length>=2){o[2]&&(o[1]+=o[2]);let s=o[1]&&o[1].toLowerCase().indexOf("pm")>-1||o[1].toLowerCase().indexOf("p.m.")>-1||o[1].toLowerCase().indexOf("p. m.")>-1||o[1].toLowerCase().indexOf("n")>-1||o[1].toLowerCase().indexOf("ch")>-1||o[1].toLowerCase().indexOf("\xF6s")>-1||e&&o[1].toLowerCase().indexOf(e)>-1;return r=parseInt(o[0],10),n=parseInt(o[1],10),r=s&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function vCi(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),i=e.pmDesignator||"",o=t.split(" ");if(o[0]){if(o[0].indexOf("/")>=0){let s=o[0].split("/");s.length===3&&(s[0].length===4?r.date=s[0]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[2]).substr(-2):s[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2)):(t.toLowerCase().indexOf("pm")>-1||t.toLowerCase().indexOf("p.m.")>-1||t.toLowerCase().indexOf("p. m.")>-1||t.toLowerCase().indexOf("am")>-1||t.toLowerCase().indexOf("a.m.")>-1||t.toLowerCase().indexOf("a. m.")>-1||n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1)&&n.indexOf("dd/")!==0?r.date=s[2]+"-"+("0"+s[0]).substr(-2)+"-"+("0"+s[1]).substr(-2):r.date=s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2))}if(o[0].indexOf(".")>=0){let s=o[0].split(".");s.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=s[2]+"-"+("0"+s[0]).substr(-2)+"-"+("0"+s[1]).substr(-2):r.date=s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2))}if(o[0].indexOf("-")>=0){let s=o[0].split("-");s.length===3&&(r.date=s[0]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[2]).substr(-2))}}if(o[1]){o.shift();let s=o.join(" ");r.time=ECi(s,i)}return r}function CCi(t,e){let r=e>0,n=1,i=0,o=0,s=[];for(let c=0;c<t.length;c++)n<=e?(/\s/.test(t[c])&&!r&&(o=c-1,s.push({from:i,to:o+1,cap:t.substring(i,o+1)}),i=o+2,n++),r=t[c]===" "):(!/\s/.test(t[c])&&r&&(o=c-1,i<o&&s.push({from:i,to:o,cap:t.substring(i,o)}),i=o+1,n++),r=t[c]===" ");o=5e3,s.push({from:i,to:o,cap:t.substring(i,o)});let a=s.length;for(let c=0;c<a;c++)s[c].cap.replace(/\s/g,"").length===0&&c+1<a&&(s[c].to=s[c+1].to,s[c].cap=s[c].cap+s[c+1].cap,s.splice(c+1,1),a=a-1);return s}function bCi(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function _Ci(){if(PCe="powershell.exe",LCe){let t=`${Iit}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;ob.existsSync(t)&&(PCe=t)}}function Icr(){if(VW.type()==="Windows_NT"&&!HP&&(HP=Iit+"\\system32\\wbem\\wmic.exe",!ob.existsSync(HP)))try{let t=$W("WHERE WMIC",oce).toString().split(`\r
387
+ ${h.slice(0,500)}`,model:a,tool:c,sessionId:u,cliVer:"0.3.10",user_id:d})};await tce("/aitrack.lifecycle.run_error",m)}getCurrentSession(){return this.currentSession}stringifyGokey(e){return Object.entries(e).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(String(n))}`).join("&")}},QP=new wCe});import M_,{dirname as J6i,join as X6i}from"node:path";import ICe from"os";import*as fcr from"crypto";import{fileURLToPath as Z6i}from"node:url";function L_(t){let e=ICe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Yc(t,e=35){if(t.length<=e)return t;let n=M_.parse(t).root,i=M_.sep,s=t.substring(n.length).split(i).filter(h=>h!=="");if(s.length<=1){let h=Math.floor((e-3)/2);if(h<=0)return t.substring(0,e-3)+"...";let m=t.substring(0,h),A=t.substring(t.length-h);return`${m}...${A}`}let a=s[0],c=s[s.length-1],u=n+a,d=[],f=i.length+c.length;for(let h=s.length-2;h>=0;h--){let m=s[h],A=f+i.length+m.length;if(A<=e)d.unshift(m),f=A;else break}let p=d.join(i)+i+c;return f>e?p:(p=u+i+p,p.length>e?"..."+p.substring(p.length-e-3):p)}function Ld(t,e){let r=M_.resolve(t),n=M_.resolve(e);return M_.relative(n,r)||"."}function rce(t){let e="";for(let r=0;r<t.length;r++)t[r]===" "&&(r===0||t[r-1]!=="\\")?e+="\\ ":e+=t[r];return e}function qP(t){return t.replace(/\\ /g," ")}function DCe(t){return fcr.createHash("sha256").update(t).digest("hex")}function D1(t){let e=DCe(t);return M_.join(ICe.homedir(),Mm,eCi,e)}function RCe(){return M_.join(ICe.homedir(),Mm,pcr)}function BCe(t){return M_.join(t,Mm,pcr)}function NCe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=J6i(Z6i(import.meta.url));return X6i(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)}function nce(t,e){let n=ICe.platform()==="win32"?M_.win32:M_,i=n.relative(t,e);return!i.startsWith(`..${n.sep}`)&&i!==".."&&!n.isAbsolute(i)}var Mm,mit,eCi,pcr,ff=Z(()=>{"use strict";Mm=".iflow",mit="google_accounts.json",eCi="tmp",pcr="commands"});import*as hcr from"os";import*as Tw from"fs";import*as yit from"path";import{randomUUID as tCi}from"crypto";function nCi(){Tw.existsSync(git)||Tw.mkdirSync(git,{recursive:!0})}function iCi(){return Tw.existsSync(Ait)&&Tw.readFileSync(Ait,"utf-8").trim()||null}function oCi(t){Tw.writeFileSync(Ait,t,"utf-8")}function OCe(){try{nCi();let t=iCi();return t||(t=tCi(),oCi(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var rCi,git,Ait,Eit=Z(()=>{"use strict";ff();rCi=hcr.homedir()??"",git=yit.join(rCi,Mm),Ait=yit.join(git,"installation_id")});var mcr=T((Zna,sCi)=>{sCi.exports={name:"systeminformation",version:"5.27.10",description:"Advanced, lightweight system and OS information library",license:"MIT",author:"Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",homepage:"https://systeminformation.io",main:"./lib/index.js",type:"commonjs",bin:{systeminformation:"lib/cli.js"},types:"./lib/index.d.ts",scripts:{test:"node ./test/test.js",testDeno:"deno run -A ./test/test.js"},files:["lib/"],keywords:["system information","sysinfo","monitor","monitoring","os","linux","osx","windows","freebsd","openbsd","netbsd","cpu","cpuload","physical cores","logical cores","processor","cores","threads","socket type","memory","file system","fsstats","diskio","block devices","netstats","network","network interfaces","network connections","network stats","iface","printer","processes","users","internet","battery","docker","docker stats","docker processes","graphics","graphic card","graphic controller","gpu","display","smart","disk layout","usb","audio","bluetooth","wifi","wifinetworks","virtual box","virtualbox","vm","backend","hardware","BIOS","chassis"],repository:{type:"git",url:"https://github.com/sebhildebrandt/systeminformation.git"},funding:{type:"Buy me a coffee",url:"https://www.buymeacoffee.com/systeminfo"},os:["darwin","linux","win32","freebsd","openbsd","netbsd","sunos","android"],engines:{node:">=8.0.0"}}});var ih=T(ki=>{"use strict";var VW=ve("os"),ob=ve("fs"),aCi=ve("path"),wit=ve("child_process").spawn,cCi=ve("child_process").exec,$W=ve("child_process").execSync,lCi=ve("util"),GP=process.platform,Tit=GP==="linux"||GP==="android",ycr=GP==="darwin",LCe=GP==="win32",Ecr=GP==="freebsd",vcr=GP==="openbsd",Ccr=GP==="netbsd",vit=0,HP="",nb="",zI=null,ib=null,Iit=process.env.WINDIR||"C:\\Windows",qh,GW="",ice=[],Dit=!1,PCe="",uCi="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",bit="--###START###--",gcr="--ERROR--",MCe="--###ENDCMD###--",_it="--##ID##--",oce={windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},FCe={maxBuffer:1024*2e4,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function dCi(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function fCi(t){let e=!1,r="",n="";for(let i of t)i>="0"&&i<="9"||e?(e=!0,r+=i):n+=i;return[n,r]}var kCe=new String,Sit=new String().replace,xit=new String().toLowerCase,bcr=new String().toString,_cr=new String().substr,Scr=new String().substring,xcr=new String().trim,wcr=new String().startsWith,Tcr=Math.min;function pCi(t){return t&&{}.toString.call(t)==="[object Function]"}function hCi(t){let e=[],r={};for(let n=0;n<t.length;n++){let i=Object.keys(t[n]);i.sort(function(s,a){return s-a});let o="";for(let s=0;s<i.length;s++)o+=JSON.stringify(i[s]),o+=JSON.stringify(t[n][i[s]]);({}).hasOwnProperty.call(r,o)||(e.push(t[n]),r[o]=!0)}return e}function mCi(t,e){return t.sort(function(r,n){let i="",o="";return e.forEach(function(s){i=i+r[s],o=o+n[s]}),i<o?-1:i>o?1:0})}function gCi(){return vit===0&&(vit=VW.cpus().length),vit}function YI(t,e,r,n,i){r=r||":",e=e.toLowerCase(),n=n||!1,i=i||!1;let o="";return t.some(s=>{let a=s.toLowerCase().replace(/\t/g,"");if(n&&(a=a.trim()),a.startsWith(e)&&(!i||a.match(e+r)||a.match(e+" "+r))){let c=n?s.trim().split(r):s.split(r);if(c.length>=2)return c.shift(),o=c.join(r).trim(),!0}}),o}function ACi(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function yCi(t){let e="",r=0;return t.split("").forEach(n=>{n>="0"&&n<="9"?r===1&&r++:(r===0&&r++,r===1&&(e+=n))}),e}function ECi(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,i=yCi(t),o=t.split(i);if(o.length>=2){o[2]&&(o[1]+=o[2]);let s=o[1]&&o[1].toLowerCase().indexOf("pm")>-1||o[1].toLowerCase().indexOf("p.m.")>-1||o[1].toLowerCase().indexOf("p. m.")>-1||o[1].toLowerCase().indexOf("n")>-1||o[1].toLowerCase().indexOf("ch")>-1||o[1].toLowerCase().indexOf("\xF6s")>-1||e&&o[1].toLowerCase().indexOf(e)>-1;return r=parseInt(o[0],10),n=parseInt(o[1],10),r=s&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function vCi(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),i=e.pmDesignator||"",o=t.split(" ");if(o[0]){if(o[0].indexOf("/")>=0){let s=o[0].split("/");s.length===3&&(s[0].length===4?r.date=s[0]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[2]).substr(-2):s[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2)):(t.toLowerCase().indexOf("pm")>-1||t.toLowerCase().indexOf("p.m.")>-1||t.toLowerCase().indexOf("p. m.")>-1||t.toLowerCase().indexOf("am")>-1||t.toLowerCase().indexOf("a.m.")>-1||t.toLowerCase().indexOf("a. m.")>-1||n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1)&&n.indexOf("dd/")!==0?r.date=s[2]+"-"+("0"+s[0]).substr(-2)+"-"+("0"+s[1]).substr(-2):r.date=s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2))}if(o[0].indexOf(".")>=0){let s=o[0].split(".");s.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=s[2]+"-"+("0"+s[0]).substr(-2)+"-"+("0"+s[1]).substr(-2):r.date=s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2))}if(o[0].indexOf("-")>=0){let s=o[0].split("-");s.length===3&&(r.date=s[0]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[2]).substr(-2))}}if(o[1]){o.shift();let s=o.join(" ");r.time=ECi(s,i)}return r}function CCi(t,e){let r=e>0,n=1,i=0,o=0,s=[];for(let c=0;c<t.length;c++)n<=e?(/\s/.test(t[c])&&!r&&(o=c-1,s.push({from:i,to:o+1,cap:t.substring(i,o+1)}),i=o+2,n++),r=t[c]===" "):(!/\s/.test(t[c])&&r&&(o=c-1,i<o&&s.push({from:i,to:o,cap:t.substring(i,o)}),i=o+1,n++),r=t[c]===" ");o=5e3,s.push({from:i,to:o,cap:t.substring(i,o)});let a=s.length;for(let c=0;c<a;c++)s[c].cap.replace(/\s/g,"").length===0&&c+1<a&&(s[c].to=s[c+1].to,s[c].cap=s[c].cap+s[c+1].cap,s.splice(c+1,1),a=a-1);return s}function bCi(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function _Ci(){if(PCe="powershell.exe",LCe){let t=`${Iit}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;ob.existsSync(t)&&(PCe=t)}}function Icr(){if(VW.type()==="Windows_NT"&&!HP&&(HP=Iit+"\\system32\\wbem\\wmic.exe",!ob.existsSync(HP)))try{let t=$W("WHERE WMIC",oce).toString().split(`\r
388
388
  `);t&&t.length?HP=t[0]:HP="wmic"}catch{HP="wmic"}return HP}function SCi(t){return new Promise(e=>{process.nextTick(()=>{try{Dcr(Icr()+" "+t).then(r=>{e(r,"")})}catch(r){e("",r)}})})}function xCi(){return LCe?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function Cit(t){let e="",r,n="";if(t.indexOf(bit)>=0){r=t.split(bit);let o=r[1].split(_it);e=o[0],o.length>1&&(t=o.slice(1).join(_it))}t.indexOf(MCe)>=0&&(r=t.split(MCe),n=r[0]);let i=-1;for(let o=0;o<ice.length;o++)ice[o].id===e&&(i=o,ice[o].callback(n));i>=0&&ice.splice(i,1)}function wCi(){qh||(qh=wit(PCe,["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})}),qh&&qh.pid&&(Dit=!0,qh.stdout.on("data",function(t){GW=GW+t.toString("utf8"),t.indexOf(MCe)>=0&&(Cit(GW),GW="")}),qh.stderr.on("data",function(){Cit(GW+gcr)}),qh.on("error",function(){Cit(GW+gcr)}),qh.on("close",function(){qh&&qh.kill()})))}function TCi(){try{qh&&(qh.stdin.write("exit"+VW.EOL),qh.stdin.end(),Dit=!1)}catch{qh&&qh.kill()}qh=null}function Dcr(t){if(Dit){let e=Math.random().toString(36).substring(2,12);return new Promise(r=>{process.nextTick(()=>{function n(i){r(i)}ice.push({id:e,cmd:t,callback:n,start:new Date});try{qh&&qh.pid&&qh.stdin.write(uCi+"echo "+bit+e+_it+"; "+VW.EOL+t+VW.EOL+"echo "+MCe+VW.EOL)}catch{r("")}})})}else{let e="";return new Promise(r=>{process.nextTick(()=>{try{let n=wit(PCe,["-NoProfile","-NoLogo","-InputFormat","Text","-ExecutionPolicy","Unrestricted","-Command",t],{stdio:"pipe",windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})});n&&!n.pid&&n.on("error",function(){r(e)}),n&&n.pid?(n.stdout.on("data",function(i){e=e+i.toString("utf8")}),n.stderr.on("data",function(){n.kill(),r(e)}),n.on("close",function(){n.kill(),r(e)}),n.on("error",function(){n.kill(),r(e)})):r(e)}catch{r(e)}})})}}function ICi(t,e,r){let n="";return r=r||{},new Promise(i=>{process.nextTick(()=>{try{let o=wit(t,e,r);o&&!o.pid&&o.on("error",function(){i(n)}),o&&o.pid?(o.stdout.on("data",function(s){n+=s.toString()}),o.on("close",function(){o.kill(),i(n)}),o.on("error",function(){o.kill(),i(n)})):i(n)}catch{i(n)}})})}function DCi(){if(LCe){if(!nb)try{let r=$W("chcp",oce).toString().split(`\r
389
389
  `)[0].split(":");nb=r.length>1?r[1].replace(".","").trim():""}catch{nb="437"}return nb}if(Tit||ycr||Ecr||vcr||Ccr){if(!nb)try{let r=$W("echo $LANG",FCe).toString().split(`\r
390
390
  `)[0].split(".");nb=r.length>1?r[1].trim():"",nb||(nb="UTF-8")}catch{nb="UTF-8"}return nb}}function RCi(){if(zI!==null)return zI;if(zI=!1,LCe)try{let t=$W("WHERE smartctl 2>nul",oce).toString().split(`\r
@@ -848,14 +848,14 @@ Otherwise navigate to:
848
848
 
849
849
  ${e}
850
850
 
851
- `);try{(await XA(e)).on("error",o=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${o.message}. Please navigate to the URL manually.`)})}catch(i){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${i}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await Wur(r.pollInterval);let i=await jur(t,r);if(i.isSuccess()){let o=i.getPrivateToken();return await kw.savePrivateToken(o),console.log("Aone authentication successful!"),!0}i.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function Rbe(t=new gj){return await kw.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await zur(t)}async function Aj(){return await kw.loadPrivateToken()}async function Bbe(){await kw.clearPrivateToken(),console.log("Aone authentication cleared.")}async function sxi(){return await kw.hasValidToken()}async function axi(t=new gj){return await Bbe(),await Rbe(t)}var Oot=Z(()=>{"use strict";Not();$I();Gur();Vur();$ur();});async function kot(t,e,r,n){if(e===Zt.LOGIN_WITH_IFLOW){let i=await UP(e,r),o=await rb();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new ZP({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||Rce,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===Zt.LOGIN_WITH_AONE){if(!await Rbe())throw new Error("Aone authentication failed. Please try again.");let o=await Aj();if(!o)throw new Error("No Aone private token found. Please re-authenticate.");let s=r.getContentGeneratorConfig(),a=Buffer.from(o,"utf8").toString("base64");return new ZP({model:r.getModel(),apiKey:a,baseUrl:s?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:s?.multimodalModelName,config:r})}if(e===Zt.CLOUD_SHELL){let i=await UP(e,r),o=await ccr(i);return new ww(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var Pot=Z(()=>{"use strict";jv();jI();lcr();bCe();xot();cb();Oot();});function cxi(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function H_(t){let e=cxi(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function kce(){return H_("apiKey")}function Pce(){return H_("baseUrl")||H_("url")}function Mce(){return H_("modelName")||H_("model")}function Yur(t){let e=H_(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function Kur(t){let e=H_(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function Jur(t){let e=H_(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function Nbe(){return!!(kce()||Pce()||Mce())}function Mot(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep","debugKeystrokeLogging"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=H_(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=Yur(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=Kur(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=Jur(o);s!==void 0&&(t[o]=s)}),t}function lxi(){return{apiKey:kce(),baseUrl:Pce(),model:Mce()}}var Lot=Z(()=>{"use strict";});async function Fot(t,e,r){await QW()&&(await CCe()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=process.env.GEMINI_API_KEY,o=process.env.GOOGLE_API_KEY,s=process.env.GOOGLE_CLOUD_PROJECT,a=process.env.GOOGLE_CLOUD_LOCATION,c=kce(),u=Pce(),d=Mce(),f=r?.apiKey||c,p=r?.baseUrl||u||uxi[e],h=t.getModel()||d||Gy,m={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===Zt.CLOUD_SHELL?m:e===Zt.LOGIN_WITH_IFLOW?(m.baseUrl=p||Rce,m.multimodalModelName="qwen3-vl-plus",f&&(m.apiKey=f),m):([...t3,Zt.OPENAI_COMPATIBLE].includes(e)&&f&&(m.apiKey=f,m.baseUrl=p,m.model=h),m)}async function Uot(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.3.10-beta.0 (${process.platform}; ${process.arch})`}};if(t.authType&&[...t3,Zt.IDEA_LAB].includes(t.authType)||t.authType===Zt.OPENAI_COMPATIBLE)return new ZP({...t,config:e});if(t.authType===Zt.LOGIN_WITH_IFLOW||t.authType===Zt.LOGIN_WITH_AONE||t.authType===Zt.CLOUD_SHELL)return kot(i,t.authType,e,r);if([...t3,Zt.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===Zt.USE_GEMINI||t.authType===Zt.USE_VERTEX_AI)return new iCe({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Zt,t3,uxi,jv=Z(()=>{"use strict";ul();Pot();cb();xot();Lot();jI();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.LOGIN_WITH_AONE="oauth-aone",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(Zt||(Zt={}));t3=[Zt.IFLOW,Zt.AONE],uxi={[Zt.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Zt.IFLOW]:Rce,[Zt.AONE]:_ur}});var Obe,Xur=Z(()=>{"use strict";Obe=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,i)=>n.name.localeCompare(i.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var Yo,vn,Ko,Jo,Fd=Z(()=>{"use strict";Yo=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(vn||(vn={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(Ko||(Ko={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(Jo||(Jo={}))});function eM(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var kbe=Z(()=>{"use strict";});var ln,Vy=Z(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed",t.HOOK_BLOCKED="hook_blocked"})(ln||(ln={}))});function dxi(t){return{text:t.text}}function fxi(t,e){return[{text:L.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function pxi(t,e){let r=t.resource;if(r?.text)return{text:r.text};if(r?.blob){let n=r.mimeType||"application/octet-stream";return[{text:L.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function hxi(t){return{text:L.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function mxi(t){let e=t?.[0]?.functionResponse,r=e?.response?.content,n=e?.name||"unknown tool";return Array.isArray(r)?r.flatMap(o=>{switch(o.type){case"text":return dxi(o);case"image":case"audio":return fxi(o,n);case"resource":return pxi(o,n);case"resource_link":return hxi(o);default:return null}}).filter(o=>o!==null):[{text:L.t("mcpTool.errors.parseResponseFailed")}]}function gxi(t){let e=t?.[0]?.functionResponse?.response?.content;return Array.isArray(e)?e.map(n=>{switch(n.type){case"text":return n.text;case"image":return L.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return L.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return L.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:L.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||L.t("mcpTool.display.unknownType")});default:return L.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
851
+ `);try{(await XA(e)).on("error",o=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${o.message}. Please navigate to the URL manually.`)})}catch(i){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${i}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await Wur(r.pollInterval);let i=await jur(t,r);if(i.isSuccess()){let o=i.getPrivateToken();return await kw.savePrivateToken(o),console.log("Aone authentication successful!"),!0}i.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function Rbe(t=new gj){return await kw.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await zur(t)}async function Aj(){return await kw.loadPrivateToken()}async function Bbe(){await kw.clearPrivateToken(),console.log("Aone authentication cleared.")}async function sxi(){return await kw.hasValidToken()}async function axi(t=new gj){return await Bbe(),await Rbe(t)}var Oot=Z(()=>{"use strict";Not();$I();Gur();Vur();$ur();});async function kot(t,e,r,n){if(e===Zt.LOGIN_WITH_IFLOW){let i=await UP(e,r),o=await rb();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new ZP({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||Rce,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===Zt.LOGIN_WITH_AONE){if(!await Rbe())throw new Error("Aone authentication failed. Please try again.");let o=await Aj();if(!o)throw new Error("No Aone private token found. Please re-authenticate.");let s=r.getContentGeneratorConfig(),a=Buffer.from(o,"utf8").toString("base64");return new ZP({model:r.getModel(),apiKey:a,baseUrl:s?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:s?.multimodalModelName,config:r})}if(e===Zt.CLOUD_SHELL){let i=await UP(e,r),o=await ccr(i);return new ww(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var Pot=Z(()=>{"use strict";jv();jI();lcr();bCe();xot();cb();Oot();});function cxi(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function H_(t){let e=cxi(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function kce(){return H_("apiKey")}function Pce(){return H_("baseUrl")||H_("url")}function Mce(){return H_("modelName")||H_("model")}function Yur(t){let e=H_(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function Kur(t){let e=H_(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function Jur(t){let e=H_(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function Nbe(){return!!(kce()||Pce()||Mce())}function Mot(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep","debugKeystrokeLogging"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=H_(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=Yur(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=Kur(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=Jur(o);s!==void 0&&(t[o]=s)}),t}function lxi(){return{apiKey:kce(),baseUrl:Pce(),model:Mce()}}var Lot=Z(()=>{"use strict";});async function Fot(t,e,r){await QW()&&(await CCe()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=process.env.GEMINI_API_KEY,o=process.env.GOOGLE_API_KEY,s=process.env.GOOGLE_CLOUD_PROJECT,a=process.env.GOOGLE_CLOUD_LOCATION,c=kce(),u=Pce(),d=Mce(),f=r?.apiKey||c,p=r?.baseUrl||u||uxi[e],h=t.getModel()||d||Gy,m={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===Zt.CLOUD_SHELL?m:e===Zt.LOGIN_WITH_IFLOW?(m.baseUrl=p||Rce,m.multimodalModelName="qwen3-vl-plus",f&&(m.apiKey=f),m):([...t3,Zt.OPENAI_COMPATIBLE].includes(e)&&f&&(m.apiKey=f,m.baseUrl=p,m.model=h),m)}async function Uot(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.3.10 (${process.platform}; ${process.arch})`}};if(t.authType&&[...t3,Zt.IDEA_LAB].includes(t.authType)||t.authType===Zt.OPENAI_COMPATIBLE)return new ZP({...t,config:e});if(t.authType===Zt.LOGIN_WITH_IFLOW||t.authType===Zt.LOGIN_WITH_AONE||t.authType===Zt.CLOUD_SHELL)return kot(i,t.authType,e,r);if([...t3,Zt.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===Zt.USE_GEMINI||t.authType===Zt.USE_VERTEX_AI)return new iCe({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Zt,t3,uxi,jv=Z(()=>{"use strict";ul();Pot();cb();xot();Lot();jI();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.LOGIN_WITH_AONE="oauth-aone",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(Zt||(Zt={}));t3=[Zt.IFLOW,Zt.AONE],uxi={[Zt.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Zt.IFLOW]:Rce,[Zt.AONE]:_ur}});var Obe,Xur=Z(()=>{"use strict";Obe=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,i)=>n.name.localeCompare(i.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var Yo,vn,Ko,Jo,Fd=Z(()=>{"use strict";Yo=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(vn||(vn={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(Ko||(Ko={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(Jo||(Jo={}))});function eM(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var kbe=Z(()=>{"use strict";});var ln,Vy=Z(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed",t.HOOK_BLOCKED="hook_blocked"})(ln||(ln={}))});function dxi(t){return{text:t.text}}function fxi(t,e){return[{text:L.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function pxi(t,e){let r=t.resource;if(r?.text)return{text:r.text};if(r?.blob){let n=r.mimeType||"application/octet-stream";return[{text:L.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function hxi(t){return{text:L.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function mxi(t){let e=t?.[0]?.functionResponse,r=e?.response?.content,n=e?.name||"unknown tool";return Array.isArray(r)?r.flatMap(o=>{switch(o.type){case"text":return dxi(o);case"image":case"audio":return fxi(o,n);case"resource":return pxi(o,n);case"resource_link":return hxi(o);default:return null}}).filter(o=>o!==null):[{text:L.t("mcpTool.errors.parseResponseFailed")}]}function gxi(t){let e=t?.[0]?.functionResponse?.response?.content;return Array.isArray(e)?e.map(n=>{switch(n.type){case"text":return n.text;case"image":return L.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return L.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return L.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:L.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||L.t("mcpTool.display.unknownType")});default:return L.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
852
852
  `):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function Zur(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var X0,Lce=Z(()=>{"use strict";kbe();Vy();Fd();ul();di();X0=class t extends Yo{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??Zur(n),`${n} (${r} MCP Server)`,i,Ko.Hammer,Jo.Other,{type:rr.OBJECT},!0,!1),this.mcpTool=e,this.serverName=r,this.serverToolName=n,this.parameterSchemaJson=o,this.timeout=s,this.trust=a}asFullyQualifiedTool(){return new t(this.mcpTool,this.serverName,this.serverToolName,this.description,this.parameterSchemaJson,this.timeout,this.trust,`${this.serverName}__${this.serverToolName}`)}get schema(){return{name:this.name,description:this.description,parametersJsonSchema:this.parameterSchemaJson}}async shouldConfirmExecute(e,r){let n=this.serverName,i=`${this.serverName}.${this.serverToolName}`;return this.trust||t.allowlist.has(n)||t.allowlist.has(i)?!1:{type:"mcp",title:L.t("mcpTool.messages.confirmExecution"),serverName:this.serverName,toolName:this.serverToolName,toolDisplayName:this.name,onConfirm:async s=>{s===vn.ProceedAlwaysServer?t.allowlist.add(n):s===vn.ProceedAlwaysTool&&t.allowlist.add(i)}}}isMCPToolError(e){let n=e?.[0]?.functionResponse?.response;if(n){let i=n?.error,o=i?.isError;if(i&&(o===!0||o==="true"))return!0}return!1}async execute(e){let{callId:r,...n}=e,i=[{name:this.serverToolName,args:n}],o=await this.mcpTool.callTool(i);if(this.isMCPToolError(o)){let a=`MCP tool '${this.serverToolName}' reported tool error for function call: ${eM(i[0])} with response: ${eM(o)}`;return{llmContent:a,returnDisplay:L.t("mcpTool.errors.toolReportedError",{toolName:this.serverToolName}),error:{message:a,type:ln.MCP_TOOL_ERROR}}}return{llmContent:mxi(o),returnDisplay:gxi(o)}}}});var tdr=T((Nsa,edr)=>{"use strict";edr.exports=function(e){return e.map(function(r){return r===""?"''":r&&typeof r=="object"?r.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(r)&&!/'/.test(r)?"'"+r.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(r)?'"'+r.replace(/(["\\$`!])/g,"\\$1")+'"':String(r).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var cdr=T((Osa,adr)=>{"use strict";var sdr="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",rdr=new RegExp("^"+sdr+"$"),ndr="|&;()<> \\t",Axi='"((\\\\"|[^"])*?)"',yxi="'((\\\\'|[^'])*?)'",Exi=/^#$/,idr="'",odr='"',Qot="$",tM="",vxi=4294967296;for(qot=0;qot<4;qot++)tM+=(vxi*Math.random()).toString(16);var qot,Cxi=new RegExp("^"+tM);function bxi(t,e){for(var r=e.lastIndex,n=[],i;i=e.exec(t);)n.push(i),e.lastIndex===i.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function _xi(t,e,r){var n=typeof t=="function"?t(r):t[r];return typeof n>"u"&&r!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+tM+JSON.stringify(n)+tM:e+n}function Sxi(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+ndr+`]|[^\\s'"`+ndr+"])+",o=new RegExp(["("+sdr+")","("+i+"|"+Axi+"|"+yxi+")+"].join("|"),"g"),s=bxi(t,o);if(s.length===0)return[];e||(e={});var a=!1;return s.map(function(c){var u=c[0];if(!u||a)return;if(rdr.test(u))return{op:u};var d=!1,f=!1,p="",h=!1,m;function A(){m+=1;var E,v,C=u.charAt(m);if(C==="{"){if(m+=1,u.charAt(m)==="}")throw new Error("Bad substitution: "+u.slice(m-2,m+1));if(E=u.indexOf("}",m),E<0)throw new Error("Bad substitution: "+u.slice(m));v=u.slice(m,E),m=E}else if(/[*@#?$!_-]/.test(C))v=C,m+=1;else{var x=u.slice(m);E=x.match(/[^\w\d_]/),E?(v=x.slice(0,E.index),m+=E.index-1):(v=x,m=u.length)}return _xi(e,"",v)}for(m=0;m<u.length;m++){var g=u.charAt(m);if(h=h||!d&&(g==="*"||g==="?"),f)p+=g,f=!1;else if(d)g===d?d=!1:d==idr?p+=g:g===n?(m+=1,g=u.charAt(m),g===odr||g===n||g===Qot?p+=g:p+=n+g):g===Qot?p+=A():p+=g;else if(g===odr||g===idr)d=g;else{if(rdr.test(g))return{op:u};if(Exi.test(g)){a=!0;var y={comment:t.slice(c.index+m+1)};return p.length?[p,y]:[y]}else g===n?f=!0:g===Qot?p+=A():p+=g}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}adr.exports=function(e,r,n){var i=Sxi(e,r,n);return typeof r!="function"?i:i.reduce(function(o,s){if(typeof s=="object")return o.concat(s);var a=s.split(RegExp("("+tM+".*?"+tM+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return Cxi.test(c)?JSON.parse(c.split(tM)[1]):c}))},[])}});var Pbe=T(Hot=>{"use strict";Hot.quote=tdr();Hot.parse=cdr()});var ya,Got,Dn,G_,Fce=Z(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ya||(ya={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Got||(Got={}));Dn=ya.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),G_=t=>{switch(typeof t){case"undefined":return Dn.undefined;case"string":return Dn.string;case"number":return Number.isNaN(t)?Dn.nan:Dn.number;case"boolean":return Dn.boolean;case"function":return Dn.function;case"bigint":return Dn.bigint;case"symbol":return Dn.symbol;case"object":return Array.isArray(t)?Dn.array:t===null?Dn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Dn.promise:typeof Map<"u"&&t instanceof Map?Dn.map:typeof Set<"u"&&t instanceof Set?Dn.set:typeof Date<"u"&&t instanceof Date?Dn.date:Dn.object;default:return Dn.unknown}}});var Hr,xxi,r3,Mbe=Z(()=>{Fce();Hr=ya.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"]),xxi=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),r3=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ya.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};r3.create=t=>new r3(t)});var wxi,Pw,Vot=Z(()=>{Mbe();Fce();wxi=(t,e)=>{let r;switch(t.code){case Hr.invalid_type:t.received===Dn.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Hr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ya.jsonStringifyReplacer)}`;break;case Hr.unrecognized_keys:r=`Unrecognized key(s) in object: ${ya.joinValues(t.keys,", ")}`;break;case Hr.invalid_union:r="Invalid input";break;case Hr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ya.joinValues(t.options)}`;break;case Hr.invalid_enum_value:r=`Invalid enum value. Expected ${ya.joinValues(t.options)}, received '${t.received}'`;break;case Hr.invalid_arguments:r="Invalid function arguments";break;case Hr.invalid_return_type:r="Invalid function return type";break;case Hr.invalid_date:r="Invalid date";break;case Hr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ya.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Hr.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Hr.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Hr.custom:r="Invalid input";break;case Hr.invalid_intersection_types:r="Intersection results could not be merged";break;case Hr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Hr.not_finite:r="Number must be finite";break;default:r=e.defaultError,ya.assertNever(t)}return{message:r}},Pw=wxi});function Txi(t){ldr=t}function yj(){return ldr}var ldr,Lbe=Z(()=>{Vot();ldr=Pw});function Cn(t,e){let r=yj(),n=Uce({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Pw?void 0:Pw].filter(i=>!!i)});t.common.issues.push(n)}var Uce,Ixi,Z0,ho,rM,Xg,Fbe,Ube,TD,Ej,$ot=Z(()=>{Lbe();Vot();Uce=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},Ixi=[];Z0=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ho;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ho;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},ho=Object.freeze({status:"aborted"}),rM=t=>({status:"dirty",value:t}),Xg=t=>({status:"valid",value:t}),Fbe=t=>t.status==="aborted",Ube=t=>t.status==="dirty",TD=t=>t.status==="valid",Ej=t=>typeof Promise<"u"&&t instanceof Promise});var udr=Z(()=>{});var pi,ddr=Z(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(pi||(pi={}))});function Es(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function mdr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function $xi(t){return new RegExp(`^${mdr(t)}$`)}function gdr(t){let e=`${hdr}T${mdr(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Wxi(t,e){return!!((e==="v4"||!e)&&Fxi.test(t)||(e==="v6"||!e)&&Qxi.test(t))}function jxi(t,e){if(!kxi.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function zxi(t,e){return!!((e==="v4"||!e)&&Uxi.test(t)||(e==="v6"||!e)&&qxi.test(t))}function Yxi(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function vj(t){if(t instanceof n3){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=i4.create(vj(n))}return new n3({...t._def,shape:()=>e})}else return t instanceof Fw?new Fw({...t._def,type:vj(t.element)}):t instanceof i4?i4.create(vj(t.unwrap())):t instanceof $_?$_.create(vj(t.unwrap())):t instanceof V_?V_.create(t.items.map(e=>vj(e))):t}function jot(t,e){let r=G_(t),n=G_(e);if(t===e)return{valid:!0,data:t};if(r===Dn.object&&n===Dn.object){let i=ya.objectKeys(e),o=ya.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=jot(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===Dn.array&&n===Dn.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],c=jot(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===Dn.date&&n===Dn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function Adr(t,e){return new pM({values:t,typeName:Eo.ZodEnum,...Es(e)})}function pdr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function ydr(t,e={},r){return t?DD.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=pdr(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=pdr(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):DD.create()}var o4,fdr,Us,Dxi,Rxi,Bxi,Nxi,Oxi,kxi,Pxi,Mxi,Lxi,Wot,Fxi,Uxi,Qxi,qxi,Hxi,Gxi,hdr,Vxi,ID,nM,iM,oM,sM,Cj,aM,cM,DD,Lw,lb,bj,Fw,n3,lM,Mw,Qbe,uM,V_,qbe,_j,Sj,Hbe,dM,fM,pM,hM,RD,s4,i4,$_,mM,gM,xj,Kxi,Qce,qce,AM,Jxi,Eo,Xxi,Edr,vdr,Zxi,e8i,Cdr,t8i,r8i,n8i,i8i,o8i,s8i,a8i,c8i,l8i,u8i,d8i,f8i,p8i,h8i,m8i,g8i,A8i,y8i,E8i,v8i,C8i,b8i,_8i,S8i,x8i,w8i,T8i,I8i,D8i,R8i,B8i,N8i,O8i,k8i,bdr=Z(()=>{Mbe();Lbe();ddr();$ot();Fce();o4=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},fdr=(t,e)=>{if(TD(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new r3(t.common.issues);return this._error=r,this._error}}};Us=class{get description(){return this._def.description}_getType(e){return G_(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:G_(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Z0,ctx:{common:e.parent.common,data:e.data,parsedType:G_(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ej(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:G_(e)},i=this._parseSync({data:e,path:n.path,parent:n});return fdr(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:G_(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return TD(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>TD(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:G_(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(Ej(i)?i:Promise.resolve(i));return fdr(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:Hr.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new s4({schema:this,typeName:Eo.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return i4.create(this,this._def)}nullable(){return $_.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fw.create(this)}promise(){return RD.create(this,this._def)}or(e){return lM.create([this,e],this._def)}and(e){return uM.create(this,e,this._def)}transform(e){return new s4({...Es(this._def),schema:this,typeName:Eo.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new mM({...Es(this._def),innerType:this,defaultValue:r,typeName:Eo.ZodDefault})}brand(){return new Qce({typeName:Eo.ZodBranded,type:this,...Es(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new gM({...Es(this._def),innerType:this,catchValue:r,typeName:Eo.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return qce.create(this,e)}readonly(){return AM.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Dxi=/^c[^\s-]{8,}$/i,Rxi=/^[0-9a-z]+$/,Bxi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nxi=/^[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,Oxi=/^[a-z0-9_-]{21}$/i,kxi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pxi=/^[-+]?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)?)??$/,Mxi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Lxi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Fxi=/^(?:(?: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])$/,Uxi=/^(?:(?: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])$/,Qxi=/^(([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]))$/,qxi=/^(([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])$/,Hxi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gxi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hdr="((\\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])))",Vxi=new RegExp(`^${hdr}$`);ID=class t extends Us{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Dn.string){let o=this._getOrReturnCtx(e);return Cn(o,{code:Hr.invalid_type,expected:Dn.string,received:o.parsedType}),ho}let n=new Z0,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?Cn(i,{code:Hr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Cn(i,{code:Hr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Mxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"email",code:Hr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Wot||(Wot=new RegExp(Lxi,"u")),Wot.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"emoji",code:Hr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Nxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"uuid",code:Hr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Oxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"nanoid",code:Hr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Dxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"cuid",code:Hr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Rxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"cuid2",code:Hr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Bxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"ulid",code:Hr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Cn(i,{validation:"url",code:Hr.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"regex",code:Hr.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?gdr(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Vxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?$xi(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Pxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"duration",code:Hr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Wxi(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"ip",code:Hr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?jxi(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"jwt",code:Hr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?zxi(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"cidr",code:Hr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Hxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"base64",code:Hr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Gxi.test(e.data)||(i=this._getOrReturnCtx(e,i),Cn(i,{validation:"base64url",code:Hr.invalid_string,message:o.message}),n.dirty()):ya.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Hr.invalid_string,...pi.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...pi.errToObj(e)})}url(e){return this._addCheck({kind:"url",...pi.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...pi.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...pi.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...pi.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...pi.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...pi.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...pi.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...pi.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...pi.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...pi.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...pi.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...pi.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...pi.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...pi.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...pi.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...pi.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...pi.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...pi.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...pi.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...pi.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...pi.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...pi.errToObj(r)})}nonempty(e){return this.min(1,pi.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};ID.create=t=>new ID({checks:[],typeName:Eo.ZodString,coerce:t?.coerce??!1,...Es(t)});nM=class t extends Us{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Dn.number){let o=this._getOrReturnCtx(e);return Cn(o,{code:Hr.invalid_type,expected:Dn.number,received:o.parsedType}),ho}let n,i=new Z0;for(let o of this._def.checks)o.kind==="int"?ya.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Cn(n,{code:Hr.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),Cn(n,{code:Hr.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),Cn(n,{code:Hr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Yxi(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),Cn(n,{code:Hr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Cn(n,{code:Hr.not_finite,message:o.message}),i.dirty()):ya.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,pi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,pi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,pi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,pi.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:pi.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:pi.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:pi.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:pi.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pi.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pi.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ya.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};nM.create=t=>new nM({checks:[],typeName:Eo.ZodNumber,coerce:t?.coerce||!1,...Es(t)});iM=class t extends Us{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Dn.bigint)return this._getInvalidInput(e);let n,i=new Z0;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),Cn(n,{code:Hr.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),Cn(n,{code:Hr.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Cn(n,{code:Hr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ya.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Cn(r,{code:Hr.invalid_type,expected:Dn.bigint,received:r.parsedType}),ho}gte(e,r){return this.setLimit("min",e,!0,pi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,pi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,pi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,pi.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:pi.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:pi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:pi.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};iM.create=t=>new iM({checks:[],typeName:Eo.ZodBigInt,coerce:t?.coerce??!1,...Es(t)});oM=class extends Us{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Dn.boolean){let n=this._getOrReturnCtx(e);return Cn(n,{code:Hr.invalid_type,expected:Dn.boolean,received:n.parsedType}),ho}return Xg(e.data)}};oM.create=t=>new oM({typeName:Eo.ZodBoolean,coerce:t?.coerce||!1,...Es(t)});sM=class t extends Us{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Dn.date){let o=this._getOrReturnCtx(e);return Cn(o,{code:Hr.invalid_type,expected:Dn.date,received:o.parsedType}),ho}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Cn(o,{code:Hr.invalid_date}),ho}let n=new Z0,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),Cn(i,{code:Hr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ya.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:pi.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:pi.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};sM.create=t=>new sM({checks:[],coerce:t?.coerce||!1,typeName:Eo.ZodDate,...Es(t)});Cj=class extends Us{_parse(e){if(this._getType(e)!==Dn.symbol){let n=this._getOrReturnCtx(e);return Cn(n,{code:Hr.invalid_type,expected:Dn.symbol,received:n.parsedType}),ho}return Xg(e.data)}};Cj.create=t=>new Cj({typeName:Eo.ZodSymbol,...Es(t)});aM=class extends Us{_parse(e){if(this._getType(e)!==Dn.undefined){let n=this._getOrReturnCtx(e);return Cn(n,{code:Hr.invalid_type,expected:Dn.undefined,received:n.parsedType}),ho}return Xg(e.data)}};aM.create=t=>new aM({typeName:Eo.ZodUndefined,...Es(t)});cM=class extends Us{_parse(e){if(this._getType(e)!==Dn.null){let n=this._getOrReturnCtx(e);return Cn(n,{code:Hr.invalid_type,expected:Dn.null,received:n.parsedType}),ho}return Xg(e.data)}};cM.create=t=>new cM({typeName:Eo.ZodNull,...Es(t)});DD=class extends Us{constructor(){super(...arguments),this._any=!0}_parse(e){return Xg(e.data)}};DD.create=t=>new DD({typeName:Eo.ZodAny,...Es(t)});Lw=class extends Us{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Xg(e.data)}};Lw.create=t=>new Lw({typeName:Eo.ZodUnknown,...Es(t)});lb=class extends Us{_parse(e){let r=this._getOrReturnCtx(e);return Cn(r,{code:Hr.invalid_type,expected:Dn.never,received:r.parsedType}),ho}};lb.create=t=>new lb({typeName:Eo.ZodNever,...Es(t)});bj=class extends Us{_parse(e){if(this._getType(e)!==Dn.undefined){let n=this._getOrReturnCtx(e);return Cn(n,{code:Hr.invalid_type,expected:Dn.void,received:n.parsedType}),ho}return Xg(e.data)}};bj.create=t=>new bj({typeName:Eo.ZodVoid,...Es(t)});Fw=class t extends Us{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Dn.array)return Cn(r,{code:Hr.invalid_type,expected:Dn.array,received:r.parsedType}),ho;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Cn(r,{code:s?Hr.too_big:Hr.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Cn(r,{code:Hr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Cn(r,{code:Hr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new o4(r,s,r.path,a)))).then(s=>Z0.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new o4(r,s,r.path,a)));return Z0.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:pi.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:pi.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:pi.toString(r)}})}nonempty(e){return this.min(1,e)}};Fw.create=(t,e)=>new Fw({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Eo.ZodArray,...Es(e)});n3=class t extends Us{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ya.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Dn.object){let u=this._getOrReturnCtx(e);return Cn(u,{code:Hr.invalid_type,expected:Dn.object,received:u.parsedType}),ho}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof lb&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let d=o[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new o4(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof lb){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")a.length>0&&(Cn(i,{code:Hr.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let f=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new o4(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>Z0.mergeObjectSync(n,u)):Z0.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return pi.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:pi.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Eo.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ya.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ya.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return vj(this)}partial(e){let r={};for(let n of ya.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ya.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof i4;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return Adr(ya.objectKeys(this.shape))}};n3.create=(t,e)=>new n3({shape:()=>t,unknownKeys:"strip",catchall:lb.create(),typeName:Eo.ZodObject,...Es(e)});n3.strictCreate=(t,e)=>new n3({shape:()=>t,unknownKeys:"strict",catchall:lb.create(),typeName:Eo.ZodObject,...Es(e)});n3.lazycreate=(t,e)=>new n3({shape:t,unknownKeys:"strip",catchall:lb.create(),typeName:Eo.ZodObject,...Es(e)});lM=class extends Us{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new r3(a.ctx.common.issues));return Cn(r,{code:Hr.invalid_union,unionErrors:s}),ho}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new r3(c));return Cn(r,{code:Hr.invalid_union,unionErrors:a}),ho}}get options(){return this._def.options}};lM.create=(t,e)=>new lM({options:t,typeName:Eo.ZodUnion,...Es(e)});Mw=t=>t instanceof dM?Mw(t.schema):t instanceof s4?Mw(t.innerType()):t instanceof fM?[t.value]:t instanceof pM?t.options:t instanceof hM?ya.objectValues(t.enum):t instanceof mM?Mw(t._def.innerType):t instanceof aM?[void 0]:t instanceof cM?[null]:t instanceof i4?[void 0,...Mw(t.unwrap())]:t instanceof $_?[null,...Mw(t.unwrap())]:t instanceof Qce||t instanceof AM?Mw(t.unwrap()):t instanceof gM?Mw(t._def.innerType):[],Qbe=class t extends Us{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Dn.object)return Cn(r,{code:Hr.invalid_type,expected:Dn.object,received:r.parsedType}),ho;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Cn(r,{code:Hr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ho)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=Mw(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:Eo.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Es(n)})}};uM=class extends Us{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(Fbe(o)||Fbe(s))return ho;let a=jot(o.value,s.value);return a.valid?((Ube(o)||Ube(s))&&r.dirty(),{status:r.value,value:a.data}):(Cn(n,{code:Hr.invalid_intersection_types}),ho)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};uM.create=(t,e,r)=>new uM({left:t,right:e,typeName:Eo.ZodIntersection,...Es(r)});V_=class t extends Us{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Dn.array)return Cn(n,{code:Hr.invalid_type,expected:Dn.array,received:n.parsedType}),ho;if(n.data.length<this._def.items.length)return Cn(n,{code:Hr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ho;!this._def.rest&&n.data.length>this._def.items.length&&(Cn(n,{code:Hr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new o4(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Z0.mergeArray(r,s)):Z0.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};V_.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new V_({items:t,typeName:Eo.ZodTuple,rest:null,...Es(e)})};qbe=class t extends Us{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Dn.object)return Cn(n,{code:Hr.invalid_type,expected:Dn.object,received:n.parsedType}),ho;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new o4(n,a,n.path,a)),value:s._parse(new o4(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Z0.mergeObjectAsync(r,i):Z0.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Us?new t({keyType:e,valueType:r,typeName:Eo.ZodRecord,...Es(n)}):new t({keyType:ID.create(),valueType:e,typeName:Eo.ZodRecord,...Es(r)})}},_j=class extends Us{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Dn.map)return Cn(n,{code:Hr.invalid_type,expected:Dn.map,received:n.parsedType}),ho;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new o4(n,a,n.path,[u,"key"])),value:o._parse(new o4(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return ho;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return ho;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};_j.create=(t,e,r)=>new _j({valueType:e,keyType:t,typeName:Eo.ZodMap,...Es(r)});Sj=class t extends Us{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Dn.set)return Cn(n,{code:Hr.invalid_type,expected:Dn.set,received:n.parsedType}),ho;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Cn(n,{code:Hr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Cn(n,{code:Hr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let d of c){if(d.status==="aborted")return ho;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new o4(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:pi.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:pi.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Sj.create=(t,e)=>new Sj({valueType:t,minSize:null,maxSize:null,typeName:Eo.ZodSet,...Es(e)});Hbe=class t extends Us{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Dn.function)return Cn(r,{code:Hr.invalid_type,expected:Dn.function,received:r.parsedType}),ho;function n(a,c){return Uce({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yj(),Pw].filter(u=>!!u),issueData:{code:Hr.invalid_arguments,argumentsError:c}})}function i(a,c){return Uce({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yj(),Pw].filter(u=>!!u),issueData:{code:Hr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof RD){let a=this;return Xg(async function(...c){let u=new r3([]),d=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),f=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(h=>{throw u.addIssue(i(f,h)),u})})}else{let a=this;return Xg(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new r3([n(c,u.error)]);let d=Reflect.apply(s,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new r3([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:V_.create(e).rest(Lw.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||V_.create([]).rest(Lw.create()),returns:r||Lw.create(),typeName:Eo.ZodFunction,...Es(n)})}},dM=class extends Us{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};dM.create=(t,e)=>new dM({getter:t,typeName:Eo.ZodLazy,...Es(e)});fM=class extends Us{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Cn(r,{received:r.data,code:Hr.invalid_literal,expected:this._def.value}),ho}return{status:"valid",value:e.data}}get value(){return this._def.value}};fM.create=(t,e)=>new fM({value:t,typeName:Eo.ZodLiteral,...Es(e)});pM=class t extends Us{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Cn(r,{expected:ya.joinValues(n),received:r.parsedType,code:Hr.invalid_type}),ho}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return Cn(r,{received:r.data,code:Hr.invalid_enum_value,options:n}),ho}return Xg(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};pM.create=Adr;hM=class extends Us{_parse(e){let r=ya.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Dn.string&&n.parsedType!==Dn.number){let i=ya.objectValues(r);return Cn(n,{expected:ya.joinValues(i),received:n.parsedType,code:Hr.invalid_type}),ho}if(this._cache||(this._cache=new Set(ya.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ya.objectValues(r);return Cn(n,{received:n.data,code:Hr.invalid_enum_value,options:i}),ho}return Xg(e.data)}get enum(){return this._def.values}};hM.create=(t,e)=>new hM({values:t,typeName:Eo.ZodNativeEnum,...Es(e)});RD=class extends Us{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Dn.promise&&r.common.async===!1)return Cn(r,{code:Hr.invalid_type,expected:Dn.promise,received:r.parsedType}),ho;let n=r.parsedType===Dn.promise?r.data:Promise.resolve(r.data);return Xg(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};RD.create=(t,e)=>new RD({type:t,typeName:Eo.ZodPromise,...Es(e)});s4=class extends Us{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Eo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{Cn(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ho;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ho:c.status==="dirty"?rM(c.value):r.value==="dirty"?rM(c.value):c});{if(r.value==="aborted")return ho;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ho:a.status==="dirty"?rM(a.value):r.value==="dirty"?rM(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ho:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ho:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!TD(s))return ho;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>TD(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ho);ya.assertNever(i)}};s4.create=(t,e,r)=>new s4({schema:t,typeName:Eo.ZodEffects,effect:e,...Es(r)});s4.createWithPreprocess=(t,e,r)=>new s4({schema:e,effect:{type:"preprocess",transform:t},typeName:Eo.ZodEffects,...Es(r)});i4=class extends Us{_parse(e){return this._getType(e)===Dn.undefined?Xg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};i4.create=(t,e)=>new i4({innerType:t,typeName:Eo.ZodOptional,...Es(e)});$_=class extends Us{_parse(e){return this._getType(e)===Dn.null?Xg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$_.create=(t,e)=>new $_({innerType:t,typeName:Eo.ZodNullable,...Es(e)});mM=class extends Us{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Dn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};mM.create=(t,e)=>new mM({innerType:t,typeName:Eo.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Es(e)});gM=class extends Us{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ej(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new r3(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new r3(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};gM.create=(t,e)=>new gM({innerType:t,typeName:Eo.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Es(e)});xj=class extends Us{_parse(e){if(this._getType(e)!==Dn.nan){let n=this._getOrReturnCtx(e);return Cn(n,{code:Hr.invalid_type,expected:Dn.nan,received:n.parsedType}),ho}return{status:"valid",value:e.data}}};xj.create=t=>new xj({typeName:Eo.ZodNaN,...Es(t)});Kxi=Symbol("zod_brand"),Qce=class extends Us{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},qce=class t extends Us{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ho:o.status==="dirty"?(r.dirty(),rM(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ho:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Eo.ZodPipeline})}},AM=class extends Us{_parse(e){let r=this._def.innerType._parse(e),n=i=>(TD(i)&&(i.value=Object.freeze(i.value)),i);return Ej(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};AM.create=(t,e)=>new AM({innerType:t,typeName:Eo.ZodReadonly,...Es(e)});Jxi={object:n3.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Eo||(Eo={}));Xxi=(t,e={message:`Input not instance of ${t.name}`})=>ydr(r=>r instanceof t,e),Edr=ID.create,vdr=nM.create,Zxi=xj.create,e8i=iM.create,Cdr=oM.create,t8i=sM.create,r8i=Cj.create,n8i=aM.create,i8i=cM.create,o8i=DD.create,s8i=Lw.create,a8i=lb.create,c8i=bj.create,l8i=Fw.create,u8i=n3.create,d8i=n3.strictCreate,f8i=lM.create,p8i=Qbe.create,h8i=uM.create,m8i=V_.create,g8i=qbe.create,A8i=_j.create,y8i=Sj.create,E8i=Hbe.create,v8i=dM.create,C8i=fM.create,b8i=pM.create,_8i=hM.create,S8i=RD.create,x8i=s4.create,w8i=i4.create,T8i=$_.create,I8i=s4.createWithPreprocess,D8i=qce.create,R8i=()=>Edr().optional(),B8i=()=>vdr().optional(),N8i=()=>Cdr().optional(),O8i={string:(t=>ID.create({...t,coerce:!0})),number:(t=>nM.create({...t,coerce:!0})),boolean:(t=>oM.create({...t,coerce:!0})),bigint:(t=>iM.create({...t,coerce:!0})),date:(t=>sM.create({...t,coerce:!0}))},k8i=ho});var ie={};ll(ie,{BRAND:()=>Kxi,DIRTY:()=>rM,EMPTY_PATH:()=>Ixi,INVALID:()=>ho,NEVER:()=>k8i,OK:()=>Xg,ParseStatus:()=>Z0,Schema:()=>Us,ZodAny:()=>DD,ZodArray:()=>Fw,ZodBigInt:()=>iM,ZodBoolean:()=>oM,ZodBranded:()=>Qce,ZodCatch:()=>gM,ZodDate:()=>sM,ZodDefault:()=>mM,ZodDiscriminatedUnion:()=>Qbe,ZodEffects:()=>s4,ZodEnum:()=>pM,ZodError:()=>r3,ZodFirstPartyTypeKind:()=>Eo,ZodFunction:()=>Hbe,ZodIntersection:()=>uM,ZodIssueCode:()=>Hr,ZodLazy:()=>dM,ZodLiteral:()=>fM,ZodMap:()=>_j,ZodNaN:()=>xj,ZodNativeEnum:()=>hM,ZodNever:()=>lb,ZodNull:()=>cM,ZodNullable:()=>$_,ZodNumber:()=>nM,ZodObject:()=>n3,ZodOptional:()=>i4,ZodParsedType:()=>Dn,ZodPipeline:()=>qce,ZodPromise:()=>RD,ZodReadonly:()=>AM,ZodRecord:()=>qbe,ZodSchema:()=>Us,ZodSet:()=>Sj,ZodString:()=>ID,ZodSymbol:()=>Cj,ZodTransformer:()=>s4,ZodTuple:()=>V_,ZodType:()=>Us,ZodUndefined:()=>aM,ZodUnion:()=>lM,ZodUnknown:()=>Lw,ZodVoid:()=>bj,addIssueToContext:()=>Cn,any:()=>o8i,array:()=>l8i,bigint:()=>e8i,boolean:()=>Cdr,coerce:()=>O8i,custom:()=>ydr,date:()=>t8i,datetimeRegex:()=>gdr,defaultErrorMap:()=>Pw,discriminatedUnion:()=>p8i,effect:()=>x8i,enum:()=>b8i,function:()=>E8i,getErrorMap:()=>yj,getParsedType:()=>G_,instanceof:()=>Xxi,intersection:()=>h8i,isAborted:()=>Fbe,isAsync:()=>Ej,isDirty:()=>Ube,isValid:()=>TD,late:()=>Jxi,lazy:()=>v8i,literal:()=>C8i,makeIssue:()=>Uce,map:()=>A8i,nan:()=>Zxi,nativeEnum:()=>_8i,never:()=>a8i,null:()=>i8i,nullable:()=>T8i,number:()=>vdr,object:()=>u8i,objectUtil:()=>Got,oboolean:()=>N8i,onumber:()=>B8i,optional:()=>w8i,ostring:()=>R8i,pipeline:()=>D8i,preprocess:()=>I8i,promise:()=>S8i,quotelessJson:()=>xxi,record:()=>g8i,set:()=>y8i,setErrorMap:()=>Txi,strictObject:()=>d8i,string:()=>Edr,symbol:()=>r8i,transformer:()=>x8i,tuple:()=>m8i,undefined:()=>n8i,union:()=>f8i,unknown:()=>s8i,util:()=>ya,void:()=>c8i});var zot=Z(()=>{Lbe();$ot();udr();Fce();bdr();Mbe()});var BD=Z(()=>{zot();zot()});var wj,_dr,Gbe,Sdr,xdr,P8i,l4,i3,Hce,W_,u4,Vbe,wdr,$be,Tdr,Idr,Ddr,Gce,a4,Rdr,Bdr,ND,yM,Wbe,Vce,Ndr,M8i,L8i,F8i,Yot,Odr,kdr,jbe,U8i,zbe,Ybe,Kbe,Pdr,Mdr,Kot,Ldr,Fdr,Q8i,q8i,Jot,H8i,Xot,G8i,Zot,V8i,$8i,W8i,j8i,z8i,Y8i,K8i,$ce,J8i,est,tst,rst,X8i,Z8i,Udr,ewi,Wce,twi,rwi,nwi,iwi,nst,Jbe,caa,owi,swi,Qdr,awi,cwi,lwi,uwi,dwi,fwi,pwi,hwi,mwi,gwi,Awi,ywi,Ewi,vwi,Cwi,bwi,_wi,ist,Swi,Xbe,xwi,wwi,laa,uaa,daa,faa,paa,haa,c4,OD=Z(()=>{BD();wj="2025-06-18",_dr=[wj,"2025-03-26","2024-11-05","2024-10-07"],Gbe="2.0",Sdr=ie.union([ie.string(),ie.number().int()]),xdr=ie.string(),P8i=ie.object({progressToken:ie.optional(Sdr)}).passthrough(),l4=ie.object({_meta:ie.optional(P8i)}).passthrough(),i3=ie.object({method:ie.string(),params:ie.optional(l4)}),Hce=ie.object({_meta:ie.optional(ie.object({}).passthrough())}).passthrough(),W_=ie.object({method:ie.string(),params:ie.optional(Hce)}),u4=ie.object({_meta:ie.optional(ie.object({}).passthrough())}).passthrough(),Vbe=ie.union([ie.string(),ie.number().int()]),wdr=ie.object({jsonrpc:ie.literal(Gbe),id:Vbe}).merge(i3).strict(),$be=t=>wdr.safeParse(t).success,Tdr=ie.object({jsonrpc:ie.literal(Gbe)}).merge(W_).strict(),Idr=t=>Tdr.safeParse(t).success,Ddr=ie.object({jsonrpc:ie.literal(Gbe),id:Vbe,result:u4}).strict(),Gce=t=>Ddr.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(a4||(a4={}));Rdr=ie.object({jsonrpc:ie.literal(Gbe),id:Vbe,error:ie.object({code:ie.number().int(),message:ie.string(),data:ie.optional(ie.unknown())})}).strict(),Bdr=t=>Rdr.safeParse(t).success,ND=ie.union([wdr,Tdr,Ddr,Rdr]),yM=u4.strict(),Wbe=W_.extend({method:ie.literal("notifications/cancelled"),params:Hce.extend({requestId:Vbe,reason:ie.string().optional()})}),Vce=ie.object({name:ie.string(),title:ie.optional(ie.string())}).passthrough(),Ndr=Vce.extend({version:ie.string()}),M8i=ie.object({experimental:ie.optional(ie.object({}).passthrough()),sampling:ie.optional(ie.object({}).passthrough()),elicitation:ie.optional(ie.object({}).passthrough()),roots:ie.optional(ie.object({listChanged:ie.optional(ie.boolean())}).passthrough())}).passthrough(),L8i=i3.extend({method:ie.literal("initialize"),params:l4.extend({protocolVersion:ie.string(),capabilities:M8i,clientInfo:Ndr})}),F8i=ie.object({experimental:ie.optional(ie.object({}).passthrough()),logging:ie.optional(ie.object({}).passthrough()),completions:ie.optional(ie.object({}).passthrough()),prompts:ie.optional(ie.object({listChanged:ie.optional(ie.boolean())}).passthrough()),resources:ie.optional(ie.object({subscribe:ie.optional(ie.boolean()),listChanged:ie.optional(ie.boolean())}).passthrough()),tools:ie.optional(ie.object({listChanged:ie.optional(ie.boolean())}).passthrough())}).passthrough(),Yot=u4.extend({protocolVersion:ie.string(),capabilities:F8i,serverInfo:Ndr,instructions:ie.optional(ie.string())}),Odr=W_.extend({method:ie.literal("notifications/initialized")}),kdr=t=>Odr.safeParse(t).success,jbe=i3.extend({method:ie.literal("ping")}),U8i=ie.object({progress:ie.number(),total:ie.optional(ie.number()),message:ie.optional(ie.string())}).passthrough(),zbe=W_.extend({method:ie.literal("notifications/progress"),params:Hce.merge(U8i).extend({progressToken:Sdr})}),Ybe=i3.extend({params:l4.extend({cursor:ie.optional(xdr)}).optional()}),Kbe=u4.extend({nextCursor:ie.optional(xdr)}),Pdr=ie.object({uri:ie.string(),mimeType:ie.optional(ie.string()),_meta:ie.optional(ie.object({}).passthrough())}).passthrough(),Mdr=Pdr.extend({text:ie.string()}),Kot=ie.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ldr=Pdr.extend({blob:Kot}),Fdr=Vce.extend({uri:ie.string(),description:ie.optional(ie.string()),mimeType:ie.optional(ie.string()),_meta:ie.optional(ie.object({}).passthrough())}),Q8i=Vce.extend({uriTemplate:ie.string(),description:ie.optional(ie.string()),mimeType:ie.optional(ie.string()),_meta:ie.optional(ie.object({}).passthrough())}),q8i=Ybe.extend({method:ie.literal("resources/list")}),Jot=Kbe.extend({resources:ie.array(Fdr)}),H8i=Ybe.extend({method:ie.literal("resources/templates/list")}),Xot=Kbe.extend({resourceTemplates:ie.array(Q8i)}),G8i=i3.extend({method:ie.literal("resources/read"),params:l4.extend({uri:ie.string()})}),Zot=u4.extend({contents:ie.array(ie.union([Mdr,Ldr]))}),V8i=W_.extend({method:ie.literal("notifications/resources/list_changed")}),$8i=i3.extend({method:ie.literal("resources/subscribe"),params:l4.extend({uri:ie.string()})}),W8i=i3.extend({method:ie.literal("resources/unsubscribe"),params:l4.extend({uri:ie.string()})}),j8i=W_.extend({method:ie.literal("notifications/resources/updated"),params:Hce.extend({uri:ie.string()})}),z8i=ie.object({name:ie.string(),description:ie.optional(ie.string()),required:ie.optional(ie.boolean())}).passthrough(),Y8i=Vce.extend({description:ie.optional(ie.string()),arguments:ie.optional(ie.array(z8i)),_meta:ie.optional(ie.object({}).passthrough())}),K8i=Ybe.extend({method:ie.literal("prompts/list")}),$ce=Kbe.extend({prompts:ie.array(Y8i)}),J8i=i3.extend({method:ie.literal("prompts/get"),params:l4.extend({name:ie.string(),arguments:ie.optional(ie.record(ie.string()))})}),est=ie.object({type:ie.literal("text"),text:ie.string(),_meta:ie.optional(ie.object({}).passthrough())}).passthrough(),tst=ie.object({type:ie.literal("image"),data:Kot,mimeType:ie.string(),_meta:ie.optional(ie.object({}).passthrough())}).passthrough(),rst=ie.object({type:ie.literal("audio"),data:Kot,mimeType:ie.string(),_meta:ie.optional(ie.object({}).passthrough())}).passthrough(),X8i=ie.object({type:ie.literal("resource"),resource:ie.union([Mdr,Ldr]),_meta:ie.optional(ie.object({}).passthrough())}).passthrough(),Z8i=Fdr.extend({type:ie.literal("resource_link")}),Udr=ie.union([est,tst,rst,Z8i,X8i]),ewi=ie.object({role:ie.enum(["user","assistant"]),content:Udr}).passthrough(),Wce=u4.extend({description:ie.optional(ie.string()),messages:ie.array(ewi)}),twi=W_.extend({method:ie.literal("notifications/prompts/list_changed")}),rwi=ie.object({title:ie.optional(ie.string()),readOnlyHint:ie.optional(ie.boolean()),destructiveHint:ie.optional(ie.boolean()),idempotentHint:ie.optional(ie.boolean()),openWorldHint:ie.optional(ie.boolean())}).passthrough(),nwi=Vce.extend({description:ie.optional(ie.string()),inputSchema:ie.object({type:ie.literal("object"),properties:ie.optional(ie.object({}).passthrough()),required:ie.optional(ie.array(ie.string()))}).passthrough(),outputSchema:ie.optional(ie.object({type:ie.literal("object"),properties:ie.optional(ie.object({}).passthrough()),required:ie.optional(ie.array(ie.string()))}).passthrough()),annotations:ie.optional(rwi),_meta:ie.optional(ie.object({}).passthrough())}),iwi=Ybe.extend({method:ie.literal("tools/list")}),nst=Kbe.extend({tools:ie.array(nwi)}),Jbe=u4.extend({content:ie.array(Udr).default([]),structuredContent:ie.object({}).passthrough().optional(),isError:ie.optional(ie.boolean())}),caa=Jbe.or(u4.extend({toolResult:ie.unknown()})),owi=i3.extend({method:ie.literal("tools/call"),params:l4.extend({name:ie.string(),arguments:ie.optional(ie.record(ie.unknown()))})}),swi=W_.extend({method:ie.literal("notifications/tools/list_changed")}),Qdr=ie.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),awi=i3.extend({method:ie.literal("logging/setLevel"),params:l4.extend({level:Qdr})}),cwi=W_.extend({method:ie.literal("notifications/message"),params:Hce.extend({level:Qdr,logger:ie.optional(ie.string()),data:ie.unknown()})}),lwi=ie.object({name:ie.string().optional()}).passthrough(),uwi=ie.object({hints:ie.optional(ie.array(lwi)),costPriority:ie.optional(ie.number().min(0).max(1)),speedPriority:ie.optional(ie.number().min(0).max(1)),intelligencePriority:ie.optional(ie.number().min(0).max(1))}).passthrough(),dwi=ie.object({role:ie.enum(["user","assistant"]),content:ie.union([est,tst,rst])}).passthrough(),fwi=i3.extend({method:ie.literal("sampling/createMessage"),params:l4.extend({messages:ie.array(dwi),systemPrompt:ie.optional(ie.string()),includeContext:ie.optional(ie.enum(["none","thisServer","allServers"])),temperature:ie.optional(ie.number()),maxTokens:ie.number().int(),stopSequences:ie.optional(ie.array(ie.string())),metadata:ie.optional(ie.object({}).passthrough()),modelPreferences:ie.optional(uwi)})}),pwi=u4.extend({model:ie.string(),stopReason:ie.optional(ie.enum(["endTurn","stopSequence","maxTokens"]).or(ie.string())),role:ie.enum(["user","assistant"]),content:ie.discriminatedUnion("type",[est,tst,rst])}),hwi=ie.object({type:ie.literal("boolean"),title:ie.optional(ie.string()),description:ie.optional(ie.string()),default:ie.optional(ie.boolean())}).passthrough(),mwi=ie.object({type:ie.literal("string"),title:ie.optional(ie.string()),description:ie.optional(ie.string()),minLength:ie.optional(ie.number()),maxLength:ie.optional(ie.number()),format:ie.optional(ie.enum(["email","uri","date","date-time"]))}).passthrough(),gwi=ie.object({type:ie.enum(["number","integer"]),title:ie.optional(ie.string()),description:ie.optional(ie.string()),minimum:ie.optional(ie.number()),maximum:ie.optional(ie.number())}).passthrough(),Awi=ie.object({type:ie.literal("string"),title:ie.optional(ie.string()),description:ie.optional(ie.string()),enum:ie.array(ie.string()),enumNames:ie.optional(ie.array(ie.string()))}).passthrough(),ywi=ie.union([hwi,mwi,gwi,Awi]),Ewi=i3.extend({method:ie.literal("elicitation/create"),params:l4.extend({message:ie.string(),requestedSchema:ie.object({type:ie.literal("object"),properties:ie.record(ie.string(),ywi),required:ie.optional(ie.array(ie.string()))}).passthrough()})}),vwi=u4.extend({action:ie.enum(["accept","decline","cancel"]),content:ie.optional(ie.record(ie.string(),ie.unknown()))}),Cwi=ie.object({type:ie.literal("ref/resource"),uri:ie.string()}).passthrough(),bwi=ie.object({type:ie.literal("ref/prompt"),name:ie.string()}).passthrough(),_wi=i3.extend({method:ie.literal("completion/complete"),params:l4.extend({ref:ie.union([bwi,Cwi]),argument:ie.object({name:ie.string(),value:ie.string()}).passthrough(),context:ie.optional(ie.object({arguments:ie.optional(ie.record(ie.string(),ie.string()))}))})}),ist=u4.extend({completion:ie.object({values:ie.array(ie.string()).max(100),total:ie.optional(ie.number().int()),hasMore:ie.optional(ie.boolean())}).passthrough()}),Swi=ie.object({uri:ie.string().startsWith("file://"),name:ie.optional(ie.string()),_meta:ie.optional(ie.object({}).passthrough())}).passthrough(),Xbe=i3.extend({method:ie.literal("roots/list")}),xwi=u4.extend({roots:ie.array(Swi)}),wwi=W_.extend({method:ie.literal("notifications/roots/list_changed")}),laa=ie.union([jbe,L8i,_wi,awi,J8i,K8i,q8i,H8i,G8i,$8i,W8i,owi,iwi]),uaa=ie.union([Wbe,zbe,Odr,wwi]),daa=ie.union([yM,pwi,vwi,xwi]),faa=ie.union([jbe,fwi,Ewi,Xbe]),paa=ie.union([Wbe,zbe,cwi,j8i,V8i,swi,twi]),haa=ie.union([yM,Yot,ist,Wce,$ce,Jot,Xot,Zot,Jbe,nst]),c4=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function qdr(t,e){return Object.entries(e).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...t})}var Twi,Zbe,Hdr=Z(()=>{OD();Twi=6e4,Zbe=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Wbe,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(zbe,r=>{this._onprogress(r)}),this.setRequestHandler(jbe,r=>({}))}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new c4(a4.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let o=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),Gce(c)||Bdr(c)?this._onresponse(c):$be(c)?this._onrequest(c,u):Idr(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new c4(a4.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;let o=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,s=this._transport;if(o===void 0){s?.send({jsonrpc:"2.0",id:e.id,error:{code:a4.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let c={signal:a.signal,sessionId:s?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,f)=>this.request(u,d,{...f,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>o(e,c)).then(u=>{if(!a.signal.aborted)return s?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var d;if(!a.signal.aborted)return s?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:a4.InternalError,message:(d=u.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){s(c);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Gce(e))n(e);else{let i=new c4(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}=n??{};return new Promise((a,c)=>{var u,d,f,p,h,m;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=n?.signal)===null||d===void 0||d.throwIfAborted();let A=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:A};n?.onprogress&&(this._progressHandlers.set(A,n.onprogress),g.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:A}});let y=C=>{var x;this._responseHandlers.delete(A),this._progressHandlers.delete(A),this._cleanupTimeout(A),(x=this._transport)===null||x===void 0||x.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:A,reason:String(C)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(R=>this._onerror(new Error(`Failed to send cancellation: ${R}`))),c(C)};this._responseHandlers.set(A,C=>{var x;if(!(!((x=n?.signal)===null||x===void 0)&&x.aborted)){if(C instanceof Error)return c(C);try{let R=r.parse(C.result);a(R)}catch(R){c(R)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var C;y((C=n?.signal)===null||C===void 0?void 0:C.reason)});let E=(h=n?.timeout)!==null&&h!==void 0?h:Twi,v=()=>y(new c4(a4.RequestTimeout,"Request timed out",{timeout:E}));this._setupTimeout(A,E,n?.maxTotalTimeout,v,(m=n?.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(g,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(C=>{this._cleanupTimeout(A),c(C)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(d=>this._onerror(d))});return}let a={...e,jsonrpc:"2.0"};await this._transport.send(a,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>Promise.resolve(r(e.parse(i),o)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}});var Vdr=T((e5e,Gdr)=>{(function(t,e){typeof e5e=="object"&&typeof Gdr<"u"?e(e5e):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(e5e,(function(t){"use strict";function e(){for(var ut=arguments.length,Ke=Array(ut),pt=0;pt<ut;pt++)Ke[pt]=arguments[pt];if(Ke.length>1){Ke[0]=Ke[0].slice(0,-1);for(var It=Ke.length-1,Rt=1;Rt<It;++Rt)Ke[Rt]=Ke[Rt].slice(1,-1);return Ke[It]=Ke[It].slice(1),Ke.join("")}else return Ke[0]}function r(ut){return"(?:"+ut+")"}function n(ut){return ut===void 0?"undefined":ut===null?"null":Object.prototype.toString.call(ut).split(" ").pop().split("]").shift().toLowerCase()}function i(ut){return ut.toUpperCase()}function o(ut){return ut!=null?ut instanceof Array?ut:typeof ut.length!="number"||ut.split||ut.setInterval||ut.call?[ut]:Array.prototype.slice.call(ut):[]}function s(ut,Ke){var pt=ut;if(Ke)for(var It in Ke)pt[It]=Ke[It];return pt}function a(ut){var Ke="[A-Za-z]",pt="[\\x0D]",It="[0-9]",Rt="[\\x22]",Ar=e(It,"[A-Fa-f]"),Wr="[\\x0A]",pn="[\\x20]",Wn=r(r("%[EFef]"+Ar+"%"+Ar+Ar+"%"+Ar+Ar)+"|"+r("%[89A-Fa-f]"+Ar+"%"+Ar+Ar)+"|"+r("%"+Ar+Ar)),Ji="[\\:\\/\\?\\#\\[\\]\\@]",qi="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Bo=e(Ji,qi),No=ut?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",li=ut?"[\\uE000-\\uF8FF]":"[]",uo=e(Ke,It,"[\\-\\.\\_\\~]",No),Ns=r(Ke+e(Ke,It,"[\\+\\-\\.]")+"*"),ns=r(r(Wn+"|"+e(uo,qi,"[\\:]"))+"*"),Zl=r(r("25[0-5]")+"|"+r("2[0-4]"+It)+"|"+r("1"+It+It)+"|"+r("[1-9]"+It)+"|"+It),Hc=r(r("25[0-5]")+"|"+r("2[0-4]"+It)+"|"+r("1"+It+It)+"|"+r("0?[1-9]"+It)+"|0?0?"+It),eu=r(Hc+"\\."+Hc+"\\."+Hc+"\\."+Hc),Wo=r(Ar+"{1,4}"),Wu=r(r(Wo+"\\:"+Wo)+"|"+eu),Ss=r(r(Wo+"\\:")+"{6}"+Wu),bo=r("\\:\\:"+r(Wo+"\\:")+"{5}"+Wu),dp=r(r(Wo)+"?\\:\\:"+r(Wo+"\\:")+"{4}"+Wu),ju=r(r(r(Wo+"\\:")+"{0,1}"+Wo)+"?\\:\\:"+r(Wo+"\\:")+"{3}"+Wu),fp=r(r(r(Wo+"\\:")+"{0,2}"+Wo)+"?\\:\\:"+r(Wo+"\\:")+"{2}"+Wu),pp=r(r(r(Wo+"\\:")+"{0,3}"+Wo)+"?\\:\\:"+Wo+"\\:"+Wu),Gc=r(r(r(Wo+"\\:")+"{0,4}"+Wo)+"?\\:\\:"+Wu),Ga=r(r(r(Wo+"\\:")+"{0,5}"+Wo)+"?\\:\\:"+Wo),zu=r(r(r(Wo+"\\:")+"{0,6}"+Wo)+"?\\:\\:"),Ve=r([Ss,bo,dp,ju,fp,pp,Gc,Ga,zu].join("|")),je=r(r(uo+"|"+Wn)+"+"),vt=r(Ve+"\\%25"+je),wt=r(Ve+r("\\%25|\\%(?!"+Ar+"{2})")+je),Ot=r("[vV]"+Ar+"+\\."+e(uo,qi,"[\\:]")+"+"),tr=r("\\["+r(wt+"|"+Ve+"|"+Ot)+"\\]"),Er=r(r(Wn+"|"+e(uo,qi))+"*"),br=r(tr+"|"+eu+"(?!"+Er+")|"+Er),$r=r(It+"*"),Ur=r(r(ns+"@")+"?"+br+r("\\:"+$r)+"?"),Xr=r(Wn+"|"+e(uo,qi,"[\\:\\@]")),Ai=r(Xr+"*"),fo=r(Xr+"+"),Ba=r(r(Wn+"|"+e(uo,qi,"[\\@]"))+"+"),ao=r(r("\\/"+Ai)+"*"),Va=r("\\/"+r(fo+ao)+"?"),Yu=r(Ba+ao),bm=r(fo+ao),Su="(?!"+Xr+")",gv=r(ao+"|"+Va+"|"+Yu+"|"+bm+"|"+Su),hp=r(r(Xr+"|"+e("[\\/\\?]",li))+"*"),Bh=r(r(Xr+"|[\\/\\?]")+"*"),p1=r(r("\\/\\/"+Ur+ao)+"|"+Va+"|"+bm+"|"+Su),AC=r(Ns+"\\:"+p1+r("\\?"+hp)+"?"+r("\\#"+Bh)+"?"),vy=r(r("\\/\\/"+Ur+ao)+"|"+Va+"|"+Yu+"|"+Su),nf=r(vy+r("\\?"+hp)+"?"+r("\\#"+Bh)+"?"),kA=r(AC+"|"+nf),k0=r(Ns+"\\:"+p1+r("\\?"+hp)+"?"),h1="^("+Ns+")\\:"+r(r("\\/\\/("+r("("+ns+")@")+"?("+br+")"+r("\\:("+$r+")")+"?)")+"?("+ao+"|"+Va+"|"+bm+"|"+Su+")")+r("\\?("+hp+")")+"?"+r("\\#("+Bh+")")+"?$",Xp="^(){0}"+r(r("\\/\\/("+r("("+ns+")@")+"?("+br+")"+r("\\:("+$r+")")+"?)")+"?("+ao+"|"+Va+"|"+Yu+"|"+Su+")")+r("\\?("+hp+")")+"?"+r("\\#("+Bh+")")+"?$",Nh="^("+Ns+")\\:"+r(r("\\/\\/("+r("("+ns+")@")+"?("+br+")"+r("\\:("+$r+")")+"?)")+"?("+ao+"|"+Va+"|"+bm+"|"+Su+")")+r("\\?("+hp+")")+"?$",of="^"+r("\\#("+Bh+")")+"?$",Av="^"+r("("+ns+")@")+"?("+br+")"+r("\\:("+$r+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",Ke,It,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",uo,qi),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",uo,qi),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",uo,qi),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",uo,qi),"g"),NOT_QUERY:new RegExp(e("[^\\%]",uo,qi,"[\\:\\@\\/\\?]",li),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",uo,qi,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",uo,qi),"g"),UNRESERVED:new RegExp(uo,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",uo,Bo),"g"),PCT_ENCODED:new RegExp(Wn,"g"),IPV4ADDRESS:new RegExp("^("+eu+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Ve+")"+r(r("\\%25|\\%(?!"+Ar+"{2})")+"("+je+")")+"?\\]?$")}}var c=a(!1),u=a(!0),d=(function(){function ut(Ke,pt){var It=[],Rt=!0,Ar=!1,Wr=void 0;try{for(var pn=Ke[Symbol.iterator](),Wn;!(Rt=(Wn=pn.next()).done)&&(It.push(Wn.value),!(pt&&It.length===pt));Rt=!0);}catch(Ji){Ar=!0,Wr=Ji}finally{try{!Rt&&pn.return&&pn.return()}finally{if(Ar)throw Wr}}return It}return function(Ke,pt){if(Array.isArray(Ke))return Ke;if(Symbol.iterator in Object(Ke))return ut(Ke,pt);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),f=function(ut){if(Array.isArray(ut)){for(var Ke=0,pt=Array(ut.length);Ke<ut.length;Ke++)pt[Ke]=ut[Ke];return pt}else return Array.from(ut)},p=2147483647,h=36,m=1,A=26,g=38,y=700,E=72,v=128,C="-",x=/^xn--/,R=/[^\0-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,P={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=h-m,O=Math.floor,N=String.fromCharCode;function F(ut){throw new RangeError(P[ut])}function M(ut,Ke){for(var pt=[],It=ut.length;It--;)pt[It]=Ke(ut[It]);return pt}function k(ut,Ke){var pt=ut.split("@"),It="";pt.length>1&&(It=pt[0]+"@",ut=pt[1]),ut=ut.replace(D,".");var Rt=ut.split("."),Ar=M(Rt,Ke).join(".");return It+Ar}function G(ut){for(var Ke=[],pt=0,It=ut.length;pt<It;){var Rt=ut.charCodeAt(pt++);if(Rt>=55296&&Rt<=56319&&pt<It){var Ar=ut.charCodeAt(pt++);(Ar&64512)==56320?Ke.push(((Rt&1023)<<10)+(Ar&1023)+65536):(Ke.push(Rt),pt--)}else Ke.push(Rt)}return Ke}var q=function(Ke){return String.fromCodePoint.apply(String,f(Ke))},W=function(Ke){return Ke-48<10?Ke-22:Ke-65<26?Ke-65:Ke-97<26?Ke-97:h},V=function(Ke,pt){return Ke+22+75*(Ke<26)-((pt!=0)<<5)},Q=function(Ke,pt,It){var Rt=0;for(Ke=It?O(Ke/y):Ke>>1,Ke+=O(Ke/pt);Ke>w*A>>1;Rt+=h)Ke=O(Ke/w);return O(Rt+(w+1)*Ke/(Ke+g))},j=function(Ke){var pt=[],It=Ke.length,Rt=0,Ar=v,Wr=E,pn=Ke.lastIndexOf(C);pn<0&&(pn=0);for(var Wn=0;Wn<pn;++Wn)Ke.charCodeAt(Wn)>=128&&F("not-basic"),pt.push(Ke.charCodeAt(Wn));for(var Ji=pn>0?pn+1:0;Ji<It;){for(var qi=Rt,Bo=1,No=h;;No+=h){Ji>=It&&F("invalid-input");var li=W(Ke.charCodeAt(Ji++));(li>=h||li>O((p-Rt)/Bo))&&F("overflow"),Rt+=li*Bo;var uo=No<=Wr?m:No>=Wr+A?A:No-Wr;if(li<uo)break;var Ns=h-uo;Bo>O(p/Ns)&&F("overflow"),Bo*=Ns}var ns=pt.length+1;Wr=Q(Rt-qi,ns,qi==0),O(Rt/ns)>p-Ar&&F("overflow"),Ar+=O(Rt/ns),Rt%=ns,pt.splice(Rt++,0,Ar)}return String.fromCodePoint.apply(String,pt)},ee=function(Ke){var pt=[];Ke=G(Ke);var It=Ke.length,Rt=v,Ar=0,Wr=E,pn=!0,Wn=!1,Ji=void 0;try{for(var qi=Ke[Symbol.iterator](),Bo;!(pn=(Bo=qi.next()).done);pn=!0){var No=Bo.value;No<128&&pt.push(N(No))}}catch(wt){Wn=!0,Ji=wt}finally{try{!pn&&qi.return&&qi.return()}finally{if(Wn)throw Ji}}var li=pt.length,uo=li;for(li&&pt.push(C);uo<It;){var Ns=p,ns=!0,Zl=!1,Hc=void 0;try{for(var eu=Ke[Symbol.iterator](),Wo;!(ns=(Wo=eu.next()).done);ns=!0){var Wu=Wo.value;Wu>=Rt&&Wu<Ns&&(Ns=Wu)}}catch(wt){Zl=!0,Hc=wt}finally{try{!ns&&eu.return&&eu.return()}finally{if(Zl)throw Hc}}var Ss=uo+1;Ns-Rt>O((p-Ar)/Ss)&&F("overflow"),Ar+=(Ns-Rt)*Ss,Rt=Ns;var bo=!0,dp=!1,ju=void 0;try{for(var fp=Ke[Symbol.iterator](),pp;!(bo=(pp=fp.next()).done);bo=!0){var Gc=pp.value;if(Gc<Rt&&++Ar>p&&F("overflow"),Gc==Rt){for(var Ga=Ar,zu=h;;zu+=h){var Ve=zu<=Wr?m:zu>=Wr+A?A:zu-Wr;if(Ga<Ve)break;var je=Ga-Ve,vt=h-Ve;pt.push(N(V(Ve+je%vt,0))),Ga=O(je/vt)}pt.push(N(V(Ga,0))),Wr=Q(Ar,Ss,uo==li),Ar=0,++uo}}}catch(wt){dp=!0,ju=wt}finally{try{!bo&&fp.return&&fp.return()}finally{if(dp)throw ju}}++Ar,++Rt}return pt.join("")},le=function(Ke){return k(Ke,function(pt){return x.test(pt)?j(pt.slice(4).toLowerCase()):pt})},J=function(Ke){return k(Ke,function(pt){return R.test(pt)?"xn--"+ee(pt):pt})},he={version:"2.1.0",ucs2:{decode:G,encode:q},decode:j,encode:ee,toASCII:J,toUnicode:le},ye={};function oe(ut){var Ke=ut.charCodeAt(0),pt=void 0;return Ke<16?pt="%0"+Ke.toString(16).toUpperCase():Ke<128?pt="%"+Ke.toString(16).toUpperCase():Ke<2048?pt="%"+(Ke>>6|192).toString(16).toUpperCase()+"%"+(Ke&63|128).toString(16).toUpperCase():pt="%"+(Ke>>12|224).toString(16).toUpperCase()+"%"+(Ke>>6&63|128).toString(16).toUpperCase()+"%"+(Ke&63|128).toString(16).toUpperCase(),pt}function ge(ut){for(var Ke="",pt=0,It=ut.length;pt<It;){var Rt=parseInt(ut.substr(pt+1,2),16);if(Rt<128)Ke+=String.fromCharCode(Rt),pt+=3;else if(Rt>=194&&Rt<224){if(It-pt>=6){var Ar=parseInt(ut.substr(pt+4,2),16);Ke+=String.fromCharCode((Rt&31)<<6|Ar&63)}else Ke+=ut.substr(pt,6);pt+=6}else if(Rt>=224){if(It-pt>=9){var Wr=parseInt(ut.substr(pt+4,2),16),pn=parseInt(ut.substr(pt+7,2),16);Ke+=String.fromCharCode((Rt&15)<<12|(Wr&63)<<6|pn&63)}else Ke+=ut.substr(pt,9);pt+=9}else Ke+=ut.substr(pt,3),pt+=3}return Ke}function ne(ut,Ke){function pt(It){var Rt=ge(It);return Rt.match(Ke.UNRESERVED)?Rt:It}return ut.scheme&&(ut.scheme=String(ut.scheme).replace(Ke.PCT_ENCODED,pt).toLowerCase().replace(Ke.NOT_SCHEME,"")),ut.userinfo!==void 0&&(ut.userinfo=String(ut.userinfo).replace(Ke.PCT_ENCODED,pt).replace(Ke.NOT_USERINFO,oe).replace(Ke.PCT_ENCODED,i)),ut.host!==void 0&&(ut.host=String(ut.host).replace(Ke.PCT_ENCODED,pt).toLowerCase().replace(Ke.NOT_HOST,oe).replace(Ke.PCT_ENCODED,i)),ut.path!==void 0&&(ut.path=String(ut.path).replace(Ke.PCT_ENCODED,pt).replace(ut.scheme?Ke.NOT_PATH:Ke.NOT_PATH_NOSCHEME,oe).replace(Ke.PCT_ENCODED,i)),ut.query!==void 0&&(ut.query=String(ut.query).replace(Ke.PCT_ENCODED,pt).replace(Ke.NOT_QUERY,oe).replace(Ke.PCT_ENCODED,i)),ut.fragment!==void 0&&(ut.fragment=String(ut.fragment).replace(Ke.PCT_ENCODED,pt).replace(Ke.NOT_FRAGMENT,oe).replace(Ke.PCT_ENCODED,i)),ut}function te(ut){return ut.replace(/^0*(.*)/,"$1")||"0"}function de(ut,Ke){var pt=ut.match(Ke.IPV4ADDRESS)||[],It=d(pt,2),Rt=It[1];return Rt?Rt.split(".").map(te).join("."):ut}function ae(ut,Ke){var pt=ut.match(Ke.IPV6ADDRESS)||[],It=d(pt,3),Rt=It[1],Ar=It[2];if(Rt){for(var Wr=Rt.toLowerCase().split("::").reverse(),pn=d(Wr,2),Wn=pn[0],Ji=pn[1],qi=Ji?Ji.split(":").map(te):[],Bo=Wn.split(":").map(te),No=Ke.IPV4ADDRESS.test(Bo[Bo.length-1]),li=No?7:8,uo=Bo.length-li,Ns=Array(li),ns=0;ns<li;++ns)Ns[ns]=qi[ns]||Bo[uo+ns]||"";No&&(Ns[li-1]=de(Ns[li-1],Ke));var Zl=Ns.reduce(function(Ss,bo,dp){if(!bo||bo==="0"){var ju=Ss[Ss.length-1];ju&&ju.index+ju.length===dp?ju.length++:Ss.push({index:dp,length:1})}return Ss},[]),Hc=Zl.sort(function(Ss,bo){return bo.length-Ss.length})[0],eu=void 0;if(Hc&&Hc.length>1){var Wo=Ns.slice(0,Hc.index),Wu=Ns.slice(Hc.index+Hc.length);eu=Wo.join(":")+"::"+Wu.join(":")}else eu=Ns.join(":");return Ar&&(eu+="%"+Ar),eu}else return ut}var ce=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Ae="".match(/(){0}/)[1]===void 0;function se(ut){var Ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pt={},It=Ke.iri!==!1?u:c;Ke.reference==="suffix"&&(ut=(Ke.scheme?Ke.scheme+":":"")+"//"+ut);var Rt=ut.match(ce);if(Rt){Ae?(pt.scheme=Rt[1],pt.userinfo=Rt[3],pt.host=Rt[4],pt.port=parseInt(Rt[5],10),pt.path=Rt[6]||"",pt.query=Rt[7],pt.fragment=Rt[8],isNaN(pt.port)&&(pt.port=Rt[5])):(pt.scheme=Rt[1]||void 0,pt.userinfo=ut.indexOf("@")!==-1?Rt[3]:void 0,pt.host=ut.indexOf("//")!==-1?Rt[4]:void 0,pt.port=parseInt(Rt[5],10),pt.path=Rt[6]||"",pt.query=ut.indexOf("?")!==-1?Rt[7]:void 0,pt.fragment=ut.indexOf("#")!==-1?Rt[8]:void 0,isNaN(pt.port)&&(pt.port=ut.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?Rt[4]:void 0)),pt.host&&(pt.host=ae(de(pt.host,It),It)),pt.scheme===void 0&&pt.userinfo===void 0&&pt.host===void 0&&pt.port===void 0&&!pt.path&&pt.query===void 0?pt.reference="same-document":pt.scheme===void 0?pt.reference="relative":pt.fragment===void 0?pt.reference="absolute":pt.reference="uri",Ke.reference&&Ke.reference!=="suffix"&&Ke.reference!==pt.reference&&(pt.error=pt.error||"URI is not a "+Ke.reference+" reference.");var Ar=ye[(Ke.scheme||pt.scheme||"").toLowerCase()];if(!Ke.unicodeSupport&&(!Ar||!Ar.unicodeSupport)){if(pt.host&&(Ke.domainHost||Ar&&Ar.domainHost))try{pt.host=he.toASCII(pt.host.replace(It.PCT_ENCODED,ge).toLowerCase())}catch(Wr){pt.error=pt.error||"Host's domain name can not be converted to ASCII via punycode: "+Wr}ne(pt,c)}else ne(pt,It);Ar&&Ar.parse&&Ar.parse(pt,Ke)}else pt.error=pt.error||"URI can not be parsed.";return pt}function Y(ut,Ke){var pt=Ke.iri!==!1?u:c,It=[];return ut.userinfo!==void 0&&(It.push(ut.userinfo),It.push("@")),ut.host!==void 0&&It.push(ae(de(String(ut.host),pt),pt).replace(pt.IPV6ADDRESS,function(Rt,Ar,Wr){return"["+Ar+(Wr?"%25"+Wr:"")+"]"})),(typeof ut.port=="number"||typeof ut.port=="string")&&(It.push(":"),It.push(String(ut.port))),It.length?It.join(""):void 0}var K=/^\.\.?\//,be=/^\/\.(\/|$)/,_e=/^\/\.\.(\/|$)/,X=/^\/?(?:.|\n)*?(?=\/|$)/;function xe(ut){for(var Ke=[];ut.length;)if(ut.match(K))ut=ut.replace(K,"");else if(ut.match(be))ut=ut.replace(be,"/");else if(ut.match(_e))ut=ut.replace(_e,"/"),Ke.pop();else if(ut==="."||ut==="..")ut="";else{var pt=ut.match(X);if(pt){var It=pt[0];ut=ut.slice(It.length),Ke.push(It)}else throw new Error("Unexpected dot segment condition")}return Ke.join("")}function Le(ut){var Ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pt=Ke.iri?u:c,It=[],Rt=ye[(Ke.scheme||ut.scheme||"").toLowerCase()];if(Rt&&Rt.serialize&&Rt.serialize(ut,Ke),ut.host&&!pt.IPV6ADDRESS.test(ut.host)){if(Ke.domainHost||Rt&&Rt.domainHost)try{ut.host=Ke.iri?he.toUnicode(ut.host):he.toASCII(ut.host.replace(pt.PCT_ENCODED,ge).toLowerCase())}catch(pn){ut.error=ut.error||"Host's domain name can not be converted to "+(Ke.iri?"Unicode":"ASCII")+" via punycode: "+pn}}ne(ut,pt),Ke.reference!=="suffix"&&ut.scheme&&(It.push(ut.scheme),It.push(":"));var Ar=Y(ut,Ke);if(Ar!==void 0&&(Ke.reference!=="suffix"&&It.push("//"),It.push(Ar),ut.path&&ut.path.charAt(0)!=="/"&&It.push("/")),ut.path!==void 0){var Wr=ut.path;!Ke.absolutePath&&(!Rt||!Rt.absolutePath)&&(Wr=xe(Wr)),Ar===void 0&&(Wr=Wr.replace(/^\/\//,"/%2F")),It.push(Wr)}return ut.query!==void 0&&(It.push("?"),It.push(ut.query)),ut.fragment!==void 0&&(It.push("#"),It.push(ut.fragment)),It.join("")}function Ue(ut,Ke){var pt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},It=arguments[3],Rt={};return It||(ut=se(Le(ut,pt),pt),Ke=se(Le(Ke,pt),pt)),pt=pt||{},!pt.tolerant&&Ke.scheme?(Rt.scheme=Ke.scheme,Rt.userinfo=Ke.userinfo,Rt.host=Ke.host,Rt.port=Ke.port,Rt.path=xe(Ke.path||""),Rt.query=Ke.query):(Ke.userinfo!==void 0||Ke.host!==void 0||Ke.port!==void 0?(Rt.userinfo=Ke.userinfo,Rt.host=Ke.host,Rt.port=Ke.port,Rt.path=xe(Ke.path||""),Rt.query=Ke.query):(Ke.path?(Ke.path.charAt(0)==="/"?Rt.path=xe(Ke.path):((ut.userinfo!==void 0||ut.host!==void 0||ut.port!==void 0)&&!ut.path?Rt.path="/"+Ke.path:ut.path?Rt.path=ut.path.slice(0,ut.path.lastIndexOf("/")+1)+Ke.path:Rt.path=Ke.path,Rt.path=xe(Rt.path)),Rt.query=Ke.query):(Rt.path=ut.path,Ke.query!==void 0?Rt.query=Ke.query:Rt.query=ut.query),Rt.userinfo=ut.userinfo,Rt.host=ut.host,Rt.port=ut.port),Rt.scheme=ut.scheme),Rt.fragment=Ke.fragment,Rt}function He(ut,Ke,pt){var It=s({scheme:"null"},pt);return Le(Ue(se(ut,It),se(Ke,It),It,!0),It)}function ue(ut,Ke){return typeof ut=="string"?ut=Le(se(ut,Ke),Ke):n(ut)==="object"&&(ut=se(Le(ut,Ke),Ke)),ut}function Be(ut,Ke,pt){return typeof ut=="string"?ut=Le(se(ut,pt),pt):n(ut)==="object"&&(ut=Le(ut,pt)),typeof Ke=="string"?Ke=Le(se(Ke,pt),pt):n(Ke)==="object"&&(Ke=Le(Ke,pt)),ut===Ke}function Oe(ut,Ke){return ut&&ut.toString().replace(!Ke||!Ke.iri?c.ESCAPE:u.ESCAPE,oe)}function Me(ut,Ke){return ut&&ut.toString().replace(!Ke||!Ke.iri?c.PCT_ENCODED:u.PCT_ENCODED,ge)}var ke={scheme:"http",domainHost:!0,parse:function(Ke,pt){return Ke.host||(Ke.error=Ke.error||"HTTP URIs must have a host."),Ke},serialize:function(Ke,pt){var It=String(Ke.scheme).toLowerCase()==="https";return(Ke.port===(It?443:80)||Ke.port==="")&&(Ke.port=void 0),Ke.path||(Ke.path="/"),Ke}},Pe={scheme:"https",domainHost:ke.domainHost,parse:ke.parse,serialize:ke.serialize};function Ge(ut){return typeof ut.secure=="boolean"?ut.secure:String(ut.scheme).toLowerCase()==="wss"}var Ye={scheme:"ws",domainHost:!0,parse:function(Ke,pt){var It=Ke;return It.secure=Ge(It),It.resourceName=(It.path||"/")+(It.query?"?"+It.query:""),It.path=void 0,It.query=void 0,It},serialize:function(Ke,pt){if((Ke.port===(Ge(Ke)?443:80)||Ke.port==="")&&(Ke.port=void 0),typeof Ke.secure=="boolean"&&(Ke.scheme=Ke.secure?"wss":"ws",Ke.secure=void 0),Ke.resourceName){var It=Ke.resourceName.split("?"),Rt=d(It,2),Ar=Rt[0],Wr=Rt[1];Ke.path=Ar&&Ar!=="/"?Ar:void 0,Ke.query=Wr,Ke.resourceName=void 0}return Ke.fragment=void 0,Ke}},ft={scheme:"wss",domainHost:Ye.domainHost,parse:Ye.parse,serialize:Ye.serialize},$t={},sr=!0,Ie="[A-Za-z0-9\\-\\.\\_\\~"+(sr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Re="[0-9A-Fa-f]",Qe=r(r("%[EFef]"+Re+"%"+Re+Re+"%"+Re+Re)+"|"+r("%[89A-Fa-f]"+Re+"%"+Re+Re)+"|"+r("%"+Re+Re)),at="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ze="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",rt=e(Ze,'[\\"\\\\]'),Et="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ht=new RegExp(Ie,"g"),Tt=new RegExp(Qe,"g"),Yt=new RegExp(e("[^]",at,"[\\.]",'[\\"]',rt),"g"),ar=new RegExp(e("[^]",Ie,Et),"g"),Jt=ar;function xr(ut){var Ke=ge(ut);return Ke.match(ht)?Ke:ut}var tn={scheme:"mailto",parse:function(Ke,pt){var It=Ke,Rt=It.to=It.path?It.path.split(","):[];if(It.path=void 0,It.query){for(var Ar=!1,Wr={},pn=It.query.split("&"),Wn=0,Ji=pn.length;Wn<Ji;++Wn){var qi=pn[Wn].split("=");switch(qi[0]){case"to":for(var Bo=qi[1].split(","),No=0,li=Bo.length;No<li;++No)Rt.push(Bo[No]);break;case"subject":It.subject=Me(qi[1],pt);break;case"body":It.body=Me(qi[1],pt);break;default:Ar=!0,Wr[Me(qi[0],pt)]=Me(qi[1],pt);break}}Ar&&(It.headers=Wr)}It.query=void 0;for(var uo=0,Ns=Rt.length;uo<Ns;++uo){var ns=Rt[uo].split("@");if(ns[0]=Me(ns[0]),pt.unicodeSupport)ns[1]=Me(ns[1],pt).toLowerCase();else try{ns[1]=he.toASCII(Me(ns[1],pt).toLowerCase())}catch(Zl){It.error=It.error||"Email address's domain name can not be converted to ASCII via punycode: "+Zl}Rt[uo]=ns.join("@")}return It},serialize:function(Ke,pt){var It=Ke,Rt=o(Ke.to);if(Rt){for(var Ar=0,Wr=Rt.length;Ar<Wr;++Ar){var pn=String(Rt[Ar]),Wn=pn.lastIndexOf("@"),Ji=pn.slice(0,Wn).replace(Tt,xr).replace(Tt,i).replace(Yt,oe),qi=pn.slice(Wn+1);try{qi=pt.iri?he.toUnicode(qi):he.toASCII(Me(qi,pt).toLowerCase())}catch(uo){It.error=It.error||"Email address's domain name can not be converted to "+(pt.iri?"Unicode":"ASCII")+" via punycode: "+uo}Rt[Ar]=Ji+"@"+qi}It.path=Rt.join(",")}var Bo=Ke.headers=Ke.headers||{};Ke.subject&&(Bo.subject=Ke.subject),Ke.body&&(Bo.body=Ke.body);var No=[];for(var li in Bo)Bo[li]!==$t[li]&&No.push(li.replace(Tt,xr).replace(Tt,i).replace(ar,oe)+"="+Bo[li].replace(Tt,xr).replace(Tt,i).replace(Jt,oe));return No.length&&(It.query=No.join("&")),It}},Jr=/^([^\:]+)\:(.*)/,dn={scheme:"urn",parse:function(Ke,pt){var It=Ke.path&&Ke.path.match(Jr),Rt=Ke;if(It){var Ar=pt.scheme||Rt.scheme||"urn",Wr=It[1].toLowerCase(),pn=It[2],Wn=Ar+":"+(pt.nid||Wr),Ji=ye[Wn];Rt.nid=Wr,Rt.nss=pn,Rt.path=void 0,Ji&&(Rt=Ji.parse(Rt,pt))}else Rt.error=Rt.error||"URN can not be parsed.";return Rt},serialize:function(Ke,pt){var It=pt.scheme||Ke.scheme||"urn",Rt=Ke.nid,Ar=It+":"+(pt.nid||Rt),Wr=ye[Ar];Wr&&(Ke=Wr.serialize(Ke,pt));var pn=Ke,Wn=Ke.nss;return pn.path=(Rt||pt.nid)+":"+Wn,pn}},Ui=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Qi={scheme:"urn:uuid",parse:function(Ke,pt){var It=Ke;return It.uuid=It.nss,It.nss=void 0,!pt.tolerant&&(!It.uuid||!It.uuid.match(Ui))&&(It.error=It.error||"UUID is not valid."),It},serialize:function(Ke,pt){var It=Ke;return It.nss=(Ke.uuid||"").toLowerCase(),It}};ye[ke.scheme]=ke,ye[Pe.scheme]=Pe,ye[Ye.scheme]=Ye,ye[ft.scheme]=ft,ye[tn.scheme]=tn,ye[dn.scheme]=dn,ye[Qi.scheme]=Qi,t.SCHEMES=ye,t.pctEncChar=oe,t.pctDecChars=ge,t.parse=se,t.removeDotSegments=xe,t.serialize=Le,t.resolveComponents=Ue,t.resolve=He,t.normalize=ue,t.equal=Be,t.escapeComponent=Oe,t.unescapeComponent=Me,Object.defineProperty(t,"__esModule",{value:!0})}))});var Tj=T((yaa,$dr)=>{"use strict";$dr.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var jdr=T((Eaa,Wdr)=>{"use strict";Wdr.exports=function(e){for(var r=0,n=e.length,i=0,o;i<n;)r++,o=e.charCodeAt(i++),o>=55296&&o<=56319&&i<n&&(o=e.charCodeAt(i),(o&64512)==56320&&i++);return r}});var EM=T((vaa,Kdr)=>{"use strict";Kdr.exports={copy:Iwi,checkDataType:ost,checkDataTypes:Dwi,coerceToTypes:Rwi,toHash:ast,getProperty:cst,escapeQuotes:lst,equal:Tj(),ucs2length:jdr(),varOccurences:Owi,varReplace:kwi,schemaHasRules:Pwi,schemaHasRulesExcept:Mwi,schemaUnknownRules:Lwi,toQuotedString:sst,getPathExpr:Fwi,getPath:Uwi,getData:Hwi,unescapeFragment:Gwi,unescapeJsonPointer:dst,escapeFragment:Vwi,escapeJsonPointer:ust};function Iwi(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function ost(t,e,r,n){var i=n?" !== ":" === ",o=n?" || ":" && ",s=n?"!":"",a=n?"":"!";switch(t){case"null":return e+i+"null";case"array":return s+"Array.isArray("+e+")";case"object":return"("+s+e+o+"typeof "+e+i+'"object"'+o+a+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+i+'"number"'+o+a+"("+e+" % 1)"+o+e+i+e+(r?o+s+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+i+'"'+t+'"'+(r?o+s+"isFinite("+e+")":"")+")";default:return"typeof "+e+i+'"'+t+'"'}}function Dwi(t,e,r){switch(t.length){case 1:return ost(t[0],e,r,!0);default:var n="",i=ast(t);i.array&&i.object&&(n=i.null?"(":"(!"+e+" || ",n+="typeof "+e+' !== "object")',delete i.null,delete i.array,delete i.object),i.number&&delete i.integer;for(var o in i)n+=(n?" && ":"")+ost(o,e,r,!0);return n}}var zdr=ast(["string","number","integer","boolean","null"]);function Rwi(t,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var i=e[n];(zdr[i]||t==="array"&&i==="array")&&(r[r.length]=i)}if(r.length)return r}else{if(zdr[e])return[e];if(t==="array"&&e==="array")return["array"]}}function ast(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var Bwi=/^[a-z$_][a-z$_0-9]*$/i,Nwi=/'|\\/g;function cst(t){return typeof t=="number"?"["+t+"]":Bwi.test(t)?"."+t:"['"+lst(t)+"']"}function lst(t){return t.replace(Nwi,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Owi(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function kwi(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function Pwi(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function Mwi(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var n in t)if(n!=r&&e[n])return!0}function Lwi(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function sst(t){return"'"+lst(t)+"'"}function Fwi(t,e,r,n){var i=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Ydr(t,i)}function Uwi(t,e,r){var n=sst(r?"/"+ust(e):cst(e));return Ydr(t,n)}var Qwi=/^\/(?:[^~]|~0|~1)*$/,qwi=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Hwi(t,e,r){var n,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!Qwi.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(qwi),!s)throw new Error("Invalid JSON-pointer: "+t);if(n=+s[1],i=s[2],i=="#"){if(n>=e)throw new Error("Cannot access property/index "+n+" levels up, current level is "+e);return r[e-n]}if(n>e)throw new Error("Cannot access data "+n+" levels up, current level is "+e);if(o="data"+(e-n||""),!i)return o}for(var a=o,c=i.split("/"),u=0;u<c.length;u++){var d=c[u];d&&(o+=cst(dst(d)),a+=" && "+o)}return a}function Ydr(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Gwi(t){return dst(decodeURIComponent(t))}function Vwi(t){return encodeURIComponent(ust(t))}function ust(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function dst(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var fst=T((Caa,Jdr)=>{"use strict";var $wi=EM();Jdr.exports=Wwi;function Wwi(t){$wi.copy(t,this)}});var Zdr=T((baa,Xdr)=>{"use strict";var kD=Xdr.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};t5e(e,n,i,t,"",t)};kD.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};kD.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};kD.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};kD.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function t5e(t,e,r,n,i,o,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,c,u);for(var d in n){var f=n[d];if(Array.isArray(f)){if(d in kD.arrayKeywords)for(var p=0;p<f.length;p++)t5e(t,e,r,f[p],i+"/"+d+"/"+p,o,i,d,n,p)}else if(d in kD.propsKeywords){if(f&&typeof f=="object")for(var h in f)t5e(t,e,r,f[h],i+"/"+d+"/"+jwi(h),o,i,d,n,h)}else(d in kD.keywords||t.allKeys&&!(d in kD.skipKeywords))&&t5e(t,e,r,f,i+"/"+d,o,i,d,n)}r(n,i,o,s,a,c,u)}}function jwi(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var a5e=T((_aa,nfr)=>{"use strict";var jce=Vdr(),efr=Tj(),o5e=EM(),r5e=fst(),zwi=Zdr();nfr.exports=MD;MD.normalizeId=PD;MD.fullPath=n5e;MD.url=i5e;MD.ids=Zwi;MD.inlineRef=pst;MD.schema=s5e;function MD(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return MD.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof r5e)return pst(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var i=s5e.call(this,e,r),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof r5e?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=pst(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function s5e(t,e){var r=jce.parse(e),n=rfr(r),i=n5e(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==i){var o=PD(n),s=this._refs[o];if(typeof s=="string")return Ywi.call(this,t,s,r);if(s instanceof r5e)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof r5e){if(s.validate||this._compile(s),o==PD(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=n5e(this._getId(t.schema))}return tfr.call(this,r,i,t.schema,t)}function Ywi(t,e,r){var n=s5e.call(this,t,e);if(n){var i=n.schema,o=n.baseId;t=n.root;var s=this._getId(i);return s&&(o=i5e(o,s)),tfr.call(this,r,o,i,t)}}var Kwi=o5e.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function tfr(t,e,r,n){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var i=t.fragment.split("/"),o=1;o<i.length;o++){var s=i[o];if(s){if(s=o5e.unescapeFragment(s),r=r[s],r===void 0)break;var a;if(!Kwi[s]&&(a=this._getId(r),a&&(e=i5e(e,a)),r.$ref)){var c=i5e(e,r.$ref),u=s5e.call(this,n,c);u&&(r=u.schema,n=u.root,e=u.baseId)}}}if(r!==void 0&&r!==n.schema)return{schema:r,root:n,baseId:e}}}var Jwi=o5e.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function pst(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return hst(t);if(e)return mst(t)<=e}function hst(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!hst(e))return!1}else for(var n in t)if(n=="$ref"||(e=t[n],typeof e=="object"&&!hst(e)))return!1;return!0}function mst(t){var e=0,r;if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(r=t[n],typeof r=="object"&&(e+=mst(r)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(Jwi[i])e++;else if(r=t[i],typeof r=="object"&&(e+=mst(r)+1),e==1/0)return 1/0}return e}function n5e(t,e){e!==!1&&(t=PD(t));var r=jce.parse(t);return rfr(r)}function rfr(t){return jce.serialize(t).split("#")[0]+"#"}var Xwi=/#\/?$/;function PD(t){return t?t.replace(Xwi,""):""}function i5e(t,e){return e=PD(e),jce.resolve(t,e)}function Zwi(t){var e=PD(this._getId(t)),r={"":e},n={"":n5e(e,!1)},i={},o=this;return zwi(t,{allKeys:!0},function(s,a,c,u,d,f,p){if(a!==""){var h=o._getId(s),m=r[u],A=n[u]+"/"+d;if(p!==void 0&&(A+="/"+(typeof p=="number"?p:o5e.escapeFragment(p))),typeof h=="string"){h=m=PD(m?jce.resolve(m,h):h);var g=o._refs[h];if(typeof g=="string"&&(g=o._refs[g]),g&&g.schema){if(!efr(s,g.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=PD(A))if(h[0]=="#"){if(i[h]&&!efr(s,i[h]))throw new Error('id "'+h+'" resolves to more than one schema');i[h]=s}else o._refs[h]=A}r[a]=m,n[a]=A}}),i}});var c5e=T((Saa,ofr)=>{"use strict";var gst=a5e();ofr.exports={Validation:ifr(e9i),MissingRef:ifr(Ast)};function e9i(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}Ast.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function Ast(t,e,r){this.message=r||Ast.message(t,e),this.missingRef=gst.url(t,e),this.missingSchema=gst.normalizeId(gst.fullPath(this.missingRef))}function ifr(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var yst=T((xaa,sfr)=>{"use strict";sfr.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(o){return function(s){return function(a,c){var u={key:a,value:s[a]},d={key:c,value:s[c]};return o(u,d)}}})(e.cmp),i=[];return(function o(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var a,c;if(Array.isArray(s)){for(c="[",a=0;a<s.length;a++)a&&(c+=","),c+=o(s[a])||"null";return c+"]"}if(s===null)return"null";if(i.indexOf(s)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=i.push(s)-1,d=Object.keys(s).sort(n&&n(s));for(c="",a=0;a<d.length;a++){var f=d[a],p=o(s[f]);p&&(c&&(c+=","),c+=JSON.stringify(f)+":"+p)}return i.splice(u,1),"{"+c+"}"}})(t)}});var Est=T((waa,afr)=>{"use strict";afr.exports=function(e,r,n){var i="",o=e.schema.$async===!0,s=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),a=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(i+=" var validate = ",o&&(e.async=!0,i+="async "),i+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",a&&(e.opts.sourceCode||e.opts.processCode)&&(i+=" "+("/*# sourceURL="+a+" */")+" ")),typeof e.schema=="boolean"||!(s||e.schema.$ref)){var r="false schema",d=e.level,f=e.dataLevel,p=e.schema[r],h=e.schemaPath+e.util.getProperty(r),m=e.errSchemaPath+"/"+r,x=!e.opts.allErrors,P,A="data"+(f||""),C="valid"+d;if(e.schema===!1){e.isTop?x=!0:i+=" var "+C+" = false; ";var g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(P||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'boolean schema is false' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var y=i;i=g.pop(),!e.compositeRule&&x?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?o?i+=" return data; ":i+=" validate.errors = null; return true; ":i+=" var "+C+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var E=e.isTop,d=e.level=0,f=e.dataLevel=0,A="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var v="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(v);else throw new Error(v)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{var d=e.level,f=e.dataLevel,A="data"+(f||"");if(a&&(e.baseId=e.resolve.url(e.baseId,a)),o&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+d+" = errors;"}var C="valid"+d,x=!e.opts.allErrors,R="",D="",P,w=e.schema.type,O=Array.isArray(w);if(w&&e.opts.nullable&&e.schema.nullable===!0&&(O?w.indexOf("null")==-1&&(w=w.concat("null")):w!="null"&&(w=[w,"null"],O=!0)),O&&w.length==1&&(w=w[0],O=!1),e.schema.$ref&&s){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(s=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(i+=" "+e.RULES.all.$comment.code(e,"$comment")),w){if(e.opts.coerceTypes)var N=e.util.coerceToTypes(e.opts.coerceTypes,w);var F=e.RULES.types[w];if(N||O||F===!0||F&&!X(F)){var h=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=e.schemaPath+".type",m=e.errSchemaPath+"/type",M=O?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[M](w,A,e.opts.strictNumbers,!0)+") { ",N){var k="dataType"+d,G="coerced"+d;i+=" var "+k+" = typeof "+A+"; var "+G+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+k+" == 'object' && Array.isArray("+A+") && "+A+".length == 1) { "+A+" = "+A+"[0]; "+k+" = typeof "+A+"; if ("+e.util.checkDataType(e.schema.type,A,e.opts.strictNumbers)+") "+G+" = "+A+"; } "),i+=" if ("+G+" !== undefined) ; ";var q=N;if(q)for(var W,V=-1,Q=q.length-1;V<Q;)W=q[V+=1],W=="string"?i+=" else if ("+k+" == 'number' || "+k+" == 'boolean') "+G+" = '' + "+A+"; else if ("+A+" === null) "+G+" = ''; ":W=="number"||W=="integer"?(i+=" else if ("+k+" == 'boolean' || "+A+" === null || ("+k+" == 'string' && "+A+" && "+A+" == +"+A+" ",W=="integer"&&(i+=" && !("+A+" % 1)"),i+=")) "+G+" = +"+A+"; "):W=="boolean"?i+=" else if ("+A+" === 'false' || "+A+" === 0 || "+A+" === null) "+G+" = false; else if ("+A+" === 'true' || "+A+" === 1) "+G+" = true; ":W=="null"?i+=" else if ("+A+" === '' || "+A+" === 0 || "+A+" === false) "+G+" = null; ":e.opts.coerceTypes=="array"&&W=="array"&&(i+=" else if ("+k+" == 'string' || "+k+" == 'number' || "+k+" == 'boolean' || "+A+" == null) "+G+" = ["+A+"]; ");i+=" else { ";var g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(P||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",O?i+=""+w.join(","):i+=""+w,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",O?i+=""+w.join(","):i+=""+w,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var y=i;i=g.pop(),!e.compositeRule&&x?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } if ("+G+" !== undefined) { ";var j=f?"data"+(f-1||""):"parentData",ee=f?e.dataPathArr[f]:"parentDataProperty";i+=" "+A+" = "+G+"; ",f||(i+="if ("+j+" !== undefined)"),i+=" "+j+"["+ee+"] = "+G+"; } "}else{var g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(P||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",O?i+=""+w.join(","):i+=""+w,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",O?i+=""+w.join(","):i+=""+w,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var y=i;i=g.pop(),!e.compositeRule&&x?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}i+=" } "}}if(e.schema.$ref&&!s)i+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",x&&(i+=" } if (errors === ",E?i+="0":i+="errs_"+d,i+=") { ",D+="}");else{var le=e.RULES;if(le){for(var F,J=-1,he=le.length-1;J<he;)if(F=le[J+=1],X(F)){if(F.type&&(i+=" if ("+e.util.checkDataType(F.type,A,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(F.type=="object"&&e.schema.properties){var p=e.schema.properties,ye=Object.keys(p),oe=ye;if(oe)for(var ge,ne=-1,te=oe.length-1;ne<te;){ge=oe[ne+=1];var de=p[ge];if(de.default!==void 0){var ae=A+e.util.getProperty(ge);if(e.compositeRule){if(e.opts.strictDefaults){var v="default is ignored for: "+ae;if(e.opts.strictDefaults==="log")e.logger.warn(v);else throw new Error(v)}}else i+=" if ("+ae+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+ae+" === null || "+ae+" === '' "),i+=" ) "+ae+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(de.default)+" ":i+=" "+JSON.stringify(de.default)+" ",i+="; "}}}else if(F.type=="array"&&Array.isArray(e.schema.items)){var ce=e.schema.items;if(ce){for(var de,V=-1,Ae=ce.length-1;V<Ae;)if(de=ce[V+=1],de.default!==void 0){var ae=A+"["+V+"]";if(e.compositeRule){if(e.opts.strictDefaults){var v="default is ignored for: "+ae;if(e.opts.strictDefaults==="log")e.logger.warn(v);else throw new Error(v)}}else i+=" if ("+ae+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+ae+" === null || "+ae+" === '' "),i+=" ) "+ae+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(de.default)+" ":i+=" "+JSON.stringify(de.default)+" ",i+="; "}}}}var se=F.rules;if(se){for(var Y,K=-1,be=se.length-1;K<be;)if(Y=se[K+=1],xe(Y)){var _e=Y.code(e,Y.keyword,F.type);_e&&(i+=" "+_e+" ",x&&(R+="}"))}}if(x&&(i+=" "+R+" ",R=""),F.type&&(i+=" } ",w&&w===F.type&&!N)){i+=" else { ";var h=e.schemaPath+".type",m=e.errSchemaPath+"/type",g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(P||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",O?i+=""+w.join(","):i+=""+w,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",O?i+=""+w.join(","):i+=""+w,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var y=i;i=g.pop(),!e.compositeRule&&x?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } "}x&&(i+=" if (errors === ",E?i+="0":i+="errs_"+d,i+=") { ",D+="}")}}}x&&(i+=" "+D+" "),E?(o?(i+=" if (errors === 0) return data; ",i+=" else throw new ValidationError(vErrors); "):(i+=" validate.errors = vErrors; ",i+=" return errors === 0; "),i+=" }; return validate;"):i+=" var "+C+" = errors === errs_"+d+";";function X(Ue){for(var He=Ue.rules,ue=0;ue<He.length;ue++)if(xe(He[ue]))return!0}function xe(Ue){return e.schema[Ue.keyword]!==void 0||Ue.implements&&Le(Ue)}function Le(Ue){for(var He=Ue.implements,ue=0;ue<He.length;ue++)if(e.schema[He[ue]]!==void 0)return!0}return i}});var ffr=T((Taa,dfr)=>{"use strict";var l5e=a5e(),d5e=EM(),lfr=c5e(),t9i=yst(),cfr=Est(),r9i=d5e.ucs2length,n9i=Tj(),i9i=lfr.Validation;dfr.exports=vst;function vst(t,e,r,n){var i=this,o=this._opts,s=[void 0],a={},c=[],u={},d=[],f={},p=[];e=e||{schema:t,refVal:s,refs:a};var h=o9i.call(this,t,e,n),m=this._compilations[h.index];if(h.compiling)return m.callValidate=v;var A=this._formats,g=this.RULES;try{var y=C(t,e,r,n);m.validate=y;var E=m.callValidate;return E&&(E.schema=y.schema,E.errors=null,E.refs=y.refs,E.refVal=y.refVal,E.root=y.root,E.$async=y.$async,o.sourceCode&&(E.source=y.source)),y}finally{s9i.call(this,t,e,n)}function v(){var M=m.validate,k=M.apply(this,arguments);return v.errors=M.errors,k}function C(M,k,G,q){var W=!k||k&&k.schema==M;if(k.schema!=e.schema)return vst.call(i,M,k,G,q);var V=M.$async===!0,Q=cfr({isTop:!0,schema:M,isRoot:W,baseId:q,root:k,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:lfr.MissingRef,RULES:g,validate:cfr,util:d5e,resolve:l5e,resolveRef:x,usePattern:O,useDefault:N,useCustomRule:F,opts:o,formats:A,logger:i.logger,self:i});Q=u5e(s,l9i)+u5e(c,a9i)+u5e(d,c9i)+u5e(p,u9i)+Q,o.processCode&&(Q=o.processCode(Q,M));var j;try{var ee=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Q);j=ee(i,g,A,e,s,d,p,n9i,r9i,i9i),s[0]=j}catch(le){throw i.logger.error("Error compiling schema, function code:",Q),le}return j.schema=M,j.errors=null,j.refs=a,j.refVal=s,j.root=W?j:k,V&&(j.$async=!0),o.sourceCode===!0&&(j.source={code:Q,patterns:c,defaults:d}),j}function x(M,k,G){k=l5e.url(M,k);var q=a[k],W,V;if(q!==void 0)return W=s[q],V="refVal["+q+"]",w(W,V);if(!G&&e.refs){var Q=e.refs[k];if(Q!==void 0)return W=e.refVal[Q],V=R(k,W),w(W,V)}V=R(k);var j=l5e.call(i,C,e,k);if(j===void 0){var ee=r&&r[k];ee&&(j=l5e.inlineRef(ee,o.inlineRefs)?ee:vst.call(i,ee,e,r,M))}if(j===void 0)D(k);else return P(k,j),w(j,V)}function R(M,k){var G=s.length;return s[G]=k,a[M]=G,"refVal"+G}function D(M){delete a[M]}function P(M,k){var G=a[M];s[G]=k}function w(M,k){return typeof M=="object"||typeof M=="boolean"?{code:k,schema:M,inline:!0}:{code:k,$async:M&&!!M.$async}}function O(M){var k=u[M];return k===void 0&&(k=u[M]=c.length,c[k]=M),"pattern"+k}function N(M){switch(typeof M){case"boolean":case"number":return""+M;case"string":return d5e.toQuotedString(M);case"object":if(M===null)return"null";var k=t9i(M),G=f[k];return G===void 0&&(G=f[k]=d.length,d[G]=M),"default"+G}}function F(M,k,G,q){if(i._opts.validateSchema!==!1){var W=M.definition.dependencies;if(W&&!W.every(function(oe){return Object.prototype.hasOwnProperty.call(G,oe)}))throw new Error("parent schema must have all required keywords: "+W.join(","));var V=M.definition.validateSchema;if(V){var Q=V(k);if(!Q){var j="keyword schema is invalid: "+i.errorsText(V.errors);if(i._opts.validateSchema=="log")i.logger.error(j);else throw new Error(j)}}}var ee=M.definition.compile,le=M.definition.inline,J=M.definition.macro,he;if(ee)he=ee.call(i,k,G,q);else if(J)he=J.call(i,k,G,q),o.validateSchema!==!1&&i.validateSchema(he,!0);else if(le)he=le.call(i,q,M.keyword,k,G);else if(he=M.definition.validate,!he)return;if(he===void 0)throw new Error('custom keyword "'+M.keyword+'"failed to compile');var ye=p.length;return p[ye]=he,{code:"customRule"+ye,validate:he}}}function o9i(t,e,r){var n=ufr.call(this,t,e,r);return n>=0?{index:n,compiling:!0}:(n=this._compilations.length,this._compilations[n]={schema:t,root:e,baseId:r},{index:n,compiling:!1})}function s9i(t,e,r){var n=ufr.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function ufr(t,e,r){for(var n=0;n<this._compilations.length;n++){var i=this._compilations[n];if(i.schema==t&&i.root==e&&i.baseId==r)return n}return-1}function a9i(t,e){return"var pattern"+t+" = new RegExp("+d5e.toQuotedString(e[t])+");"}function c9i(t){return"var default"+t+" = defaults["+t+"];"}function l9i(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function u9i(t){return"var customRule"+t+" = customRules["+t+"];"}function u5e(t,e){if(!t.length)return"";for(var r="",n=0;n<t.length;n++)r+=e(n,t);return r}});var hfr=T((Iaa,pfr)=>{"use strict";var f5e=pfr.exports=function(){this._cache={}};f5e.prototype.put=function(e,r){this._cache[e]=r};f5e.prototype.get=function(e){return this._cache[e]};f5e.prototype.del=function(e){delete this._cache[e]};f5e.prototype.clear=function(){this._cache={}}});var wfr=T((Daa,xfr)=>{"use strict";var d9i=EM(),f9i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,p9i=[0,31,28,31,30,31,30,31,31,30,31,30,31],h9i=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,mfr=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,m9i=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,g9i=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,gfr=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Afr=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,yfr=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Efr=/^(?:\/(?:[^~/]|~0|~1)*)*$/,vfr=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Cfr=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;xfr.exports=p5e;function p5e(t){return t=t=="full"?"full":"fast",d9i.copy(p5e[t])}p5e.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":gfr,url:Afr,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:mfr,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Sfr,uuid:yfr,"json-pointer":Efr,"json-pointer-uri-fragment":vfr,"relative-json-pointer":Cfr};p5e.full={date:bfr,time:_fr,"date-time":E9i,uri:C9i,"uri-reference":g9i,"uri-template":gfr,url:Afr,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:mfr,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Sfr,uuid:yfr,"json-pointer":Efr,"json-pointer-uri-fragment":vfr,"relative-json-pointer":Cfr};function A9i(t){return t%4===0&&(t%100!==0||t%400===0)}function bfr(t){var e=t.match(f9i);if(!e)return!1;var r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&A9i(r)?29:p9i[n])}function _fr(t,e){var r=t.match(h9i);if(!r)return!1;var n=r[1],i=r[2],o=r[3],s=r[5];return(n<=23&&i<=59&&o<=59||n==23&&i==59&&o==60)&&(!e||s)}var y9i=/t|\s/i;function E9i(t){var e=t.split(y9i);return e.length==2&&bfr(e[0])&&_fr(e[1],!0)}var v9i=/\/|:/;function C9i(t){return v9i.test(t)&&m9i.test(t)}var b9i=/[^\\]\\Z/;function Sfr(t){if(b9i.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Ifr=T((Raa,Tfr)=>{"use strict";Tfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(s||""),f="valid"+o,p,h;if(a=="#"||a=="#/")e.isRoot?(p=e.async,h="validate"):(p=e.root.schema.$async===!0,h="root.refVal[0]");else{var m=e.resolveRef(e.baseId,a,e.isRoot);if(m===void 0){var A=e.MissingRefError.message(e.baseId,a);if(e.opts.missingRefs=="fail"){e.logger.error(A);var g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(a)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(a)+"' "),e.opts.verbose&&(i+=" , schema: "+e.util.toQuotedString(a)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var y=i;i=g.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(i+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(A),u&&(i+=" if (true) { ");else throw new e.MissingRefError(e.baseId,a,A)}else if(m.inline){var E=e.util.copy(e);E.level++;var v="valid"+E.level;E.schema=m.schema,E.schemaPath="",E.errSchemaPath=a;var C=e.validate(E).replace(/validate\.schema/g,m.code);i+=" "+C+" ",u&&(i+=" if ("+v+") { ")}else p=m.$async===!0||e.async&&m.$async!==!1,h=m.code}if(h){var g=g||[];g.push(i),i="",e.opts.passContext?i+=" "+h+".call(this, ":i+=" "+h+"( ",i+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var x=s?"data"+(s-1||""):"parentData",R=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+x+" , "+R+", rootData) ";var D=i;if(i=g.pop(),p){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+f+"; "),i+=" try { await "+D+"; ",u&&(i+=" "+f+" = true; "),i+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(i+=" "+f+" = false; "),i+=" } ",u&&(i+=" if ("+f+") { ")}else i+=" if (!"+D+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var Rfr=T((Baa,Dfr)=>{"use strict";Dfr.exports=function(e,r,n){var i=" ",o=e.schema[r],s=e.schemaPath+e.util.getProperty(r),a=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u=e.util.copy(e),d="";u.level++;var f="valid"+u.level,p=u.baseId,h=!0,m=o;if(m)for(var A,g=-1,y=m.length-1;g<y;)A=m[g+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))&&(h=!1,u.schema=A,u.schemaPath=s+"["+g+"]",u.errSchemaPath=a+"/"+g,i+=" "+e.validate(u)+" ",u.baseId=p,c&&(i+=" if ("+f+") { ",d+="}"));return c&&(h?i+=" if (true) { ":i+=" "+d.slice(0,-1)+" "),i}});var Nfr=T((Naa,Bfr)=>{"use strict";Bfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),A="";m.level++;var g="valid"+m.level,y=a.every(function(P){return e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all)});if(y){var E=m.baseId;i+=" var "+h+" = errors; var "+p+" = false; ";var v=e.compositeRule;e.compositeRule=m.compositeRule=!0;var C=a;if(C)for(var x,R=-1,D=C.length-1;R<D;)x=C[R+=1],m.schema=x,m.schemaPath=c+"["+R+"]",m.errSchemaPath=u+"/"+R,i+=" "+e.validate(m)+" ",m.baseId=E,i+=" "+p+" = "+p+" || "+g+"; if (!"+p+") { ",A+="}";e.compositeRule=m.compositeRule=v,i+=" "+A+" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else d&&(i+=" if (true) { ");return i}});var kfr=T((Oaa,Ofr)=>{"use strict";Ofr.exports=function(e,r,n){var i=" ",o=e.schema[r],s=e.errSchemaPath+"/"+r,a=!e.opts.allErrors,c=e.util.toQuotedString(o);return e.opts.$comment===!0?i+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(i+=" self._opts.$comment("+c+", "+e.util.toQuotedString(s)+", validate.root.schema);"),i}});var Mfr=T((kaa,Pfr)=>{"use strict";Pfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,h||(i+=" var schema"+o+" = validate.schema"+c+";"),i+="var "+p+" = equal("+f+", schema"+o+"); if (!"+p+") { ";var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to constant' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var g=i;return i=A.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+g+"]); ":i+=" validate.errors = ["+g+"]; return false; ":i+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",d&&(i+=" else { "),i}});var Ffr=T((Paa,Lfr)=>{"use strict";Lfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),A="";m.level++;var g="valid"+m.level,y="i"+o,E=m.dataLevel=e.dataLevel+1,v="data"+E,C=e.baseId,x=e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all);if(i+="var "+h+" = errors;var "+p+";",x){var R=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" var "+g+" = false; for (var "+y+" = 0; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var D=f+"["+y+"]";m.dataPathArr[E]=y;var P=e.validate(m);m.baseId=C,e.util.varOccurences(P,v)<2?i+=" "+e.util.varReplace(P,v,D)+" ":i+=" var "+v+" = "+D+"; "+P+" ",i+=" if ("+g+") break; } ",e.compositeRule=m.compositeRule=R,i+=" "+A+" if (!"+g+") {"}else i+=" if ("+f+".length == 0) {";var w=w||[];w.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should contain a valid item' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var O=i;return i=w.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+O+"]); ":i+=" validate.errors = ["+O+"]; return false; ":i+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { ",x&&(i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var Qfr=T((Maa,Ufr)=>{"use strict";Ufr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var A="valid"+h.level,g={},y={},E=e.opts.ownProperties;for(R in a)if(R!="__proto__"){var v=a[R],C=Array.isArray(v)?y:g;C[R]=v}i+="var "+p+" = errors;";var x=e.errorPath;i+="var missing"+o+";";for(var R in y)if(C=y[R],C.length){if(i+=" if ( "+f+e.util.getProperty(R)+" !== undefined ",E&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(R)+"') "),d){i+=" && ( ";var D=C;if(D)for(var P,w=-1,O=D.length-1;w<O;){P=D[w+=1],w&&(i+=" || ");var N=e.util.getProperty(P),F=f+N;i+=" ( ( "+F+" === undefined ",E&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(P)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?P:N)+") ) "}i+=")) { ";var M="missing"+o,k="' + "+M+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,M,!0):x+" + "+M);var G=G||[];G.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(R)+"', missingProperty: '"+k+"', depsCount: "+C.length+", deps: '"+e.util.escapeQuotes(C.length==1?C[0]:C.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",C.length==1?i+="property "+e.util.escapeQuotes(C[0]):i+="properties "+e.util.escapeQuotes(C.join(", ")),i+=" when property "+e.util.escapeQuotes(R)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var q=i;i=G.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+q+"]); ":i+=" validate.errors = ["+q+"]; return false; ":i+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{i+=" ) { ";var W=C;if(W)for(var P,V=-1,Q=W.length-1;V<Q;){P=W[V+=1];var N=e.util.getProperty(P),k=e.util.escapeQuotes(P),F=f+N;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,P,e.opts.jsonPointers)),i+=" if ( "+F+" === undefined ",E&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(P)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(R)+"', missingProperty: '"+k+"', depsCount: "+C.length+", deps: '"+e.util.escapeQuotes(C.length==1?C[0]:C.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",C.length==1?i+="property "+e.util.escapeQuotes(C[0]):i+="properties "+e.util.escapeQuotes(C.join(", ")),i+=" when property "+e.util.escapeQuotes(R)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}i+=" } ",d&&(m+="}",i+=" else { ")}e.errorPath=x;var j=h.baseId;for(var R in g){var v=g[R];(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all))&&(i+=" "+A+" = true; if ( "+f+e.util.getProperty(R)+" !== undefined ",E&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(R)+"') "),i+=") { ",h.schema=v,h.schemaPath=c+e.util.getProperty(R),h.errSchemaPath=u+"/"+e.util.escapeFragment(R),i+=" "+e.validate(h)+" ",h.baseId=j,i+=" } ",d&&(i+=" if ("+A+") { ",m+="}"))}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var Hfr=T((Laa,qfr)=>{"use strict";qfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var A="i"+o,g="schema"+o;h||(i+=" var "+g+" = validate.schema"+c+";"),i+="var "+p+";",h&&(i+=" if (schema"+o+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+o+")) "+p+" = false; else {"),i+=""+p+" = false;for (var "+A+"=0; "+A+"<"+g+".length; "+A+"++) if (equal("+f+", "+g+"["+A+"])) { "+p+" = true; break; }",h&&(i+=" } "),i+=" if (!"+p+") { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var E=i;return i=y.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+E+"]); ":i+=" validate.errors = ["+E+"]; return false; ":i+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",d&&(i+=" else { "),i}});var Vfr=T((Faa,Gfr)=>{"use strict";Gfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||"");if(e.opts.format===!1)return d&&(i+=" if (true) { "),i;var p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var m=e.opts.unknownFormats,A=Array.isArray(m);if(p){var g="format"+o,y="isObject"+o,E="formatType"+o;i+=" var "+g+" = formats["+h+"]; var "+y+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+E+" = "+y+" && "+g+".type || 'string'; if ("+y+") { ",e.async&&(i+=" var async"+o+" = "+g+".async; "),i+=" "+g+" = "+g+".validate; } if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" (",m!="ignore"&&(i+=" ("+h+" && !"+g+" ",A&&(i+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),i+=") || "),i+=" ("+g+" && "+E+" == '"+n+"' && !(typeof "+g+" == 'function' ? ",e.async?i+=" (async"+o+" ? await "+g+"("+f+") : "+g+"("+f+")) ":i+=" "+g+"("+f+") ",i+=" : "+g+".test("+f+"))))) {"}else{var g=e.formats[a];if(!g){if(m=="ignore")return e.logger.warn('unknown format "'+a+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(i+=" if (true) { "),i;if(A&&m.indexOf(a)>=0)return d&&(i+=" if (true) { "),i;throw new Error('unknown format "'+a+'" is used in schema at path "'+e.errSchemaPath+'"')}var y=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,E=y&&g.type||"string";if(y){var v=g.async===!0;g=g.validate}if(E!=n)return d&&(i+=" if (true) { "),i;if(v){if(!e.async)throw new Error("async format in sync schema");var C="formats"+e.util.getProperty(a)+".validate";i+=" if (!(await "+C+"("+f+"))) { "}else{i+=" if (! ";var C="formats"+e.util.getProperty(a);y&&(C+=".validate"),typeof g=="function"?i+=" "+C+"("+f+") ":i+=" "+C+".test("+f+") ",i+=") { "}}var x=x||[];x.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",p?i+=""+h:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match format "`,p?i+="' + "+h+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var R=i;return i=x.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+R+"]); ":i+=" validate.errors = ["+R+"]; return false; ":i+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { "),i}});var Wfr=T((Uaa,$fr)=>{"use strict";$fr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e);m.level++;var A="valid"+m.level,g=e.schema.then,y=e.schema.else,E=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),v=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),C=m.baseId;if(E||v){var x;m.createErrors=!1,m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" var "+h+" = errors; var "+p+" = true; ";var R=e.compositeRule;e.compositeRule=m.compositeRule=!0,i+=" "+e.validate(m)+" ",m.baseId=C,m.createErrors=!0,i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=R,E?(i+=" if ("+A+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",i+=" "+e.validate(m)+" ",m.baseId=C,i+=" "+p+" = "+A+"; ",E&&v?(x="ifClause"+o,i+=" var "+x+" = 'then'; "):x="'then'",i+=" } ",v&&(i+=" else { ")):i+=" if (!"+A+") { ",v&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",i+=" "+e.validate(m)+" ",m.baseId=C,i+=" "+p+" = "+A+"; ",E&&v?(x="ifClause"+o,i+=" var "+x+" = 'else'; "):x="'else'",i+=" } "),i+=" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+x+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+x+` + '" schema' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",d&&(i+=" else { ")}else d&&(i+=" if (true) { ");return i}});var zfr=T((Qaa,jfr)=>{"use strict";jfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),A="";m.level++;var g="valid"+m.level,y="i"+o,E=m.dataLevel=e.dataLevel+1,v="data"+E,C=e.baseId;if(i+="var "+h+" = errors;var "+p+";",Array.isArray(a)){var x=e.schema.additionalItems;if(x===!1){i+=" "+p+" = "+f+".length <= "+a.length+"; ";var R=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+p+") { ";var D=D||[];D.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+a.length+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have more than "+a.length+" items' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var P=i;i=D.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+P+"]); ":i+=" validate.errors = ["+P+"]; return false; ":i+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u=R,d&&(A+="}",i+=" else { ")}var w=a;if(w){for(var O,N=-1,F=w.length-1;N<F;)if(O=w[N+=1],e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all)){i+=" "+g+" = true; if ("+f+".length > "+N+") { ";var M=f+"["+N+"]";m.schema=O,m.schemaPath=c+"["+N+"]",m.errSchemaPath=u+"/"+N,m.errorPath=e.util.getPathExpr(e.errorPath,N,e.opts.jsonPointers,!0),m.dataPathArr[E]=N;var k=e.validate(m);m.baseId=C,e.util.varOccurences(k,v)<2?i+=" "+e.util.varReplace(k,v,M)+" ":i+=" var "+v+" = "+M+"; "+k+" ",i+=" } ",d&&(i+=" if ("+g+") { ",A+="}")}}if(typeof x=="object"&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))){m.schema=x,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+g+" = true; if ("+f+".length > "+a.length+") { for (var "+y+" = "+a.length+"; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var M=f+"["+y+"]";m.dataPathArr[E]=y;var k=e.validate(m);m.baseId=C,e.util.varOccurences(k,v)<2?i+=" "+e.util.varReplace(k,v,M)+" ":i+=" var "+v+" = "+M+"; "+k+" ",d&&(i+=" if (!"+g+") break; "),i+=" } } ",d&&(i+=" if ("+g+") { ",A+="}")}}else if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" for (var "+y+" = 0; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var M=f+"["+y+"]";m.dataPathArr[E]=y;var k=e.validate(m);m.baseId=C,e.util.varOccurences(k,v)<2?i+=" "+e.util.varReplace(k,v,M)+" ":i+=" var "+v+" = "+M+"; "+k+" ",d&&(i+=" if (!"+g+") break; "),i+=" }"}return d&&(i+=" "+A+" if ("+h+" == errors) {"),i}});var Cst=T((qaa,Yfr)=>{"use strict";Yfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,C,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var m=r=="maximum",A=m?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[A],y=e.opts.$data&&g&&g.$data,E=m?"<":">",v=m?">":"<",C=void 0;if(!(p||typeof a=="number"||a===void 0))throw new Error(r+" must be number");if(!(y||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(A+" must be number or boolean");if(y){var x=e.util.getData(g.$data,s,e.dataPathArr),R="exclusive"+o,D="exclType"+o,P="exclIsNumber"+o,w="op"+o,O="' + "+w+" + '";i+=" var schemaExcl"+o+" = "+x+"; ",x="schemaExcl"+o,i+=" var "+R+"; var "+D+" = typeof "+x+"; if ("+D+" != 'boolean' && "+D+" != 'undefined' && "+D+" != 'number') { ";var C=A,N=N||[];N.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(C||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+A+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var F=i;i=N.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+F+"]); ":i+=" validate.errors = ["+F+"]; return false; ":i+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+D+" == 'number' ? ( ("+R+" = "+h+" === undefined || "+x+" "+E+"= "+h+") ? "+f+" "+v+"= "+x+" : "+f+" "+v+" "+h+" ) : ( ("+R+" = "+x+" === true) ? "+f+" "+v+"= "+h+" : "+f+" "+v+" "+h+" ) || "+f+" !== "+f+") { var op"+o+" = "+R+" ? '"+E+"' : '"+E+"='; ",a===void 0&&(C=A,u=e.errSchemaPath+"/"+A,h=x,p=y)}else{var P=typeof g=="number",O=E;if(P&&p){var w="'"+O+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" ( "+h+" === undefined || "+g+" "+E+"= "+h+" ? "+f+" "+v+"= "+g+" : "+f+" "+v+" "+h+" ) || "+f+" !== "+f+") { "}else{P&&a===void 0?(R=!0,C=A,u=e.errSchemaPath+"/"+A,h=g,v+="="):(P&&(h=Math[m?"min":"max"](g,a)),g===(P?h:!0)?(R=!0,C=A,u=e.errSchemaPath+"/"+A,v+="="):(R=!1,O+="="));var w="'"+O+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+f+" "+v+" "+h+" || "+f+" !== "+f+") { "}}C=C||r;var N=N||[];N.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(C||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+w+", limit: "+h+", exclusive: "+R+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+O+" ",p?i+="' + "+h:i+=""+h+"'"),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var F=i;return i=N.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+F+"]); ":i+=" validate.errors = ["+F+"]; return false; ":i+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { "),i}});var bst=T((Haa,Kfr)=>{"use strict";Kfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,A,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var m=r=="maxItems"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+f+".length "+m+" "+h+") { ";var A=r,g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",r=="maxItems"?i+="more":i+="fewer",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" items' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var _st=T((Gaa,Jfr)=>{"use strict";Jfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,A,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var m=r=="maxLength"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),e.opts.unicode===!1?i+=" "+f+".length ":i+=" ucs2length("+f+") ",i+=" "+m+" "+h+") { ";var A=r,g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be ",r=="maxLength"?i+="longer":i+="shorter",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" characters' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var Sst=T((Vaa,Xfr)=>{"use strict";Xfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,A,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var m=r=="maxProperties"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" Object.keys("+f+").length "+m+" "+h+") { ";var A=r,g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",r=="maxProperties"?i+="more":i+="fewer",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" properties' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=g.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var epr=T(($aa,Zfr)=>{"use strict";Zfr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");i+="var division"+o+";if (",p&&(i+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),i+=" (division"+o+" = "+f+" / "+h+", ",e.opts.multipleOfPrecision?i+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":i+=" division"+o+" !== parseInt(division"+o+") ",i+=" ) ",p&&(i+=" ) "),i+=" ) { ";var m=m||[];m.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be multiple of ",p?i+="' + "+h:i+=""+h+"'"),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var A=i;return i=m.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+A+"]); ":i+=" validate.errors = ["+A+"]; return false; ":i+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var rpr=T((Waa,tpr)=>{"use strict";tpr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e);h.level++;var m="valid"+h.level;if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){h.schema=a,h.schemaPath=c,h.errSchemaPath=u,i+=" var "+p+" = errors; ";var A=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1;var g;h.opts.allErrors&&(g=h.opts.allErrors,h.opts.allErrors=!1),i+=" "+e.validate(h)+" ",h.createErrors=!0,g&&(h.opts.allErrors=g),e.compositeRule=h.compositeRule=A,i+=" if ("+m+") { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var E=i;i=y.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+E+"]); ":i+=" validate.errors = ["+E+"]; return false; ":i+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(i+=" if (false) { ");return i}});var ipr=T((jaa,npr)=>{"use strict";npr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),A="";m.level++;var g="valid"+m.level,y=m.baseId,E="prevValid"+o,v="passingSchemas"+o;i+="var "+h+" = errors , "+E+" = false , "+p+" = false , "+v+" = null; ";var C=e.compositeRule;e.compositeRule=m.compositeRule=!0;var x=a;if(x)for(var R,D=-1,P=x.length-1;D<P;)R=x[D+=1],(e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:e.util.schemaHasRules(R,e.RULES.all))?(m.schema=R,m.schemaPath=c+"["+D+"]",m.errSchemaPath=u+"/"+D,i+=" "+e.validate(m)+" ",m.baseId=y):i+=" var "+g+" = true; ",D&&(i+=" if ("+g+" && "+E+") { "+p+" = false; "+v+" = ["+v+", "+D+"]; } else { ",A+="}"),i+=" if ("+g+") { "+p+" = "+E+" = true; "+v+" = "+D+"; }";return e.compositeRule=m.compositeRule=C,i+=""+A+"if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+v+" } ",e.opts.messages!==!1&&(i+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(i+=" } "),i}});var spr=T((zaa,opr)=>{"use strict";opr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var m=p?"(new RegExp("+h+"))":e.usePattern(a);i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" !"+m+".test("+f+") ) { ";var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",p?i+=""+h:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match pattern "`,p?i+="' + "+h+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var g=i;return i=A.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+g+"]); ":i+=" validate.errors = ["+g+"]; return false; ":i+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var cpr=T((Yaa,apr)=>{"use strict";apr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var A="valid"+h.level,g="key"+o,y="idx"+o,E=h.dataLevel=e.dataLevel+1,v="data"+E,C="dataProperties"+o,x=Object.keys(a||{}).filter(V),R=e.schema.patternProperties||{},D=Object.keys(R).filter(V),P=e.schema.additionalProperties,w=x.length||D.length,O=P===!1,N=typeof P=="object"&&Object.keys(P).length,F=e.opts.removeAdditional,M=O||N||F,k=e.opts.ownProperties,G=e.baseId,q=e.schema.required;if(q&&!(e.opts.$data&&q.$data)&&q.length<e.opts.loopRequired)var W=e.util.toHash(q);function V(Me){return Me!=="__proto__"}if(i+="var "+p+" = errors;var "+A+" = true;",k&&(i+=" var "+C+" = undefined;"),M){if(k?i+=" "+C+" = "+C+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+C+".length; "+y+"++) { var "+g+" = "+C+"["+y+"]; ":i+=" for (var "+g+" in "+f+") { ",w){if(i+=" var isAdditional"+o+" = !(false ",x.length)if(x.length>8)i+=" || validate.schema"+c+".hasOwnProperty("+g+") ";else{var Q=x;if(Q)for(var j,ee=-1,le=Q.length-1;ee<le;)j=Q[ee+=1],i+=" || "+g+" == "+e.util.toQuotedString(j)+" "}if(D.length){var J=D;if(J)for(var he,ye=-1,oe=J.length-1;ye<oe;)he=J[ye+=1],i+=" || "+e.usePattern(he)+".test("+g+") "}i+=" ); if (isAdditional"+o+") { "}if(F=="all")i+=" delete "+f+"["+g+"]; ";else{var ge=e.errorPath,ne="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),O)if(F)i+=" delete "+f+"["+g+"]; ";else{i+=" "+A+" = false; ";var te=u;u=e.errSchemaPath+"/additionalProperties";var de=de||[];de.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+ne+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is an invalid additional property":i+="should NOT have additional properties",i+="' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var ae=i;i=de.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+ae+"]); ":i+=" validate.errors = ["+ae+"]; return false; ":i+=" var err = "+ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=te,d&&(i+=" break; ")}else if(N)if(F=="failing"){i+=" var "+p+" = errors; ";var ce=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=P,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[E]=g;var se=e.validate(h);h.baseId=G,e.util.varOccurences(se,v)<2?i+=" "+e.util.varReplace(se,v,Ae)+" ":i+=" var "+v+" = "+Ae+"; "+se+" ",i+=" if (!"+A+") { errors = "+p+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+g+"]; } ",e.compositeRule=h.compositeRule=ce}else{h.schema=P,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[E]=g;var se=e.validate(h);h.baseId=G,e.util.varOccurences(se,v)<2?i+=" "+e.util.varReplace(se,v,Ae)+" ":i+=" var "+v+" = "+Ae+"; "+se+" ",d&&(i+=" if (!"+A+") break; ")}e.errorPath=ge}w&&(i+=" } "),i+=" } ",d&&(i+=" if ("+A+") { ",m+="}")}var Y=e.opts.useDefaults&&!e.compositeRule;if(x.length){var K=x;if(K)for(var j,be=-1,_e=K.length-1;be<_e;){j=K[be+=1];var X=a[j];if(e.opts.strictKeywords?typeof X=="object"&&Object.keys(X).length>0||X===!1:e.util.schemaHasRules(X,e.RULES.all)){var xe=e.util.getProperty(j),Ae=f+xe,Le=Y&&X.default!==void 0;h.schema=X,h.schemaPath=c+xe,h.errSchemaPath=u+"/"+e.util.escapeFragment(j),h.errorPath=e.util.getPath(e.errorPath,j,e.opts.jsonPointers),h.dataPathArr[E]=e.util.toQuotedString(j);var se=e.validate(h);if(h.baseId=G,e.util.varOccurences(se,v)<2){se=e.util.varReplace(se,v,Ae);var Ue=Ae}else{var Ue=v;i+=" var "+v+" = "+Ae+"; "}if(Le)i+=" "+se+" ";else{if(W&&W[j]){i+=" if ( "+Ue+" === undefined ",k&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(j)+"') "),i+=") { "+A+" = false; ";var ge=e.errorPath,te=u,He=e.util.escapeQuotes(j);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(ge,j,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var de=de||[];de.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+He+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+He+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var ae=i;i=de.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+ae+"]); ":i+=" validate.errors = ["+ae+"]; return false; ":i+=" var err = "+ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=te,e.errorPath=ge,i+=" } else { "}else d?(i+=" if ( "+Ue+" === undefined ",k&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(j)+"') "),i+=") { "+A+" = true; } else { "):(i+=" if ("+Ue+" !== undefined ",k&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(j)+"') "),i+=" ) { ");i+=" "+se+" } "}}d&&(i+=" if ("+A+") { ",m+="}")}}if(D.length){var ue=D;if(ue)for(var he,Be=-1,Oe=ue.length-1;Be<Oe;){he=ue[Be+=1];var X=R[he];if(e.opts.strictKeywords?typeof X=="object"&&Object.keys(X).length>0||X===!1:e.util.schemaHasRules(X,e.RULES.all)){h.schema=X,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(he),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(he),k?i+=" "+C+" = "+C+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+C+".length; "+y+"++) { var "+g+" = "+C+"["+y+"]; ":i+=" for (var "+g+" in "+f+") { ",i+=" if ("+e.usePattern(he)+".test("+g+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ae=f+"["+g+"]";h.dataPathArr[E]=g;var se=e.validate(h);h.baseId=G,e.util.varOccurences(se,v)<2?i+=" "+e.util.varReplace(se,v,Ae)+" ":i+=" var "+v+" = "+Ae+"; "+se+" ",d&&(i+=" if (!"+A+") break; "),i+=" } ",d&&(i+=" else "+A+" = true; "),i+=" } ",d&&(i+=" if ("+A+") { ",m+="}")}}}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var upr=T((Kaa,lpr)=>{"use strict";lpr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var A="valid"+h.level;if(i+="var "+p+" = errors;",e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){h.schema=a,h.schemaPath=c,h.errSchemaPath=u;var g="key"+o,y="idx"+o,E="i"+o,v="' + "+g+" + '",C=h.dataLevel=e.dataLevel+1,x="data"+C,R="dataProperties"+o,D=e.opts.ownProperties,P=e.baseId;D&&(i+=" var "+R+" = undefined; "),D?i+=" "+R+" = "+R+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+R+".length; "+y+"++) { var "+g+" = "+R+"["+y+"]; ":i+=" for (var "+g+" in "+f+") { ",i+=" var startErrs"+o+" = errors; ";var w=g,O=e.compositeRule;e.compositeRule=h.compositeRule=!0;var N=e.validate(h);h.baseId=P,e.util.varOccurences(N,x)<2?i+=" "+e.util.varReplace(N,x,w)+" ":i+=" var "+x+" = "+w+"; "+N+" ",e.compositeRule=h.compositeRule=O,i+=" if (!"+A+") { for (var "+E+"=startErrs"+o+"; "+E+"<errors; "+E+"++) { vErrors["+E+"].propertyName = "+g+"; } var err = ",e.createErrors!==!1?(i+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+v+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+v+"\\' is invalid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),d&&(i+=" break; "),i+=" } }"}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var fpr=T((Jaa,dpr)=>{"use strict";dpr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var A="schema"+o;if(!h)if(a.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var g=[],y=a;if(y)for(var E,v=-1,C=y.length-1;v<C;){E=y[v+=1];var x=e.schema.properties[E];x&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))||(g[g.length]=E)}}else var g=a;if(h||g.length){var R=e.errorPath,D=h||g.length>=e.opts.loopRequired,P=e.opts.ownProperties;if(d)if(i+=" var missing"+o+"; ",D){h||(i+=" var "+A+" = validate.schema"+c+"; ");var w="i"+o,O="schema"+o+"["+w+"]",N="' + "+O+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(R,O,e.opts.jsonPointers)),i+=" var "+p+" = true; ",h&&(i+=" if (schema"+o+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+o+")) "+p+" = false; else {"),i+=" for (var "+w+" = 0; "+w+" < "+A+".length; "+w+"++) { "+p+" = "+f+"["+A+"["+w+"]] !== undefined ",P&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", "+A+"["+w+"]) "),i+="; if (!"+p+") break; } ",h&&(i+=" } "),i+=" if (!"+p+") { ";var F=F||[];F.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+N+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+N+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var M=i;i=F.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+M+"]); ":i+=" validate.errors = ["+M+"]; return false; ":i+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var k=g;if(k)for(var G,w=-1,q=k.length-1;w<q;){G=k[w+=1],w&&(i+=" || ");var W=e.util.getProperty(G),V=f+W;i+=" ( ( "+V+" === undefined ",P&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(G)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?G:W)+") ) "}i+=") { ";var O="missing"+o,N="' + "+O+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(R,O,!0):R+" + "+O);var F=F||[];F.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+N+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+N+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var M=i;i=F.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+M+"]); ":i+=" validate.errors = ["+M+"]; return false; ":i+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else if(D){h||(i+=" var "+A+" = validate.schema"+c+"; ");var w="i"+o,O="schema"+o+"["+w+"]",N="' + "+O+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(R,O,e.opts.jsonPointers)),h&&(i+=" if ("+A+" && !Array.isArray("+A+")) { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+N+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+N+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+A+" !== undefined) { "),i+=" for (var "+w+" = 0; "+w+" < "+A+".length; "+w+"++) { if ("+f+"["+A+"["+w+"]] === undefined ",P&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+A+"["+w+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+N+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+N+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(i+=" } ")}else{var Q=g;if(Q)for(var G,j=-1,ee=Q.length-1;j<ee;){G=Q[j+=1];var W=e.util.getProperty(G),N=e.util.escapeQuotes(G),V=f+W;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(R,G,e.opts.jsonPointers)),i+=" if ( "+V+" === undefined ",P&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(G)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+N+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+N+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=R}else d&&(i+=" if (true) {");return i}});var hpr=T((Xaa,ppr)=>{"use strict";ppr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,(a||h)&&e.opts.uniqueItems!==!1){h&&(i+=" var "+p+"; if ("+m+" === false || "+m+" === undefined) "+p+" = true; else if (typeof "+m+" != 'boolean') "+p+" = false; else { "),i+=" var i = "+f+".length , "+p+" = true , j; if (i > 1) { ";var A=e.schema.items&&e.schema.items.type,g=Array.isArray(A);if(!A||A=="object"||A=="array"||g&&(A.indexOf("object")>=0||A.indexOf("array")>=0))i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+p+" = false; break outer; } } } ";else{i+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var y="checkDataType"+(g?"s":"");i+=" if ("+e.util[y](A,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(i+=` if (typeof item == 'string') item = '"' + item; `),i+=" if (typeof itemIndices[item] == 'number') { "+p+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}i+=" } ",h&&(i+=" } "),i+=" if (!"+p+") { ";var E=E||[];E.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var v=i;i=E.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")}else d&&(i+=" if (true) { ");return i}});var gpr=T((Zaa,mpr)=>{"use strict";mpr.exports={$ref:Ifr(),allOf:Rfr(),anyOf:Nfr(),$comment:kfr(),const:Mfr(),contains:Ffr(),dependencies:Qfr(),enum:Hfr(),format:Vfr(),if:Wfr(),items:zfr(),maximum:Cst(),minimum:Cst(),maxItems:bst(),minItems:bst(),maxLength:_st(),minLength:_st(),maxProperties:Sst(),minProperties:Sst(),multipleOf:epr(),not:rpr(),oneOf:ipr(),pattern:spr(),properties:cpr(),propertyNames:upr(),required:fpr(),uniqueItems:hpr(),validate:Est()}});var Epr=T((eca,ypr)=>{"use strict";var Apr=gpr(),xst=EM().toHash;ypr.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],n=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],i=["number","integer","string","array","object","boolean","null"];return e.all=xst(r),e.types=xst(i),e.forEach(function(o){o.rules=o.rules.map(function(s){var a;if(typeof s=="object"){var c=Object.keys(s)[0];a=s[c],s=c,a.forEach(function(d){r.push(d),e.all[d]=!0})}r.push(s);var u=e.all[s]={keyword:s,code:Apr[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:Apr.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=xst(r.concat(n)),e.custom={},e}});var bpr=T((tca,Cpr)=>{"use strict";var vpr=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Cpr.exports=function(t,e){for(var r=0;r<e.length;r++){t=JSON.parse(JSON.stringify(t));var n=e[r].split("/"),i=t,o;for(o=1;o<n.length;o++)i=i[n[o]];for(o=0;o<vpr.length;o++){var s=vpr[o],a=i[s];a&&(i[s]={anyOf:[a,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t}});var xpr=T((rca,Spr)=>{"use strict";var _9i=c5e().MissingRef;Spr.exports=_pr;function _pr(t,e,r){var n=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var i=o(t).then(function(){var a=n._addSchema(t,void 0,e);return a.validate||s(a)});return r&&i.then(function(a){r(null,a)},r),i;function o(a){var c=a.$schema;return c&&!n.getSchema(c)?_pr.call(n,{$ref:c},!0):Promise.resolve()}function s(a){try{return n._compile(a)}catch(u){if(u instanceof _9i)return c(u);throw u}function c(u){var d=u.missingSchema;if(h(d))throw new Error("Schema "+d+" is loaded but "+u.missingRef+" cannot be resolved");var f=n._loadingSchemas[d];return f||(f=n._loadingSchemas[d]=n._opts.loadSchema(d),f.then(p,p)),f.then(function(m){if(!h(d))return o(m).then(function(){h(d)||n.addSchema(m,d,void 0,e)})}).then(function(){return s(a)});function p(){delete n._loadingSchemas[d]}function h(m){return n._refs[m]||n._schemas[m]}}}}});var Tpr=T((nca,wpr)=>{"use strict";wpr.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f,p="data"+(s||""),h="valid"+o,m="errs__"+o,A=e.opts.$data&&a&&a.$data,g;A?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=a;var y=this,E="definition"+o,v=y.definition,C="",x,R,D,P,w;if(A&&v.$data){w="keywordValidate"+o;var O=v.validateSchema;i+=" var "+E+" = RULES.custom['"+r+"'].definition; var "+w+" = "+E+".validate;"}else{if(P=e.useCustomRule(y,a,e.schema,e),!P)return;g="validate.schema"+c,w=P.code,x=v.compile,R=v.inline,D=v.macro}var N=w+".errors",F="i"+o,M="ruleErr"+o,k=v.async;if(k&&!e.async)throw new Error("async keyword in sync schema");if(R||D||(i+=""+N+" = null;"),i+="var "+m+" = errors;var "+h+";",A&&v.$data&&(C+="}",i+=" if ("+g+" === undefined) { "+h+" = true; } else { ",O&&(C+="}",i+=" "+h+" = "+E+".validateSchema("+g+"); if ("+h+") { ")),R)v.statements?i+=" "+P.validate+" ":i+=" "+h+" = "+P.validate+"; ";else if(D){var G=e.util.copy(e),C="";G.level++;var q="valid"+G.level;G.schema=P.validate,G.schemaPath="";var W=e.compositeRule;e.compositeRule=G.compositeRule=!0;var V=e.validate(G).replace(/validate\.schema/g,w);e.compositeRule=G.compositeRule=W,i+=" "+V}else{var Q=Q||[];Q.push(i),i="",i+=" "+w+".call( ",e.opts.passContext?i+="this":i+="self",x||v.schema===!1?i+=" , "+p+" ":i+=" , "+g+" , "+p+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var j=s?"data"+(s-1||""):"parentData",ee=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+j+" , "+ee+" , rootData ) ";var le=i;i=Q.pop(),v.errors===!1?(i+=" "+h+" = ",k&&(i+="await "),i+=""+le+"; "):k?(N="customErrors"+o,i+=" var "+N+" = null; try { "+h+" = await "+le+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+N+" = e.errors; else throw e; } "):i+=" "+N+" = null; "+h+" = "+le+"; "}if(v.modifying&&(i+=" if ("+j+") "+p+" = "+j+"["+ee+"];"),i+=""+C,v.valid)d&&(i+=" if (true) { ");else{i+=" if ( ",v.valid===void 0?(i+=" !",D?i+=""+q:i+=""+h):i+=" "+!v.valid+" ",i+=") { ",f=y.keyword;var Q=Q||[];Q.push(i),i="";var Q=Q||[];Q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var J=i;i=Q.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+J+"]); ":i+=" validate.errors = ["+J+"]; return false; ":i+=" var err = "+J+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var he=i;i=Q.pop(),R?v.errors?v.errors!="full"&&(i+=" for (var "+F+"="+m+"; "+F+"<errors; "+F+"++) { var "+M+" = vErrors["+F+"]; if ("+M+".dataPath === undefined) "+M+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+M+".schemaPath === undefined) { "+M+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+M+".schema = "+g+"; "+M+".data = "+p+"; "),i+=" } "):v.errors===!1?i+=" "+he+" ":(i+=" if ("+m+" == errors) { "+he+" } else { for (var "+F+"="+m+"; "+F+"<errors; "+F+"++) { var "+M+" = vErrors["+F+"]; if ("+M+".dataPath === undefined) "+M+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+M+".schemaPath === undefined) { "+M+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+M+".schema = "+g+"; "+M+".data = "+p+"; "),i+=" } } "):D?(i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):v.errors===!1?i+=" "+he+" ":(i+=" if (Array.isArray("+N+")) { if (vErrors === null) vErrors = "+N+"; else vErrors = vErrors.concat("+N+"); errors = vErrors.length; for (var "+F+"="+m+"; "+F+"<errors; "+F+"++) { var "+M+" = vErrors["+F+"]; if ("+M+".dataPath === undefined) "+M+".dataPath = (dataPath || '') + "+e.errorPath+"; "+M+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+M+".schema = "+g+"; "+M+".data = "+p+"; "),i+=" } } else { "+he+" } "),i+=" } ",d&&(i+=" else { ")}return i}});var wst=T((ica,S9i)=>{S9i.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Rpr=T((oca,Dpr)=>{"use strict";var Ipr=wst();Dpr.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Ipr.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Ipr.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var Npr=T((sca,Bpr)=>{"use strict";var x9i=/^[a-z_$][a-z0-9_$-]*$/i,w9i=Tpr(),T9i=Rpr();Bpr.exports={add:I9i,get:D9i,remove:R9i,validate:Tst};function I9i(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!x9i.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var n=e.type;if(Array.isArray(n))for(var i=0;i<n.length;i++)s(t,n[i],e);else s(t,n,e);var o=e.metaSchema;o&&(e.$data&&this._opts.$data&&(o={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(o,!0))}r.keywords[t]=r.all[t]=!0;function s(a,c,u){for(var d,f=0;f<r.length;f++){var p=r[f];if(p.type==c){d=p;break}}d||(d={type:c,rules:[]},r.push(d));var h={keyword:a,definition:u,custom:!0,code:w9i,implements:u.implements};d.rules.push(h),r.custom[a]=h}return this}function D9i(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function R9i(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var r=0;r<e.length;r++)for(var n=e[r].rules,i=0;i<n.length;i++)if(n[i].keyword==t){n.splice(i,1);break}return this}function Tst(t,e){Tst.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(T9i,!0);if(r(t))return!0;if(Tst.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var Opr=T((aca,B9i)=>{B9i.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Gpr=T((cca,Hpr)=>{"use strict";var Ppr=ffr(),vM=a5e(),N9i=hfr(),Mpr=fst(),O9i=yst(),k9i=wfr(),P9i=Epr(),Lpr=bpr(),Fpr=EM();Hpr.exports=Qf;Qf.prototype.validate=L9i;Qf.prototype.compile=F9i;Qf.prototype.addSchema=U9i;Qf.prototype.addMetaSchema=Q9i;Qf.prototype.validateSchema=q9i;Qf.prototype.getSchema=G9i;Qf.prototype.removeSchema=$9i;Qf.prototype.addFormat=Z9i;Qf.prototype.errorsText=X9i;Qf.prototype._addSchema=W9i;Qf.prototype._compile=j9i;Qf.prototype.compileAsync=xpr();var g5e=Npr();Qf.prototype.addKeyword=g5e.add;Qf.prototype.getKeyword=g5e.get;Qf.prototype.removeKeyword=g5e.remove;Qf.prototype.validateKeyword=g5e.validate;var Upr=c5e();Qf.ValidationError=Upr.Validation;Qf.MissingRefError=Upr.MissingRef;Qf.$dataMetaSchema=Lpr;var m5e="http://json-schema.org/draft-07/schema",kpr=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],M9i=["/properties"];function Qf(t){if(!(this instanceof Qf))return new Qf(t);t=this._opts=Fpr.copy(t)||{},oTi(this),this._schemas={},this._refs={},this._fragments={},this._formats=k9i(t.format),this._cache=t.cache||new N9i,this._loadingSchemas={},this._compilations=[],this.RULES=P9i(),this._getId=z9i(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=O9i),this._metaOpts=iTi(this),t.formats&&rTi(this),t.keywords&&nTi(this),eTi(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),tTi(this)}function L9i(t,e){var r;if(typeof t=="string"){if(r=this.getSchema(t),!r)throw new Error('no schema with key or ref "'+t+'"')}else{var n=this._addSchema(t);r=n.validate||this._compile(n)}var i=r(e);return r.$async!==!0&&(this.errors=r.errors),i}function F9i(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function U9i(t,e,r,n){if(Array.isArray(t)){for(var i=0;i<t.length;i++)this.addSchema(t[i],void 0,r,n);return this}var o=this._getId(t);if(o!==void 0&&typeof o!="string")throw new Error("schema id must be string");return e=vM.normalizeId(e||o),qpr(this,e),this._schemas[e]=this._addSchema(t,r,n,!0),this}function Q9i(t,e,r){return this.addSchema(t,e,r,!0),this}function q9i(t,e){var r=t.$schema;if(r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||H9i(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var n=this.validate(r,t);if(!n&&e){var i="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(i);else throw new Error(i)}return n}function H9i(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(m5e)?m5e:void 0,t._opts.defaultMeta}function G9i(t){var e=Qpr(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return V9i(this,t)}}function V9i(t,e){var r=vM.schema.call(t,{schema:{}},e);if(r){var n=r.schema,i=r.root,o=r.baseId,s=Ppr.call(t,n,i,void 0,o);return t._fragments[e]=new Mpr({ref:e,fragment:!0,schema:n,root:i,baseId:o,validate:s}),s}}function Qpr(t,e){return e=vM.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function $9i(t){if(t instanceof RegExp)return h5e(this,this._schemas,t),h5e(this,this._refs,t),this;switch(typeof t){case"undefined":return h5e(this,this._schemas),h5e(this,this._refs),this._cache.clear(),this;case"string":var e=Qpr(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var r=this._opts.serialize,n=r?r(t):t;this._cache.del(n);var i=this._getId(t);i&&(i=vM.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function h5e(t,e,r){for(var n in e){var i=e[n];!i.meta&&(!r||r.test(n))&&(t._cache.del(i.cacheKey),delete e[n])}}function W9i(t,e,r,n){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var i=this._opts.serialize,o=i?i(t):t,s=this._cache.get(o);if(s)return s;n=n||this._opts.addUsedSchema!==!1;var a=vM.normalizeId(this._getId(t));a&&n&&qpr(this,a);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=a&&a==vM.normalizeId(t.$schema))&&this.validateSchema(t,!0);var d=vM.ids.call(this,t),f=new Mpr({id:a,schema:t,localRefs:d,cacheKey:o,meta:r});return a[0]!="#"&&n&&(this._refs[a]=f),this._cache.put(o,f),c&&u&&this.validateSchema(t,!0),f}function j9i(t,e){if(t.compiling)return t.validate=i,i.schema=t.schema,i.errors=null,i.root=e||i,t.schema.$async===!0&&(i.$async=!0),i;t.compiling=!0;var r;t.meta&&(r=this._opts,this._opts=this._metaOpts);var n;try{n=Ppr.call(this,t.schema,e,t.localRefs)}catch(o){throw delete t.validate,o}finally{t.compiling=!1,t.meta&&(this._opts=r)}return t.validate=n,t.refs=n.refs,t.refVal=n.refVal,t.root=n.root,n;function i(){var o=t.validate,s=o.apply(this,arguments);return i.errors=o.errors,s}}function z9i(t){switch(t.schemaId){case"auto":return J9i;case"id":return Y9i;default:return K9i}}function Y9i(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function K9i(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function J9i(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function X9i(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var r=e.separator===void 0?", ":e.separator,n=e.dataVar===void 0?"data":e.dataVar,i="",o=0;o<t.length;o++){var s=t[o];s&&(i+=n+s.dataPath+" "+s.message+r)}return i.slice(0,-r.length)}function Z9i(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function eTi(t){var e;if(t._opts.$data&&(e=Opr(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=wst();t._opts.$data&&(r=Lpr(r,M9i)),t.addMetaSchema(r,m5e,!0),t._refs["http://json-schema.org/schema"]=m5e}}function tTi(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var r in e)t.addSchema(e[r],r)}function rTi(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function nTi(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function qpr(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function iTi(t){for(var e=Fpr.copy(t._opts),r=0;r<kpr.length;r++)delete e[kpr[r]];return e}function oTi(t){var e=t._opts.logger;if(e===!1)t.logger={log:Ist,warn:Ist,error:Ist};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function Ist(){}});var Vpr,$y,Ij=Z(()=>{Hdr();OD();Vpr=Ne(Gpr(),1),$y=class extends Zbe{constructor(e,r){var n;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new Vpr.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=qdr(this._capabilities,e)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:wj,capabilities:this._capabilities,clientInfo:this._clientInfo}},Yot,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!_dr.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,i,o,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},yM,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},ist,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},yM,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Wce,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},$ce,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Jot,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Xot,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Zot,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},yM,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},yM,r)}async callTool(e,r=Jbe,n){let i=await this.request({method:"tools/call",params:e},r,n),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new c4(a4.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new c4(a4.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof c4?s:new c4(a4.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let n=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},nst,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var Ypr=T((fca,zpr)=>{zpr.exports=jpr;jpr.sync=aTi;var $pr=ve("fs");function sTi(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function Wpr(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:sTi(e,r)}function jpr(t,e,r){$pr.stat(t,function(n,i){r(n,n?!1:Wpr(i,t,e))})}function aTi(t,e){return Wpr($pr.statSync(t),t,e)}});var ehr=T((pca,Zpr)=>{Zpr.exports=Jpr;Jpr.sync=cTi;var Kpr=ve("fs");function Jpr(t,e,r){Kpr.stat(t,function(n,i){r(n,n?!1:Xpr(i,e))})}function cTi(t,e){return Xpr(Kpr.statSync(t),e)}function Xpr(t,e){return t.isFile()&&lTi(t,e)}function lTi(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),d=a|c,f=r&u||r&c&&i===s||r&a&&n===o||r&d&&o===0;return f}});var rhr=T((mca,thr)=>{var hca=ve("fs"),A5e;process.platform==="win32"||global.TESTING_WINDOWS?A5e=Ypr():A5e=ehr();thr.exports=Dst;Dst.sync=uTi;function Dst(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){Dst(t,e||{},function(o,s){o?i(o):n(s)})})}A5e(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function uTi(t,e){try{return A5e.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var lhr=T((gca,chr)=>{var Dj=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",nhr=ve("path"),dTi=Dj?";":":",ihr=rhr(),ohr=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),shr=(t,e)=>{let r=e.colon||dTi,n=t.match(/\//)||Dj&&t.match(/\\/)?[""]:[...Dj?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Dj?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Dj?i.split(r):[""];return Dj&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},ahr=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=shr(t,e),s=[],a=u=>new Promise((d,f)=>{if(u===n.length)return e.all&&s.length?d(s):f(ohr(t));let p=n[u],h=/^".*"$/.test(p)?p.slice(1,-1):p,m=nhr.join(h,t),A=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;d(c(A,u,0))}),c=(u,d,f)=>new Promise((p,h)=>{if(f===i.length)return p(a(d+1));let m=i[f];ihr(u+m,{pathExt:o},(A,g)=>{if(!A&&g)if(e.all)s.push(u+m);else return p(u+m);return p(c(u,d,f+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},fTi=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=shr(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=nhr.join(c,t),d=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let f=0;f<n.length;f++){let p=d+n[f];try{if(ihr.sync(p,{pathExt:i}))if(e.all)o.push(p);else return p}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw ohr(t)};chr.exports=ahr;ahr.sync=fTi});var dhr=T((Aca,Rst)=>{"use strict";var uhr=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Rst.exports=uhr;Rst.exports.default=uhr});var mhr=T((yca,hhr)=>{"use strict";var fhr=ve("path"),pTi=lhr(),hTi=dhr();function phr(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=pTi.sync(t.command,{path:r[hTi({env:r})],pathExt:e?fhr.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=fhr.resolve(i?t.options.cwd:"",s)),s}function mTi(t){return phr(t)||phr(t,!0)}hhr.exports=mTi});var ghr=T((Eca,Nst)=>{"use strict";var Bst=/([()\][%!^"`<>&|;, *?])/g;function gTi(t){return t=t.replace(Bst,"^$1"),t}function ATi(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Bst,"^$1"),e&&(t=t.replace(Bst,"^$1")),t}Nst.exports.command=gTi;Nst.exports.argument=ATi});var yhr=T((vca,Ahr)=>{"use strict";Ahr.exports=/^#!(.*)/});var vhr=T((Cca,Ehr)=>{"use strict";var yTi=yhr();Ehr.exports=(t="")=>{let e=t.match(yTi);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var bhr=T((bca,Chr)=>{"use strict";var Ost=ve("fs"),ETi=vhr();function vTi(t){let r=Buffer.alloc(150),n;try{n=Ost.openSync(t,"r"),Ost.readSync(n,r,0,150,0),Ost.closeSync(n)}catch{}return ETi(r.toString())}Chr.exports=vTi});var whr=T((_ca,xhr)=>{"use strict";var CTi=ve("path"),_hr=mhr(),Shr=ghr(),bTi=bhr(),_Ti=process.platform==="win32",STi=/\.(?:com|exe)$/i,xTi=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function wTi(t){t.file=_hr(t);let e=t.file&&bTi(t.file);return e?(t.args.unshift(t.file),t.command=e,_hr(t)):t.file}function TTi(t){if(!_Ti)return t;let e=wTi(t),r=!STi.test(e);if(t.options.forceShell||r){let n=xTi.test(e);t.command=CTi.normalize(t.command),t.command=Shr.command(t.command),t.args=t.args.map(o=>Shr.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function ITi(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:TTi(n)}xhr.exports=ITi});var Dhr=T((Sca,Ihr)=>{"use strict";var kst=process.platform==="win32";function Pst(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function DTi(t,e){if(!kst)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=Thr(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function Thr(t,e){return kst&&t===1&&!e.file?Pst(e.original,"spawn"):null}function RTi(t,e){return kst&&t===1&&!e.file?Pst(e.original,"spawnSync"):null}Ihr.exports={hookChildProcess:DTi,verifyENOENT:Thr,verifyENOENTSync:RTi,notFoundError:Pst}});var Nhr=T((xca,Rj)=>{"use strict";var Rhr=ve("child_process"),Mst=whr(),Lst=Dhr();function Bhr(t,e,r){let n=Mst(t,e,r),i=Rhr.spawn(n.command,n.args,n.options);return Lst.hookChildProcess(i,n),i}function BTi(t,e,r){let n=Mst(t,e,r),i=Rhr.spawnSync(n.command,n.args,n.options);return i.error=i.error||Lst.verifyENOENTSync(i.status,n),i}Rj.exports=Bhr;Rj.exports.spawn=Bhr;Rj.exports.sync=BTi;Rj.exports._parse=Mst;Rj.exports._enoent=Lst});function NTi(t){return ND.parse(JSON.parse(t))}function Ohr(t){return JSON.stringify(t)+`
853
853
  `}var y5e,khr=Z(()=>{OD();y5e=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
854
854
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),NTi(r)}clear(){this._buffer=void 0}}});import E5e from"node:process";import{PassThrough as OTi}from"node:stream";function PTi(){let t={};for(let e of kTi){let r=E5e.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}function MTi(){return"type"in E5e}var Phr,kTi,Bj,Fst=Z(()=>{Phr=Ne(Nhr(),1);khr();kTi=E5e.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];Bj=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new y5e,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new OTi)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{var n,i,o,s,a;this._process=(0,Phr.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...PTi(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:E5e.platform==="win32"&&MTi(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var u,d;if(c.name==="AbortError"){(u=this.onclose)===null||u===void 0||u.call(this);return}r(c),(d=this.onerror)===null||d===void 0||d.call(this,c)}),this._process.on("spawn",()=>{e()}),this._process.on("close",c=>{var u;this._process=void 0,(u=this.onclose)===null||u===void 0||u.call(this)}),(o=this._process.stdin)===null||o===void 0||o.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),(s=this._process.stdout)===null||s===void 0||s.on("data",c=>{this._readBuffer.append(c),this.processReadBuffer()}),(a=this._process.stdout)===null||a===void 0||a.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,r;return this._stderrStream?this._stderrStream:(r=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&r!==void 0?r:null}get pid(){var e,r;return(r=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&r!==void 0?r:null}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var n;if(!(!((n=this._process)===null||n===void 0)&&n.stdin))throw new Error("Not connected");let i=Ohr(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}}});function Ust(t){}function C5e(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Ust,onError:r=Ust,onRetry:n=Ust,onComment:i}=t,o="",s=!0,a,c="",u="";function d(A){let g=s?A.replace(/^\xEF\xBB\xBF/,""):A,[y,E]=LTi(`${o}${g}`);for(let v of y)f(v);o=E,s=!1}function f(A){if(A===""){h();return}if(A.startsWith(":")){i&&i(A.slice(A.startsWith(": ")?2:1));return}let g=A.indexOf(":");if(g!==-1){let y=A.slice(0,g),E=A[g+1]===" "?2:1,v=A.slice(g+E);p(y,v,A);return}p(A,"",A)}function p(A,g,y){switch(A){case"event":u=g;break;case"data":c=`${c}${g}
855
855
  `;break;case"id":a=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?n(parseInt(g,10)):r(new v5e(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:y}));break;default:r(new v5e(`Unknown field "${A.length>20?`${A.slice(0,20)}\u2026`:A}"`,{type:"unknown-field",field:A,value:g,line:y}));break}}function h(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
856
856
  `)?c.slice(0,-1):c}),a=void 0,c="",u=""}function m(A={}){o&&A.consume&&f(o),s=!0,a=void 0,c="",u="",o=""}return{feed:d,reset:m}}function LTi(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
857
857
  `,n),s=-1;if(i!==-1&&o!==-1?s=Math.min(i,o):i!==-1?i===t.length-1?s=-1:s=i:o!==-1&&(s=o),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
858
- `&&n++}}return[e,r]}var v5e,Qst=Z(()=>{v5e=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function FTi(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function qst(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(qst).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${qst(t.cause)}`:t.message:`${t}`}function Mhr(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function UTi(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var _5e,Fhr,Yst,Ea,Gh,Ud,Uw,o3,CM,Nj,b5e,S5e,Kce,Pj,Jce,LD,Oj,Mj,kj,zce,ub,Hst,Gst,Vst,Lhr,$st,Wst,Yce,jst,zst,bM,Uhr=Z(()=>{Qst();_5e=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(Mhr(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(Mhr(this),r)}};Fhr=t=>{throw TypeError(t)},Yst=(t,e,r)=>e.has(t)||Fhr("Cannot "+r),Ea=(t,e,r)=>(Yst(t,e,"read from private field"),r?r.call(t):e.get(t)),Gh=(t,e,r)=>e.has(t)?Fhr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ud=(t,e,r,n)=>(Yst(t,e,"write to private field"),e.set(t,r),r),Uw=(t,e,r)=>(Yst(t,e,"access private method"),r),bM=class extends EventTarget{constructor(e,r){var n,i;super(),Gh(this,ub),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Gh(this,o3),Gh(this,CM),Gh(this,Nj),Gh(this,b5e),Gh(this,S5e),Gh(this,Kce),Gh(this,Pj),Gh(this,Jce,null),Gh(this,LD),Gh(this,Oj),Gh(this,Mj,null),Gh(this,kj,null),Gh(this,zce,null),Gh(this,Gst,async o=>{var s;Ea(this,Oj).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){Uw(this,ub,Yce).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Ud(this,Nj,new URL(o.url)):Ud(this,Nj,void 0),u!==200){Uw(this,ub,Yce).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){Uw(this,ub,Yce).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ea(this,o3)===this.CLOSED)return;Ud(this,o3,this.OPEN);let f=new Event("open");if((s=Ea(this,zce))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Uw(this,ub,Yce).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:A,value:g}=await h.read();g&&Ea(this,Oj).feed(p.decode(g,{stream:!A})),A&&(m=!1,Ea(this,Oj).reset(),Uw(this,ub,jst).call(this))}while(m)}),Gh(this,Vst,o=>{Ud(this,LD,void 0),!(o.name==="AbortError"||o.type==="aborted")&&Uw(this,ub,jst).call(this,qst(o))}),Gh(this,$st,o=>{typeof o.id=="string"&&Ud(this,Jce,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Ea(this,Nj)?Ea(this,Nj).origin:Ea(this,CM).origin,lastEventId:o.id||""});Ea(this,kj)&&(!o.event||o.event==="message")&&Ea(this,kj).call(this,s),this.dispatchEvent(s)}),Gh(this,Wst,o=>{Ud(this,Kce,o)}),Gh(this,zst,()=>{Ud(this,Pj,void 0),Ea(this,o3)===this.CONNECTING&&Uw(this,ub,Hst).call(this)});try{if(e instanceof URL)Ud(this,CM,e);else if(typeof e=="string")Ud(this,CM,new URL(e,UTi()));else throw new Error("Invalid URL")}catch{throw FTi("An invalid or illegal string was specified")}Ud(this,Oj,C5e({onEvent:Ea(this,$st),onRetry:Ea(this,Wst)})),Ud(this,o3,this.CONNECTING),Ud(this,Kce,3e3),Ud(this,S5e,(n=r?.fetch)!=null?n:globalThis.fetch),Ud(this,b5e,(i=r?.withCredentials)!=null?i:!1),Uw(this,ub,Hst).call(this)}get readyState(){return Ea(this,o3)}get url(){return Ea(this,CM).href}get withCredentials(){return Ea(this,b5e)}get onerror(){return Ea(this,Mj)}set onerror(e){Ud(this,Mj,e)}get onmessage(){return Ea(this,kj)}set onmessage(e){Ud(this,kj,e)}get onopen(){return Ea(this,zce)}set onopen(e){Ud(this,zce,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Ea(this,Pj)&&clearTimeout(Ea(this,Pj)),Ea(this,o3)!==this.CLOSED&&(Ea(this,LD)&&Ea(this,LD).abort(),Ud(this,o3,this.CLOSED),Ud(this,LD,void 0))}};o3=new WeakMap,CM=new WeakMap,Nj=new WeakMap,b5e=new WeakMap,S5e=new WeakMap,Kce=new WeakMap,Pj=new WeakMap,Jce=new WeakMap,LD=new WeakMap,Oj=new WeakMap,Mj=new WeakMap,kj=new WeakMap,zce=new WeakMap,ub=new WeakSet,Hst=function(){Ud(this,o3,this.CONNECTING),Ud(this,LD,new AbortController),Ea(this,S5e)(Ea(this,CM),Uw(this,ub,Lhr).call(this)).then(Ea(this,Gst)).catch(Ea(this,Vst))},Gst=new WeakMap,Vst=new WeakMap,Lhr=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ea(this,Jce)?{"Last-Event-ID":Ea(this,Jce)}:void 0},cache:"no-store",signal:(t=Ea(this,LD))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},$st=new WeakMap,Wst=new WeakMap,Yce=function(t,e){var r;Ea(this,o3)!==this.CLOSED&&Ud(this,o3,this.CLOSED);let n=new _5e("error",{code:e,message:t});(r=Ea(this,Mj))==null||r.call(this,n),this.dispatchEvent(n)},jst=function(t,e){var r;if(Ea(this,o3)===this.CLOSED)return;Ud(this,o3,this.CONNECTING);let n=new _5e("error",{code:e,message:t});(r=Ea(this,Mj))==null||r.call(this,n),this.dispatchEvent(n),Ud(this,Pj,setTimeout(Ea(this,zst),Ea(this,Kce)))},zst=new WeakMap,bM.CONNECTING=0,bM.OPEN=1,bM.CLOSED=2});async function QTi(t){return(await Kst).getRandomValues(new Uint8Array(t))}async function qTi(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await QTi(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function HTi(t){return await qTi(t)}async function GTi(t){let e=await(await Kst).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Jst(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await HTi(t),r=await GTi(e);return{code_verifier:e,code_challenge:r}}var Kst,Qhr=Z(()=>{Kst=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Fm,qhr,Xst,VTi,Hhr,Zst,Ghr,$Ti,WTi,Vhr,Lca,Fca,eat=Z(()=>{BD();Fm=ie.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:ie.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),ie.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),qhr=ie.object({resource:ie.string().url(),authorization_servers:ie.array(Fm).optional(),jwks_uri:ie.string().url().optional(),scopes_supported:ie.array(ie.string()).optional(),bearer_methods_supported:ie.array(ie.string()).optional(),resource_signing_alg_values_supported:ie.array(ie.string()).optional(),resource_name:ie.string().optional(),resource_documentation:ie.string().optional(),resource_policy_uri:ie.string().url().optional(),resource_tos_uri:ie.string().url().optional(),tls_client_certificate_bound_access_tokens:ie.boolean().optional(),authorization_details_types_supported:ie.array(ie.string()).optional(),dpop_signing_alg_values_supported:ie.array(ie.string()).optional(),dpop_bound_access_tokens_required:ie.boolean().optional()}).passthrough(),Xst=ie.object({issuer:ie.string(),authorization_endpoint:Fm,token_endpoint:Fm,registration_endpoint:Fm.optional(),scopes_supported:ie.array(ie.string()).optional(),response_types_supported:ie.array(ie.string()),response_modes_supported:ie.array(ie.string()).optional(),grant_types_supported:ie.array(ie.string()).optional(),token_endpoint_auth_methods_supported:ie.array(ie.string()).optional(),token_endpoint_auth_signing_alg_values_supported:ie.array(ie.string()).optional(),service_documentation:Fm.optional(),revocation_endpoint:Fm.optional(),revocation_endpoint_auth_methods_supported:ie.array(ie.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ie.array(ie.string()).optional(),introspection_endpoint:ie.string().optional(),introspection_endpoint_auth_methods_supported:ie.array(ie.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ie.array(ie.string()).optional(),code_challenge_methods_supported:ie.array(ie.string()).optional()}).passthrough(),VTi=ie.object({issuer:ie.string(),authorization_endpoint:Fm,token_endpoint:Fm,userinfo_endpoint:Fm.optional(),jwks_uri:Fm,registration_endpoint:Fm.optional(),scopes_supported:ie.array(ie.string()).optional(),response_types_supported:ie.array(ie.string()),response_modes_supported:ie.array(ie.string()).optional(),grant_types_supported:ie.array(ie.string()).optional(),acr_values_supported:ie.array(ie.string()).optional(),subject_types_supported:ie.array(ie.string()),id_token_signing_alg_values_supported:ie.array(ie.string()),id_token_encryption_alg_values_supported:ie.array(ie.string()).optional(),id_token_encryption_enc_values_supported:ie.array(ie.string()).optional(),userinfo_signing_alg_values_supported:ie.array(ie.string()).optional(),userinfo_encryption_alg_values_supported:ie.array(ie.string()).optional(),userinfo_encryption_enc_values_supported:ie.array(ie.string()).optional(),request_object_signing_alg_values_supported:ie.array(ie.string()).optional(),request_object_encryption_alg_values_supported:ie.array(ie.string()).optional(),request_object_encryption_enc_values_supported:ie.array(ie.string()).optional(),token_endpoint_auth_methods_supported:ie.array(ie.string()).optional(),token_endpoint_auth_signing_alg_values_supported:ie.array(ie.string()).optional(),display_values_supported:ie.array(ie.string()).optional(),claim_types_supported:ie.array(ie.string()).optional(),claims_supported:ie.array(ie.string()).optional(),service_documentation:ie.string().optional(),claims_locales_supported:ie.array(ie.string()).optional(),ui_locales_supported:ie.array(ie.string()).optional(),claims_parameter_supported:ie.boolean().optional(),request_parameter_supported:ie.boolean().optional(),request_uri_parameter_supported:ie.boolean().optional(),require_request_uri_registration:ie.boolean().optional(),op_policy_uri:Fm.optional(),op_tos_uri:Fm.optional()}).passthrough(),Hhr=VTi.merge(Xst.pick({code_challenge_methods_supported:!0})),Zst=ie.object({access_token:ie.string(),id_token:ie.string().optional(),token_type:ie.string(),expires_in:ie.number().optional(),scope:ie.string().optional(),refresh_token:ie.string().optional()}).strip(),Ghr=ie.object({error:ie.string(),error_description:ie.string().optional(),error_uri:ie.string().optional()}),$Ti=ie.object({redirect_uris:ie.array(Fm),token_endpoint_auth_method:ie.string().optional(),grant_types:ie.array(ie.string()).optional(),response_types:ie.array(ie.string()).optional(),client_name:ie.string().optional(),client_uri:Fm.optional(),logo_uri:Fm.optional(),scope:ie.string().optional(),contacts:ie.array(ie.string()).optional(),tos_uri:Fm.optional(),policy_uri:ie.string().optional(),jwks_uri:Fm.optional(),jwks:ie.any().optional(),software_id:ie.string().optional(),software_version:ie.string().optional(),software_statement:ie.string().optional()}).strip(),WTi=ie.object({client_id:ie.string(),client_secret:ie.string().optional(),client_id_issued_at:ie.number().optional(),client_secret_expires_at:ie.number().optional()}).strip(),Vhr=$Ti.merge(WTi),Lca=ie.object({error:ie.string(),error_description:ie.string().optional()}).strip(),Fca=ie.object({token:ie.string(),token_type_hint:ie.string().optional()}).strip()});function $hr(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Whr({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var jhr=Z(()=>{});var ah,Xce,_M,SM,xM,Zce,ele,tle,Qw,rle,nle,ile,ole,sle,ale,cle,lle,zhr,Yhr=Z(()=>{ah=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Xce=class extends ah{};Xce.errorCode="invalid_request";_M=class extends ah{};_M.errorCode="invalid_client";SM=class extends ah{};SM.errorCode="invalid_grant";xM=class extends ah{};xM.errorCode="unauthorized_client";Zce=class extends ah{};Zce.errorCode="unsupported_grant_type";ele=class extends ah{};ele.errorCode="invalid_scope";tle=class extends ah{};tle.errorCode="access_denied";Qw=class extends ah{};Qw.errorCode="server_error";rle=class extends ah{};rle.errorCode="temporarily_unavailable";nle=class extends ah{};nle.errorCode="unsupported_response_type";ile=class extends ah{};ile.errorCode="unsupported_token_type";ole=class extends ah{};ole.errorCode="invalid_token";sle=class extends ah{};sle.errorCode="method_not_allowed";ale=class extends ah{};ale.errorCode="too_many_requests";cle=class extends ah{};cle.errorCode="invalid_client_metadata";lle=class extends ah{};lle.errorCode="insufficient_scope";zhr={[Xce.errorCode]:Xce,[_M.errorCode]:_M,[SM.errorCode]:SM,[xM.errorCode]:xM,[Zce.errorCode]:Zce,[ele.errorCode]:ele,[tle.errorCode]:tle,[Qw.errorCode]:Qw,[rle.errorCode]:rle,[nle.errorCode]:nle,[ile.errorCode]:ile,[ole.errorCode]:ole,[sle.errorCode]:sle,[ale.errorCode]:ale,[cle.errorCode]:cle,[lle.errorCode]:lle}});function Jhr(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function Xhr(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":jTi(i,o,r);return;case"client_secret_post":zTi(i,o,n);return;case"none":YTi(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function jTi(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function zTi(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function YTi(t,e){e.set("client_id",t)}async function rat(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Ghr.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=zhr[i]||Qw;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Qw(i)}}async function FD(t,e){var r,n;try{return await tat(t,e)}catch(i){if(i instanceof _M||i instanceof xM)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await tat(t,e);if(i instanceof SM)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await tat(t,e);throw i}}async function tat(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await JTi(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await KTi(e,t,s),u=await r7i(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let A=await i7i(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(A),d=A}if(r!==void 0){let A=await t.codeVerifier(),g=await iat(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:A,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let A=await oat(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof ah)||A instanceof Qw))throw A}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await n7i(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function KTi(t,e,r){let n=$hr(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Whr({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function ule(t){let e=t.headers.get("WWW-Authenticate");if(!e)return;let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;let o=/resource_metadata="([^"]*)"/.exec(e);if(o)try{return new URL(o[1])}catch{return}}async function JTi(t,e,r=fetch){let n=await e7i(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return qhr.parse(await n.json())}async function nat(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?nat(t,void 0,r):void 0;throw n}}function XTi(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Khr(t,e,r=fetch){return await nat(t,{"MCP-Protocol-Version":e},r)}function ZTi(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function e7i(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:wj,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=XTi(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await Khr(c,a,r);if(!n?.metadataUrl&&ZTi(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await Khr(d,a,r)}return u}function t7i(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function r7i(t,{fetchFn:e=fetch,protocolVersion:r=wj}={}){var n;let i={"MCP-Protocol-Version":r},o=t7i(t);for(let{url:s,type:a}of o){let c=await nat(s,i,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(a==="oauth")return Xst.parse(await c.json());{let u=Hhr.parse(await c.json());if(!(!((n=u.code_challenge_methods_supported)===null||n===void 0)&&n.includes("S256")))throw new Error(`Incompatible OIDC provider at ${s}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function n7i(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a="code",c="S256",u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a))throw new Error(`Incompatible auth server: does not support response type ${a}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);let d=await Jst(),f=d.code_verifier,p=d.code_challenge;return u.searchParams.set("response_type",a),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",p),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(n)),o&&u.searchParams.set("state",o),i&&u.searchParams.set("scope",i),i?.includes("offline_access")&&u.searchParams.append("prompt","consent"),s&&u.searchParams.set("resource",s.href),{authorizationUrl:u,codeVerifier:f}}async function iat(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let A=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],g=Jhr(r,A);Xhr(g,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await rat(m);return Zst.parse(await m.json())}async function oat(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=Jhr(r,h);Xhr(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await rat(p);return Zst.parse({refresh_token:n,...await p.json()})}async function i7i(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await rat(o);return Vhr.parse(await o.json())}var s3,x5e=Z(()=>{Qhr();OD();eat();eat();jhr();Yhr();s3=class extends Error{constructor(e){super(e??"Unauthorized")}}});var sat,Lj,Zhr=Z(()=>{Uhr();OD();x5e();sat=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Lj=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new s3("No auth provider");let r;try{r=await FD(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new s3;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new bM(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=ule(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new sat(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=ND.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new s3("No auth provider");if(await FD(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new s3("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){if(this._resourceMetadataUrl=ule(a),await FD(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new s3;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var w5e,emr=Z(()=>{Qst();w5e=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=C5e({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var o7i,dle,UD,aat=Z(()=>{OD();x5e();emr();o7i={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},dle=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},UD=class{constructor(e,r){var n;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:o7i}async _authThenStart(){var e;if(!this._authProvider)throw new s3("No auth provider");let r;try{r=await FD(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new s3;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new dle(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new w5e).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let A=ND.parse(JSON.parse(h.data));o!==void 0&&Gce(A)&&(A.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,A)}catch(A){(u=this.onerror)===null||u===void 0||u.call(this,A)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new s3("No auth provider");if(await FD(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new s3("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:$be(e)?e.id:void 0}).catch(g=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,g)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=ule(f),await FD(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new s3;return this.send(e)}let g=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${g}`)}if(f.status===202){kdr(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(g=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,g)});return}let m=(Array.isArray(e)?e:[e]).filter(g=>"method"in g&&"id"in g&&g.id!==void 0).length>0,A=f.headers.get("content-type");if(m)if(A?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(A?.includes("application/json")){let g=await f.json(),y=Array.isArray(g)?g.map(E=>ND.parse(E)):[ND.parse(g)];for(let E of y)(o=this.onmessage)===null||o===void 0||o.call(this,E)}else throw new dle(-1,`Unexpected content type: ${A}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new dle(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as s7i}from"node:fs/promises";var fle,ple,wM,cat=Z(()=>{"use strict";R$();x5e();di();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(fle||(fle={}));ple=class extends Error{code;constructor(e,r){super(r),this.code=e}},wM=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||lw.default}async start(){if(this._isClosed)throw new Error(L.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await oat(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(L.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new ple(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new ple(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(L.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await iat(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(L.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===lw.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(L.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(L.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==lw.default.OPEN)throw new Error(L.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new ple(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:fle.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.3.10-beta.0",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:fle.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await s7i(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:fle.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var tmr,T5e,rmr=Z(()=>{"use strict";tmr=Ne(Wae(),1);di();T5e=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(L.t("mcp.auth.scopesRequired"));this.auth=new tmr.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(L.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as a7i}from"node:child_process";import{promisify as c7i}from"node:util";import{platform as l7i}from"node:os";import{URL as u7i}from"node:url";function d7i(t){let e;try{e=new u7i(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function imr(t){d7i(t);let e=l7i(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await nmr(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await nmr(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var nmr,omr=Z(()=>{"use strict";nmr=c7i(a7i)});function na(t){return t instanceof Error&&"code"in t}function Ir(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function lat(t){if(t&&typeof t=="object"&&"response"in t){let r=f7i(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new D5e(r.error.message);case 401:return new QD(r.error.message);case 403:return new I5e(r.error.message);default:}}return t}function f7i(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var I5e,QD,D5e,Qd=Z(()=>{"use strict";I5e=class extends Error{},QD=class extends Error{},D5e=class extends Error{}});import{promises as Fj}from"node:fs";import*as R5e from"node:path";import*as smr from"node:os";var Um,B5e=Z(()=>{"use strict";Qd();di();Um=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=smr.homedir();return R5e.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=R5e.dirname(this.getTokenFilePath());await Fj.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await Fj.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(L.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:Ir(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await Fj.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(L.t("mcp.tokenStorage.errors.failedToSaveToken",{error:Ir(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await Fj.unlink(i):await Fj.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(L.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:Ir(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await Fj.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(L.t("mcp.tokenStorage.errors.failedToClearTokens",{error:Ir(e)}))}}}});var Qm,N5e=Z(()=>{"use strict";Qd();di();Qm=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${Ir(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${Ir(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(L.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(L.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${Ir(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(L.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(L.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as amr from"node:http";import*as hle from"node:crypto";import{URL as uat}from"node:url";var Wy,dat=Z(()=>{"use strict";omr();B5e();Qd();N5e();di();Wy=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(L.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Qm.extractBaseUrl(e);return Qm.discoverOAuthConfig(r)}static generatePKCEParams(){let e=hle.randomBytes(32).toString("base64url"),r=hle.createHash("sha256").update(e).digest("base64url"),n=hle.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=amr.createServer(async(o,s)=>{try{let a=new uat(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(L.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
858
+ `&&n++}}return[e,r]}var v5e,Qst=Z(()=>{v5e=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function FTi(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function qst(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(qst).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${qst(t.cause)}`:t.message:`${t}`}function Mhr(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function UTi(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var _5e,Fhr,Yst,Ea,Gh,Ud,Uw,o3,CM,Nj,b5e,S5e,Kce,Pj,Jce,LD,Oj,Mj,kj,zce,ub,Hst,Gst,Vst,Lhr,$st,Wst,Yce,jst,zst,bM,Uhr=Z(()=>{Qst();_5e=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(Mhr(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(Mhr(this),r)}};Fhr=t=>{throw TypeError(t)},Yst=(t,e,r)=>e.has(t)||Fhr("Cannot "+r),Ea=(t,e,r)=>(Yst(t,e,"read from private field"),r?r.call(t):e.get(t)),Gh=(t,e,r)=>e.has(t)?Fhr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ud=(t,e,r,n)=>(Yst(t,e,"write to private field"),e.set(t,r),r),Uw=(t,e,r)=>(Yst(t,e,"access private method"),r),bM=class extends EventTarget{constructor(e,r){var n,i;super(),Gh(this,ub),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Gh(this,o3),Gh(this,CM),Gh(this,Nj),Gh(this,b5e),Gh(this,S5e),Gh(this,Kce),Gh(this,Pj),Gh(this,Jce,null),Gh(this,LD),Gh(this,Oj),Gh(this,Mj,null),Gh(this,kj,null),Gh(this,zce,null),Gh(this,Gst,async o=>{var s;Ea(this,Oj).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){Uw(this,ub,Yce).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Ud(this,Nj,new URL(o.url)):Ud(this,Nj,void 0),u!==200){Uw(this,ub,Yce).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){Uw(this,ub,Yce).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ea(this,o3)===this.CLOSED)return;Ud(this,o3,this.OPEN);let f=new Event("open");if((s=Ea(this,zce))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Uw(this,ub,Yce).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:A,value:g}=await h.read();g&&Ea(this,Oj).feed(p.decode(g,{stream:!A})),A&&(m=!1,Ea(this,Oj).reset(),Uw(this,ub,jst).call(this))}while(m)}),Gh(this,Vst,o=>{Ud(this,LD,void 0),!(o.name==="AbortError"||o.type==="aborted")&&Uw(this,ub,jst).call(this,qst(o))}),Gh(this,$st,o=>{typeof o.id=="string"&&Ud(this,Jce,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Ea(this,Nj)?Ea(this,Nj).origin:Ea(this,CM).origin,lastEventId:o.id||""});Ea(this,kj)&&(!o.event||o.event==="message")&&Ea(this,kj).call(this,s),this.dispatchEvent(s)}),Gh(this,Wst,o=>{Ud(this,Kce,o)}),Gh(this,zst,()=>{Ud(this,Pj,void 0),Ea(this,o3)===this.CONNECTING&&Uw(this,ub,Hst).call(this)});try{if(e instanceof URL)Ud(this,CM,e);else if(typeof e=="string")Ud(this,CM,new URL(e,UTi()));else throw new Error("Invalid URL")}catch{throw FTi("An invalid or illegal string was specified")}Ud(this,Oj,C5e({onEvent:Ea(this,$st),onRetry:Ea(this,Wst)})),Ud(this,o3,this.CONNECTING),Ud(this,Kce,3e3),Ud(this,S5e,(n=r?.fetch)!=null?n:globalThis.fetch),Ud(this,b5e,(i=r?.withCredentials)!=null?i:!1),Uw(this,ub,Hst).call(this)}get readyState(){return Ea(this,o3)}get url(){return Ea(this,CM).href}get withCredentials(){return Ea(this,b5e)}get onerror(){return Ea(this,Mj)}set onerror(e){Ud(this,Mj,e)}get onmessage(){return Ea(this,kj)}set onmessage(e){Ud(this,kj,e)}get onopen(){return Ea(this,zce)}set onopen(e){Ud(this,zce,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Ea(this,Pj)&&clearTimeout(Ea(this,Pj)),Ea(this,o3)!==this.CLOSED&&(Ea(this,LD)&&Ea(this,LD).abort(),Ud(this,o3,this.CLOSED),Ud(this,LD,void 0))}};o3=new WeakMap,CM=new WeakMap,Nj=new WeakMap,b5e=new WeakMap,S5e=new WeakMap,Kce=new WeakMap,Pj=new WeakMap,Jce=new WeakMap,LD=new WeakMap,Oj=new WeakMap,Mj=new WeakMap,kj=new WeakMap,zce=new WeakMap,ub=new WeakSet,Hst=function(){Ud(this,o3,this.CONNECTING),Ud(this,LD,new AbortController),Ea(this,S5e)(Ea(this,CM),Uw(this,ub,Lhr).call(this)).then(Ea(this,Gst)).catch(Ea(this,Vst))},Gst=new WeakMap,Vst=new WeakMap,Lhr=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ea(this,Jce)?{"Last-Event-ID":Ea(this,Jce)}:void 0},cache:"no-store",signal:(t=Ea(this,LD))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},$st=new WeakMap,Wst=new WeakMap,Yce=function(t,e){var r;Ea(this,o3)!==this.CLOSED&&Ud(this,o3,this.CLOSED);let n=new _5e("error",{code:e,message:t});(r=Ea(this,Mj))==null||r.call(this,n),this.dispatchEvent(n)},jst=function(t,e){var r;if(Ea(this,o3)===this.CLOSED)return;Ud(this,o3,this.CONNECTING);let n=new _5e("error",{code:e,message:t});(r=Ea(this,Mj))==null||r.call(this,n),this.dispatchEvent(n),Ud(this,Pj,setTimeout(Ea(this,zst),Ea(this,Kce)))},zst=new WeakMap,bM.CONNECTING=0,bM.OPEN=1,bM.CLOSED=2});async function QTi(t){return(await Kst).getRandomValues(new Uint8Array(t))}async function qTi(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await QTi(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function HTi(t){return await qTi(t)}async function GTi(t){let e=await(await Kst).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Jst(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await HTi(t),r=await GTi(e);return{code_verifier:e,code_challenge:r}}var Kst,Qhr=Z(()=>{Kst=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Fm,qhr,Xst,VTi,Hhr,Zst,Ghr,$Ti,WTi,Vhr,Lca,Fca,eat=Z(()=>{BD();Fm=ie.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:ie.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),ie.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),qhr=ie.object({resource:ie.string().url(),authorization_servers:ie.array(Fm).optional(),jwks_uri:ie.string().url().optional(),scopes_supported:ie.array(ie.string()).optional(),bearer_methods_supported:ie.array(ie.string()).optional(),resource_signing_alg_values_supported:ie.array(ie.string()).optional(),resource_name:ie.string().optional(),resource_documentation:ie.string().optional(),resource_policy_uri:ie.string().url().optional(),resource_tos_uri:ie.string().url().optional(),tls_client_certificate_bound_access_tokens:ie.boolean().optional(),authorization_details_types_supported:ie.array(ie.string()).optional(),dpop_signing_alg_values_supported:ie.array(ie.string()).optional(),dpop_bound_access_tokens_required:ie.boolean().optional()}).passthrough(),Xst=ie.object({issuer:ie.string(),authorization_endpoint:Fm,token_endpoint:Fm,registration_endpoint:Fm.optional(),scopes_supported:ie.array(ie.string()).optional(),response_types_supported:ie.array(ie.string()),response_modes_supported:ie.array(ie.string()).optional(),grant_types_supported:ie.array(ie.string()).optional(),token_endpoint_auth_methods_supported:ie.array(ie.string()).optional(),token_endpoint_auth_signing_alg_values_supported:ie.array(ie.string()).optional(),service_documentation:Fm.optional(),revocation_endpoint:Fm.optional(),revocation_endpoint_auth_methods_supported:ie.array(ie.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ie.array(ie.string()).optional(),introspection_endpoint:ie.string().optional(),introspection_endpoint_auth_methods_supported:ie.array(ie.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ie.array(ie.string()).optional(),code_challenge_methods_supported:ie.array(ie.string()).optional()}).passthrough(),VTi=ie.object({issuer:ie.string(),authorization_endpoint:Fm,token_endpoint:Fm,userinfo_endpoint:Fm.optional(),jwks_uri:Fm,registration_endpoint:Fm.optional(),scopes_supported:ie.array(ie.string()).optional(),response_types_supported:ie.array(ie.string()),response_modes_supported:ie.array(ie.string()).optional(),grant_types_supported:ie.array(ie.string()).optional(),acr_values_supported:ie.array(ie.string()).optional(),subject_types_supported:ie.array(ie.string()),id_token_signing_alg_values_supported:ie.array(ie.string()),id_token_encryption_alg_values_supported:ie.array(ie.string()).optional(),id_token_encryption_enc_values_supported:ie.array(ie.string()).optional(),userinfo_signing_alg_values_supported:ie.array(ie.string()).optional(),userinfo_encryption_alg_values_supported:ie.array(ie.string()).optional(),userinfo_encryption_enc_values_supported:ie.array(ie.string()).optional(),request_object_signing_alg_values_supported:ie.array(ie.string()).optional(),request_object_encryption_alg_values_supported:ie.array(ie.string()).optional(),request_object_encryption_enc_values_supported:ie.array(ie.string()).optional(),token_endpoint_auth_methods_supported:ie.array(ie.string()).optional(),token_endpoint_auth_signing_alg_values_supported:ie.array(ie.string()).optional(),display_values_supported:ie.array(ie.string()).optional(),claim_types_supported:ie.array(ie.string()).optional(),claims_supported:ie.array(ie.string()).optional(),service_documentation:ie.string().optional(),claims_locales_supported:ie.array(ie.string()).optional(),ui_locales_supported:ie.array(ie.string()).optional(),claims_parameter_supported:ie.boolean().optional(),request_parameter_supported:ie.boolean().optional(),request_uri_parameter_supported:ie.boolean().optional(),require_request_uri_registration:ie.boolean().optional(),op_policy_uri:Fm.optional(),op_tos_uri:Fm.optional()}).passthrough(),Hhr=VTi.merge(Xst.pick({code_challenge_methods_supported:!0})),Zst=ie.object({access_token:ie.string(),id_token:ie.string().optional(),token_type:ie.string(),expires_in:ie.number().optional(),scope:ie.string().optional(),refresh_token:ie.string().optional()}).strip(),Ghr=ie.object({error:ie.string(),error_description:ie.string().optional(),error_uri:ie.string().optional()}),$Ti=ie.object({redirect_uris:ie.array(Fm),token_endpoint_auth_method:ie.string().optional(),grant_types:ie.array(ie.string()).optional(),response_types:ie.array(ie.string()).optional(),client_name:ie.string().optional(),client_uri:Fm.optional(),logo_uri:Fm.optional(),scope:ie.string().optional(),contacts:ie.array(ie.string()).optional(),tos_uri:Fm.optional(),policy_uri:ie.string().optional(),jwks_uri:Fm.optional(),jwks:ie.any().optional(),software_id:ie.string().optional(),software_version:ie.string().optional(),software_statement:ie.string().optional()}).strip(),WTi=ie.object({client_id:ie.string(),client_secret:ie.string().optional(),client_id_issued_at:ie.number().optional(),client_secret_expires_at:ie.number().optional()}).strip(),Vhr=$Ti.merge(WTi),Lca=ie.object({error:ie.string(),error_description:ie.string().optional()}).strip(),Fca=ie.object({token:ie.string(),token_type_hint:ie.string().optional()}).strip()});function $hr(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Whr({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var jhr=Z(()=>{});var ah,Xce,_M,SM,xM,Zce,ele,tle,Qw,rle,nle,ile,ole,sle,ale,cle,lle,zhr,Yhr=Z(()=>{ah=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Xce=class extends ah{};Xce.errorCode="invalid_request";_M=class extends ah{};_M.errorCode="invalid_client";SM=class extends ah{};SM.errorCode="invalid_grant";xM=class extends ah{};xM.errorCode="unauthorized_client";Zce=class extends ah{};Zce.errorCode="unsupported_grant_type";ele=class extends ah{};ele.errorCode="invalid_scope";tle=class extends ah{};tle.errorCode="access_denied";Qw=class extends ah{};Qw.errorCode="server_error";rle=class extends ah{};rle.errorCode="temporarily_unavailable";nle=class extends ah{};nle.errorCode="unsupported_response_type";ile=class extends ah{};ile.errorCode="unsupported_token_type";ole=class extends ah{};ole.errorCode="invalid_token";sle=class extends ah{};sle.errorCode="method_not_allowed";ale=class extends ah{};ale.errorCode="too_many_requests";cle=class extends ah{};cle.errorCode="invalid_client_metadata";lle=class extends ah{};lle.errorCode="insufficient_scope";zhr={[Xce.errorCode]:Xce,[_M.errorCode]:_M,[SM.errorCode]:SM,[xM.errorCode]:xM,[Zce.errorCode]:Zce,[ele.errorCode]:ele,[tle.errorCode]:tle,[Qw.errorCode]:Qw,[rle.errorCode]:rle,[nle.errorCode]:nle,[ile.errorCode]:ile,[ole.errorCode]:ole,[sle.errorCode]:sle,[ale.errorCode]:ale,[cle.errorCode]:cle,[lle.errorCode]:lle}});function Jhr(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function Xhr(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":jTi(i,o,r);return;case"client_secret_post":zTi(i,o,n);return;case"none":YTi(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function jTi(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function zTi(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function YTi(t,e){e.set("client_id",t)}async function rat(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Ghr.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=zhr[i]||Qw;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Qw(i)}}async function FD(t,e){var r,n;try{return await tat(t,e)}catch(i){if(i instanceof _M||i instanceof xM)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await tat(t,e);if(i instanceof SM)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await tat(t,e);throw i}}async function tat(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await JTi(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await KTi(e,t,s),u=await r7i(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let A=await i7i(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(A),d=A}if(r!==void 0){let A=await t.codeVerifier(),g=await iat(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:A,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let A=await oat(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof ah)||A instanceof Qw))throw A}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await n7i(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function KTi(t,e,r){let n=$hr(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Whr({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function ule(t){let e=t.headers.get("WWW-Authenticate");if(!e)return;let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;let o=/resource_metadata="([^"]*)"/.exec(e);if(o)try{return new URL(o[1])}catch{return}}async function JTi(t,e,r=fetch){let n=await e7i(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return qhr.parse(await n.json())}async function nat(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?nat(t,void 0,r):void 0;throw n}}function XTi(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Khr(t,e,r=fetch){return await nat(t,{"MCP-Protocol-Version":e},r)}function ZTi(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function e7i(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:wj,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=XTi(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await Khr(c,a,r);if(!n?.metadataUrl&&ZTi(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await Khr(d,a,r)}return u}function t7i(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function r7i(t,{fetchFn:e=fetch,protocolVersion:r=wj}={}){var n;let i={"MCP-Protocol-Version":r},o=t7i(t);for(let{url:s,type:a}of o){let c=await nat(s,i,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(a==="oauth")return Xst.parse(await c.json());{let u=Hhr.parse(await c.json());if(!(!((n=u.code_challenge_methods_supported)===null||n===void 0)&&n.includes("S256")))throw new Error(`Incompatible OIDC provider at ${s}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function n7i(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a="code",c="S256",u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a))throw new Error(`Incompatible auth server: does not support response type ${a}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);let d=await Jst(),f=d.code_verifier,p=d.code_challenge;return u.searchParams.set("response_type",a),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",p),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(n)),o&&u.searchParams.set("state",o),i&&u.searchParams.set("scope",i),i?.includes("offline_access")&&u.searchParams.append("prompt","consent"),s&&u.searchParams.set("resource",s.href),{authorizationUrl:u,codeVerifier:f}}async function iat(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let A=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],g=Jhr(r,A);Xhr(g,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await rat(m);return Zst.parse(await m.json())}async function oat(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=Jhr(r,h);Xhr(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await rat(p);return Zst.parse({refresh_token:n,...await p.json()})}async function i7i(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await rat(o);return Vhr.parse(await o.json())}var s3,x5e=Z(()=>{Qhr();OD();eat();eat();jhr();Yhr();s3=class extends Error{constructor(e){super(e??"Unauthorized")}}});var sat,Lj,Zhr=Z(()=>{Uhr();OD();x5e();sat=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Lj=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new s3("No auth provider");let r;try{r=await FD(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new s3;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new bM(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=ule(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new sat(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=ND.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new s3("No auth provider");if(await FD(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new s3("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){if(this._resourceMetadataUrl=ule(a),await FD(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new s3;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var w5e,emr=Z(()=>{Qst();w5e=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=C5e({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var o7i,dle,UD,aat=Z(()=>{OD();x5e();emr();o7i={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},dle=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},UD=class{constructor(e,r){var n;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:o7i}async _authThenStart(){var e;if(!this._authProvider)throw new s3("No auth provider");let r;try{r=await FD(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new s3;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new dle(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new w5e).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let A=ND.parse(JSON.parse(h.data));o!==void 0&&Gce(A)&&(A.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,A)}catch(A){(u=this.onerror)===null||u===void 0||u.call(this,A)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new s3("No auth provider");if(await FD(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new s3("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:$be(e)?e.id:void 0}).catch(g=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,g)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=ule(f),await FD(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new s3;return this.send(e)}let g=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${g}`)}if(f.status===202){kdr(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(g=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,g)});return}let m=(Array.isArray(e)?e:[e]).filter(g=>"method"in g&&"id"in g&&g.id!==void 0).length>0,A=f.headers.get("content-type");if(m)if(A?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(A?.includes("application/json")){let g=await f.json(),y=Array.isArray(g)?g.map(E=>ND.parse(E)):[ND.parse(g)];for(let E of y)(o=this.onmessage)===null||o===void 0||o.call(this,E)}else throw new dle(-1,`Unexpected content type: ${A}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new dle(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as s7i}from"node:fs/promises";var fle,ple,wM,cat=Z(()=>{"use strict";R$();x5e();di();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(fle||(fle={}));ple=class extends Error{code;constructor(e,r){super(r),this.code=e}},wM=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||lw.default}async start(){if(this._isClosed)throw new Error(L.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await oat(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(L.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new ple(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new ple(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(L.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await iat(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(L.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===lw.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(L.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(L.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==lw.default.OPEN)throw new Error(L.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new ple(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:fle.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.3.10",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:fle.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await s7i(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:fle.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var tmr,T5e,rmr=Z(()=>{"use strict";tmr=Ne(Wae(),1);di();T5e=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(L.t("mcp.auth.scopesRequired"));this.auth=new tmr.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(L.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as a7i}from"node:child_process";import{promisify as c7i}from"node:util";import{platform as l7i}from"node:os";import{URL as u7i}from"node:url";function d7i(t){let e;try{e=new u7i(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function imr(t){d7i(t);let e=l7i(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await nmr(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await nmr(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var nmr,omr=Z(()=>{"use strict";nmr=c7i(a7i)});function na(t){return t instanceof Error&&"code"in t}function Ir(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function lat(t){if(t&&typeof t=="object"&&"response"in t){let r=f7i(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new D5e(r.error.message);case 401:return new QD(r.error.message);case 403:return new I5e(r.error.message);default:}}return t}function f7i(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var I5e,QD,D5e,Qd=Z(()=>{"use strict";I5e=class extends Error{},QD=class extends Error{},D5e=class extends Error{}});import{promises as Fj}from"node:fs";import*as R5e from"node:path";import*as smr from"node:os";var Um,B5e=Z(()=>{"use strict";Qd();di();Um=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=smr.homedir();return R5e.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=R5e.dirname(this.getTokenFilePath());await Fj.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await Fj.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(L.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:Ir(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await Fj.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(L.t("mcp.tokenStorage.errors.failedToSaveToken",{error:Ir(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await Fj.unlink(i):await Fj.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(L.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:Ir(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await Fj.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(L.t("mcp.tokenStorage.errors.failedToClearTokens",{error:Ir(e)}))}}}});var Qm,N5e=Z(()=>{"use strict";Qd();di();Qm=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${Ir(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${Ir(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(L.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(L.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${Ir(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(L.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(L.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as amr from"node:http";import*as hle from"node:crypto";import{URL as uat}from"node:url";var Wy,dat=Z(()=>{"use strict";omr();B5e();Qd();N5e();di();Wy=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(L.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Qm.extractBaseUrl(e);return Qm.discoverOAuthConfig(r)}static generatePKCEParams(){let e=hle.randomBytes(32).toString("base64url"),r=hle.createHash("sha256").update(e).digest("base64url"),n=hle.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=amr.createServer(async(o,s)=>{try{let a=new uat(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(L.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
859
859
  <html>
860
860
  <body>
861
861
  <h1>${L.t("mcp.ui.authenticationFailed")}</h1>
@@ -4382,7 +4382,7 @@ ${X.description}`:X.subject||X.description||"Thinking...",[]),Ae=(0,oc.useRef)(!
4382
4382
  `,e-1);return{line:r===-1?0:t.slice(0,r+1).match(/\n/g).length,column:e-r-1}}function hGt(t,e,{oneBased:r=!1}={}){if(typeof t!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(e))throw new TypeError("Index parameter should be an integer");if(e<0||e>t.length)throw new RangeError("Index out of bounds");let n=pNs(t,e);return r?{line:n.line+1,column:n.column+1}:n}var hNs=t=>`\\u{${t.codePointAt(0).toString(16)}}`,mGt=class t extends Error{name="JSONError";fileName;#e;#t;#r;#n;#o;constructor(e){if(typeof e=="string")super(),this.#r=e;else{let{jsonParseError:r,fileName:n,input:i}=e;super(void 0,{cause:r}),this.#e=i,this.#t=r,this.fileName=n}Error.captureStackTrace?.(this,t)}get message(){this.#r??=`${gNs(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
4383
4383
 
4384
4384
  ${e}
4385
- `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=mNs(r,this.#t.message);if(n)return(0,nGn.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#o??=this.#i(!1),this.#o}},mNs=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:hGt(t,Number(n),{oneBased:!0})},gNs=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${hNs(n)})`);function gGt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new mGt({jsonParseError:n,fileName:r,input:t})}}var eVn=Ne(XGn(),1);import{fileURLToPath as hOs}from"node:url";function ZGn(t){return t instanceof URL?hOs(t):t}var AOs=t=>gOs.resolve(ZGn(t)??".","package.json"),yOs=(t,e)=>{let r=typeof t=="string"?gGt(t):t;return e&&(0,eVn.default)(r),r};async function tVn({cwd:t,normalize:e=!0}={}){let r=await mOs.readFile(AOs(t),"utf8");return yOs(r,e)}async function rVn(t){let e=await NHn("package.json",t);if(e)return{packageJson:await tVn({...t,cwd:EOs.dirname(e)}),path:e}}import{fileURLToPath as vOs}from"url";import COs from"path";var bOs=vOs(import.meta.url),_Os=COs.dirname(bOs),Pje;async function YO(){if(Pje)return Pje;let t=await rVn({cwd:_Os});if(t)return Pje=t.packageJson,Pje}async function KO(){let t=await YO();return"0.3.10-beta.0"}ra();Wt();import gG from"node:process";var nVn={name:"about",description:L.t("command.about"),kind:"built-in",action:async t=>{let e=gG.platform,r=L.t("aboutCommand.noSandbox");gG.env.SANDBOX&&gG.env.SANDBOX!=="sandbox-exec"?r=gG.env.SANDBOX:gG.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${gG.env.SEATBELT_PROFILE||L.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||L.t("aboutCommand.unknown"),i=await KO(),o=t.services.settings.merged.selectedAuthType||"",s=gG.env.GOOGLE_CLOUD_PROJECT||"",a={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:o,gcpProject:s};t.ui.addItem(a,Date.now())}};Wt();Wt();ra();var Lje="\x1B[32m";var oVn="\x1B[31m",JO="\x1B[36m",Lg="\x1B[90m";var al="\x1B[0m";function Mje(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
4385
+ `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=mNs(r,this.#t.message);if(n)return(0,nGn.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#o??=this.#i(!1),this.#o}},mNs=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:hGt(t,Number(n),{oneBased:!0})},gNs=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${hNs(n)})`);function gGt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new mGt({jsonParseError:n,fileName:r,input:t})}}var eVn=Ne(XGn(),1);import{fileURLToPath as hOs}from"node:url";function ZGn(t){return t instanceof URL?hOs(t):t}var AOs=t=>gOs.resolve(ZGn(t)??".","package.json"),yOs=(t,e)=>{let r=typeof t=="string"?gGt(t):t;return e&&(0,eVn.default)(r),r};async function tVn({cwd:t,normalize:e=!0}={}){let r=await mOs.readFile(AOs(t),"utf8");return yOs(r,e)}async function rVn(t){let e=await NHn("package.json",t);if(e)return{packageJson:await tVn({...t,cwd:EOs.dirname(e)}),path:e}}import{fileURLToPath as vOs}from"url";import COs from"path";var bOs=vOs(import.meta.url),_Os=COs.dirname(bOs),Pje;async function YO(){if(Pje)return Pje;let t=await rVn({cwd:_Os});if(t)return Pje=t.packageJson,Pje}async function KO(){let t=await YO();return"0.3.10"}ra();Wt();import gG from"node:process";var nVn={name:"about",description:L.t("command.about"),kind:"built-in",action:async t=>{let e=gG.platform,r=L.t("aboutCommand.noSandbox");gG.env.SANDBOX&&gG.env.SANDBOX!=="sandbox-exec"?r=gG.env.SANDBOX:gG.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${gG.env.SEATBELT_PROFILE||L.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||L.t("aboutCommand.unknown"),i=await KO(),o=t.services.settings.merged.selectedAuthType||"",s=gG.env.GOOGLE_CLOUD_PROJECT||"",a={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:o,gcpProject:s};t.ui.addItem(a,Date.now())}};Wt();Wt();ra();var Lje="\x1B[32m";var oVn="\x1B[31m",JO="\x1B[36m",Lg="\x1B[90m";var al="\x1B[0m";function Mje(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
4386
4386
  ${oVn}${L.t("agentsCommand.list.noAgentsFound")}${al}
4387
4387
  `;i="\u{1F7E2} ";let o=`${i}${e}
4388
4388
  `;for(let s of t)n?o+=SOs(s):o+=`${Lje}- ${s.agentType}${al}
@@ -5471,7 +5471,7 @@ ${L.t("gemini.errors.criticalUnhandledRejection")}
5471
5471
  =========================================
5472
5472
  ${L.t("gemini.errors.reason",{reason:e})}${e instanceof Error&&e.stack?`
5473
5473
  ${L.t("gemini.errors.stackTrace")}
5474
- ${e.stack}`:""}`;xa.emit("log-error",n),t||(t=!0,xa.emit("open-debug-console"))})}function kWs(){console.log(L.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.3.10-beta.0"}},r=`crash-${Date.now()}-${process.pid}.json`,n=SWs.join(process.cwd(),r);try{DWs.writeFileSync(n,JSON.stringify(e,null,2)),console.error(L.t("gemini.crashDetected",{crashFilePath:n})),console.error(L.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(L.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(L.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(L.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function eoi(){OWs();let t=process.cwd(),e=Nl(t);if(!e.user.settings.cna){let p=await gbe();p&&e.setValue("User","cna",p)}if(await Gti(),e.errors.length>0){for(let p of e.errors){let h=L.t("gemini.errorInFile",{path:p.path,message:p.message});process.env.NO_COLOR||(h=`\x1B[31m${h}\x1B[0m`),console.error(h),console.error(L.t("gemini.pleaseFixFileAndTryAgain",{path:p.path}))}process.exit(1)}let r=await oKe();(!!r.prompt&&!r.promptInteractive&&!r.continue&&!r.resume||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let i=pk(t),o=await oV(e.merged,i,Mg.generateSessionId(),r);if(L.changeLanguage(o.getLanguage()),o.getDebugMode()&&kWs(),TWs.setDefaultResultOrder(RWs(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(L.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),o.getListExtensions()){console.debug(L.t("gemini.installedExtensions"));for(let p of i)console.debug(`- ${p.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:p}=await Promise.resolve().then(()=>(mjt(),Mti)),h=(await Promise.resolve().then(()=>(qzt(),Qzt))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:p}=await Promise.resolve().then(()=>(pjt(),_ti)),h=(await Promise.resolve().then(()=>(qzt(),Qzt))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",Zt.CLOUD_SHELL),lXn(o.getDebugMode()),await o.initialize(),Qc.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(Qc.setActiveTheme(e.merged.theme)||console.warn(L.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let p=e.merged.autoConfigureMaxOldSpaceSize?BWs(o):[],h=o.getSandbox();if(h){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let m=WG(e.merged.selectedAuthType);if(m)throw new Error(m);await o.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(m){console.error(L.t("gemini.errorAuthenticating"),m),process.exit(1)}await $ni(h,p,o),process.exit(0)}else p.length>0&&(await NWs(p),process.exit(0))}if(e.merged.selectedAuthType===Zt.LOGIN_WITH_IFLOW&&o.isBrowserLaunchSuppressed()&&await UP(e.merged.selectedAuthType,o),o.getExperimentalAcp())return o.getAcpPort()?await dii(o,e,i,r,o.getAcpPort()):iii(o,e,i,r);let s=o.getQuestion(),a=[...await Wni(),...await zni(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&s?.length===0){console.clear();let p=await KO();Zii(Xii(t),e);try{await CKn()}catch(E){o.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",E)}try{await o.setIdeModeAndSyncConnection(!0)}catch(E){console.error(L.t("gemini.failedToConnectToIdeServer"),E)}let h,m=async()=>{try{if(console.clear(),Zii(Xii(t),e),h)try{h.unmount(),await new Promise(C=>process.nextTick(C))}catch(C){console.error(L.t("gemini.errorDuringUnmount"),C)}let{executeSessionStartHooks:E}=await Promise.resolve().then(()=>(EG(),yG)),v=await E(o,"resume");h=p4e((0,lEe.jsx)(Hzt.default.StrictMode,{children:(0,lEe.jsx)(Kjt,{instance:()=>h,config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:v})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:UGt()})}catch(E){console.error(L.t("gemini.errorDuringResume"),E)}};process.on("SIGCONT",m),Kye(()=>{process.off("SIGCONT",m)});let A="startup";(r.continue||r.resume)&&(A="resume");let{executeSessionStartHooks:g}=await Promise.resolve().then(()=>(EG(),yG)),y=await g(o,A);h=p4e((0,lEe.jsx)(Hzt.default.StrictMode,{children:(0,lEe.jsx)(Kjt,{instance:()=>h,config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:y})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:UGt()}),e.merged.disableAutoUpdate||vze().then(E=>{sni(E,e,o.getProjectRoot())}).catch(E=>{o.getDebugMode()&&console.error(L.t("gemini.updateCheckFailed"),E)}),Kye(()=>h.unmount());return}!process.stdin.isTTY&&!s&&(s+=await qni()),s||(console.error(L.t("gemini.noInputProvidedViaStdin")),process.exit(1));let u=Math.random().toString(16).slice(2);cte(o,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:s,prompt_id:u,auth_type:o.getContentGeneratorConfig()?.authType,prompt_length:s.length});let d=await PWs(o,i,e,r),f=r.outputFile||r.output_file;await Kni(d,s,u,f),process.exit(0)}function Zii(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function PWs(t,e,r,n){let i=t;if(t.getApprovalMode()!==hi.YOLO){let o=r.merged.excludeTools||[],s=[$d.Name,mh.Name,Yf.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await oV(c,e,t.getSessionId(),u),await i.initialize()}return await MWs(r.merged.selectedAuthType,i,r)}async function MWs(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!Nbe()&&(console.error(L.t("gemini.pleaseSetAuthMethod",{userSettingsPath:fG})),process.exit(1)),t||(Nbe()?t=Zt.IFLOW:t=Zt.IFLOW);let n=WG(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:r.merged.modelName}),e}eoi().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
5474
+ ${e.stack}`:""}`;xa.emit("log-error",n),t||(t=!0,xa.emit("open-debug-console"))})}function kWs(){console.log(L.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.3.10"}},r=`crash-${Date.now()}-${process.pid}.json`,n=SWs.join(process.cwd(),r);try{DWs.writeFileSync(n,JSON.stringify(e,null,2)),console.error(L.t("gemini.crashDetected",{crashFilePath:n})),console.error(L.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(L.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(L.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(L.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function eoi(){OWs();let t=process.cwd(),e=Nl(t);if(!e.user.settings.cna){let p=await gbe();p&&e.setValue("User","cna",p)}if(await Gti(),e.errors.length>0){for(let p of e.errors){let h=L.t("gemini.errorInFile",{path:p.path,message:p.message});process.env.NO_COLOR||(h=`\x1B[31m${h}\x1B[0m`),console.error(h),console.error(L.t("gemini.pleaseFixFileAndTryAgain",{path:p.path}))}process.exit(1)}let r=await oKe();(!!r.prompt&&!r.promptInteractive&&!r.continue&&!r.resume||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let i=pk(t),o=await oV(e.merged,i,Mg.generateSessionId(),r);if(L.changeLanguage(o.getLanguage()),o.getDebugMode()&&kWs(),TWs.setDefaultResultOrder(RWs(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(L.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),o.getListExtensions()){console.debug(L.t("gemini.installedExtensions"));for(let p of i)console.debug(`- ${p.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:p}=await Promise.resolve().then(()=>(mjt(),Mti)),h=(await Promise.resolve().then(()=>(qzt(),Qzt))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:p}=await Promise.resolve().then(()=>(pjt(),_ti)),h=(await Promise.resolve().then(()=>(qzt(),Qzt))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",Zt.CLOUD_SHELL),lXn(o.getDebugMode()),await o.initialize(),Qc.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(Qc.setActiveTheme(e.merged.theme)||console.warn(L.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let p=e.merged.autoConfigureMaxOldSpaceSize?BWs(o):[],h=o.getSandbox();if(h){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let m=WG(e.merged.selectedAuthType);if(m)throw new Error(m);await o.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(m){console.error(L.t("gemini.errorAuthenticating"),m),process.exit(1)}await $ni(h,p,o),process.exit(0)}else p.length>0&&(await NWs(p),process.exit(0))}if(e.merged.selectedAuthType===Zt.LOGIN_WITH_IFLOW&&o.isBrowserLaunchSuppressed()&&await UP(e.merged.selectedAuthType,o),o.getExperimentalAcp())return o.getAcpPort()?await dii(o,e,i,r,o.getAcpPort()):iii(o,e,i,r);let s=o.getQuestion(),a=[...await Wni(),...await zni(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&s?.length===0){console.clear();let p=await KO();Zii(Xii(t),e);try{await CKn()}catch(E){o.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",E)}try{await o.setIdeModeAndSyncConnection(!0)}catch(E){console.error(L.t("gemini.failedToConnectToIdeServer"),E)}let h,m=async()=>{try{if(console.clear(),Zii(Xii(t),e),h)try{h.unmount(),await new Promise(C=>process.nextTick(C))}catch(C){console.error(L.t("gemini.errorDuringUnmount"),C)}let{executeSessionStartHooks:E}=await Promise.resolve().then(()=>(EG(),yG)),v=await E(o,"resume");h=p4e((0,lEe.jsx)(Hzt.default.StrictMode,{children:(0,lEe.jsx)(Kjt,{instance:()=>h,config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:v})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:UGt()})}catch(E){console.error(L.t("gemini.errorDuringResume"),E)}};process.on("SIGCONT",m),Kye(()=>{process.off("SIGCONT",m)});let A="startup";(r.continue||r.resume)&&(A="resume");let{executeSessionStartHooks:g}=await Promise.resolve().then(()=>(EG(),yG)),y=await g(o,A);h=p4e((0,lEe.jsx)(Hzt.default.StrictMode,{children:(0,lEe.jsx)(Kjt,{instance:()=>h,config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:y})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:UGt()}),e.merged.disableAutoUpdate||vze().then(E=>{sni(E,e,o.getProjectRoot())}).catch(E=>{o.getDebugMode()&&console.error(L.t("gemini.updateCheckFailed"),E)}),Kye(()=>h.unmount());return}!process.stdin.isTTY&&!s&&(s+=await qni()),s||(console.error(L.t("gemini.noInputProvidedViaStdin")),process.exit(1));let u=Math.random().toString(16).slice(2);cte(o,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:s,prompt_id:u,auth_type:o.getContentGeneratorConfig()?.authType,prompt_length:s.length});let d=await PWs(o,i,e,r),f=r.outputFile||r.output_file;await Kni(d,s,u,f),process.exit(0)}function Zii(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function PWs(t,e,r,n){let i=t;if(t.getApprovalMode()!==hi.YOLO){let o=r.merged.excludeTools||[],s=[$d.Name,mh.Name,Yf.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await oV(c,e,t.getSessionId(),u),await i.initialize()}return await MWs(r.merged.selectedAuthType,i,r)}async function MWs(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!Nbe()&&(console.error(L.t("gemini.pleaseSetAuthMethod",{userSettingsPath:fG})),process.exit(1)),t||(Nbe()?t=Zt.IFLOW:t=Zt.IFLOW);let n=WG(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:r.merged.modelName}),e}eoi().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
5475
5475
  /**
5476
5476
  * @license
5477
5477
  * Copyright 2025 Google LLC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iflow-ai/iflow-cli",
3
- "version": "0.3.10-beta.0",
3
+ "version": "0.3.10",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },