@github/copilot 0.0.343-7 → 0.0.343-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -5
- package/package.json +2 -2
- package/sdk/index.js +5 -5
- package/sdk/index.js.map +2 -2
package/index.js
CHANGED
|
@@ -842,7 +842,7 @@ Found ${Z.length} review comment(s):
|
|
|
842
842
|
`}else N+=`
|
|
843
843
|
No review comments found.`,h.warning&&(N+=`
|
|
844
844
|
|
|
845
|
-
Note: ${h.warning}`);e.debug(`Code review completed: ${N}`);let y=Z.map(Y=>Y.meta?.queryId).filter(Y=>!!Y&&Y.trim().length>0).sort();return{textResultForLlm:N,resultType:"success",sessionLog:N,toolTelemetry:{properties:{commentQueryNames:y.join(", "),codeReviewResult:"success",codeReviewModel:d},restrictedProperties:{prTitle:s.prTitle,filesReviewed:b.map(Y=>Y.path).join(", ")},metrics:{reviewedFiles:b.length,commentsGenerated:Z.length,commentsExcluded:h.alerts.length-Z.length}}}}catch(u){let b=gAt(u),p=b?AAt:`Error during code review: ${u}`;return e.error(p),{textResultForLlm:p,resultType:"failure",error:p,toolTelemetry:{properties:{codeReviewResult:"failure",codeReviewError:p,codeReviewTimedOut:b?"true":"false",codeReviewModel:d},metrics:{},restrictedProperties:{}}}}finally{r.endJob()}},safeForTelemetry:!0}};function t5l(){return"capi-prod-claude-sonnet-4"}async function l5l(t,e,l,n,r){try{let I=l.swebench_base_commit
|
|
845
|
+
Note: ${h.warning}`);e.debug(`Code review completed: ${N}`);let y=Z.map(Y=>Y.meta?.queryId).filter(Y=>!!Y&&Y.trim().length>0).sort();return{textResultForLlm:N,resultType:"success",sessionLog:N,toolTelemetry:{properties:{commentQueryNames:y.join(", "),codeReviewResult:"success",codeReviewModel:d},restrictedProperties:{prTitle:s.prTitle,filesReviewed:b.map(Y=>Y.path).join(", ")},metrics:{reviewedFiles:b.length,commentsGenerated:Z.length,commentsExcluded:h.alerts.length-Z.length}}}}catch(u){let b=gAt(u),p=b?AAt:`Error during code review: ${u}`;return e.error(p),{textResultForLlm:p,resultType:"failure",error:p,toolTelemetry:{properties:{codeReviewResult:"failure",codeReviewError:p,codeReviewTimedOut:b?"true":"false",codeReviewModel:d},metrics:{},restrictedProperties:{}}}}finally{r.endJob()}},safeForTelemetry:!0}};function t5l(){return"capi-prod-claude-sonnet-4"}async function l5l(t,e,l,n,r){try{let I=l.swebench_base_commit&&l.swebench_base_commit!=="undefined"?l.swebench_base_commit:"HEAD~1",a=[];try{await t.stageChanges(e),a=await t.getChangedPaths(e,I)}catch(o){r.debug(`Could not get diff against ${I}, checking for working directory changes: ${o}`);try{let u=(await n.execReturn("git",["diff","--name-only"],{cwd:e})).stdout.trim().split(`
|
|
846
846
|
`).filter(h=>h.length>0),p=(await n.execReturn("git",["diff","--cached","--name-only"],{cwd:e})).stdout.trim().split(`
|
|
847
847
|
`).filter(h=>h.length>0);if(a=[...new Set([...u,...p])],a.length===0)try{a=(await n.execReturn("git",["diff","--name-only",pAt,"HEAD"],{cwd:e})).stdout.trim().split(`
|
|
848
848
|
`).filter(Z=>Z.length>0),I=pAt}catch{return r.debug("Could not compare against empty tree"),[]}}catch(d){return r.error(`Error getting working directory changes: ${d}`),[]}}let s=[];for(let o of a)try{let d="";try{let b=kF(e,o);d=await hAt(b,"utf-8")}catch{d=""}let u="";try{u=(await n.execReturn("git",["show",`${I}:${o}`],{cwd:e})).stdout}catch{u=""}s.push({path:o,contents:d,baseContents:u,regions:[[1,Math.max(1,d.split(`
|
|
@@ -868,12 +868,12 @@ extensions:
|
|
|
868
868
|
`,I=t.map(o=>` - [${Zyt.stringify(o.path,{lineWidth:0}).trim()}, ${o.startLine}, ${o.endLine}]
|
|
869
869
|
`).join("");I||(I=` - ["", 0, 0]
|
|
870
870
|
`);let a=r+I,s=Axe.join(n,"pr-diff-range.yml");return hxe.writeFileSync(s,a),l(`Wrote pr-diff-range extension pack to ${s}:
|
|
871
|
-
${a}`,8),n}c();import*as ele from"os";import*as xge from"fs";var HBl=.05,Nyt=1024*1024;function Wyt(t){let e=ele.platform(),l=kBl(e,t)/(1024*1024),n=XBl(l,e),r=Math.floor(l-n);return t(`Using ${r} MB for CodeQL, out of ${l} MB total.`,8),r}function XBl(t,e){let l=1024*(e==="win32"?1.5:1),n=HBl*Math.max(t-8*1024,0);return l+n}function kBl(t,e){let l=[ele.totalmem()];return t==="linux"&&l.push(...["/sys/fs/cgroup/memory/memory.limit_in_bytes","/sys/fs/cgroup/memory.max"].map(r=>LBl(r,e)).filter(r=>r!==void 0).map(r=>r)),Math.min(...l)}function LBl(t,e){if(!xge.existsSync(t)){e(`While resolving RAM, did not find a cgroup memory limit at ${t}.`,8);return}let l=Number(xge.readFileSync(t,"utf8"));if(!Number.isInteger(l)){e(`While resolving RAM, ignored the file ${t} that may contain a cgroup memory limit as this file did not contain an integer.`,8);return}let n=`${Math.floor(l/(1024*1024))} MiB`;if(l>ele.totalmem()){e(`While resolving RAM, ignored the file ${t} that may contain a cgroup memory limit as its contents ${n} were greater than the total amount of system memory.`,8);return}if(l<Nyt){e(`While resolving RAM, ignored a cgroup limit of ${n} in ${t} as it was below ${Nyt/(1024*1024)} MiB.`,8);return}return e(`While resolving RAM, found a cgroup limit of ${n} in ${t}.`,8),l}c();import*as iD from"fs";import*as Sge from"os";function yyt(t){let e=[Sge.cpus().length];return Sge.platform()==="linux"&&(e.push(...["/sys/fs/cgroup/cpuset.cpus.effective","/sys/fs/cgroup/cpuset.cpus"].map(n=>xBl(n,t)).filter(n=>n!==void 0&&n>0).map(n=>n)),e.push(...["/sys/fs/cgroup/cpu.max"].map(n=>JBl(n,t)).filter(n=>n!==void 0&&n>0).map(n=>n))),Math.min(...e)}function JBl(t,e){if(!iD.existsSync(t)){e(`While resolving threads, did not find a cgroup CPU file at ${t}.`,8);return}let n=iD.readFileSync(t,"utf-8").split(" ");if(n.length!==2){e(`While resolving threads, did not use cgroup CPU file at ${t} because it contained ${n.length} value(s) rather than the two expected.`,8);return}let r=n[0];if(r==="max")return;let I=n[1],a=Math.floor(parseInt(r)/parseInt(I));return e(`While resolving threads, found a cgroup CPU file with ${a} CPUs in ${t}.`,8),a}function xBl(t,e){if(!iD.existsSync(t)){e(`While resolving threads, did not find a cgroup CPUs file at ${t}.`,8);return}let l=0,n=iD.readFileSync(t,"utf-8").trim();if(n.length!==0){for(let r of n.split(","))if(!r.includes("-"))++l;else{let I=parseInt(r.split("-")[0]),a=parseInt(r.split("-")[1]);l+=a-I+1}return e(`While resolving threads, found a cgroup CPUs file with ${l} CPUs in ${t}.`,8),l}}var cD=class t{constructor(e,l,n,r,I,a){this.exec=e;this.executablePath=l;this.databaseDir=n;this.settings=r;this.sourceRoot=I;this.progressLogger=a;this.ram=this.resolveRam(),this.threads=this.resolveThreads()}static DIFF_INFORMED_FEATURE_FLAG_NAME="copilot_swe_agent_codeql_diff_informed";ram;repositorySizeCache=new Map;threads;async createDatabase(e,l){let n=`${this.databaseDir}/${l}`,r=this.getBuildMode(l);return await this.execCommand(e,["database","create",this.ram,this.threads,"--no-sublanguage-file-coverage","--no-calculate-baseline","--overwrite","--language",l,"--build-mode",r,"--source-root",this.sourceRoot,n]),n}static AUTOBUILD_ONLY_LANGUAGES=["cpp","go","swift"];getBuildMode(e){return t.AUTOBUILD_ONLY_LANGUAGES.includes(e)?"autobuild":"none"}async analyzeDatabase(e,l,n){let r=[];if(Lo(this.settings,t.DIFF_INFORMED_FEATURE_FLAG_NAME)){let d=dD.mkdtempSync(tle.join(Zxe.tmpdir(),"codeql-")),u=gyt(n,d,this.progressLogger);this.progressLogger(`Created diff range data extension pack at ${u}`,8),r=["--additional-packs",u,"--extension-packs","codeql-action/pr-diff-range"]}let I=`${this.databaseDir}/${l}`,a=`${I}/results-${l}.json`;await dD.promises.rm(a,{force:!0}),this.progressLogger(`Analyzing database at ${I} for language ${l}`);let s=["database","analyze",this.ram,this.threads,"--format","sarifv2.1.0","--output",a,...r,I,`codeql/${l}-queries`];return await this.execCommand(e,s),new OZe(a,this.progressLogger.bind(this)).summarize(l,n)}async version(e){let l=await this.execCommand(e,["version","--format","json"]);try{return JSON.parse(l).version}catch{throw new Error(`Failed to parse CodeQL version output: ${l}`)}}async getRepositorySize(e){return this.repositorySizeCache.has(e)||this.repositorySizeCache.set(e,await this.computeRepositorySize(e)),this.repositorySizeCache.get(e)}async execCommand(e,l){return this.progressLogger(`Executing CodeQL command: ${
|
|
871
|
+
${a}`,8),n}c();import*as ele from"os";import*as xge from"fs";var HBl=.05,Nyt=1024*1024;function Wyt(t){let e=ele.platform(),l=kBl(e,t)/(1024*1024),n=XBl(l,e),r=Math.floor(l-n);return t(`Using ${r} MB for CodeQL, out of ${l} MB total.`,8),r}function XBl(t,e){let l=1024*(e==="win32"?1.5:1),n=HBl*Math.max(t-8*1024,0);return l+n}function kBl(t,e){let l=[ele.totalmem()];return t==="linux"&&l.push(...["/sys/fs/cgroup/memory/memory.limit_in_bytes","/sys/fs/cgroup/memory.max"].map(r=>LBl(r,e)).filter(r=>r!==void 0).map(r=>r)),Math.min(...l)}function LBl(t,e){if(!xge.existsSync(t)){e(`While resolving RAM, did not find a cgroup memory limit at ${t}.`,8);return}let l=Number(xge.readFileSync(t,"utf8"));if(!Number.isInteger(l)){e(`While resolving RAM, ignored the file ${t} that may contain a cgroup memory limit as this file did not contain an integer.`,8);return}let n=`${Math.floor(l/(1024*1024))} MiB`;if(l>ele.totalmem()){e(`While resolving RAM, ignored the file ${t} that may contain a cgroup memory limit as its contents ${n} were greater than the total amount of system memory.`,8);return}if(l<Nyt){e(`While resolving RAM, ignored a cgroup limit of ${n} in ${t} as it was below ${Nyt/(1024*1024)} MiB.`,8);return}return e(`While resolving RAM, found a cgroup limit of ${n} in ${t}.`,8),l}c();import*as iD from"fs";import*as Sge from"os";function yyt(t){let e=[Sge.cpus().length];return Sge.platform()==="linux"&&(e.push(...["/sys/fs/cgroup/cpuset.cpus.effective","/sys/fs/cgroup/cpuset.cpus"].map(n=>xBl(n,t)).filter(n=>n!==void 0&&n>0).map(n=>n)),e.push(...["/sys/fs/cgroup/cpu.max"].map(n=>JBl(n,t)).filter(n=>n!==void 0&&n>0).map(n=>n))),Math.min(...e)}function JBl(t,e){if(!iD.existsSync(t)){e(`While resolving threads, did not find a cgroup CPU file at ${t}.`,8);return}let n=iD.readFileSync(t,"utf-8").split(" ");if(n.length!==2){e(`While resolving threads, did not use cgroup CPU file at ${t} because it contained ${n.length} value(s) rather than the two expected.`,8);return}let r=n[0];if(r==="max")return;let I=n[1],a=Math.floor(parseInt(r)/parseInt(I));return e(`While resolving threads, found a cgroup CPU file with ${a} CPUs in ${t}.`,8),a}function xBl(t,e){if(!iD.existsSync(t)){e(`While resolving threads, did not find a cgroup CPUs file at ${t}.`,8);return}let l=0,n=iD.readFileSync(t,"utf-8").trim();if(n.length!==0){for(let r of n.split(","))if(!r.includes("-"))++l;else{let I=parseInt(r.split("-")[0]),a=parseInt(r.split("-")[1]);l+=a-I+1}return e(`While resolving threads, found a cgroup CPUs file with ${l} CPUs in ${t}.`,8),l}}var cD=class t{constructor(e,l,n,r,I,a){this.exec=e;this.executablePath=l;this.databaseDir=n;this.settings=r;this.sourceRoot=I;this.progressLogger=a;this.ram=this.resolveRam(),this.threads=this.resolveThreads()}static DIFF_INFORMED_FEATURE_FLAG_NAME="copilot_swe_agent_codeql_diff_informed";ram;repositorySizeCache=new Map;threads;async createDatabase(e,l){let n=`${this.databaseDir}/${l}`,r=this.getBuildMode(l);return await this.execCommand(e,["database","create",this.ram,this.threads,"--no-sublanguage-file-coverage","--no-calculate-baseline","--overwrite","--language",l,"--build-mode",r,"--source-root",this.sourceRoot,n]),n}static AUTOBUILD_ONLY_LANGUAGES=["cpp","go","swift"];getBuildMode(e){return t.AUTOBUILD_ONLY_LANGUAGES.includes(e)?"autobuild":"none"}async analyzeDatabase(e,l,n){let r=[];if(Lo(this.settings,t.DIFF_INFORMED_FEATURE_FLAG_NAME)){let d=dD.mkdtempSync(tle.join(Zxe.tmpdir(),"codeql-")),u=gyt(n,d,this.progressLogger);this.progressLogger(`Created diff range data extension pack at ${u}`,8),r=["--additional-packs",u,"--extension-packs","codeql-action/pr-diff-range"]}let I=`${this.databaseDir}/${l}`,a=`${I}/results-${l}.json`;await dD.promises.rm(a,{force:!0}),this.progressLogger(`Analyzing database at ${I} for language ${l}`);let s=["database","analyze",this.ram,this.threads,"--format","sarifv2.1.0","--output",a,...r,I,`codeql/${l}-queries`];return await this.execCommand(e,s),new OZe(a,this.progressLogger.bind(this)).summarize(l,n)}async version(e){let l=await this.execCommand(e,["version","--format","json"]);try{return JSON.parse(l).version}catch{throw new Error(`Failed to parse CodeQL version output: ${l}`)}}async getRepositorySize(e){return this.repositorySizeCache.has(e)||this.repositorySizeCache.set(e,await this.computeRepositorySize(e)),this.repositorySizeCache.get(e)}async execCommand(e,l){let n=l.filter(Boolean);return this.progressLogger(`Executing CodeQL command: ${n}`),(await this.exec.execReturn(this.executablePath,n,{abortSignal:e})).stdout}resolveRam(){try{return`--ram=${Wyt(this.progressLogger)}`}catch(e){return this.progressLogger(`Failed to resolve RAM, not passing --ram flag to CodeQL: ${e}`,2),""}}resolveThreads(){try{return`--threads=${yyt(this.progressLogger)}`}catch(e){return this.progressLogger(`Failed to resolve threads, not passing --threads flag to CodeQL: ${e}`,2),""}}getSccExecutablePath(){let e=tle.dirname(this.executablePath),l;switch(Zxe.platform()){case"win32":l=tle.join(e,"tools/win64/scc.exe");break;case"darwin":l=tle.join(e,"tools/osx64/scc");break;case"linux":l=tle.join(e,"tools/linux64/scc");break;default:return}if(dD.existsSync(l))return l}async computeRepositorySize(e){let l=this.getSccExecutablePath();if(!l){this.progressLogger(`SCC executable not found for platform: ${Zxe.platform()}`,2);return}let n=EAt(e);if(!n){this.progressLogger(`No file extensions found for language: ${e}`,2);return}let r=["--exclude-dir",tLe.join(","),"--format","json","--include-ext",n.join(","),"--no-complexity","--no-cocomo"],I=Eyt.spawn(l,r,{cwd:this.sourceRoot}),a="",s="";I.stdout.on("data",d=>{a+=d}),I.stderr.on("data",d=>{s+=d});let o=await new Promise(d=>{I.on("close",d)});if(o!==0){this.progressLogger(`SCC failed with exit code ${o}: ${s}`,2);return}try{let u=JSON.parse(a).reduce((b,p)=>b+p.Bytes,0);return this.progressLogger(`SCC output for ${e}: ${u} bytes`,4),u}catch(d){this.progressLogger(`Failed to parse SCC output: ${d}`,2);return}}};var Yyt="codeql-bundle-linux64.tar.gz",OBl=new U3;async function TBl(t,e){let r=(await new UAe({auth:t}).rest.repos.getLatestRelease({owner:"github",repo:"codeql-action"})).data.assets.find(I=>I.name===Yyt);if(r)return e(`CodeQL asset ID: ${r.id}`),r.id;throw new Error("CodeQL asset not found")}async function UBl(t,e,l,n){let r=await fetch(`https://api.github.com/repos/github/codeql-action/releases/assets/${t}`,{headers:{Authorization:`token ${l}`,Accept:"application/octet-stream"},redirect:"follow"});if(!r.ok||!r.body)throw new Error(`Failed to download asset: ${r.statusText}`);let I=uD.join(e,Yyt),a=V1.createWriteStream(I,{flags:"wx"});return await BBl(SBl.fromWeb(r.body).pipe(a)),n(`CodeQL downloaded to ${I}`),I}async function MBl(t,e,l){await V1.promises.mkdir(e,{recursive:!0});try{return await HJe({file:t,cwd:e}),l(`CodeQL unzipped to ${e}`),wyt(e)}catch(n){throw OBl.error(`Error unzipping CodeQL: ${String(n)}`),n}}async function _Bl(t,e,l){let n=process.env.GITHUB_TOKEN||O3(l),r=await TBl(n,e),I=DBl(t);await V1.promises.mkdir(I,{recursive:!0});let a=await UBl(r,I,n,e);return await MBl(a,t,e),await V1.promises.rm(a),Qyt(t)}async function Vyt(t,e,l,n,r){let I=zBl(t);await V1.promises.mkdir(I,{recursive:!0});let a=await PBl(r);if(a)return new cD(n,a,I,l,e,r);let s=Qyt(t);if(await gxe(s))return r(`CodeQL already exists at ${s}`),new cD(n,s,I,l,e,r);try{let o=await _Bl(t,r,l);return new cD(n,o,I,l,e,r)}catch(o){throw r(`Error ensuring CodeQL: ${String(o)}`,1),o}}function DBl(t){return uD.join(t,"codeql-download")}function Qyt(t){return uD.join(wyt(t),"codeql")}function wyt(t){return uD.join(t,"codeql")}function zBl(t){return uD.join(t,"dbs")}async function PBl(t){if(!process.env.RUNNER_TOOL_CACHE)return;let e=Bge.findAllVersions("CodeQL");if(!e.length)return;let l=e[0],n=Bge.find("CodeQL",l,Ryt.arch());if(n){let r=uD.join(n,"codeql","codeql");if(t(`CodeQL directory found in toolcache at '${n}'.`),!await gxe(r)){let I;throw await gxe(n)?I=V1.readdirSync(n):I=["path does not exist"],new Error(`CodeQL executable not found at '${r}'. Contents of toolcache: '${I.join(", ")}'.`)}return r}}async function gxe(t){try{return await V1.promises.stat(t),!0}catch{return!1}}var Oge=class t{constructor(e,l,n,r,I){this.config=e;this.git=l;this.baseCommit=n;this.settings=r;this.logger=I;this.budgeter=Q_.createBudgeter(t.TOOL_NAME,r)}static DEFAULT_MAX_REPO_SIZE_BYTES=1e7;static DEFAULT_TIMEOUT_MS=180*1e3;static TOOL_NAME="codeql_checker";static CODEQL_CHECKER_ENABLED_FF="copilot_swe_agent_enable_security_tool";static CODEQL_CHECKER_DISABLED_FF="copilot_swe_agent_enable_security_tool_disabled";static isEnabled(e){return Lo(e,t.CODEQL_CHECKER_ENABLED_FF)&&!Lo(e,t.CODEQL_CHECKER_DISABLED_FF)}executor;budgeter;async getCodeQLCheckerTool(){let e=await this.createCodeQLScratchDir(this.config.location);return this.executor=await Vyt(e,this.config.location,this.settings,new aW(this.logger),this.logProgress.bind(this)),{name:t.TOOL_NAME,description:`This is a security tool that discovers vulnerabilities in code using CodeQL. It must always be run when there are code changes.
|
|
872
872
|
It is run after committing all changed code and before the final verification. Feedback from this tool must be incorporated into
|
|
873
|
-
the change and then the tool must be re-run.`,input_schema:{type:"object",properties:{}},callback:this.callback.bind(this),safeForTelemetry:!0}}async callback(){let e={},l="unknown",n=Date.now();try{if(!this.executor)throw new Error("CodeQL Executor is not initialized.");let r=this.budgeter.startJob();r.throwIfAborted(),l=await this.executor.version(r),await this.git.stageChanges(this.config.location);let I=await this.git.getDiffRanges(this.config.location,this.baseCommit),a=yAt(I);a.length>0?this.logProgress(`Languages found to analyze: ${a.join(", ")}`):this.logProgress("No languages found to analyze.");let s=[],o=!0;for(let u of a){if(r.throwIfAborted(),!await this.shouldAnalyzeLanguage(this.executor,u)){e[u]={skipped:!0};continue}let b=Date.now();try{await this.executor.createDatabase(r,u),this.logProgress(`Created database for ${u}.`),e[u]={databaseCreationSuccess:!0,databaseCreationTimeMs:Date.now()-b}}catch(h){
|
|
873
|
+
the change and then the tool must be re-run.`,input_schema:{type:"object",properties:{}},callback:this.callback.bind(this),safeForTelemetry:!0}}async callback(){let e={},l="unknown",n=Date.now();try{if(!this.executor)throw new Error("CodeQL Executor is not initialized.");let r=this.budgeter.startJob();r.throwIfAborted(),l=await this.executor.version(r),await this.git.stageChanges(this.config.location);let I=await this.git.getDiffRanges(this.config.location,this.baseCommit),a=yAt(I);a.length>0?this.logProgress(`Languages found to analyze: ${a.join(", ")}`):this.logProgress("No languages found to analyze.");let s=[],o=!0;for(let u of a){if(r.throwIfAborted(),!await this.shouldAnalyzeLanguage(this.executor,u)){e[u]={skipped:!0};continue}let b=Date.now();try{await this.executor.createDatabase(r,u),this.logProgress(`Created database for ${u}.`),e[u]={databaseCreationSuccess:!0,databaseCreationTimeMs:Date.now()-b}}catch(h){o=!1;let Z=`Error creating database for ${u}: ${String(h)}`;if(this.logProgress(Z,1),e[u]={databaseCreationError:h instanceof Error?h:new Error(String(h)),databaseCreationSuccess:!1,databaseCreationTimeMs:Date.now()-b},this.isAbortError(h))throw e[u].aborted=!0,h;continue}r.throwIfAborted();let p=Date.now();try{let h=await this.executor.analyzeDatabase(r,u,I);s.push(h);let Z=h.alerts.length;this.logProgress(`Completed analysis of ${u}. ${Z} ${Z===1?"alert":"alerts"} found.`),e[u]={...e[u],analysisSuccess:!0,analysisTimeMs:Date.now()-p,analysisRuleIds:h.alerts.flatMap(N=>N.ruleId?[N.ruleId]:[]),querySuite:`${u}-code-scanning`}}catch(h){if(this.isAbortError(h))throw e[u].aborted=!0,h;o=!1;let Z=`Error analyzing database for ${u}: ${String(h)}`;this.logProgress(Z,1),e[u]={...e[u],analysisError:h instanceof Error?h:new Error(String(h)),analysisSuccess:!1,analysisTimeMs:Date.now()-p,analysisRuleIds:[]},s.push({language:u,alerts:[],numFilteredAlerts:0})}}let d=this.generateAnalysisReport(s,e);return{resultType:o?"success":"failure",textResultForLlm:d,sessionLog:d,toolTelemetry:{event:"tool_call_executed",properties:{"codeql.version":l},metrics:{"codeql.languages.count":a.length,"codeql.total.alerts":s.reduce((u,b)=>u+b.alerts.length,0),"codeql.duration.ms":Date.now()-n},restrictedProperties:{}}}}catch(r){let I=this.isAbortError(r)?`Operation cancelled due to timeout. Do not re-run the ${t.TOOL_NAME} tool because it will not complete successfully.`:`Error in CodeQL Checker: '${String(r)}'`;this.logProgress(I,1);let a={event:"tool_call_executed",properties:{"codeql.version":l,"codeql.aborted":this.isAbortError(r)?"true":"false"},metrics:{"codeql.languages.count":0,"codeql.total.alerts":0,"codeql.duration.ms":Date.now()-n},restrictedProperties:{"codeql.stack":r instanceof Error?r.stack??"":""}};return oW({telemetry:a},r,"codeql.error"),{resultType:"failure",textResultForLlm:I,sessionLog:I,toolTelemetry:a}}finally{this.budgeter.endJob();let r=this.createTelemetryByLanguage(e,l);for(let I of r)this.config.callback?.progress({kind:"telemetry",telemetry:I})}}generateAnalysisReport(e,l){let n=e.map(a=>{let s=l[a.language];if(s){if("skipped"in s)return`- ${a.language}: Analysis was skipped because the database size is too large.`;if(s.databaseCreationSuccess){if("analysisSuccess"in s&&!s.analysisSuccess)return`- ${a.language}: Analysis failed.`;if(a.alerts.length===0)return`- ${a.language}: No alerts found.`}else return`- ${a.language}: Database creation failed.`}else return`- ${a.language}: No telemetry data available.`;return`- ${a.language}: \`\`\`${JSON.stringify(a,null,2)}\`\`\``}),r=e.reduce((a,s)=>a+s.alerts.length,0),I=e.map(a=>a.language);return I.length===0?"No code changes detected for languages that CodeQL can analyze, so no analysis was performed.":`Analysis Result for '${I.join(", ")}'. Found ${r} alert(s):
|
|
874
874
|
|
|
875
875
|
${n.join(`
|
|
876
|
-
`)}`}isAbortError(e){return e instanceof Error&&(e.name==="TimeoutError"||e.name==="AbortError")}
|
|
876
|
+
`)}`}isAbortError(e){return e instanceof Error&&(e.name==="TimeoutError"||e.name==="AbortError")}async logProgress(e,l=4,n){switch(n&&this.logger.startGroup(n),l){case 8:this.logger.debug(e);break;case 4:this.logger.info(e);break;case 2:this.logger.warning(e);break;case 1:this.logger.error(e);break;default:this.logger.log(e);break}n&&this.logger.endGroup(),this.config.callback&&await this.config.callback?.progress({kind:"log",message:e})}async createCodeQLScratchDir(e){let l=Fyt.normalize(Fyt.join(e,"..",".codeql-scratch"));return await Cyt.promises.mkdir(l,{recursive:!0}),l}createTelemetryByLanguage(e,l){let n=[];for(let[r,I]of Object.entries(e)){if(NAt(I)){let s={event:"codeql-checker-completion",properties:{"codeql.language":r,"codeql.skipped":"true","codeql.version":l},metrics:{},restrictedProperties:{}};n.push(s);continue}let a={event:"codeql-checker-completion",properties:{"codeql.language":r,"codeql.databaseCreationSuccess":I.databaseCreationSuccess?"true":"false","codeql.analysisRuleIds":w_(I)?I.analysisRuleIds.join(","):"","codeql.version":l,"codeql.querySuite":w_(I)?I.querySuite:void 0},metrics:{"codeql.databaseCreationTimeMs":I.databaseCreationTimeMs,"codeql.analysisTimeMs":w_(I)?I.analysisTimeMs:void 0,"codeql.alertCount":w_(I)?I.analysisRuleIds.length:0},restrictedProperties:{}};I.aborted&&(a.properties["codeql.aborted"]="true"),I.databaseCreationError&&(oW({telemetry:a},I.databaseCreationError,"codeql.databaseCreationError"),a.restrictedProperties["codeql.databaseCreationStack"]=String(I.databaseCreationError.stack)),w_(I)&&(a.properties["codeql.analysisSuccess"]=I.analysisSuccess?"true":"false",I.analysisError&&(oW({telemetry:a},I.analysisError,"codeql.analysisError"),a.restrictedProperties["codeql.analysisStack"]=String(I.analysisError.stack))),n.push(a)}return n}async shouldAnalyzeLanguage(e,l){if(l=="actions")return!0;let n=await e.getRepositorySize(l);if(n===void 0)return!0;let r=n<=t.DEFAULT_MAX_REPO_SIZE_BYTES;return r||this.logProgress(`Skipping analysis for ${l} because the repository size is ${n} bytes, which exceeds the limit of ${t.DEFAULT_MAX_REPO_SIZE_BYTES} bytes.`,2),r}};c();c();var mD=["actions","composer","erlang","go","maven","npm","nuget","other","pip","pub","rubygems","rust","swift"],jBl={npm_and_yarn:"npm",bundler:"rubygems",pip:"pip",maven:"maven",composer:"composer",go_modules:"go",github_actions:"actions",cargo:"rust",pub:"pub",swift:"swift",nuget:"nuget",gradle:"maven",hex:"erlang",other:"other"};function fyt(t){if(!t)return;let e=t.toLowerCase();return jBl[e]}async function Hyt(t,e,l){let n;if(mD.includes(e.ecosystem)?n=e.ecosystem:n=fyt(e.ecosystem),!n)return l?.warning(`Unsupported ecosystem '${e.ecosystem}' for dependency ${e.name}; skipping advisory lookup.`),[];let r={affects:`${e.name}@${e.version}`,ecosystem:n},[I,a,s]=await Promise.all([t.securityAdvisories.listGlobalAdvisories({...r,severity:"high"}),t.securityAdvisories.listGlobalAdvisories({...r,severity:"critical"}),t.securityAdvisories.listGlobalAdvisories({...r,type:"malware"})]);return[...I.data,...a.data,...s.data].flatMap(d=>d.vulnerabilities?.map(u=>({name:e.name,version:e.version,summary:d.summary,ecosystem:u.package?.ecosystem??"unknown",affectedVersions:u.vulnerable_version_range??"",patchedVersion:u.first_patched_version??"not available",severity:d.severity,type:d.type}))??[])}function Xyt(t){return t.map(e=>{let l=e.type==="malware"?"is malware":"has a vulnerability";return`Dependency ${e.name} version ${e.version} in ecosystem ${e.ecosystem} ${l}: ${e.summary}. Affected versions: ${e.affectedVersions}. Patched version: ${e.patchedVersion}.`}).join(`
|
|
877
877
|
|
|
878
878
|
`)}function vyt(t){if(!t.trim())return"parameter must be a non-empty string."}function KBl(t){if(!mD.includes(t)&&!fyt(t))return`ecosystem '${t}' is not supported. Supported ecosystems are: ${mD.join(", ")}.`}function kyt(t){let e=[],l=vyt(t.name);l&&e.push(`name: ${l}`);let n=vyt(t.version);n&&e.push(`version: ${n}`);let r=KBl(t.ecosystem);return r&&e.push(`ecosystem: ${r}`),e}var qBl="gh-advisory-database",Lyt="copilot_swe_agent_validation_agent_dependencies",$Bl="security agent",Jyt={name:qBl,description:`Security tool that checks the GitHub advisory DB for vulnerabilities in dependencies. Run this tool ALWAYS before adding new dependencies from these SUPPORTED ecosystems: ${mD.join(", ")}. For ANY other ecosystem (e.g., Haskell/Cabal, C++/vcpkg, Elixir/Hex, etc.), DO NOT call this tool - just proceed with adding the dependency. If you don't know the version number, retrieve that first. Feedback from this tool MUST be incorporated. Re-run the tool as appropriate.`,input_schema:{type:"object",properties:{dependencies:{type:"array",items:{type:"object",properties:{version:{type:"string",description:"The version of the dependency in semver format. Examples: '1.0.0', '2.1.0'."},name:{type:"string",description:"The name of the dependency. Examples: 'express', 'lodash'."},ecosystem:{type:"string",enum:mD,description:"The package ecosystem for the dependency. Must be one of the supported ecosystems. If the dependency's ecosystem is not in the list of supported ecosystems, DO NOT use this tool."}},required:["name","version","ecosystem"]}}},required:["dependencies"]},callback:e9l,safeForTelemetry:{name:!0,inputsNames:!1}};async function e9l({dependencies:t},e){if(!t||t.length===0)return{textResultForLlm:"No dependencies provided for checking.",resultType:"success",sessionLog:"No dependencies provided for checking.",toolTelemetry:{}};let l=[];for(let n of t){let r=kyt(n);if(r.length>0){let I=`Invalid parameters found for dependency ${n.name}: ${r.join(", ")}`;return{textResultForLlm:I,resultType:"failure",sessionLog:I,toolTelemetry:{}}}try{let I=e?O3(e.settings):process.env.GH_TOKEN;if(!I){let s="GitHub token is required to use the dependency checker tool. Please set it in the settings or as the GH_TOKEN environment variable.";return{textResultForLlm:s,resultType:"failure",sessionLog:s,toolTelemetry:{properties:{error:s}}}}let a=new UAe({userAgent:$Bl,auth:I});l.push(...await Hyt(a,n))}catch(I){let a=`Error checking dependency ${n.name}: ${String(I)}`,s=I instanceof Error?I.stack:void 0;return{textResultForLlm:a,resultType:"failure",sessionLog:a,toolTelemetry:{restrictedProperties:{dep:`${n.name}@${n.version}`,error:a,stackTrace:s}}}}}if(l.length===0)return{textResultForLlm:"No vulnerabilities found in the provided dependencies.",resultType:"success",sessionLog:"No vulnerabilities found in the provided dependencies.",toolTelemetry:{}};{let n=Xyt(l);return{textResultForLlm:n,resultType:"success",sessionLog:n,toolTelemetry:{restrictedProperties:{vulnerableDeps:l.map(r=>`${r.name}@${r.version}`).join(", ")},metrics:{vulnerableDependencies:l.length}}}}}c();var xyt="reply_to_comment",Syt=(t,e)=>({name:xyt,description:`Reply to new comments. Use when you've completed a meaningful unit of work that specifically addresses the request, question, or feedback in the comment.
|
|
879
879
|
* Use this tool no more than once per <comment_id>, and only after you have completed meaningful work that specifically addresses the text in the comment.
|
|
@@ -1956,7 +1956,7 @@ Pay attention to the following when using it:
|
|
|
1956
1956
|
This tool is used to perform a semantic search of the codebase to find relevant information based on the question asked.
|
|
1957
1957
|
* It leverages advanced AI techniques to understand the context and semantics of the codebase.
|
|
1958
1958
|
* Use this tool when you need to find information that is not easily accessible through traditional search methods.
|
|
1959
|
-
`,input_schema:{type:"object",properties:{question:{type:"string",description:"A question about the codebase. It should reference by name any topics, specific file names, and concepts that are relevant to the question and specify the desired output format."}},required:["question"]},callback:async n=>{let r,I=YAe(t),a="",s="",o=I.split("/");if(o.length===2){[a,s]=o,l.info("Searching for repository insights");try{r=await wPe(n.question,a,s,e,l),l.info(`Blackbird results: ${r}`)}catch(d){l.error(`Error occurred while searching for repository insights: ${d}`)}}return{resultType:"success",textResultForLlm:r??"No results found.",toolTelemetry:{}}}}}async function hSt(t,e,l,n,r,I,a){let s=await ASt(t),o=await dhn(t,l,n),d=GSt(l)?[new uYe(n,l,r,I,t,t.location,Dge(),a).getSearch()]:[],u=t.splitEditingTools?Vxe(t,n,l):[Kge(t,n,l)];return[s.shellTool,...s.otherTools??[],...o,...d,...u,Uyt(t,e,l,n,r),Lo(l,$ke)?ZAt(t,n,r,l):void 0,t?.requireReasoning?wxe(t):void 0,Lo(l,Lyt)?Jyt:void 0,await uhn(t,l,n,r)].filter(b=>b!==void 0)}async function vPe(t,e){let l=await ASt(t),n=t.splitEditingTools?Vxe(t,e):[Kge(t,e)];return[l.shellTool,...l.otherTools??[],...n,t?.requireReasoning?wxe(t):void 0].filter(r=>r!==void 0)}async function chn(t,e,l,n,r,I,a){return[...await hSt(t,e,l,n,r,I,a),Syt(t,n)]}var fPe=t=>({...uQ,supports:{...uQ.supports,reasoning:t?.thinkingMode?!0:uQ.supports?.reasoning}}),uQ={supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!1},createPR:{toolInit:hSt,jitInstructions:SOe},prDetails:{},respondToPRComment:{toolInit:chn,jitInstructions:SOe}},HPe=t=>({"sweagent-capi":{"claude-3.5-sonnet":{...uQ,supports:{tool_choice:!1,reasoning:!1}},"claude-3.7-sonnet":{...uQ,supports:{tool_choice:!1,reasoning:!1,vision:!0}},"claude-sonnet-4":{...uQ,supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!0,vision:!0},toolConfigOverrides:{splitEditingTools:!0}},"claude-sonnet-4.5":{...uQ,supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!0,vision:!0},toolConfigOverrides:{splitEditingTools:!0}},oswe:{...uQ,supports:{tool_choice:!0,reasoning:!0,vision:!0}},"oswe-prime":{...uQ,supports:{tool_choice:!0,reasoning:!0,vision:!0}},"gpt-5":{...uQ,supports:{tool_choice:!0,reasoning:!0,parallel_tool_calls:!0,vision:!0,steering:!0},toolConfigOverrides:{splitEditingTools:!0}}}});async function ASt(t){let e=new tNe(t);return{shellTool:e.getShellTool(),otherTools:[e.getWriteShellTool(),e.getReadShellTool(),e.getStopShellTool()]}}async function dhn(t,e,l){if(zSe(e,"cloud"))return[new Qle(new XNe(e,l,void 0)).getStoreMemory()];if(zSe(e,"local")){let n=new Qle(new HNe(t.location));return[n.getStoreMemory(),n.getReadMemory()]}return[]}async function uhn(t,e,l,n){if(t.includeCodeQLTool){let r=new cg(l,n),I=e.swebench_base_commit??await r.getCurrentCommitHash(t.location);return new Oge(t,r,I,e,l).getCodeQLCheckerTool()}}c();async function ZSt(t,e){switch(t.kind){case"image_processing":return e.onImageProcessingEvent(t);case"images_removed":return e.onImageRemovalEvent(t);case"message":return e.onMessage(t);case"model_call_failure":return e.onModelCallFailure(t);case"model_call_success":return await e.onModelCallSuccess(t);case"response":return e.onResponse(t);case"tool_execution":return e.onToolExecution(t);case"history_truncated":return e.onTruncationEvent(t);case"turn_started":case"turn_ended":case"turn_failed":case"turn_retry":return e.onTurnEvent(t);default:{let l=t;throw new Error(`unexpected event kind: ${JSON.stringify(t)}`)}}}c();c();c();import{Writable as v0n}from"stream";c();c();c();c();c();var P={};sb(P,{BRAND:()=>Jhn,DIRTY:()=>L9,EMPTY_PATH:()=>phn,INVALID:()=>Br,NEVER:()=>dAn,OK:()=>kh,ParseStatus:()=>Yp,Schema:()=>ga,ZodAny:()=>Jk,ZodArray:()=>Ov,ZodBigInt:()=>x9,ZodBoolean:()=>S9,ZodBranded:()=>Cce,ZodCatch:()=>K9,ZodDate:()=>B9,ZodDefault:()=>j9,ZodDiscriminatedUnion:()=>GYe,ZodEffects:()=>KE,ZodEnum:()=>z9,ZodError:()=>Xh,ZodFirstPartyTypeKind:()=>Pr,ZodFunction:()=>hYe,ZodIntersection:()=>M9,ZodIssueCode:()=>vl,ZodLazy:()=>_9,ZodLiteral:()=>D9,ZodMap:()=>OK,ZodNaN:()=>UK,ZodNativeEnum:()=>P9,ZodNever:()=>H2,ZodNull:()=>T9,ZodNullable:()=>GQ,ZodNumber:()=>J9,ZodObject:()=>jg,ZodOptional:()=>PE,ZodParsedType:()=>Fn,ZodPipeline:()=>vce,ZodPromise:()=>xk,ZodReadonly:()=>q9,ZodRecord:()=>pYe,ZodSchema:()=>ga,ZodSet:()=>TK,ZodString:()=>Lk,ZodSymbol:()=>SK,ZodTransformer:()=>KE,ZodTuple:()=>bQ,ZodType:()=>ga,ZodUndefined:()=>O9,ZodUnion:()=>U9,ZodUnknown:()=>Bv,ZodVoid:()=>BK,addIssueToContext:()=>hn,any:()=>JPe,array:()=>Wu,bigint:()=>Ohn,boolean:()=>Do,coerce:()=>Hce,custom:()=>VSt,date:()=>Thn,datetimeRegex:()=>RSt,defaultErrorMap:()=>xv,discriminatedUnion:()=>fce,effect:()=>nAn,enum:()=>Kg,function:()=>$hn,getErrorMap:()=>LK,getParsedType:()=>mQ,instanceof:()=>Shn,intersection:()=>jhn,isAborted:()=>mYe,isAsync:()=>JK,isDirty:()=>bYe,isValid:()=>kk,late:()=>xhn,lazy:()=>eAn,literal:()=>Ar,makeIssue:()=>Fce,map:()=>Khn,nan:()=>Bhn,nativeEnum:()=>tAn,never:()=>Dhn,null:()=>_hn,nullable:()=>IAn,number:()=>Lh,object:()=>$l,objectUtil:()=>XPe,oboolean:()=>cAn,onumber:()=>iAn,optional:()=>rAn,ostring:()=>oAn,pipeline:()=>sAn,preprocess:()=>aAn,promise:()=>lAn,quotelessJson:()=>mhn,record:()=>X2,set:()=>qhn,setErrorMap:()=>Ghn,strictObject:()=>Phn,string:()=>Vt,symbol:()=>Uhn,transformer:()=>nAn,tuple:()=>xPe,undefined:()=>Mhn,union:()=>Jh,unknown:()=>pQ,util:()=>Is,void:()=>zhn});c();c();c();c();c();var Is;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function l(r){throw new Error}t.assertNever=l,t.arrayToEnum=r=>{let I={};for(let a of r)I[a]=a;return I},t.getValidEnumValues=r=>{let I=t.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),a={};for(let s of I)a[s]=r[s];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(I){return r[I]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let I=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&I.push(a);return I},t.find=(r,I)=>{for(let a of r)if(I(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,I=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(I)}t.joinValues=n,t.jsonStringifyReplacer=(r,I)=>typeof I=="bigint"?I.toString():I})(Is||(Is={}));var XPe;(function(t){t.mergeShapes=(e,l)=>({...e,...l})})(XPe||(XPe={}));var Fn=Is.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mQ=t=>{switch(typeof t){case"undefined":return Fn.undefined;case"string":return Fn.string;case"number":return Number.isNaN(t)?Fn.nan:Fn.number;case"boolean":return Fn.boolean;case"function":return Fn.function;case"bigint":return Fn.bigint;case"symbol":return Fn.symbol;case"object":return Array.isArray(t)?Fn.array:t===null?Fn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Fn.promise:typeof Map<"u"&&t instanceof Map?Fn.map:typeof Set<"u"&&t instanceof Set?Fn.set:typeof Date<"u"&&t instanceof Date?Fn.date:Fn.object;default:return Fn.unknown}};var vl=Is.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"]),mhn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Xh=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 l=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,l):this.__proto__=l,this.name="ZodError",this.issues=e}format(e){let l=e||function(I){return I.message},n={_errors:[]},r=I=>{for(let a of I.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(l(a));else{let s=n,o=0;for(;o<a.path.length;){let d=a.path[o];o===a.path.length-1?(s[d]=s[d]||{_errors:[]},s[d]._errors.push(l(a))):s[d]=s[d]||{_errors:[]},s=s[d],o++}}};return r(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,Is.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=l=>l.message){let l={},n=[];for(let r of this.issues)if(r.path.length>0){let I=r.path[0];l[I]=l[I]||[],l[I].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:l}}get formErrors(){return this.flatten()}};Xh.create=t=>new Xh(t);var bhn=(t,e)=>{let l;switch(t.code){case vl.invalid_type:t.received===Fn.undefined?l="Required":l=`Expected ${t.expected}, received ${t.received}`;break;case vl.invalid_literal:l=`Invalid literal value, expected ${JSON.stringify(t.expected,Is.jsonStringifyReplacer)}`;break;case vl.unrecognized_keys:l=`Unrecognized key(s) in object: ${Is.joinValues(t.keys,", ")}`;break;case vl.invalid_union:l="Invalid input";break;case vl.invalid_union_discriminator:l=`Invalid discriminator value. Expected ${Is.joinValues(t.options)}`;break;case vl.invalid_enum_value:l=`Invalid enum value. Expected ${Is.joinValues(t.options)}, received '${t.received}'`;break;case vl.invalid_arguments:l="Invalid function arguments";break;case vl.invalid_return_type:l="Invalid function return type";break;case vl.invalid_date:l="Invalid date";break;case vl.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(l=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(l=`${l} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?l=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?l=`Invalid input: must end with "${t.validation.endsWith}"`:Is.assertNever(t.validation):t.validation!=="regex"?l=`Invalid ${t.validation}`:l="Invalid";break;case vl.too_small:t.type==="array"?l=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?l=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?l=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?l=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?l=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:l="Invalid input";break;case vl.too_big:t.type==="array"?l=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?l=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?l=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?l=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?l=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:l="Invalid input";break;case vl.custom:l="Invalid input";break;case vl.invalid_intersection_types:l="Intersection results could not be merged";break;case vl.not_multiple_of:l=`Number must be a multiple of ${t.multipleOf}`;break;case vl.not_finite:l="Number must be finite";break;default:l=e.defaultError,Is.assertNever(t)}return{message:l}},xv=bhn;var gSt=xv;function Ghn(t){gSt=t}function LK(){return gSt}c();var Fce=t=>{let{data:e,path:l,errorMaps:n,issueData:r}=t,I=[...l,...r.path||[]],a={...r,path:I};if(r.message!==void 0)return{...r,path:I,message:r.message};let s="",o=n.filter(d=>!!d).slice().reverse();for(let d of o)s=d(a,{data:e,defaultError:s}).message;return{...r,path:I,message:s}},phn=[];function hn(t,e){let l=LK(),n=Fce({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l,l===xv?void 0:xv].filter(r=>!!r)});t.common.issues.push(n)}var Yp=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,l){let n=[];for(let r of l){if(r.status==="aborted")return Br;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,l){let n=[];for(let r of l){let I=await r.key,a=await r.value;n.push({key:I,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,l){let n={};for(let r of l){let{key:I,value:a}=r;if(I.status==="aborted"||a.status==="aborted")return Br;I.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),I.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(n[I.value]=a.value)}return{status:e.value,value:n}}},Br=Object.freeze({status:"aborted"}),L9=t=>({status:"dirty",value:t}),kh=t=>({status:"valid",value:t}),mYe=t=>t.status==="aborted",bYe=t=>t.status==="dirty",kk=t=>t.status==="valid",JK=t=>typeof Promise<"u"&&t instanceof Promise;c();c();var sr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(sr||(sr={}));var jE=class{constructor(e,l,n,r){this._cachedPath=[],this.parent=e,this.data=l,this._path=n,this._key=r}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}},NSt=(t,e)=>{if(kk(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 l=new Xh(t.common.issues);return this._error=l,this._error}}};function ta(t){if(!t)return{};let{errorMap:e,invalid_type_error:l,required_error:n,description:r}=t;if(e&&(l||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,s)=>{let{message:o}=t;return a.code==="invalid_enum_value"?{message:o??s.defaultError}:typeof s.data>"u"?{message:o??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:o??l??s.defaultError}},description:r}}var ga=class{get description(){return this._def.description}_getType(e){return mQ(e.data)}_getOrReturnCtx(e,l){return l||{common:e.parent.common,data:e.data,parsedType:mQ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yp,ctx:{common:e.parent.common,data:e.data,parsedType:mQ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let l=this._parse(e);if(JK(l))throw new Error("Synchronous parse encountered promise.");return l}_parseAsync(e){let l=this._parse(e);return Promise.resolve(l)}parse(e,l){let n=this.safeParse(e,l);if(n.success)return n.data;throw n.error}safeParse(e,l){let n={common:{issues:[],async:l?.async??!1,contextualErrorMap:l?.errorMap},path:l?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mQ(e)},r=this._parseSync({data:e,path:n.path,parent:n});return NSt(n,r)}"~validate"(e){let l={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mQ(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:l});return kk(n)?{value:n.value}:{issues:l.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),l.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:l}).then(n=>kk(n)?{value:n.value}:{issues:l.common.issues})}async parseAsync(e,l){let n=await this.safeParseAsync(e,l);if(n.success)return n.data;throw n.error}async safeParseAsync(e,l){let n={common:{issues:[],contextualErrorMap:l?.errorMap,async:!0},path:l?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mQ(e)},r=this._parse({data:e,path:n.path,parent:n}),I=await(JK(r)?r:Promise.resolve(r));return NSt(n,I)}refine(e,l){let n=r=>typeof l=="string"||typeof l>"u"?{message:l}:typeof l=="function"?l(r):l;return this._refinement((r,I)=>{let a=e(r),s=()=>I.addIssue({code:vl.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(o=>o?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,l){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof l=="function"?l(n,r):l),!1))}_refinement(e){return new KE({schema:this,typeName:Pr.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:l=>this["~validate"](l)}}optional(){return PE.create(this,this._def)}nullable(){return GQ.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ov.create(this)}promise(){return xk.create(this,this._def)}or(e){return U9.create([this,e],this._def)}and(e){return M9.create(this,e,this._def)}transform(e){return new KE({...ta(this._def),schema:this,typeName:Pr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let l=typeof e=="function"?e:()=>e;return new j9({...ta(this._def),innerType:this,defaultValue:l,typeName:Pr.ZodDefault})}brand(){return new Cce({typeName:Pr.ZodBranded,type:this,...ta(this._def)})}catch(e){let l=typeof e=="function"?e:()=>e;return new K9({...ta(this._def),innerType:this,catchValue:l,typeName:Pr.ZodCatch})}describe(e){let l=this.constructor;return new l({...this._def,description:e})}pipe(e){return vce.create(this,e)}readonly(){return q9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},hhn=/^c[^\s-]{8,}$/i,Ahn=/^[0-9a-z]+$/,Zhn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ghn=/^[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,Nhn=/^[a-z0-9_-]{21}$/i,Whn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yhn=/^[-+]?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)?)??$/,Ehn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rhn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kPe,Yhn=/^(?:(?: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])$/,Vhn=/^(?:(?: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])$/,Qhn=/^(([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]))$/,whn=/^(([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])$/,Fhn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Chn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ySt="((\\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])))",vhn=new RegExp(`^${ySt}$`);function ESt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let l=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${l}`}function fhn(t){return new RegExp(`^${ESt(t)}$`)}function RSt(t){let e=`${ySt}T${ESt(t)}`,l=[];return l.push(t.local?"Z?":"Z"),t.offset&&l.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${l.join("|")})`,new RegExp(`^${e}$`)}function Hhn(t,e){return!!((e==="v4"||!e)&&Yhn.test(t)||(e==="v6"||!e)&&Qhn.test(t))}function Xhn(t,e){if(!Whn.test(t))return!1;try{let[l]=t.split(".");if(!l)return!1;let n=l.replace(/-/g,"+").replace(/_/g,"/").padEnd(l.length+(4-l.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function khn(t,e){return!!((e==="v4"||!e)&&Vhn.test(t)||(e==="v6"||!e)&&whn.test(t))}var Lk=class t extends ga{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Fn.string){let I=this._getOrReturnCtx(e);return hn(I,{code:vl.invalid_type,expected:Fn.string,received:I.parsedType}),Br}let n=new Yp,r;for(let I of this._def.checks)if(I.kind==="min")e.data.length<I.value&&(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.too_small,minimum:I.value,type:"string",inclusive:!0,exact:!1,message:I.message}),n.dirty());else if(I.kind==="max")e.data.length>I.value&&(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.too_big,maximum:I.value,type:"string",inclusive:!0,exact:!1,message:I.message}),n.dirty());else if(I.kind==="length"){let a=e.data.length>I.value,s=e.data.length<I.value;(a||s)&&(r=this._getOrReturnCtx(e,r),a?hn(r,{code:vl.too_big,maximum:I.value,type:"string",inclusive:!0,exact:!0,message:I.message}):s&&hn(r,{code:vl.too_small,minimum:I.value,type:"string",inclusive:!0,exact:!0,message:I.message}),n.dirty())}else if(I.kind==="email")Ehn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"email",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="emoji")kPe||(kPe=new RegExp(Rhn,"u")),kPe.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"emoji",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="uuid")ghn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"uuid",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="nanoid")Nhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"nanoid",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="cuid")hhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"cuid",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="cuid2")Ahn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"cuid2",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="ulid")Zhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"ulid",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),hn(r,{validation:"url",code:vl.invalid_string,message:I.message}),n.dirty()}else I.kind==="regex"?(I.regex.lastIndex=0,I.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"regex",code:vl.invalid_string,message:I.message}),n.dirty())):I.kind==="trim"?e.data=e.data.trim():I.kind==="includes"?e.data.includes(I.value,I.position)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:{includes:I.value,position:I.position},message:I.message}),n.dirty()):I.kind==="toLowerCase"?e.data=e.data.toLowerCase():I.kind==="toUpperCase"?e.data=e.data.toUpperCase():I.kind==="startsWith"?e.data.startsWith(I.value)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:{startsWith:I.value},message:I.message}),n.dirty()):I.kind==="endsWith"?e.data.endsWith(I.value)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:{endsWith:I.value},message:I.message}),n.dirty()):I.kind==="datetime"?RSt(I).test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:"datetime",message:I.message}),n.dirty()):I.kind==="date"?vhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:"date",message:I.message}),n.dirty()):I.kind==="time"?fhn(I).test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:"time",message:I.message}),n.dirty()):I.kind==="duration"?yhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"duration",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="ip"?Hhn(e.data,I.version)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"ip",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="jwt"?Xhn(e.data,I.alg)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"jwt",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="cidr"?khn(e.data,I.version)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"cidr",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="base64"?Fhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"base64",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="base64url"?Chn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"base64url",code:vl.invalid_string,message:I.message}),n.dirty()):Is.assertNever(I);return{status:n.value,value:e.data}}_regex(e,l,n){return this.refinement(r=>e.test(r),{validation:l,code:vl.invalid_string,...sr.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...sr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...sr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...sr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...sr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...sr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...sr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...sr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...sr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...sr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...sr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...sr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...sr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...sr.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,...sr.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,...sr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...sr.errToObj(e)})}regex(e,l){return this._addCheck({kind:"regex",regex:e,...sr.errToObj(l)})}includes(e,l){return this._addCheck({kind:"includes",value:e,position:l?.position,...sr.errToObj(l?.message)})}startsWith(e,l){return this._addCheck({kind:"startsWith",value:e,...sr.errToObj(l)})}endsWith(e,l){return this._addCheck({kind:"endsWith",value:e,...sr.errToObj(l)})}min(e,l){return this._addCheck({kind:"min",value:e,...sr.errToObj(l)})}max(e,l){return this._addCheck({kind:"max",value:e,...sr.errToObj(l)})}length(e,l){return this._addCheck({kind:"length",value:e,...sr.errToObj(l)})}nonempty(e){return this.min(1,sr.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 l of this._def.checks)l.kind==="min"&&(e===null||l.value>e)&&(e=l.value);return e}get maxLength(){let e=null;for(let l of this._def.checks)l.kind==="max"&&(e===null||l.value<e)&&(e=l.value);return e}};Lk.create=t=>new Lk({checks:[],typeName:Pr.ZodString,coerce:t?.coerce??!1,...ta(t)});function Lhn(t,e){let l=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=l>n?l:n,I=Number.parseInt(t.toFixed(r).replace(".","")),a=Number.parseInt(e.toFixed(r).replace(".",""));return I%a/10**r}var J9=class t extends ga{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)!==Fn.number){let I=this._getOrReturnCtx(e);return hn(I,{code:vl.invalid_type,expected:Fn.number,received:I.parsedType}),Br}let n,r=new Yp;for(let I of this._def.checks)I.kind==="int"?Is.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.invalid_type,expected:"integer",received:"float",message:I.message}),r.dirty()):I.kind==="min"?(I.inclusive?e.data<I.value:e.data<=I.value)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.too_small,minimum:I.value,type:"number",inclusive:I.inclusive,exact:!1,message:I.message}),r.dirty()):I.kind==="max"?(I.inclusive?e.data>I.value:e.data>=I.value)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.too_big,maximum:I.value,type:"number",inclusive:I.inclusive,exact:!1,message:I.message}),r.dirty()):I.kind==="multipleOf"?Lhn(e.data,I.value)!==0&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.not_multiple_of,multipleOf:I.value,message:I.message}),r.dirty()):I.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.not_finite,message:I.message}),r.dirty()):Is.assertNever(I);return{status:r.value,value:e.data}}gte(e,l){return this.setLimit("min",e,!0,sr.toString(l))}gt(e,l){return this.setLimit("min",e,!1,sr.toString(l))}lte(e,l){return this.setLimit("max",e,!0,sr.toString(l))}lt(e,l){return this.setLimit("max",e,!1,sr.toString(l))}setLimit(e,l,n,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:l,inclusive:n,message:sr.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:sr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:sr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:sr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:sr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:sr.toString(e)})}multipleOf(e,l){return this._addCheck({kind:"multipleOf",value:e,message:sr.toString(l)})}finite(e){return this._addCheck({kind:"finite",message:sr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:sr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:sr.toString(e)})}get minValue(){let e=null;for(let l of this._def.checks)l.kind==="min"&&(e===null||l.value>e)&&(e=l.value);return e}get maxValue(){let e=null;for(let l of this._def.checks)l.kind==="max"&&(e===null||l.value<e)&&(e=l.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Is.isInteger(e.value))}get isFinite(){let e=null,l=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(l===null||n.value>l)&&(l=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(l)&&Number.isFinite(e)}};J9.create=t=>new J9({checks:[],typeName:Pr.ZodNumber,coerce:t?.coerce||!1,...ta(t)});var x9=class t extends ga{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)!==Fn.bigint)return this._getInvalidInput(e);let n,r=new Yp;for(let I of this._def.checks)I.kind==="min"?(I.inclusive?e.data<I.value:e.data<=I.value)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.too_small,type:"bigint",minimum:I.value,inclusive:I.inclusive,message:I.message}),r.dirty()):I.kind==="max"?(I.inclusive?e.data>I.value:e.data>=I.value)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.too_big,type:"bigint",maximum:I.value,inclusive:I.inclusive,message:I.message}),r.dirty()):I.kind==="multipleOf"?e.data%I.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.not_multiple_of,multipleOf:I.value,message:I.message}),r.dirty()):Is.assertNever(I);return{status:r.value,value:e.data}}_getInvalidInput(e){let l=this._getOrReturnCtx(e);return hn(l,{code:vl.invalid_type,expected:Fn.bigint,received:l.parsedType}),Br}gte(e,l){return this.setLimit("min",e,!0,sr.toString(l))}gt(e,l){return this.setLimit("min",e,!1,sr.toString(l))}lte(e,l){return this.setLimit("max",e,!0,sr.toString(l))}lt(e,l){return this.setLimit("max",e,!1,sr.toString(l))}setLimit(e,l,n,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:l,inclusive:n,message:sr.toString(r)}]})}_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:sr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:sr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:sr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:sr.toString(e)})}multipleOf(e,l){return this._addCheck({kind:"multipleOf",value:e,message:sr.toString(l)})}get minValue(){let e=null;for(let l of this._def.checks)l.kind==="min"&&(e===null||l.value>e)&&(e=l.value);return e}get maxValue(){let e=null;for(let l of this._def.checks)l.kind==="max"&&(e===null||l.value<e)&&(e=l.value);return e}};x9.create=t=>new x9({checks:[],typeName:Pr.ZodBigInt,coerce:t?.coerce??!1,...ta(t)});var S9=class extends ga{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Fn.boolean){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.boolean,received:n.parsedType}),Br}return kh(e.data)}};S9.create=t=>new S9({typeName:Pr.ZodBoolean,coerce:t?.coerce||!1,...ta(t)});var B9=class t extends ga{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Fn.date){let I=this._getOrReturnCtx(e);return hn(I,{code:vl.invalid_type,expected:Fn.date,received:I.parsedType}),Br}if(Number.isNaN(e.data.getTime())){let I=this._getOrReturnCtx(e);return hn(I,{code:vl.invalid_date}),Br}let n=new Yp,r;for(let I of this._def.checks)I.kind==="min"?e.data.getTime()<I.value&&(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.too_small,message:I.message,inclusive:!0,exact:!1,minimum:I.value,type:"date"}),n.dirty()):I.kind==="max"?e.data.getTime()>I.value&&(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.too_big,message:I.message,inclusive:!0,exact:!1,maximum:I.value,type:"date"}),n.dirty()):Is.assertNever(I);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,l){return this._addCheck({kind:"min",value:e.getTime(),message:sr.toString(l)})}max(e,l){return this._addCheck({kind:"max",value:e.getTime(),message:sr.toString(l)})}get minDate(){let e=null;for(let l of this._def.checks)l.kind==="min"&&(e===null||l.value>e)&&(e=l.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let l of this._def.checks)l.kind==="max"&&(e===null||l.value<e)&&(e=l.value);return e!=null?new Date(e):null}};B9.create=t=>new B9({checks:[],coerce:t?.coerce||!1,typeName:Pr.ZodDate,...ta(t)});var SK=class extends ga{_parse(e){if(this._getType(e)!==Fn.symbol){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.symbol,received:n.parsedType}),Br}return kh(e.data)}};SK.create=t=>new SK({typeName:Pr.ZodSymbol,...ta(t)});var O9=class extends ga{_parse(e){if(this._getType(e)!==Fn.undefined){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.undefined,received:n.parsedType}),Br}return kh(e.data)}};O9.create=t=>new O9({typeName:Pr.ZodUndefined,...ta(t)});var T9=class extends ga{_parse(e){if(this._getType(e)!==Fn.null){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.null,received:n.parsedType}),Br}return kh(e.data)}};T9.create=t=>new T9({typeName:Pr.ZodNull,...ta(t)});var Jk=class extends ga{constructor(){super(...arguments),this._any=!0}_parse(e){return kh(e.data)}};Jk.create=t=>new Jk({typeName:Pr.ZodAny,...ta(t)});var Bv=class extends ga{constructor(){super(...arguments),this._unknown=!0}_parse(e){return kh(e.data)}};Bv.create=t=>new Bv({typeName:Pr.ZodUnknown,...ta(t)});var H2=class extends ga{_parse(e){let l=this._getOrReturnCtx(e);return hn(l,{code:vl.invalid_type,expected:Fn.never,received:l.parsedType}),Br}};H2.create=t=>new H2({typeName:Pr.ZodNever,...ta(t)});var BK=class extends ga{_parse(e){if(this._getType(e)!==Fn.undefined){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.void,received:n.parsedType}),Br}return kh(e.data)}};BK.create=t=>new BK({typeName:Pr.ZodVoid,...ta(t)});var Ov=class t extends ga{_parse(e){let{ctx:l,status:n}=this._processInputParams(e),r=this._def;if(l.parsedType!==Fn.array)return hn(l,{code:vl.invalid_type,expected:Fn.array,received:l.parsedType}),Br;if(r.exactLength!==null){let a=l.data.length>r.exactLength.value,s=l.data.length<r.exactLength.value;(a||s)&&(hn(l,{code:a?vl.too_big:vl.too_small,minimum:s?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&l.data.length<r.minLength.value&&(hn(l,{code:vl.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&l.data.length>r.maxLength.value&&(hn(l,{code:vl.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),l.common.async)return Promise.all([...l.data].map((a,s)=>r.type._parseAsync(new jE(l,a,l.path,s)))).then(a=>Yp.mergeArray(n,a));let I=[...l.data].map((a,s)=>r.type._parseSync(new jE(l,a,l.path,s)));return Yp.mergeArray(n,I)}get element(){return this._def.type}min(e,l){return new t({...this._def,minLength:{value:e,message:sr.toString(l)}})}max(e,l){return new t({...this._def,maxLength:{value:e,message:sr.toString(l)}})}length(e,l){return new t({...this._def,exactLength:{value:e,message:sr.toString(l)}})}nonempty(e){return this.min(1,e)}};Ov.create=(t,e)=>new Ov({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Pr.ZodArray,...ta(e)});function xK(t){if(t instanceof jg){let e={};for(let l in t.shape){let n=t.shape[l];e[l]=PE.create(xK(n))}return new jg({...t._def,shape:()=>e})}else return t instanceof Ov?new Ov({...t._def,type:xK(t.element)}):t instanceof PE?PE.create(xK(t.unwrap())):t instanceof GQ?GQ.create(xK(t.unwrap())):t instanceof bQ?bQ.create(t.items.map(e=>xK(e))):t}var jg=class t extends ga{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(),l=Is.objectKeys(e);return this._cached={shape:e,keys:l},this._cached}_parse(e){if(this._getType(e)!==Fn.object){let d=this._getOrReturnCtx(e);return hn(d,{code:vl.invalid_type,expected:Fn.object,received:d.parsedType}),Br}let{status:n,ctx:r}=this._processInputParams(e),{shape:I,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof H2&&this._def.unknownKeys==="strip"))for(let d in r.data)a.includes(d)||s.push(d);let o=[];for(let d of a){let u=I[d],b=r.data[d];o.push({key:{status:"valid",value:d},value:u._parse(new jE(r,b,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof H2){let d=this._def.unknownKeys;if(d==="passthrough")for(let u of s)o.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(d==="strict")s.length>0&&(hn(r,{code:vl.unrecognized_keys,keys:s}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let u of s){let b=r.data[u];o.push({key:{status:"valid",value:u},value:d._parse(new jE(r,b,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let d=[];for(let u of o){let b=await u.key,p=await u.value;d.push({key:b,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>Yp.mergeObjectSync(n,d)):Yp.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return sr.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(l,n)=>{let r=this._def.errorMap?.(l,n).message??n.defaultError;return l.code==="unrecognized_keys"?{message:sr.errToObj(e).message??r}:{message:r}}}:{}})}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:Pr.ZodObject})}setKey(e,l){return this.augment({[e]:l})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let l={};for(let n of Is.objectKeys(e))e[n]&&this.shape[n]&&(l[n]=this.shape[n]);return new t({...this._def,shape:()=>l})}omit(e){let l={};for(let n of Is.objectKeys(this.shape))e[n]||(l[n]=this.shape[n]);return new t({...this._def,shape:()=>l})}deepPartial(){return xK(this)}partial(e){let l={};for(let n of Is.objectKeys(this.shape)){let r=this.shape[n];e&&!e[n]?l[n]=r:l[n]=r.optional()}return new t({...this._def,shape:()=>l})}required(e){let l={};for(let n of Is.objectKeys(this.shape))if(e&&!e[n])l[n]=this.shape[n];else{let I=this.shape[n];for(;I instanceof PE;)I=I._def.innerType;l[n]=I}return new t({...this._def,shape:()=>l})}keyof(){return YSt(Is.objectKeys(this.shape))}};jg.create=(t,e)=>new jg({shape:()=>t,unknownKeys:"strip",catchall:H2.create(),typeName:Pr.ZodObject,...ta(e)});jg.strictCreate=(t,e)=>new jg({shape:()=>t,unknownKeys:"strict",catchall:H2.create(),typeName:Pr.ZodObject,...ta(e)});jg.lazycreate=(t,e)=>new jg({shape:t,unknownKeys:"strip",catchall:H2.create(),typeName:Pr.ZodObject,...ta(e)});var U9=class extends ga{_parse(e){let{ctx:l}=this._processInputParams(e),n=this._def.options;function r(I){for(let s of I)if(s.result.status==="valid")return s.result;for(let s of I)if(s.result.status==="dirty")return l.common.issues.push(...s.ctx.common.issues),s.result;let a=I.map(s=>new Xh(s.ctx.common.issues));return hn(l,{code:vl.invalid_union,unionErrors:a}),Br}if(l.common.async)return Promise.all(n.map(async I=>{let a={...l,common:{...l.common,issues:[]},parent:null};return{result:await I._parseAsync({data:l.data,path:l.path,parent:a}),ctx:a}})).then(r);{let I,a=[];for(let o of n){let d={...l,common:{...l.common,issues:[]},parent:null},u=o._parseSync({data:l.data,path:l.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!I&&(I={result:u,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(I)return l.common.issues.push(...I.ctx.common.issues),I.result;let s=a.map(o=>new Xh(o));return hn(l,{code:vl.invalid_union,unionErrors:s}),Br}}get options(){return this._def.options}};U9.create=(t,e)=>new U9({options:t,typeName:Pr.ZodUnion,...ta(e)});var Sv=t=>t instanceof _9?Sv(t.schema):t instanceof KE?Sv(t.innerType()):t instanceof D9?[t.value]:t instanceof z9?t.options:t instanceof P9?Is.objectValues(t.enum):t instanceof j9?Sv(t._def.innerType):t instanceof O9?[void 0]:t instanceof T9?[null]:t instanceof PE?[void 0,...Sv(t.unwrap())]:t instanceof GQ?[null,...Sv(t.unwrap())]:t instanceof Cce||t instanceof q9?Sv(t.unwrap()):t instanceof K9?Sv(t._def.innerType):[],GYe=class t extends ga{_parse(e){let{ctx:l}=this._processInputParams(e);if(l.parsedType!==Fn.object)return hn(l,{code:vl.invalid_type,expected:Fn.object,received:l.parsedType}),Br;let n=this.discriminator,r=l.data[n],I=this.optionsMap.get(r);return I?l.common.async?I._parseAsync({data:l.data,path:l.path,parent:l}):I._parseSync({data:l.data,path:l.path,parent:l}):(hn(l,{code:vl.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Br)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,l,n){let r=new Map;for(let I of l){let a=Sv(I.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(r.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);r.set(s,I)}}return new t({typeName:Pr.ZodDiscriminatedUnion,discriminator:e,options:l,optionsMap:r,...ta(n)})}};function LPe(t,e){let l=mQ(t),n=mQ(e);if(t===e)return{valid:!0,data:t};if(l===Fn.object&&n===Fn.object){let r=Is.objectKeys(e),I=Is.objectKeys(t).filter(s=>r.indexOf(s)!==-1),a={...t,...e};for(let s of I){let o=LPe(t[s],e[s]);if(!o.valid)return{valid:!1};a[s]=o.data}return{valid:!0,data:a}}else if(l===Fn.array&&n===Fn.array){if(t.length!==e.length)return{valid:!1};let r=[];for(let I=0;I<t.length;I++){let a=t[I],s=e[I],o=LPe(a,s);if(!o.valid)return{valid:!1};r.push(o.data)}return{valid:!0,data:r}}else return l===Fn.date&&n===Fn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var M9=class extends ga{_parse(e){let{status:l,ctx:n}=this._processInputParams(e),r=(I,a)=>{if(mYe(I)||mYe(a))return Br;let s=LPe(I.value,a.value);return s.valid?((bYe(I)||bYe(a))&&l.dirty(),{status:l.value,value:s.data}):(hn(n,{code:vl.invalid_intersection_types}),Br)};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(([I,a])=>r(I,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};M9.create=(t,e,l)=>new M9({left:t,right:e,typeName:Pr.ZodIntersection,...ta(l)});var bQ=class t extends ga{_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.parsedType!==Fn.array)return hn(n,{code:vl.invalid_type,expected:Fn.array,received:n.parsedType}),Br;if(n.data.length<this._def.items.length)return hn(n,{code:vl.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Br;!this._def.rest&&n.data.length>this._def.items.length&&(hn(n,{code:vl.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.dirty());let I=[...n.data].map((a,s)=>{let o=this._def.items[s]||this._def.rest;return o?o._parse(new jE(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(I).then(a=>Yp.mergeArray(l,a)):Yp.mergeArray(l,I)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};bQ.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new bQ({items:t,typeName:Pr.ZodTuple,rest:null,...ta(e)})};var pYe=class t extends ga{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.parsedType!==Fn.object)return hn(n,{code:vl.invalid_type,expected:Fn.object,received:n.parsedType}),Br;let r=[],I=this._def.keyType,a=this._def.valueType;for(let s in n.data)r.push({key:I._parse(new jE(n,s,n.path,s)),value:a._parse(new jE(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Yp.mergeObjectAsync(l,r):Yp.mergeObjectSync(l,r)}get element(){return this._def.valueType}static create(e,l,n){return l instanceof ga?new t({keyType:e,valueType:l,typeName:Pr.ZodRecord,...ta(n)}):new t({keyType:Lk.create(),valueType:e,typeName:Pr.ZodRecord,...ta(l)})}},OK=class extends ga{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.parsedType!==Fn.map)return hn(n,{code:vl.invalid_type,expected:Fn.map,received:n.parsedType}),Br;let r=this._def.keyType,I=this._def.valueType,a=[...n.data.entries()].map(([s,o],d)=>({key:r._parse(new jE(n,s,n.path,[d,"key"])),value:I._parse(new jE(n,o,n.path,[d,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let o of a){let d=await o.key,u=await o.value;if(d.status==="aborted"||u.status==="aborted")return Br;(d.status==="dirty"||u.status==="dirty")&&l.dirty(),s.set(d.value,u.value)}return{status:l.value,value:s}})}else{let s=new Map;for(let o of a){let d=o.key,u=o.value;if(d.status==="aborted"||u.status==="aborted")return Br;(d.status==="dirty"||u.status==="dirty")&&l.dirty(),s.set(d.value,u.value)}return{status:l.value,value:s}}}};OK.create=(t,e,l)=>new OK({valueType:e,keyType:t,typeName:Pr.ZodMap,...ta(l)});var TK=class t extends ga{_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.parsedType!==Fn.set)return hn(n,{code:vl.invalid_type,expected:Fn.set,received:n.parsedType}),Br;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(hn(n,{code:vl.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),l.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(hn(n,{code:vl.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),l.dirty());let I=this._def.valueType;function a(o){let d=new Set;for(let u of o){if(u.status==="aborted")return Br;u.status==="dirty"&&l.dirty(),d.add(u.value)}return{status:l.value,value:d}}let s=[...n.data.values()].map((o,d)=>I._parse(new jE(n,o,n.path,d)));return n.common.async?Promise.all(s).then(o=>a(o)):a(s)}min(e,l){return new t({...this._def,minSize:{value:e,message:sr.toString(l)}})}max(e,l){return new t({...this._def,maxSize:{value:e,message:sr.toString(l)}})}size(e,l){return this.min(e,l).max(e,l)}nonempty(e){return this.min(1,e)}};TK.create=(t,e)=>new TK({valueType:t,minSize:null,maxSize:null,typeName:Pr.ZodSet,...ta(e)});var hYe=class t extends ga{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:l}=this._processInputParams(e);if(l.parsedType!==Fn.function)return hn(l,{code:vl.invalid_type,expected:Fn.function,received:l.parsedType}),Br;function n(s,o){return Fce({data:s,path:l.path,errorMaps:[l.common.contextualErrorMap,l.schemaErrorMap,LK(),xv].filter(d=>!!d),issueData:{code:vl.invalid_arguments,argumentsError:o}})}function r(s,o){return Fce({data:s,path:l.path,errorMaps:[l.common.contextualErrorMap,l.schemaErrorMap,LK(),xv].filter(d=>!!d),issueData:{code:vl.invalid_return_type,returnTypeError:o}})}let I={errorMap:l.common.contextualErrorMap},a=l.data;if(this._def.returns instanceof xk){let s=this;return kh(async function(...o){let d=new Xh([]),u=await s._def.args.parseAsync(o,I).catch(h=>{throw d.addIssue(n(o,h)),d}),b=await Reflect.apply(a,this,u);return await s._def.returns._def.type.parseAsync(b,I).catch(h=>{throw d.addIssue(r(b,h)),d})})}else{let s=this;return kh(function(...o){let d=s._def.args.safeParse(o,I);if(!d.success)throw new Xh([n(o,d.error)]);let u=Reflect.apply(a,this,d.data),b=s._def.returns.safeParse(u,I);if(!b.success)throw new Xh([r(u,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:bQ.create(e).rest(Bv.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,l,n){return new t({args:e||bQ.create([]).rest(Bv.create()),returns:l||Bv.create(),typeName:Pr.ZodFunction,...ta(n)})}},_9=class extends ga{get schema(){return this._def.getter()}_parse(e){let{ctx:l}=this._processInputParams(e);return this._def.getter()._parse({data:l.data,path:l.path,parent:l})}};_9.create=(t,e)=>new _9({getter:t,typeName:Pr.ZodLazy,...ta(e)});var D9=class extends ga{_parse(e){if(e.data!==this._def.value){let l=this._getOrReturnCtx(e);return hn(l,{received:l.data,code:vl.invalid_literal,expected:this._def.value}),Br}return{status:"valid",value:e.data}}get value(){return this._def.value}};D9.create=(t,e)=>new D9({value:t,typeName:Pr.ZodLiteral,...ta(e)});function YSt(t,e){return new z9({values:t,typeName:Pr.ZodEnum,...ta(e)})}var z9=class t extends ga{_parse(e){if(typeof e.data!="string"){let l=this._getOrReturnCtx(e),n=this._def.values;return hn(l,{expected:Is.joinValues(n),received:l.parsedType,code:vl.invalid_type}),Br}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let l=this._getOrReturnCtx(e),n=this._def.values;return hn(l,{received:l.data,code:vl.invalid_enum_value,options:n}),Br}return kh(e.data)}get options(){return this._def.values}get enum(){let e={};for(let l of this._def.values)e[l]=l;return e}get Values(){let e={};for(let l of this._def.values)e[l]=l;return e}get Enum(){let e={};for(let l of this._def.values)e[l]=l;return e}extract(e,l=this._def){return t.create(e,{...this._def,...l})}exclude(e,l=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...l})}};z9.create=YSt;var P9=class extends ga{_parse(e){let l=Is.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Fn.string&&n.parsedType!==Fn.number){let r=Is.objectValues(l);return hn(n,{expected:Is.joinValues(r),received:n.parsedType,code:vl.invalid_type}),Br}if(this._cache||(this._cache=new Set(Is.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=Is.objectValues(l);return hn(n,{received:n.data,code:vl.invalid_enum_value,options:r}),Br}return kh(e.data)}get enum(){return this._def.values}};P9.create=(t,e)=>new P9({values:t,typeName:Pr.ZodNativeEnum,...ta(e)});var xk=class extends ga{unwrap(){return this._def.type}_parse(e){let{ctx:l}=this._processInputParams(e);if(l.parsedType!==Fn.promise&&l.common.async===!1)return hn(l,{code:vl.invalid_type,expected:Fn.promise,received:l.parsedType}),Br;let n=l.parsedType===Fn.promise?l.data:Promise.resolve(l.data);return kh(n.then(r=>this._def.type.parseAsync(r,{path:l.path,errorMap:l.common.contextualErrorMap})))}};xk.create=(t,e)=>new xk({type:t,typeName:Pr.ZodPromise,...ta(e)});var KE=class extends ga{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:l,ctx:n}=this._processInputParams(e),r=this._def.effect||null,I={addIssue:a=>{hn(n,a),a.fatal?l.abort():l.dirty()},get path(){return n.path}};if(I.addIssue=I.addIssue.bind(I),r.type==="preprocess"){let a=r.transform(n.data,I);if(n.common.async)return Promise.resolve(a).then(async s=>{if(l.value==="aborted")return Br;let o=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return o.status==="aborted"?Br:o.status==="dirty"?L9(o.value):l.value==="dirty"?L9(o.value):o});{if(l.value==="aborted")return Br;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Br:s.status==="dirty"?L9(s.value):l.value==="dirty"?L9(s.value):s}}if(r.type==="refinement"){let a=s=>{let o=r.refinement(s,I);if(n.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Br:(s.status==="dirty"&&l.dirty(),a(s.value),{status:l.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Br:(s.status==="dirty"&&l.dirty(),a(s.value).then(()=>({status:l.value,value:s.value}))))}if(r.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!kk(a))return Br;let s=r.transform(a.value,I);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:l.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>kk(a)?Promise.resolve(r.transform(a.value,I)).then(s=>({status:l.value,value:s})):Br);Is.assertNever(r)}};KE.create=(t,e,l)=>new KE({schema:t,typeName:Pr.ZodEffects,effect:e,...ta(l)});KE.createWithPreprocess=(t,e,l)=>new KE({schema:e,effect:{type:"preprocess",transform:t},typeName:Pr.ZodEffects,...ta(l)});var PE=class extends ga{_parse(e){return this._getType(e)===Fn.undefined?kh(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};PE.create=(t,e)=>new PE({innerType:t,typeName:Pr.ZodOptional,...ta(e)});var GQ=class extends ga{_parse(e){return this._getType(e)===Fn.null?kh(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};GQ.create=(t,e)=>new GQ({innerType:t,typeName:Pr.ZodNullable,...ta(e)});var j9=class extends ga{_parse(e){let{ctx:l}=this._processInputParams(e),n=l.data;return l.parsedType===Fn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:l.path,parent:l})}removeDefault(){return this._def.innerType}};j9.create=(t,e)=>new j9({innerType:t,typeName:Pr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ta(e)});var K9=class extends ga{_parse(e){let{ctx:l}=this._processInputParams(e),n={...l,common:{...l.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return JK(r)?r.then(I=>({status:"valid",value:I.status==="valid"?I.value:this._def.catchValue({get error(){return new Xh(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Xh(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};K9.create=(t,e)=>new K9({innerType:t,typeName:Pr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ta(e)});var UK=class extends ga{_parse(e){if(this._getType(e)!==Fn.nan){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.nan,received:n.parsedType}),Br}return{status:"valid",value:e.data}}};UK.create=t=>new UK({typeName:Pr.ZodNaN,...ta(t)});var Jhn=Symbol("zod_brand"),Cce=class extends ga{_parse(e){let{ctx:l}=this._processInputParams(e),n=l.data;return this._def.type._parse({data:n,path:l.path,parent:l})}unwrap(){return this._def.type}},vce=class t extends ga{_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let I=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return I.status==="aborted"?Br:I.status==="dirty"?(l.dirty(),L9(I.value)):this._def.out._parseAsync({data:I.value,path:n.path,parent:n})})();{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?Br:r.status==="dirty"?(l.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,l){return new t({in:e,out:l,typeName:Pr.ZodPipeline})}},q9=class extends ga{_parse(e){let l=this._def.innerType._parse(e),n=r=>(kk(r)&&(r.value=Object.freeze(r.value)),r);return JK(l)?l.then(r=>n(r)):n(l)}unwrap(){return this._def.innerType}};q9.create=(t,e)=>new q9({innerType:t,typeName:Pr.ZodReadonly,...ta(e)});function WSt(t,e){let l=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof l=="string"?{message:l}:l}function VSt(t,e={},l){return t?Jk.create().superRefine((n,r)=>{let I=t(n);if(I instanceof Promise)return I.then(a=>{if(!a){let s=WSt(e,n),o=s.fatal??l??!0;r.addIssue({code:"custom",...s,fatal:o})}});if(!I){let a=WSt(e,n),s=a.fatal??l??!0;r.addIssue({code:"custom",...a,fatal:s})}}):Jk.create()}var xhn={object:jg.lazycreate},Pr;(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"})(Pr||(Pr={}));var Shn=(t,e={message:`Input not instance of ${t.name}`})=>VSt(l=>l instanceof t,e),Vt=Lk.create,Lh=J9.create,Bhn=UK.create,Ohn=x9.create,Do=S9.create,Thn=B9.create,Uhn=SK.create,Mhn=O9.create,_hn=T9.create,JPe=Jk.create,pQ=Bv.create,Dhn=H2.create,zhn=BK.create,Wu=Ov.create,$l=jg.create,Phn=jg.strictCreate,Jh=U9.create,fce=GYe.create,jhn=M9.create,xPe=bQ.create,X2=pYe.create,Khn=OK.create,qhn=TK.create,$hn=hYe.create,eAn=_9.create,Ar=D9.create,Kg=z9.create,tAn=P9.create,lAn=xk.create,nAn=KE.create,rAn=PE.create,IAn=GQ.create,aAn=KE.createWithPreprocess,sAn=vce.create,oAn=()=>Vt().optional(),iAn=()=>Lh().optional(),cAn=()=>Do().optional(),Hce={string:t=>Lk.create({...t,coerce:!0}),number:t=>J9.create({...t,coerce:!0}),boolean:t=>S9.create({...t,coerce:!0}),bigint:t=>x9.create({...t,coerce:!0}),date:t=>B9.create({...t,coerce:!0})};var dAn=Br;var Ha=P;var MK="2025-06-18";var QSt=[MK,"2025-03-26","2024-11-05","2024-10-07"],AYe="2.0",wSt=P.union([P.string(),P.number().int()]),FSt=P.string(),uAn=P.object({progressToken:P.optional(wSt)}).passthrough(),e0=P.object({_meta:P.optional(uAn)}).passthrough(),qg=P.object({method:P.string(),params:P.optional(e0)}),Xce=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),hQ=P.object({method:P.string(),params:P.optional(Xce)}),t0=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),ZYe=P.union([P.string(),P.number().int()]),CSt=P.object({jsonrpc:P.literal(AYe),id:ZYe}).merge(qg).strict(),gYe=t=>CSt.safeParse(t).success,vSt=P.object({jsonrpc:P.literal(AYe)}).merge(hQ).strict(),fSt=t=>vSt.safeParse(t).success,HSt=P.object({jsonrpc:P.literal(AYe),id:ZYe,result:t0}).strict(),kce=t=>HSt.safeParse(t).success,qE;(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"})(qE||(qE={}));var XSt=P.object({jsonrpc:P.literal(AYe),id:ZYe,error:P.object({code:P.number().int(),message:P.string(),data:P.optional(P.unknown())})}).strict(),kSt=t=>XSt.safeParse(t).success,Bk=P.union([CSt,vSt,HSt,XSt]),$9=t0.strict(),NYe=hQ.extend({method:P.literal("notifications/cancelled"),params:Xce.extend({requestId:ZYe,reason:P.string().optional()})}),WYe=P.object({src:P.string(),mimeType:P.optional(P.string()),sizes:P.optional(P.string())}).passthrough(),Lce=P.object({name:P.string(),title:P.optional(P.string())}).passthrough(),LSt=Lce.extend({version:P.string(),websiteUrl:P.optional(P.string()),icons:P.optional(P.array(WYe))}),mAn=P.object({experimental:P.optional(P.object({}).passthrough()),sampling:P.optional(P.object({}).passthrough()),elicitation:P.optional(P.object({}).passthrough()),roots:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),bAn=qg.extend({method:P.literal("initialize"),params:e0.extend({protocolVersion:P.string(),capabilities:mAn,clientInfo:LSt})});var GAn=P.object({experimental:P.optional(P.object({}).passthrough()),logging:P.optional(P.object({}).passthrough()),completions:P.optional(P.object({}).passthrough()),prompts:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough()),resources:P.optional(P.object({subscribe:P.optional(P.boolean()),listChanged:P.optional(P.boolean())}).passthrough()),tools:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),SPe=t0.extend({protocolVersion:P.string(),capabilities:GAn,serverInfo:LSt,instructions:P.optional(P.string())}),JSt=hQ.extend({method:P.literal("notifications/initialized")}),xSt=t=>JSt.safeParse(t).success,yYe=qg.extend({method:P.literal("ping")}),pAn=P.object({progress:P.number(),total:P.optional(P.number()),message:P.optional(P.string())}).passthrough(),EYe=hQ.extend({method:P.literal("notifications/progress"),params:Xce.merge(pAn).extend({progressToken:wSt})}),RYe=qg.extend({params:e0.extend({cursor:P.optional(FSt)}).optional()}),YYe=t0.extend({nextCursor:P.optional(FSt)}),SSt=P.object({uri:P.string(),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),BSt=SSt.extend({text:P.string()}),BPe=P.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),OSt=SSt.extend({blob:BPe}),TSt=Lce.extend({uri:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),icons:P.optional(P.array(WYe)),_meta:P.optional(P.object({}).passthrough())}),hAn=Lce.extend({uriTemplate:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}),AAn=RYe.extend({method:P.literal("resources/list")}),OPe=YYe.extend({resources:P.array(TSt)}),ZAn=RYe.extend({method:P.literal("resources/templates/list")}),TPe=YYe.extend({resourceTemplates:P.array(hAn)}),gAn=qg.extend({method:P.literal("resources/read"),params:e0.extend({uri:P.string()})}),UPe=t0.extend({contents:P.array(P.union([BSt,OSt]))}),NAn=hQ.extend({method:P.literal("notifications/resources/list_changed")}),WAn=qg.extend({method:P.literal("resources/subscribe"),params:e0.extend({uri:P.string()})}),yAn=qg.extend({method:P.literal("resources/unsubscribe"),params:e0.extend({uri:P.string()})}),EAn=hQ.extend({method:P.literal("notifications/resources/updated"),params:Xce.extend({uri:P.string()})}),RAn=P.object({name:P.string(),description:P.optional(P.string()),required:P.optional(P.boolean())}).passthrough(),YAn=Lce.extend({description:P.optional(P.string()),arguments:P.optional(P.array(RAn)),icons:P.optional(P.array(WYe)),_meta:P.optional(P.object({}).passthrough())}),VAn=RYe.extend({method:P.literal("prompts/list")}),MPe=YYe.extend({prompts:P.array(YAn)}),QAn=qg.extend({method:P.literal("prompts/get"),params:e0.extend({name:P.string(),arguments:P.optional(P.record(P.string()))})}),_Pe=P.object({type:P.literal("text"),text:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),DPe=P.object({type:P.literal("image"),data:BPe,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),zPe=P.object({type:P.literal("audio"),data:BPe,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),wAn=P.object({type:P.literal("resource"),resource:P.union([BSt,OSt]),_meta:P.optional(P.object({}).passthrough())}).passthrough(),FAn=TSt.extend({type:P.literal("resource_link")}),USt=P.union([_Pe,DPe,zPe,FAn,wAn]),CAn=P.object({role:P.enum(["user","assistant"]),content:USt}).passthrough(),PPe=t0.extend({description:P.optional(P.string()),messages:P.array(CAn)}),vAn=hQ.extend({method:P.literal("notifications/prompts/list_changed")}),fAn=P.object({title:P.optional(P.string()),readOnlyHint:P.optional(P.boolean()),destructiveHint:P.optional(P.boolean()),idempotentHint:P.optional(P.boolean()),openWorldHint:P.optional(P.boolean())}).passthrough(),HAn=Lce.extend({description:P.optional(P.string()),inputSchema:P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough(),outputSchema:P.optional(P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough()),annotations:P.optional(fAn),icons:P.optional(P.array(WYe)),_meta:P.optional(P.object({}).passthrough())}),XAn=RYe.extend({method:P.literal("tools/list")}),jPe=YYe.extend({tools:P.array(HAn)}),VYe=t0.extend({content:P.array(USt).default([]),structuredContent:P.object({}).passthrough().optional(),isError:P.optional(P.boolean())}),Hba=VYe.or(t0.extend({toolResult:P.unknown()})),kAn=qg.extend({method:P.literal("tools/call"),params:e0.extend({name:P.string(),arguments:P.optional(P.record(P.unknown()))})}),LAn=hQ.extend({method:P.literal("notifications/tools/list_changed")}),MSt=P.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),JAn=qg.extend({method:P.literal("logging/setLevel"),params:e0.extend({level:MSt})}),xAn=hQ.extend({method:P.literal("notifications/message"),params:Xce.extend({level:MSt,logger:P.optional(P.string()),data:P.unknown()})}),SAn=P.object({name:P.string().optional()}).passthrough(),BAn=P.object({hints:P.optional(P.array(SAn)),costPriority:P.optional(P.number().min(0).max(1)),speedPriority:P.optional(P.number().min(0).max(1)),intelligencePriority:P.optional(P.number().min(0).max(1))}).passthrough(),OAn=P.object({role:P.enum(["user","assistant"]),content:P.union([_Pe,DPe,zPe])}).passthrough(),TAn=qg.extend({method:P.literal("sampling/createMessage"),params:e0.extend({messages:P.array(OAn),systemPrompt:P.optional(P.string()),includeContext:P.optional(P.enum(["none","thisServer","allServers"])),temperature:P.optional(P.number()),maxTokens:P.number().int(),stopSequences:P.optional(P.array(P.string())),metadata:P.optional(P.object({}).passthrough()),modelPreferences:P.optional(BAn)})}),UAn=t0.extend({model:P.string(),stopReason:P.optional(P.enum(["endTurn","stopSequence","maxTokens"]).or(P.string())),role:P.enum(["user","assistant"]),content:P.discriminatedUnion("type",[_Pe,DPe,zPe])}),MAn=P.object({type:P.literal("boolean"),title:P.optional(P.string()),description:P.optional(P.string()),default:P.optional(P.boolean())}).passthrough(),_An=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),minLength:P.optional(P.number()),maxLength:P.optional(P.number()),format:P.optional(P.enum(["email","uri","date","date-time"]))}).passthrough(),DAn=P.object({type:P.enum(["number","integer"]),title:P.optional(P.string()),description:P.optional(P.string()),minimum:P.optional(P.number()),maximum:P.optional(P.number())}).passthrough(),zAn=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),enum:P.array(P.string()),enumNames:P.optional(P.array(P.string()))}).passthrough(),PAn=P.union([MAn,_An,DAn,zAn]),jAn=qg.extend({method:P.literal("elicitation/create"),params:e0.extend({message:P.string(),requestedSchema:P.object({type:P.literal("object"),properties:P.record(P.string(),PAn),required:P.optional(P.array(P.string()))}).passthrough()})}),KAn=t0.extend({action:P.enum(["accept","decline","cancel"]),content:P.optional(P.record(P.string(),P.unknown()))}),qAn=P.object({type:P.literal("ref/resource"),uri:P.string()}).passthrough();var $An=P.object({type:P.literal("ref/prompt"),name:P.string()}).passthrough(),eZn=qg.extend({method:P.literal("completion/complete"),params:e0.extend({ref:P.union([$An,qAn]),argument:P.object({name:P.string(),value:P.string()}).passthrough(),context:P.optional(P.object({arguments:P.optional(P.record(P.string(),P.string()))}))})}),KPe=t0.extend({completion:P.object({values:P.array(P.string()).max(100),total:P.optional(P.number().int()),hasMore:P.optional(P.boolean())}).passthrough()}),tZn=P.object({uri:P.string().startsWith("file://"),name:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),lZn=qg.extend({method:P.literal("roots/list")}),nZn=t0.extend({roots:P.array(tZn)}),rZn=hQ.extend({method:P.literal("notifications/roots/list_changed")}),Xba=P.union([yYe,bAn,eZn,JAn,QAn,VAn,AAn,ZAn,gAn,WAn,yAn,kAn,XAn]),kba=P.union([NYe,EYe,JSt,rZn]),Lba=P.union([$9,UAn,KAn,nZn]),Jba=P.union([yYe,TAn,jAn,lZn]),xba=P.union([NYe,EYe,xAn,EAn,NAn,LAn,vAn]),Sba=P.union([$9,SPe,KPe,PPe,MPe,OPe,TPe,UPe,VYe,jPe]),$E=class extends Error{constructor(e,l,n){super(`MCP error ${e}: ${l}`),this.code=e,this.data=n,this.name="McpError"}};var IZn=6e4,QYe=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(NYe,l=>{let n=this._requestHandlerAbortControllers.get(l.params.requestId);n?.abort(l.params.reason)}),this.setNotificationHandler(EYe,l=>{this._onprogress(l)}),this.setRequestHandler(yYe,l=>({}))}_setupTimeout(e,l,n,r,I=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,l),startTime:Date.now(),timeout:l,maxTotalTimeout:n,resetTimeoutOnProgress:I,onTimeout:r})}_resetTimeout(e){let l=this._timeoutInfo.get(e);if(!l)return!1;let n=Date.now()-l.startTime;if(l.maxTotalTimeout&&n>=l.maxTotalTimeout)throw this._timeoutInfo.delete(e),new $E(qE.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:l.maxTotalTimeout,totalElapsed:n});return clearTimeout(l.timeoutId),l.timeoutId=setTimeout(l.onTimeout,l.timeout),!0}_cleanupTimeout(e){let l=this._timeoutInfo.get(e);l&&(clearTimeout(l.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var l,n,r;this._transport=e;let I=(l=this.transport)===null||l===void 0?void 0:l.onclose;this._transport.onclose=()=>{I?.(),this._onclose()};let a=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=o=>{a?.(o),this._onerror(o)};let s=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(o,d)=>{s?.(o,d),kce(o)||kSt(o)?this._onresponse(o):gYe(o)?this._onrequest(o,d):fSt(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){var e;let l=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 $E(qE.ConnectionClosed,"Connection closed");for(let r of l.values())r(n)}_onerror(e){var l;(l=this.onerror)===null||l===void 0||l.call(this,e)}_onnotification(e){var l;let n=(l=this._notificationHandlers.get(e.method))!==null&&l!==void 0?l:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,l){var n,r;let I=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,a=this._transport;if(I===void 0){a?.send({jsonrpc:"2.0",id:e.id,error:{code:qE.MethodNotFound,message:"Method not found"}}).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let o={signal:s.signal,sessionId:a?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:d=>this.notification(d,{relatedRequestId:e.id}),sendRequest:(d,u,b)=>this.request(d,u,{...b,relatedRequestId:e.id}),authInfo:l?.authInfo,requestId:e.id,requestInfo:l?.requestInfo};Promise.resolve().then(()=>I(e,o)).then(d=>{if(!s.signal.aborted)return a?.send({result:d,jsonrpc:"2.0",id:e.id})},d=>{var u;if(!s.signal.aborted)return a?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(d.code)?d.code:qE.InternalError,message:(u=d.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(d=>this._onerror(new Error(`Failed to send response: ${d}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:l,...n}=e.params,r=Number(l),I=this._progressHandlers.get(r);if(!I){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(o){a(o);return}I(n)}_onresponse(e){let l=Number(e.id),n=this._responseHandlers.get(l);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(l),this._progressHandlers.delete(l),this._cleanupTimeout(l),kce(e))n(e);else{let r=new $E(e.error.code,e.error.message,e.error.data);n(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,l,n){let{relatedRequestId:r,resumptionToken:I,onresumptiontoken:a}=n??{};return new Promise((s,o)=>{var d,u,b,p,h,Z;if(!this._transport){o(new Error("Not connected"));return}((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=n?.signal)===null||u===void 0||u.throwIfAborted();let N=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:N};n?.onprogress&&(this._progressHandlers.set(N,n.onprogress),y.params={...e.params,_meta:{...((b=e.params)===null||b===void 0?void 0:b._meta)||{},progressToken:N}});let Y=J=>{var O;this._responseHandlers.delete(N),this._progressHandlers.delete(N),this._cleanupTimeout(N),(O=this._transport)===null||O===void 0||O.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:N,reason:String(J)}},{relatedRequestId:r,resumptionToken:I,onresumptiontoken:a}).catch(D=>this._onerror(new Error(`Failed to send cancellation: ${D}`))),o(J)};this._responseHandlers.set(N,J=>{var O;if(!(!((O=n?.signal)===null||O===void 0)&&O.aborted)){if(J instanceof Error)return o(J);try{let D=l.parse(J.result);s(D)}catch(D){o(D)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var J;Y((J=n?.signal)===null||J===void 0?void 0:J.reason)});let Q=(h=n?.timeout)!==null&&h!==void 0?h:IZn,H=()=>Y(new $E(qE.RequestTimeout,"Request timed out",{timeout:Q}));this._setupTimeout(N,Q,n?.maxTotalTimeout,H,(Z=n?.resetTimeoutOnProgress)!==null&&Z!==void 0?Z:!1),this._transport.send(y,{relatedRequestId:r,resumptionToken:I,onresumptiontoken:a}).catch(J=>{this._cleanupTimeout(N),o(J)})})}async notification(e,l){var n,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!l?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var o;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let d={...e,jsonrpc:"2.0"};(o=this._transport)===null||o===void 0||o.send(d,l).catch(u=>this._onerror(u))});return}let s={...e,jsonrpc:"2.0"};await this._transport.send(s,l)}setRequestHandler(e,l){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(r,I)=>Promise.resolve(l(e.parse(r),I)))}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,l){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(l(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function _St(t,e){return Object.entries(e).reduce((l,[n,r])=>(r&&typeof r=="object"?l[n]=l[n]?{...l[n],...r}:r:l[n]=r,l),{...t})}var YOt=lt(ROt(),1),i1e=class extends QYe{constructor(e,l){var n;super(l),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=l?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new YOt.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_St(this._capabilities,e)}assertCapability(e,l){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${l})`)}async connect(e,l){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:MK,capabilities:this._capabilities,clientInfo:this._clientInfo}},SPe,l);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!QSt.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 l,n,r,I,a;switch(e){case"logging/setLevel":if(!(!((l=this._serverCapabilities)===null||l===void 0)&&l.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(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.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(!(!((I=this._serverCapabilities)===null||I===void 0)&&I.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var l;switch(e){case"notifications/roots/list_changed":if(!(!((l=this._capabilities.roots)===null||l===void 0)&&l.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"},$9,e)}async complete(e,l){return this.request({method:"completion/complete",params:e},KPe,l)}async setLoggingLevel(e,l){return this.request({method:"logging/setLevel",params:{level:e}},$9,l)}async getPrompt(e,l){return this.request({method:"prompts/get",params:e},PPe,l)}async listPrompts(e,l){return this.request({method:"prompts/list",params:e},MPe,l)}async listResources(e,l){return this.request({method:"resources/list",params:e},OPe,l)}async listResourceTemplates(e,l){return this.request({method:"resources/templates/list",params:e},TPe,l)}async readResource(e,l){return this.request({method:"resources/read",params:e},UPe,l)}async subscribeResource(e,l){return this.request({method:"resources/subscribe",params:e},$9,l)}async unsubscribeResource(e,l){return this.request({method:"resources/unsubscribe",params:e},$9,l)}async callTool(e,l=VYe,n){let r=await this.request({method:"tools/call",params:e},l,n),I=this.getToolOutputValidator(e.name);if(I){if(!r.structuredContent&&!r.isError)throw new $E(qE.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!I(r.structuredContent))throw new $E(qE.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(I.errors)}`)}catch(a){throw a instanceof $E?a:new $E(qE.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return r}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let l of e)if(l.outputSchema)try{let n=this._ajv.compile(l.outputSchema);this._cachedToolOutputValidators.set(l.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,l){let n=await this.request({method:"tools/list",params:e},jPe,l);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var c1e=class{createClient(e,l){return new i1e(e,l)}};c();c();c();c();var d1e=class extends Error{constructor(e,l){super(e),this.name="ParseError",this.type=l.type,this.field=l.field,this.value=l.value,this.line=l.line}};function X6e(t){}function u1e(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=X6e,onError:l=X6e,onRetry:n=X6e,onComment:r}=t,I="",a=!0,s,o="",d="";function u(N){let y=a?N.replace(/^\xEF\xBB\xBF/,""):N,[Y,Q]=FEn(`${I}${y}`);for(let H of Y)b(H);I=Q,a=!1}function b(N){if(N===""){h();return}if(N.startsWith(":")){r&&r(N.slice(N.startsWith(": ")?2:1));return}let y=N.indexOf(":");if(y!==-1){let Y=N.slice(0,y),Q=N[y+1]===" "?2:1,H=N.slice(y+Q);p(Y,H,N);return}p(N,"",N)}function p(N,y,Y){switch(N){case"event":d=y;break;case"data":o=`${o}${y}
|
|
1959
|
+
`,input_schema:{type:"object",properties:{question:{type:"string",description:"A question about the codebase. It should reference by name any topics, specific file names, and concepts that are relevant to the question and specify the desired output format."}},required:["question"]},callback:async n=>{let r,I=YAe(t),a="",s="",o=I.split("/");if(o.length===2){[a,s]=o,l.info("Searching for repository insights");try{r=await wPe(n.question,a,s,e,l),l.info(`Blackbird results: ${r}`)}catch(d){l.error(`Error occurred while searching for repository insights: ${d}`)}}return{resultType:"success",textResultForLlm:r??"No results found.",toolTelemetry:{}}}}}async function hSt(t,e,l,n,r,I,a){let s=await ASt(t),o=await dhn(t,l,n),d=GSt(l)?[new uYe(n,l,r,I,t,t.location,Dge(),a).getSearch()]:[],u=t.splitEditingTools?Vxe(t,n,l):[Kge(t,n,l)];return[s.shellTool,...s.otherTools??[],...o,...d,...u,Uyt(t,e,l,n,r),Lo(l,$ke)?ZAt(t,n,r,l):void 0,t?.requireReasoning?wxe(t):void 0,Lo(l,Lyt)?Jyt:void 0,await uhn(t,l,n,r)].filter(b=>b!==void 0)}async function vPe(t,e){let l=await ASt(t),n=t.splitEditingTools?Vxe(t,e):[Kge(t,e)];return[l.shellTool,...l.otherTools??[],...n,t?.requireReasoning?wxe(t):void 0].filter(r=>r!==void 0)}async function chn(t,e,l,n,r,I,a){return[...await hSt(t,e,l,n,r,I,a),Syt(t,n)]}var fPe=t=>({...uQ,supports:{...uQ.supports,reasoning:t?.thinkingMode?!0:uQ.supports?.reasoning}}),uQ={supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!1},createPR:{toolInit:hSt,jitInstructions:SOe},prDetails:{},respondToPRComment:{toolInit:chn,jitInstructions:SOe}},HPe=t=>({"sweagent-capi":{"claude-3.5-sonnet":{...uQ,supports:{tool_choice:!1,reasoning:!1}},"claude-3.7-sonnet":{...uQ,supports:{tool_choice:!1,reasoning:!1,vision:!0}},"claude-sonnet-4":{...uQ,supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!0,vision:!0},toolConfigOverrides:{splitEditingTools:!0}},"claude-sonnet-4.5":{...uQ,supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!0,vision:!0},toolConfigOverrides:{splitEditingTools:!0}},oswe:{...uQ,supports:{tool_choice:!0,reasoning:!0,vision:!0}},"oswe-prime":{...uQ,supports:{tool_choice:!0,reasoning:!0,vision:!0}},"gpt-5":{...uQ,supports:{tool_choice:!0,reasoning:!0,parallel_tool_calls:!0,vision:!0,steering:!0},toolConfigOverrides:{splitEditingTools:!0}}}});async function ASt(t){let e=new tNe(t);return{shellTool:e.getShellTool(),otherTools:[e.getWriteShellTool(),e.getReadShellTool(),e.getStopShellTool()]}}async function dhn(t,e,l){if(zSe(e,"cloud"))return[new Qle(new XNe(e,l,void 0)).getStoreMemory()];if(zSe(e,"local")){let n=new Qle(new HNe(t.location));return[n.getStoreMemory(),n.getReadMemory()]}return[]}async function uhn(t,e,l,n){if(t.includeCodeQLTool){let r=new cg(l,n),I=e.swebench_base_commit&&e.swebench_base_commit!=="undefined"?e.swebench_base_commit:await r.getCurrentCommitHash(t.location);return new Oge(t,r,I,e,l).getCodeQLCheckerTool()}}c();async function ZSt(t,e){switch(t.kind){case"image_processing":return e.onImageProcessingEvent(t);case"images_removed":return e.onImageRemovalEvent(t);case"message":return e.onMessage(t);case"model_call_failure":return e.onModelCallFailure(t);case"model_call_success":return await e.onModelCallSuccess(t);case"response":return e.onResponse(t);case"tool_execution":return e.onToolExecution(t);case"history_truncated":return e.onTruncationEvent(t);case"turn_started":case"turn_ended":case"turn_failed":case"turn_retry":return e.onTurnEvent(t);default:{let l=t;throw new Error(`unexpected event kind: ${JSON.stringify(t)}`)}}}c();c();c();import{Writable as v0n}from"stream";c();c();c();c();c();var P={};sb(P,{BRAND:()=>Jhn,DIRTY:()=>L9,EMPTY_PATH:()=>phn,INVALID:()=>Br,NEVER:()=>dAn,OK:()=>kh,ParseStatus:()=>Yp,Schema:()=>ga,ZodAny:()=>Jk,ZodArray:()=>Ov,ZodBigInt:()=>x9,ZodBoolean:()=>S9,ZodBranded:()=>Cce,ZodCatch:()=>K9,ZodDate:()=>B9,ZodDefault:()=>j9,ZodDiscriminatedUnion:()=>GYe,ZodEffects:()=>KE,ZodEnum:()=>z9,ZodError:()=>Xh,ZodFirstPartyTypeKind:()=>Pr,ZodFunction:()=>hYe,ZodIntersection:()=>M9,ZodIssueCode:()=>vl,ZodLazy:()=>_9,ZodLiteral:()=>D9,ZodMap:()=>OK,ZodNaN:()=>UK,ZodNativeEnum:()=>P9,ZodNever:()=>H2,ZodNull:()=>T9,ZodNullable:()=>GQ,ZodNumber:()=>J9,ZodObject:()=>jg,ZodOptional:()=>PE,ZodParsedType:()=>Fn,ZodPipeline:()=>vce,ZodPromise:()=>xk,ZodReadonly:()=>q9,ZodRecord:()=>pYe,ZodSchema:()=>ga,ZodSet:()=>TK,ZodString:()=>Lk,ZodSymbol:()=>SK,ZodTransformer:()=>KE,ZodTuple:()=>bQ,ZodType:()=>ga,ZodUndefined:()=>O9,ZodUnion:()=>U9,ZodUnknown:()=>Bv,ZodVoid:()=>BK,addIssueToContext:()=>hn,any:()=>JPe,array:()=>Wu,bigint:()=>Ohn,boolean:()=>Do,coerce:()=>Hce,custom:()=>VSt,date:()=>Thn,datetimeRegex:()=>RSt,defaultErrorMap:()=>xv,discriminatedUnion:()=>fce,effect:()=>nAn,enum:()=>Kg,function:()=>$hn,getErrorMap:()=>LK,getParsedType:()=>mQ,instanceof:()=>Shn,intersection:()=>jhn,isAborted:()=>mYe,isAsync:()=>JK,isDirty:()=>bYe,isValid:()=>kk,late:()=>xhn,lazy:()=>eAn,literal:()=>Ar,makeIssue:()=>Fce,map:()=>Khn,nan:()=>Bhn,nativeEnum:()=>tAn,never:()=>Dhn,null:()=>_hn,nullable:()=>IAn,number:()=>Lh,object:()=>$l,objectUtil:()=>XPe,oboolean:()=>cAn,onumber:()=>iAn,optional:()=>rAn,ostring:()=>oAn,pipeline:()=>sAn,preprocess:()=>aAn,promise:()=>lAn,quotelessJson:()=>mhn,record:()=>X2,set:()=>qhn,setErrorMap:()=>Ghn,strictObject:()=>Phn,string:()=>Vt,symbol:()=>Uhn,transformer:()=>nAn,tuple:()=>xPe,undefined:()=>Mhn,union:()=>Jh,unknown:()=>pQ,util:()=>Is,void:()=>zhn});c();c();c();c();c();var Is;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function l(r){throw new Error}t.assertNever=l,t.arrayToEnum=r=>{let I={};for(let a of r)I[a]=a;return I},t.getValidEnumValues=r=>{let I=t.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),a={};for(let s of I)a[s]=r[s];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(I){return r[I]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let I=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&I.push(a);return I},t.find=(r,I)=>{for(let a of r)if(I(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,I=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(I)}t.joinValues=n,t.jsonStringifyReplacer=(r,I)=>typeof I=="bigint"?I.toString():I})(Is||(Is={}));var XPe;(function(t){t.mergeShapes=(e,l)=>({...e,...l})})(XPe||(XPe={}));var Fn=Is.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mQ=t=>{switch(typeof t){case"undefined":return Fn.undefined;case"string":return Fn.string;case"number":return Number.isNaN(t)?Fn.nan:Fn.number;case"boolean":return Fn.boolean;case"function":return Fn.function;case"bigint":return Fn.bigint;case"symbol":return Fn.symbol;case"object":return Array.isArray(t)?Fn.array:t===null?Fn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Fn.promise:typeof Map<"u"&&t instanceof Map?Fn.map:typeof Set<"u"&&t instanceof Set?Fn.set:typeof Date<"u"&&t instanceof Date?Fn.date:Fn.object;default:return Fn.unknown}};var vl=Is.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"]),mhn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Xh=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 l=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,l):this.__proto__=l,this.name="ZodError",this.issues=e}format(e){let l=e||function(I){return I.message},n={_errors:[]},r=I=>{for(let a of I.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(l(a));else{let s=n,o=0;for(;o<a.path.length;){let d=a.path[o];o===a.path.length-1?(s[d]=s[d]||{_errors:[]},s[d]._errors.push(l(a))):s[d]=s[d]||{_errors:[]},s=s[d],o++}}};return r(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,Is.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=l=>l.message){let l={},n=[];for(let r of this.issues)if(r.path.length>0){let I=r.path[0];l[I]=l[I]||[],l[I].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:l}}get formErrors(){return this.flatten()}};Xh.create=t=>new Xh(t);var bhn=(t,e)=>{let l;switch(t.code){case vl.invalid_type:t.received===Fn.undefined?l="Required":l=`Expected ${t.expected}, received ${t.received}`;break;case vl.invalid_literal:l=`Invalid literal value, expected ${JSON.stringify(t.expected,Is.jsonStringifyReplacer)}`;break;case vl.unrecognized_keys:l=`Unrecognized key(s) in object: ${Is.joinValues(t.keys,", ")}`;break;case vl.invalid_union:l="Invalid input";break;case vl.invalid_union_discriminator:l=`Invalid discriminator value. Expected ${Is.joinValues(t.options)}`;break;case vl.invalid_enum_value:l=`Invalid enum value. Expected ${Is.joinValues(t.options)}, received '${t.received}'`;break;case vl.invalid_arguments:l="Invalid function arguments";break;case vl.invalid_return_type:l="Invalid function return type";break;case vl.invalid_date:l="Invalid date";break;case vl.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(l=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(l=`${l} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?l=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?l=`Invalid input: must end with "${t.validation.endsWith}"`:Is.assertNever(t.validation):t.validation!=="regex"?l=`Invalid ${t.validation}`:l="Invalid";break;case vl.too_small:t.type==="array"?l=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?l=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?l=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?l=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?l=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:l="Invalid input";break;case vl.too_big:t.type==="array"?l=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?l=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?l=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?l=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?l=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:l="Invalid input";break;case vl.custom:l="Invalid input";break;case vl.invalid_intersection_types:l="Intersection results could not be merged";break;case vl.not_multiple_of:l=`Number must be a multiple of ${t.multipleOf}`;break;case vl.not_finite:l="Number must be finite";break;default:l=e.defaultError,Is.assertNever(t)}return{message:l}},xv=bhn;var gSt=xv;function Ghn(t){gSt=t}function LK(){return gSt}c();var Fce=t=>{let{data:e,path:l,errorMaps:n,issueData:r}=t,I=[...l,...r.path||[]],a={...r,path:I};if(r.message!==void 0)return{...r,path:I,message:r.message};let s="",o=n.filter(d=>!!d).slice().reverse();for(let d of o)s=d(a,{data:e,defaultError:s}).message;return{...r,path:I,message:s}},phn=[];function hn(t,e){let l=LK(),n=Fce({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l,l===xv?void 0:xv].filter(r=>!!r)});t.common.issues.push(n)}var Yp=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,l){let n=[];for(let r of l){if(r.status==="aborted")return Br;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,l){let n=[];for(let r of l){let I=await r.key,a=await r.value;n.push({key:I,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,l){let n={};for(let r of l){let{key:I,value:a}=r;if(I.status==="aborted"||a.status==="aborted")return Br;I.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),I.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(n[I.value]=a.value)}return{status:e.value,value:n}}},Br=Object.freeze({status:"aborted"}),L9=t=>({status:"dirty",value:t}),kh=t=>({status:"valid",value:t}),mYe=t=>t.status==="aborted",bYe=t=>t.status==="dirty",kk=t=>t.status==="valid",JK=t=>typeof Promise<"u"&&t instanceof Promise;c();c();var sr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(sr||(sr={}));var jE=class{constructor(e,l,n,r){this._cachedPath=[],this.parent=e,this.data=l,this._path=n,this._key=r}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}},NSt=(t,e)=>{if(kk(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 l=new Xh(t.common.issues);return this._error=l,this._error}}};function ta(t){if(!t)return{};let{errorMap:e,invalid_type_error:l,required_error:n,description:r}=t;if(e&&(l||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,s)=>{let{message:o}=t;return a.code==="invalid_enum_value"?{message:o??s.defaultError}:typeof s.data>"u"?{message:o??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:o??l??s.defaultError}},description:r}}var ga=class{get description(){return this._def.description}_getType(e){return mQ(e.data)}_getOrReturnCtx(e,l){return l||{common:e.parent.common,data:e.data,parsedType:mQ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yp,ctx:{common:e.parent.common,data:e.data,parsedType:mQ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let l=this._parse(e);if(JK(l))throw new Error("Synchronous parse encountered promise.");return l}_parseAsync(e){let l=this._parse(e);return Promise.resolve(l)}parse(e,l){let n=this.safeParse(e,l);if(n.success)return n.data;throw n.error}safeParse(e,l){let n={common:{issues:[],async:l?.async??!1,contextualErrorMap:l?.errorMap},path:l?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mQ(e)},r=this._parseSync({data:e,path:n.path,parent:n});return NSt(n,r)}"~validate"(e){let l={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mQ(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:l});return kk(n)?{value:n.value}:{issues:l.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),l.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:l}).then(n=>kk(n)?{value:n.value}:{issues:l.common.issues})}async parseAsync(e,l){let n=await this.safeParseAsync(e,l);if(n.success)return n.data;throw n.error}async safeParseAsync(e,l){let n={common:{issues:[],contextualErrorMap:l?.errorMap,async:!0},path:l?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mQ(e)},r=this._parse({data:e,path:n.path,parent:n}),I=await(JK(r)?r:Promise.resolve(r));return NSt(n,I)}refine(e,l){let n=r=>typeof l=="string"||typeof l>"u"?{message:l}:typeof l=="function"?l(r):l;return this._refinement((r,I)=>{let a=e(r),s=()=>I.addIssue({code:vl.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(o=>o?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,l){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof l=="function"?l(n,r):l),!1))}_refinement(e){return new KE({schema:this,typeName:Pr.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:l=>this["~validate"](l)}}optional(){return PE.create(this,this._def)}nullable(){return GQ.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ov.create(this)}promise(){return xk.create(this,this._def)}or(e){return U9.create([this,e],this._def)}and(e){return M9.create(this,e,this._def)}transform(e){return new KE({...ta(this._def),schema:this,typeName:Pr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let l=typeof e=="function"?e:()=>e;return new j9({...ta(this._def),innerType:this,defaultValue:l,typeName:Pr.ZodDefault})}brand(){return new Cce({typeName:Pr.ZodBranded,type:this,...ta(this._def)})}catch(e){let l=typeof e=="function"?e:()=>e;return new K9({...ta(this._def),innerType:this,catchValue:l,typeName:Pr.ZodCatch})}describe(e){let l=this.constructor;return new l({...this._def,description:e})}pipe(e){return vce.create(this,e)}readonly(){return q9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},hhn=/^c[^\s-]{8,}$/i,Ahn=/^[0-9a-z]+$/,Zhn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ghn=/^[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,Nhn=/^[a-z0-9_-]{21}$/i,Whn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yhn=/^[-+]?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)?)??$/,Ehn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rhn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kPe,Yhn=/^(?:(?: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])$/,Vhn=/^(?:(?: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])$/,Qhn=/^(([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]))$/,whn=/^(([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])$/,Fhn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Chn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ySt="((\\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])))",vhn=new RegExp(`^${ySt}$`);function ESt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let l=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${l}`}function fhn(t){return new RegExp(`^${ESt(t)}$`)}function RSt(t){let e=`${ySt}T${ESt(t)}`,l=[];return l.push(t.local?"Z?":"Z"),t.offset&&l.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${l.join("|")})`,new RegExp(`^${e}$`)}function Hhn(t,e){return!!((e==="v4"||!e)&&Yhn.test(t)||(e==="v6"||!e)&&Qhn.test(t))}function Xhn(t,e){if(!Whn.test(t))return!1;try{let[l]=t.split(".");if(!l)return!1;let n=l.replace(/-/g,"+").replace(/_/g,"/").padEnd(l.length+(4-l.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function khn(t,e){return!!((e==="v4"||!e)&&Vhn.test(t)||(e==="v6"||!e)&&whn.test(t))}var Lk=class t extends ga{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Fn.string){let I=this._getOrReturnCtx(e);return hn(I,{code:vl.invalid_type,expected:Fn.string,received:I.parsedType}),Br}let n=new Yp,r;for(let I of this._def.checks)if(I.kind==="min")e.data.length<I.value&&(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.too_small,minimum:I.value,type:"string",inclusive:!0,exact:!1,message:I.message}),n.dirty());else if(I.kind==="max")e.data.length>I.value&&(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.too_big,maximum:I.value,type:"string",inclusive:!0,exact:!1,message:I.message}),n.dirty());else if(I.kind==="length"){let a=e.data.length>I.value,s=e.data.length<I.value;(a||s)&&(r=this._getOrReturnCtx(e,r),a?hn(r,{code:vl.too_big,maximum:I.value,type:"string",inclusive:!0,exact:!0,message:I.message}):s&&hn(r,{code:vl.too_small,minimum:I.value,type:"string",inclusive:!0,exact:!0,message:I.message}),n.dirty())}else if(I.kind==="email")Ehn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"email",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="emoji")kPe||(kPe=new RegExp(Rhn,"u")),kPe.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"emoji",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="uuid")ghn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"uuid",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="nanoid")Nhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"nanoid",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="cuid")hhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"cuid",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="cuid2")Ahn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"cuid2",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="ulid")Zhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"ulid",code:vl.invalid_string,message:I.message}),n.dirty());else if(I.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),hn(r,{validation:"url",code:vl.invalid_string,message:I.message}),n.dirty()}else I.kind==="regex"?(I.regex.lastIndex=0,I.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"regex",code:vl.invalid_string,message:I.message}),n.dirty())):I.kind==="trim"?e.data=e.data.trim():I.kind==="includes"?e.data.includes(I.value,I.position)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:{includes:I.value,position:I.position},message:I.message}),n.dirty()):I.kind==="toLowerCase"?e.data=e.data.toLowerCase():I.kind==="toUpperCase"?e.data=e.data.toUpperCase():I.kind==="startsWith"?e.data.startsWith(I.value)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:{startsWith:I.value},message:I.message}),n.dirty()):I.kind==="endsWith"?e.data.endsWith(I.value)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:{endsWith:I.value},message:I.message}),n.dirty()):I.kind==="datetime"?RSt(I).test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:"datetime",message:I.message}),n.dirty()):I.kind==="date"?vhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:"date",message:I.message}),n.dirty()):I.kind==="time"?fhn(I).test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.invalid_string,validation:"time",message:I.message}),n.dirty()):I.kind==="duration"?yhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"duration",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="ip"?Hhn(e.data,I.version)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"ip",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="jwt"?Xhn(e.data,I.alg)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"jwt",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="cidr"?khn(e.data,I.version)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"cidr",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="base64"?Fhn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"base64",code:vl.invalid_string,message:I.message}),n.dirty()):I.kind==="base64url"?Chn.test(e.data)||(r=this._getOrReturnCtx(e,r),hn(r,{validation:"base64url",code:vl.invalid_string,message:I.message}),n.dirty()):Is.assertNever(I);return{status:n.value,value:e.data}}_regex(e,l,n){return this.refinement(r=>e.test(r),{validation:l,code:vl.invalid_string,...sr.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...sr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...sr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...sr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...sr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...sr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...sr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...sr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...sr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...sr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...sr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...sr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...sr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...sr.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,...sr.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,...sr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...sr.errToObj(e)})}regex(e,l){return this._addCheck({kind:"regex",regex:e,...sr.errToObj(l)})}includes(e,l){return this._addCheck({kind:"includes",value:e,position:l?.position,...sr.errToObj(l?.message)})}startsWith(e,l){return this._addCheck({kind:"startsWith",value:e,...sr.errToObj(l)})}endsWith(e,l){return this._addCheck({kind:"endsWith",value:e,...sr.errToObj(l)})}min(e,l){return this._addCheck({kind:"min",value:e,...sr.errToObj(l)})}max(e,l){return this._addCheck({kind:"max",value:e,...sr.errToObj(l)})}length(e,l){return this._addCheck({kind:"length",value:e,...sr.errToObj(l)})}nonempty(e){return this.min(1,sr.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 l of this._def.checks)l.kind==="min"&&(e===null||l.value>e)&&(e=l.value);return e}get maxLength(){let e=null;for(let l of this._def.checks)l.kind==="max"&&(e===null||l.value<e)&&(e=l.value);return e}};Lk.create=t=>new Lk({checks:[],typeName:Pr.ZodString,coerce:t?.coerce??!1,...ta(t)});function Lhn(t,e){let l=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=l>n?l:n,I=Number.parseInt(t.toFixed(r).replace(".","")),a=Number.parseInt(e.toFixed(r).replace(".",""));return I%a/10**r}var J9=class t extends ga{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)!==Fn.number){let I=this._getOrReturnCtx(e);return hn(I,{code:vl.invalid_type,expected:Fn.number,received:I.parsedType}),Br}let n,r=new Yp;for(let I of this._def.checks)I.kind==="int"?Is.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.invalid_type,expected:"integer",received:"float",message:I.message}),r.dirty()):I.kind==="min"?(I.inclusive?e.data<I.value:e.data<=I.value)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.too_small,minimum:I.value,type:"number",inclusive:I.inclusive,exact:!1,message:I.message}),r.dirty()):I.kind==="max"?(I.inclusive?e.data>I.value:e.data>=I.value)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.too_big,maximum:I.value,type:"number",inclusive:I.inclusive,exact:!1,message:I.message}),r.dirty()):I.kind==="multipleOf"?Lhn(e.data,I.value)!==0&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.not_multiple_of,multipleOf:I.value,message:I.message}),r.dirty()):I.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.not_finite,message:I.message}),r.dirty()):Is.assertNever(I);return{status:r.value,value:e.data}}gte(e,l){return this.setLimit("min",e,!0,sr.toString(l))}gt(e,l){return this.setLimit("min",e,!1,sr.toString(l))}lte(e,l){return this.setLimit("max",e,!0,sr.toString(l))}lt(e,l){return this.setLimit("max",e,!1,sr.toString(l))}setLimit(e,l,n,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:l,inclusive:n,message:sr.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:sr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:sr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:sr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:sr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:sr.toString(e)})}multipleOf(e,l){return this._addCheck({kind:"multipleOf",value:e,message:sr.toString(l)})}finite(e){return this._addCheck({kind:"finite",message:sr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:sr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:sr.toString(e)})}get minValue(){let e=null;for(let l of this._def.checks)l.kind==="min"&&(e===null||l.value>e)&&(e=l.value);return e}get maxValue(){let e=null;for(let l of this._def.checks)l.kind==="max"&&(e===null||l.value<e)&&(e=l.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Is.isInteger(e.value))}get isFinite(){let e=null,l=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(l===null||n.value>l)&&(l=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(l)&&Number.isFinite(e)}};J9.create=t=>new J9({checks:[],typeName:Pr.ZodNumber,coerce:t?.coerce||!1,...ta(t)});var x9=class t extends ga{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)!==Fn.bigint)return this._getInvalidInput(e);let n,r=new Yp;for(let I of this._def.checks)I.kind==="min"?(I.inclusive?e.data<I.value:e.data<=I.value)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.too_small,type:"bigint",minimum:I.value,inclusive:I.inclusive,message:I.message}),r.dirty()):I.kind==="max"?(I.inclusive?e.data>I.value:e.data>=I.value)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.too_big,type:"bigint",maximum:I.value,inclusive:I.inclusive,message:I.message}),r.dirty()):I.kind==="multipleOf"?e.data%I.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),hn(n,{code:vl.not_multiple_of,multipleOf:I.value,message:I.message}),r.dirty()):Is.assertNever(I);return{status:r.value,value:e.data}}_getInvalidInput(e){let l=this._getOrReturnCtx(e);return hn(l,{code:vl.invalid_type,expected:Fn.bigint,received:l.parsedType}),Br}gte(e,l){return this.setLimit("min",e,!0,sr.toString(l))}gt(e,l){return this.setLimit("min",e,!1,sr.toString(l))}lte(e,l){return this.setLimit("max",e,!0,sr.toString(l))}lt(e,l){return this.setLimit("max",e,!1,sr.toString(l))}setLimit(e,l,n,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:l,inclusive:n,message:sr.toString(r)}]})}_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:sr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:sr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:sr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:sr.toString(e)})}multipleOf(e,l){return this._addCheck({kind:"multipleOf",value:e,message:sr.toString(l)})}get minValue(){let e=null;for(let l of this._def.checks)l.kind==="min"&&(e===null||l.value>e)&&(e=l.value);return e}get maxValue(){let e=null;for(let l of this._def.checks)l.kind==="max"&&(e===null||l.value<e)&&(e=l.value);return e}};x9.create=t=>new x9({checks:[],typeName:Pr.ZodBigInt,coerce:t?.coerce??!1,...ta(t)});var S9=class extends ga{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Fn.boolean){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.boolean,received:n.parsedType}),Br}return kh(e.data)}};S9.create=t=>new S9({typeName:Pr.ZodBoolean,coerce:t?.coerce||!1,...ta(t)});var B9=class t extends ga{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Fn.date){let I=this._getOrReturnCtx(e);return hn(I,{code:vl.invalid_type,expected:Fn.date,received:I.parsedType}),Br}if(Number.isNaN(e.data.getTime())){let I=this._getOrReturnCtx(e);return hn(I,{code:vl.invalid_date}),Br}let n=new Yp,r;for(let I of this._def.checks)I.kind==="min"?e.data.getTime()<I.value&&(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.too_small,message:I.message,inclusive:!0,exact:!1,minimum:I.value,type:"date"}),n.dirty()):I.kind==="max"?e.data.getTime()>I.value&&(r=this._getOrReturnCtx(e,r),hn(r,{code:vl.too_big,message:I.message,inclusive:!0,exact:!1,maximum:I.value,type:"date"}),n.dirty()):Is.assertNever(I);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,l){return this._addCheck({kind:"min",value:e.getTime(),message:sr.toString(l)})}max(e,l){return this._addCheck({kind:"max",value:e.getTime(),message:sr.toString(l)})}get minDate(){let e=null;for(let l of this._def.checks)l.kind==="min"&&(e===null||l.value>e)&&(e=l.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let l of this._def.checks)l.kind==="max"&&(e===null||l.value<e)&&(e=l.value);return e!=null?new Date(e):null}};B9.create=t=>new B9({checks:[],coerce:t?.coerce||!1,typeName:Pr.ZodDate,...ta(t)});var SK=class extends ga{_parse(e){if(this._getType(e)!==Fn.symbol){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.symbol,received:n.parsedType}),Br}return kh(e.data)}};SK.create=t=>new SK({typeName:Pr.ZodSymbol,...ta(t)});var O9=class extends ga{_parse(e){if(this._getType(e)!==Fn.undefined){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.undefined,received:n.parsedType}),Br}return kh(e.data)}};O9.create=t=>new O9({typeName:Pr.ZodUndefined,...ta(t)});var T9=class extends ga{_parse(e){if(this._getType(e)!==Fn.null){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.null,received:n.parsedType}),Br}return kh(e.data)}};T9.create=t=>new T9({typeName:Pr.ZodNull,...ta(t)});var Jk=class extends ga{constructor(){super(...arguments),this._any=!0}_parse(e){return kh(e.data)}};Jk.create=t=>new Jk({typeName:Pr.ZodAny,...ta(t)});var Bv=class extends ga{constructor(){super(...arguments),this._unknown=!0}_parse(e){return kh(e.data)}};Bv.create=t=>new Bv({typeName:Pr.ZodUnknown,...ta(t)});var H2=class extends ga{_parse(e){let l=this._getOrReturnCtx(e);return hn(l,{code:vl.invalid_type,expected:Fn.never,received:l.parsedType}),Br}};H2.create=t=>new H2({typeName:Pr.ZodNever,...ta(t)});var BK=class extends ga{_parse(e){if(this._getType(e)!==Fn.undefined){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.void,received:n.parsedType}),Br}return kh(e.data)}};BK.create=t=>new BK({typeName:Pr.ZodVoid,...ta(t)});var Ov=class t extends ga{_parse(e){let{ctx:l,status:n}=this._processInputParams(e),r=this._def;if(l.parsedType!==Fn.array)return hn(l,{code:vl.invalid_type,expected:Fn.array,received:l.parsedType}),Br;if(r.exactLength!==null){let a=l.data.length>r.exactLength.value,s=l.data.length<r.exactLength.value;(a||s)&&(hn(l,{code:a?vl.too_big:vl.too_small,minimum:s?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&l.data.length<r.minLength.value&&(hn(l,{code:vl.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&l.data.length>r.maxLength.value&&(hn(l,{code:vl.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),l.common.async)return Promise.all([...l.data].map((a,s)=>r.type._parseAsync(new jE(l,a,l.path,s)))).then(a=>Yp.mergeArray(n,a));let I=[...l.data].map((a,s)=>r.type._parseSync(new jE(l,a,l.path,s)));return Yp.mergeArray(n,I)}get element(){return this._def.type}min(e,l){return new t({...this._def,minLength:{value:e,message:sr.toString(l)}})}max(e,l){return new t({...this._def,maxLength:{value:e,message:sr.toString(l)}})}length(e,l){return new t({...this._def,exactLength:{value:e,message:sr.toString(l)}})}nonempty(e){return this.min(1,e)}};Ov.create=(t,e)=>new Ov({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Pr.ZodArray,...ta(e)});function xK(t){if(t instanceof jg){let e={};for(let l in t.shape){let n=t.shape[l];e[l]=PE.create(xK(n))}return new jg({...t._def,shape:()=>e})}else return t instanceof Ov?new Ov({...t._def,type:xK(t.element)}):t instanceof PE?PE.create(xK(t.unwrap())):t instanceof GQ?GQ.create(xK(t.unwrap())):t instanceof bQ?bQ.create(t.items.map(e=>xK(e))):t}var jg=class t extends ga{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(),l=Is.objectKeys(e);return this._cached={shape:e,keys:l},this._cached}_parse(e){if(this._getType(e)!==Fn.object){let d=this._getOrReturnCtx(e);return hn(d,{code:vl.invalid_type,expected:Fn.object,received:d.parsedType}),Br}let{status:n,ctx:r}=this._processInputParams(e),{shape:I,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof H2&&this._def.unknownKeys==="strip"))for(let d in r.data)a.includes(d)||s.push(d);let o=[];for(let d of a){let u=I[d],b=r.data[d];o.push({key:{status:"valid",value:d},value:u._parse(new jE(r,b,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof H2){let d=this._def.unknownKeys;if(d==="passthrough")for(let u of s)o.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(d==="strict")s.length>0&&(hn(r,{code:vl.unrecognized_keys,keys:s}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let u of s){let b=r.data[u];o.push({key:{status:"valid",value:u},value:d._parse(new jE(r,b,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let d=[];for(let u of o){let b=await u.key,p=await u.value;d.push({key:b,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>Yp.mergeObjectSync(n,d)):Yp.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return sr.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(l,n)=>{let r=this._def.errorMap?.(l,n).message??n.defaultError;return l.code==="unrecognized_keys"?{message:sr.errToObj(e).message??r}:{message:r}}}:{}})}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:Pr.ZodObject})}setKey(e,l){return this.augment({[e]:l})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let l={};for(let n of Is.objectKeys(e))e[n]&&this.shape[n]&&(l[n]=this.shape[n]);return new t({...this._def,shape:()=>l})}omit(e){let l={};for(let n of Is.objectKeys(this.shape))e[n]||(l[n]=this.shape[n]);return new t({...this._def,shape:()=>l})}deepPartial(){return xK(this)}partial(e){let l={};for(let n of Is.objectKeys(this.shape)){let r=this.shape[n];e&&!e[n]?l[n]=r:l[n]=r.optional()}return new t({...this._def,shape:()=>l})}required(e){let l={};for(let n of Is.objectKeys(this.shape))if(e&&!e[n])l[n]=this.shape[n];else{let I=this.shape[n];for(;I instanceof PE;)I=I._def.innerType;l[n]=I}return new t({...this._def,shape:()=>l})}keyof(){return YSt(Is.objectKeys(this.shape))}};jg.create=(t,e)=>new jg({shape:()=>t,unknownKeys:"strip",catchall:H2.create(),typeName:Pr.ZodObject,...ta(e)});jg.strictCreate=(t,e)=>new jg({shape:()=>t,unknownKeys:"strict",catchall:H2.create(),typeName:Pr.ZodObject,...ta(e)});jg.lazycreate=(t,e)=>new jg({shape:t,unknownKeys:"strip",catchall:H2.create(),typeName:Pr.ZodObject,...ta(e)});var U9=class extends ga{_parse(e){let{ctx:l}=this._processInputParams(e),n=this._def.options;function r(I){for(let s of I)if(s.result.status==="valid")return s.result;for(let s of I)if(s.result.status==="dirty")return l.common.issues.push(...s.ctx.common.issues),s.result;let a=I.map(s=>new Xh(s.ctx.common.issues));return hn(l,{code:vl.invalid_union,unionErrors:a}),Br}if(l.common.async)return Promise.all(n.map(async I=>{let a={...l,common:{...l.common,issues:[]},parent:null};return{result:await I._parseAsync({data:l.data,path:l.path,parent:a}),ctx:a}})).then(r);{let I,a=[];for(let o of n){let d={...l,common:{...l.common,issues:[]},parent:null},u=o._parseSync({data:l.data,path:l.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!I&&(I={result:u,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(I)return l.common.issues.push(...I.ctx.common.issues),I.result;let s=a.map(o=>new Xh(o));return hn(l,{code:vl.invalid_union,unionErrors:s}),Br}}get options(){return this._def.options}};U9.create=(t,e)=>new U9({options:t,typeName:Pr.ZodUnion,...ta(e)});var Sv=t=>t instanceof _9?Sv(t.schema):t instanceof KE?Sv(t.innerType()):t instanceof D9?[t.value]:t instanceof z9?t.options:t instanceof P9?Is.objectValues(t.enum):t instanceof j9?Sv(t._def.innerType):t instanceof O9?[void 0]:t instanceof T9?[null]:t instanceof PE?[void 0,...Sv(t.unwrap())]:t instanceof GQ?[null,...Sv(t.unwrap())]:t instanceof Cce||t instanceof q9?Sv(t.unwrap()):t instanceof K9?Sv(t._def.innerType):[],GYe=class t extends ga{_parse(e){let{ctx:l}=this._processInputParams(e);if(l.parsedType!==Fn.object)return hn(l,{code:vl.invalid_type,expected:Fn.object,received:l.parsedType}),Br;let n=this.discriminator,r=l.data[n],I=this.optionsMap.get(r);return I?l.common.async?I._parseAsync({data:l.data,path:l.path,parent:l}):I._parseSync({data:l.data,path:l.path,parent:l}):(hn(l,{code:vl.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Br)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,l,n){let r=new Map;for(let I of l){let a=Sv(I.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(r.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);r.set(s,I)}}return new t({typeName:Pr.ZodDiscriminatedUnion,discriminator:e,options:l,optionsMap:r,...ta(n)})}};function LPe(t,e){let l=mQ(t),n=mQ(e);if(t===e)return{valid:!0,data:t};if(l===Fn.object&&n===Fn.object){let r=Is.objectKeys(e),I=Is.objectKeys(t).filter(s=>r.indexOf(s)!==-1),a={...t,...e};for(let s of I){let o=LPe(t[s],e[s]);if(!o.valid)return{valid:!1};a[s]=o.data}return{valid:!0,data:a}}else if(l===Fn.array&&n===Fn.array){if(t.length!==e.length)return{valid:!1};let r=[];for(let I=0;I<t.length;I++){let a=t[I],s=e[I],o=LPe(a,s);if(!o.valid)return{valid:!1};r.push(o.data)}return{valid:!0,data:r}}else return l===Fn.date&&n===Fn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var M9=class extends ga{_parse(e){let{status:l,ctx:n}=this._processInputParams(e),r=(I,a)=>{if(mYe(I)||mYe(a))return Br;let s=LPe(I.value,a.value);return s.valid?((bYe(I)||bYe(a))&&l.dirty(),{status:l.value,value:s.data}):(hn(n,{code:vl.invalid_intersection_types}),Br)};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(([I,a])=>r(I,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};M9.create=(t,e,l)=>new M9({left:t,right:e,typeName:Pr.ZodIntersection,...ta(l)});var bQ=class t extends ga{_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.parsedType!==Fn.array)return hn(n,{code:vl.invalid_type,expected:Fn.array,received:n.parsedType}),Br;if(n.data.length<this._def.items.length)return hn(n,{code:vl.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Br;!this._def.rest&&n.data.length>this._def.items.length&&(hn(n,{code:vl.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.dirty());let I=[...n.data].map((a,s)=>{let o=this._def.items[s]||this._def.rest;return o?o._parse(new jE(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(I).then(a=>Yp.mergeArray(l,a)):Yp.mergeArray(l,I)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};bQ.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new bQ({items:t,typeName:Pr.ZodTuple,rest:null,...ta(e)})};var pYe=class t extends ga{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.parsedType!==Fn.object)return hn(n,{code:vl.invalid_type,expected:Fn.object,received:n.parsedType}),Br;let r=[],I=this._def.keyType,a=this._def.valueType;for(let s in n.data)r.push({key:I._parse(new jE(n,s,n.path,s)),value:a._parse(new jE(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Yp.mergeObjectAsync(l,r):Yp.mergeObjectSync(l,r)}get element(){return this._def.valueType}static create(e,l,n){return l instanceof ga?new t({keyType:e,valueType:l,typeName:Pr.ZodRecord,...ta(n)}):new t({keyType:Lk.create(),valueType:e,typeName:Pr.ZodRecord,...ta(l)})}},OK=class extends ga{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.parsedType!==Fn.map)return hn(n,{code:vl.invalid_type,expected:Fn.map,received:n.parsedType}),Br;let r=this._def.keyType,I=this._def.valueType,a=[...n.data.entries()].map(([s,o],d)=>({key:r._parse(new jE(n,s,n.path,[d,"key"])),value:I._parse(new jE(n,o,n.path,[d,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let o of a){let d=await o.key,u=await o.value;if(d.status==="aborted"||u.status==="aborted")return Br;(d.status==="dirty"||u.status==="dirty")&&l.dirty(),s.set(d.value,u.value)}return{status:l.value,value:s}})}else{let s=new Map;for(let o of a){let d=o.key,u=o.value;if(d.status==="aborted"||u.status==="aborted")return Br;(d.status==="dirty"||u.status==="dirty")&&l.dirty(),s.set(d.value,u.value)}return{status:l.value,value:s}}}};OK.create=(t,e,l)=>new OK({valueType:e,keyType:t,typeName:Pr.ZodMap,...ta(l)});var TK=class t extends ga{_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.parsedType!==Fn.set)return hn(n,{code:vl.invalid_type,expected:Fn.set,received:n.parsedType}),Br;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(hn(n,{code:vl.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),l.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(hn(n,{code:vl.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),l.dirty());let I=this._def.valueType;function a(o){let d=new Set;for(let u of o){if(u.status==="aborted")return Br;u.status==="dirty"&&l.dirty(),d.add(u.value)}return{status:l.value,value:d}}let s=[...n.data.values()].map((o,d)=>I._parse(new jE(n,o,n.path,d)));return n.common.async?Promise.all(s).then(o=>a(o)):a(s)}min(e,l){return new t({...this._def,minSize:{value:e,message:sr.toString(l)}})}max(e,l){return new t({...this._def,maxSize:{value:e,message:sr.toString(l)}})}size(e,l){return this.min(e,l).max(e,l)}nonempty(e){return this.min(1,e)}};TK.create=(t,e)=>new TK({valueType:t,minSize:null,maxSize:null,typeName:Pr.ZodSet,...ta(e)});var hYe=class t extends ga{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:l}=this._processInputParams(e);if(l.parsedType!==Fn.function)return hn(l,{code:vl.invalid_type,expected:Fn.function,received:l.parsedType}),Br;function n(s,o){return Fce({data:s,path:l.path,errorMaps:[l.common.contextualErrorMap,l.schemaErrorMap,LK(),xv].filter(d=>!!d),issueData:{code:vl.invalid_arguments,argumentsError:o}})}function r(s,o){return Fce({data:s,path:l.path,errorMaps:[l.common.contextualErrorMap,l.schemaErrorMap,LK(),xv].filter(d=>!!d),issueData:{code:vl.invalid_return_type,returnTypeError:o}})}let I={errorMap:l.common.contextualErrorMap},a=l.data;if(this._def.returns instanceof xk){let s=this;return kh(async function(...o){let d=new Xh([]),u=await s._def.args.parseAsync(o,I).catch(h=>{throw d.addIssue(n(o,h)),d}),b=await Reflect.apply(a,this,u);return await s._def.returns._def.type.parseAsync(b,I).catch(h=>{throw d.addIssue(r(b,h)),d})})}else{let s=this;return kh(function(...o){let d=s._def.args.safeParse(o,I);if(!d.success)throw new Xh([n(o,d.error)]);let u=Reflect.apply(a,this,d.data),b=s._def.returns.safeParse(u,I);if(!b.success)throw new Xh([r(u,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:bQ.create(e).rest(Bv.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,l,n){return new t({args:e||bQ.create([]).rest(Bv.create()),returns:l||Bv.create(),typeName:Pr.ZodFunction,...ta(n)})}},_9=class extends ga{get schema(){return this._def.getter()}_parse(e){let{ctx:l}=this._processInputParams(e);return this._def.getter()._parse({data:l.data,path:l.path,parent:l})}};_9.create=(t,e)=>new _9({getter:t,typeName:Pr.ZodLazy,...ta(e)});var D9=class extends ga{_parse(e){if(e.data!==this._def.value){let l=this._getOrReturnCtx(e);return hn(l,{received:l.data,code:vl.invalid_literal,expected:this._def.value}),Br}return{status:"valid",value:e.data}}get value(){return this._def.value}};D9.create=(t,e)=>new D9({value:t,typeName:Pr.ZodLiteral,...ta(e)});function YSt(t,e){return new z9({values:t,typeName:Pr.ZodEnum,...ta(e)})}var z9=class t extends ga{_parse(e){if(typeof e.data!="string"){let l=this._getOrReturnCtx(e),n=this._def.values;return hn(l,{expected:Is.joinValues(n),received:l.parsedType,code:vl.invalid_type}),Br}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let l=this._getOrReturnCtx(e),n=this._def.values;return hn(l,{received:l.data,code:vl.invalid_enum_value,options:n}),Br}return kh(e.data)}get options(){return this._def.values}get enum(){let e={};for(let l of this._def.values)e[l]=l;return e}get Values(){let e={};for(let l of this._def.values)e[l]=l;return e}get Enum(){let e={};for(let l of this._def.values)e[l]=l;return e}extract(e,l=this._def){return t.create(e,{...this._def,...l})}exclude(e,l=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...l})}};z9.create=YSt;var P9=class extends ga{_parse(e){let l=Is.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Fn.string&&n.parsedType!==Fn.number){let r=Is.objectValues(l);return hn(n,{expected:Is.joinValues(r),received:n.parsedType,code:vl.invalid_type}),Br}if(this._cache||(this._cache=new Set(Is.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=Is.objectValues(l);return hn(n,{received:n.data,code:vl.invalid_enum_value,options:r}),Br}return kh(e.data)}get enum(){return this._def.values}};P9.create=(t,e)=>new P9({values:t,typeName:Pr.ZodNativeEnum,...ta(e)});var xk=class extends ga{unwrap(){return this._def.type}_parse(e){let{ctx:l}=this._processInputParams(e);if(l.parsedType!==Fn.promise&&l.common.async===!1)return hn(l,{code:vl.invalid_type,expected:Fn.promise,received:l.parsedType}),Br;let n=l.parsedType===Fn.promise?l.data:Promise.resolve(l.data);return kh(n.then(r=>this._def.type.parseAsync(r,{path:l.path,errorMap:l.common.contextualErrorMap})))}};xk.create=(t,e)=>new xk({type:t,typeName:Pr.ZodPromise,...ta(e)});var KE=class extends ga{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:l,ctx:n}=this._processInputParams(e),r=this._def.effect||null,I={addIssue:a=>{hn(n,a),a.fatal?l.abort():l.dirty()},get path(){return n.path}};if(I.addIssue=I.addIssue.bind(I),r.type==="preprocess"){let a=r.transform(n.data,I);if(n.common.async)return Promise.resolve(a).then(async s=>{if(l.value==="aborted")return Br;let o=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return o.status==="aborted"?Br:o.status==="dirty"?L9(o.value):l.value==="dirty"?L9(o.value):o});{if(l.value==="aborted")return Br;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Br:s.status==="dirty"?L9(s.value):l.value==="dirty"?L9(s.value):s}}if(r.type==="refinement"){let a=s=>{let o=r.refinement(s,I);if(n.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Br:(s.status==="dirty"&&l.dirty(),a(s.value),{status:l.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Br:(s.status==="dirty"&&l.dirty(),a(s.value).then(()=>({status:l.value,value:s.value}))))}if(r.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!kk(a))return Br;let s=r.transform(a.value,I);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:l.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>kk(a)?Promise.resolve(r.transform(a.value,I)).then(s=>({status:l.value,value:s})):Br);Is.assertNever(r)}};KE.create=(t,e,l)=>new KE({schema:t,typeName:Pr.ZodEffects,effect:e,...ta(l)});KE.createWithPreprocess=(t,e,l)=>new KE({schema:e,effect:{type:"preprocess",transform:t},typeName:Pr.ZodEffects,...ta(l)});var PE=class extends ga{_parse(e){return this._getType(e)===Fn.undefined?kh(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};PE.create=(t,e)=>new PE({innerType:t,typeName:Pr.ZodOptional,...ta(e)});var GQ=class extends ga{_parse(e){return this._getType(e)===Fn.null?kh(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};GQ.create=(t,e)=>new GQ({innerType:t,typeName:Pr.ZodNullable,...ta(e)});var j9=class extends ga{_parse(e){let{ctx:l}=this._processInputParams(e),n=l.data;return l.parsedType===Fn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:l.path,parent:l})}removeDefault(){return this._def.innerType}};j9.create=(t,e)=>new j9({innerType:t,typeName:Pr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ta(e)});var K9=class extends ga{_parse(e){let{ctx:l}=this._processInputParams(e),n={...l,common:{...l.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return JK(r)?r.then(I=>({status:"valid",value:I.status==="valid"?I.value:this._def.catchValue({get error(){return new Xh(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Xh(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};K9.create=(t,e)=>new K9({innerType:t,typeName:Pr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ta(e)});var UK=class extends ga{_parse(e){if(this._getType(e)!==Fn.nan){let n=this._getOrReturnCtx(e);return hn(n,{code:vl.invalid_type,expected:Fn.nan,received:n.parsedType}),Br}return{status:"valid",value:e.data}}};UK.create=t=>new UK({typeName:Pr.ZodNaN,...ta(t)});var Jhn=Symbol("zod_brand"),Cce=class extends ga{_parse(e){let{ctx:l}=this._processInputParams(e),n=l.data;return this._def.type._parse({data:n,path:l.path,parent:l})}unwrap(){return this._def.type}},vce=class t extends ga{_parse(e){let{status:l,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let I=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return I.status==="aborted"?Br:I.status==="dirty"?(l.dirty(),L9(I.value)):this._def.out._parseAsync({data:I.value,path:n.path,parent:n})})();{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?Br:r.status==="dirty"?(l.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,l){return new t({in:e,out:l,typeName:Pr.ZodPipeline})}},q9=class extends ga{_parse(e){let l=this._def.innerType._parse(e),n=r=>(kk(r)&&(r.value=Object.freeze(r.value)),r);return JK(l)?l.then(r=>n(r)):n(l)}unwrap(){return this._def.innerType}};q9.create=(t,e)=>new q9({innerType:t,typeName:Pr.ZodReadonly,...ta(e)});function WSt(t,e){let l=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof l=="string"?{message:l}:l}function VSt(t,e={},l){return t?Jk.create().superRefine((n,r)=>{let I=t(n);if(I instanceof Promise)return I.then(a=>{if(!a){let s=WSt(e,n),o=s.fatal??l??!0;r.addIssue({code:"custom",...s,fatal:o})}});if(!I){let a=WSt(e,n),s=a.fatal??l??!0;r.addIssue({code:"custom",...a,fatal:s})}}):Jk.create()}var xhn={object:jg.lazycreate},Pr;(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"})(Pr||(Pr={}));var Shn=(t,e={message:`Input not instance of ${t.name}`})=>VSt(l=>l instanceof t,e),Vt=Lk.create,Lh=J9.create,Bhn=UK.create,Ohn=x9.create,Do=S9.create,Thn=B9.create,Uhn=SK.create,Mhn=O9.create,_hn=T9.create,JPe=Jk.create,pQ=Bv.create,Dhn=H2.create,zhn=BK.create,Wu=Ov.create,$l=jg.create,Phn=jg.strictCreate,Jh=U9.create,fce=GYe.create,jhn=M9.create,xPe=bQ.create,X2=pYe.create,Khn=OK.create,qhn=TK.create,$hn=hYe.create,eAn=_9.create,Ar=D9.create,Kg=z9.create,tAn=P9.create,lAn=xk.create,nAn=KE.create,rAn=PE.create,IAn=GQ.create,aAn=KE.createWithPreprocess,sAn=vce.create,oAn=()=>Vt().optional(),iAn=()=>Lh().optional(),cAn=()=>Do().optional(),Hce={string:t=>Lk.create({...t,coerce:!0}),number:t=>J9.create({...t,coerce:!0}),boolean:t=>S9.create({...t,coerce:!0}),bigint:t=>x9.create({...t,coerce:!0}),date:t=>B9.create({...t,coerce:!0})};var dAn=Br;var Ha=P;var MK="2025-06-18";var QSt=[MK,"2025-03-26","2024-11-05","2024-10-07"],AYe="2.0",wSt=P.union([P.string(),P.number().int()]),FSt=P.string(),uAn=P.object({progressToken:P.optional(wSt)}).passthrough(),e0=P.object({_meta:P.optional(uAn)}).passthrough(),qg=P.object({method:P.string(),params:P.optional(e0)}),Xce=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),hQ=P.object({method:P.string(),params:P.optional(Xce)}),t0=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),ZYe=P.union([P.string(),P.number().int()]),CSt=P.object({jsonrpc:P.literal(AYe),id:ZYe}).merge(qg).strict(),gYe=t=>CSt.safeParse(t).success,vSt=P.object({jsonrpc:P.literal(AYe)}).merge(hQ).strict(),fSt=t=>vSt.safeParse(t).success,HSt=P.object({jsonrpc:P.literal(AYe),id:ZYe,result:t0}).strict(),kce=t=>HSt.safeParse(t).success,qE;(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"})(qE||(qE={}));var XSt=P.object({jsonrpc:P.literal(AYe),id:ZYe,error:P.object({code:P.number().int(),message:P.string(),data:P.optional(P.unknown())})}).strict(),kSt=t=>XSt.safeParse(t).success,Bk=P.union([CSt,vSt,HSt,XSt]),$9=t0.strict(),NYe=hQ.extend({method:P.literal("notifications/cancelled"),params:Xce.extend({requestId:ZYe,reason:P.string().optional()})}),WYe=P.object({src:P.string(),mimeType:P.optional(P.string()),sizes:P.optional(P.string())}).passthrough(),Lce=P.object({name:P.string(),title:P.optional(P.string())}).passthrough(),LSt=Lce.extend({version:P.string(),websiteUrl:P.optional(P.string()),icons:P.optional(P.array(WYe))}),mAn=P.object({experimental:P.optional(P.object({}).passthrough()),sampling:P.optional(P.object({}).passthrough()),elicitation:P.optional(P.object({}).passthrough()),roots:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),bAn=qg.extend({method:P.literal("initialize"),params:e0.extend({protocolVersion:P.string(),capabilities:mAn,clientInfo:LSt})});var GAn=P.object({experimental:P.optional(P.object({}).passthrough()),logging:P.optional(P.object({}).passthrough()),completions:P.optional(P.object({}).passthrough()),prompts:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough()),resources:P.optional(P.object({subscribe:P.optional(P.boolean()),listChanged:P.optional(P.boolean())}).passthrough()),tools:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),SPe=t0.extend({protocolVersion:P.string(),capabilities:GAn,serverInfo:LSt,instructions:P.optional(P.string())}),JSt=hQ.extend({method:P.literal("notifications/initialized")}),xSt=t=>JSt.safeParse(t).success,yYe=qg.extend({method:P.literal("ping")}),pAn=P.object({progress:P.number(),total:P.optional(P.number()),message:P.optional(P.string())}).passthrough(),EYe=hQ.extend({method:P.literal("notifications/progress"),params:Xce.merge(pAn).extend({progressToken:wSt})}),RYe=qg.extend({params:e0.extend({cursor:P.optional(FSt)}).optional()}),YYe=t0.extend({nextCursor:P.optional(FSt)}),SSt=P.object({uri:P.string(),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),BSt=SSt.extend({text:P.string()}),BPe=P.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),OSt=SSt.extend({blob:BPe}),TSt=Lce.extend({uri:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),icons:P.optional(P.array(WYe)),_meta:P.optional(P.object({}).passthrough())}),hAn=Lce.extend({uriTemplate:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}),AAn=RYe.extend({method:P.literal("resources/list")}),OPe=YYe.extend({resources:P.array(TSt)}),ZAn=RYe.extend({method:P.literal("resources/templates/list")}),TPe=YYe.extend({resourceTemplates:P.array(hAn)}),gAn=qg.extend({method:P.literal("resources/read"),params:e0.extend({uri:P.string()})}),UPe=t0.extend({contents:P.array(P.union([BSt,OSt]))}),NAn=hQ.extend({method:P.literal("notifications/resources/list_changed")}),WAn=qg.extend({method:P.literal("resources/subscribe"),params:e0.extend({uri:P.string()})}),yAn=qg.extend({method:P.literal("resources/unsubscribe"),params:e0.extend({uri:P.string()})}),EAn=hQ.extend({method:P.literal("notifications/resources/updated"),params:Xce.extend({uri:P.string()})}),RAn=P.object({name:P.string(),description:P.optional(P.string()),required:P.optional(P.boolean())}).passthrough(),YAn=Lce.extend({description:P.optional(P.string()),arguments:P.optional(P.array(RAn)),icons:P.optional(P.array(WYe)),_meta:P.optional(P.object({}).passthrough())}),VAn=RYe.extend({method:P.literal("prompts/list")}),MPe=YYe.extend({prompts:P.array(YAn)}),QAn=qg.extend({method:P.literal("prompts/get"),params:e0.extend({name:P.string(),arguments:P.optional(P.record(P.string()))})}),_Pe=P.object({type:P.literal("text"),text:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),DPe=P.object({type:P.literal("image"),data:BPe,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),zPe=P.object({type:P.literal("audio"),data:BPe,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),wAn=P.object({type:P.literal("resource"),resource:P.union([BSt,OSt]),_meta:P.optional(P.object({}).passthrough())}).passthrough(),FAn=TSt.extend({type:P.literal("resource_link")}),USt=P.union([_Pe,DPe,zPe,FAn,wAn]),CAn=P.object({role:P.enum(["user","assistant"]),content:USt}).passthrough(),PPe=t0.extend({description:P.optional(P.string()),messages:P.array(CAn)}),vAn=hQ.extend({method:P.literal("notifications/prompts/list_changed")}),fAn=P.object({title:P.optional(P.string()),readOnlyHint:P.optional(P.boolean()),destructiveHint:P.optional(P.boolean()),idempotentHint:P.optional(P.boolean()),openWorldHint:P.optional(P.boolean())}).passthrough(),HAn=Lce.extend({description:P.optional(P.string()),inputSchema:P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough(),outputSchema:P.optional(P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough()),annotations:P.optional(fAn),icons:P.optional(P.array(WYe)),_meta:P.optional(P.object({}).passthrough())}),XAn=RYe.extend({method:P.literal("tools/list")}),jPe=YYe.extend({tools:P.array(HAn)}),VYe=t0.extend({content:P.array(USt).default([]),structuredContent:P.object({}).passthrough().optional(),isError:P.optional(P.boolean())}),Hba=VYe.or(t0.extend({toolResult:P.unknown()})),kAn=qg.extend({method:P.literal("tools/call"),params:e0.extend({name:P.string(),arguments:P.optional(P.record(P.unknown()))})}),LAn=hQ.extend({method:P.literal("notifications/tools/list_changed")}),MSt=P.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),JAn=qg.extend({method:P.literal("logging/setLevel"),params:e0.extend({level:MSt})}),xAn=hQ.extend({method:P.literal("notifications/message"),params:Xce.extend({level:MSt,logger:P.optional(P.string()),data:P.unknown()})}),SAn=P.object({name:P.string().optional()}).passthrough(),BAn=P.object({hints:P.optional(P.array(SAn)),costPriority:P.optional(P.number().min(0).max(1)),speedPriority:P.optional(P.number().min(0).max(1)),intelligencePriority:P.optional(P.number().min(0).max(1))}).passthrough(),OAn=P.object({role:P.enum(["user","assistant"]),content:P.union([_Pe,DPe,zPe])}).passthrough(),TAn=qg.extend({method:P.literal("sampling/createMessage"),params:e0.extend({messages:P.array(OAn),systemPrompt:P.optional(P.string()),includeContext:P.optional(P.enum(["none","thisServer","allServers"])),temperature:P.optional(P.number()),maxTokens:P.number().int(),stopSequences:P.optional(P.array(P.string())),metadata:P.optional(P.object({}).passthrough()),modelPreferences:P.optional(BAn)})}),UAn=t0.extend({model:P.string(),stopReason:P.optional(P.enum(["endTurn","stopSequence","maxTokens"]).or(P.string())),role:P.enum(["user","assistant"]),content:P.discriminatedUnion("type",[_Pe,DPe,zPe])}),MAn=P.object({type:P.literal("boolean"),title:P.optional(P.string()),description:P.optional(P.string()),default:P.optional(P.boolean())}).passthrough(),_An=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),minLength:P.optional(P.number()),maxLength:P.optional(P.number()),format:P.optional(P.enum(["email","uri","date","date-time"]))}).passthrough(),DAn=P.object({type:P.enum(["number","integer"]),title:P.optional(P.string()),description:P.optional(P.string()),minimum:P.optional(P.number()),maximum:P.optional(P.number())}).passthrough(),zAn=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),enum:P.array(P.string()),enumNames:P.optional(P.array(P.string()))}).passthrough(),PAn=P.union([MAn,_An,DAn,zAn]),jAn=qg.extend({method:P.literal("elicitation/create"),params:e0.extend({message:P.string(),requestedSchema:P.object({type:P.literal("object"),properties:P.record(P.string(),PAn),required:P.optional(P.array(P.string()))}).passthrough()})}),KAn=t0.extend({action:P.enum(["accept","decline","cancel"]),content:P.optional(P.record(P.string(),P.unknown()))}),qAn=P.object({type:P.literal("ref/resource"),uri:P.string()}).passthrough();var $An=P.object({type:P.literal("ref/prompt"),name:P.string()}).passthrough(),eZn=qg.extend({method:P.literal("completion/complete"),params:e0.extend({ref:P.union([$An,qAn]),argument:P.object({name:P.string(),value:P.string()}).passthrough(),context:P.optional(P.object({arguments:P.optional(P.record(P.string(),P.string()))}))})}),KPe=t0.extend({completion:P.object({values:P.array(P.string()).max(100),total:P.optional(P.number().int()),hasMore:P.optional(P.boolean())}).passthrough()}),tZn=P.object({uri:P.string().startsWith("file://"),name:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),lZn=qg.extend({method:P.literal("roots/list")}),nZn=t0.extend({roots:P.array(tZn)}),rZn=hQ.extend({method:P.literal("notifications/roots/list_changed")}),Xba=P.union([yYe,bAn,eZn,JAn,QAn,VAn,AAn,ZAn,gAn,WAn,yAn,kAn,XAn]),kba=P.union([NYe,EYe,JSt,rZn]),Lba=P.union([$9,UAn,KAn,nZn]),Jba=P.union([yYe,TAn,jAn,lZn]),xba=P.union([NYe,EYe,xAn,EAn,NAn,LAn,vAn]),Sba=P.union([$9,SPe,KPe,PPe,MPe,OPe,TPe,UPe,VYe,jPe]),$E=class extends Error{constructor(e,l,n){super(`MCP error ${e}: ${l}`),this.code=e,this.data=n,this.name="McpError"}};var IZn=6e4,QYe=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(NYe,l=>{let n=this._requestHandlerAbortControllers.get(l.params.requestId);n?.abort(l.params.reason)}),this.setNotificationHandler(EYe,l=>{this._onprogress(l)}),this.setRequestHandler(yYe,l=>({}))}_setupTimeout(e,l,n,r,I=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,l),startTime:Date.now(),timeout:l,maxTotalTimeout:n,resetTimeoutOnProgress:I,onTimeout:r})}_resetTimeout(e){let l=this._timeoutInfo.get(e);if(!l)return!1;let n=Date.now()-l.startTime;if(l.maxTotalTimeout&&n>=l.maxTotalTimeout)throw this._timeoutInfo.delete(e),new $E(qE.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:l.maxTotalTimeout,totalElapsed:n});return clearTimeout(l.timeoutId),l.timeoutId=setTimeout(l.onTimeout,l.timeout),!0}_cleanupTimeout(e){let l=this._timeoutInfo.get(e);l&&(clearTimeout(l.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var l,n,r;this._transport=e;let I=(l=this.transport)===null||l===void 0?void 0:l.onclose;this._transport.onclose=()=>{I?.(),this._onclose()};let a=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=o=>{a?.(o),this._onerror(o)};let s=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(o,d)=>{s?.(o,d),kce(o)||kSt(o)?this._onresponse(o):gYe(o)?this._onrequest(o,d):fSt(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){var e;let l=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 $E(qE.ConnectionClosed,"Connection closed");for(let r of l.values())r(n)}_onerror(e){var l;(l=this.onerror)===null||l===void 0||l.call(this,e)}_onnotification(e){var l;let n=(l=this._notificationHandlers.get(e.method))!==null&&l!==void 0?l:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,l){var n,r;let I=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,a=this._transport;if(I===void 0){a?.send({jsonrpc:"2.0",id:e.id,error:{code:qE.MethodNotFound,message:"Method not found"}}).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let o={signal:s.signal,sessionId:a?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:d=>this.notification(d,{relatedRequestId:e.id}),sendRequest:(d,u,b)=>this.request(d,u,{...b,relatedRequestId:e.id}),authInfo:l?.authInfo,requestId:e.id,requestInfo:l?.requestInfo};Promise.resolve().then(()=>I(e,o)).then(d=>{if(!s.signal.aborted)return a?.send({result:d,jsonrpc:"2.0",id:e.id})},d=>{var u;if(!s.signal.aborted)return a?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(d.code)?d.code:qE.InternalError,message:(u=d.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(d=>this._onerror(new Error(`Failed to send response: ${d}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:l,...n}=e.params,r=Number(l),I=this._progressHandlers.get(r);if(!I){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(o){a(o);return}I(n)}_onresponse(e){let l=Number(e.id),n=this._responseHandlers.get(l);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(l),this._progressHandlers.delete(l),this._cleanupTimeout(l),kce(e))n(e);else{let r=new $E(e.error.code,e.error.message,e.error.data);n(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,l,n){let{relatedRequestId:r,resumptionToken:I,onresumptiontoken:a}=n??{};return new Promise((s,o)=>{var d,u,b,p,h,Z;if(!this._transport){o(new Error("Not connected"));return}((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=n?.signal)===null||u===void 0||u.throwIfAborted();let N=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:N};n?.onprogress&&(this._progressHandlers.set(N,n.onprogress),y.params={...e.params,_meta:{...((b=e.params)===null||b===void 0?void 0:b._meta)||{},progressToken:N}});let Y=J=>{var O;this._responseHandlers.delete(N),this._progressHandlers.delete(N),this._cleanupTimeout(N),(O=this._transport)===null||O===void 0||O.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:N,reason:String(J)}},{relatedRequestId:r,resumptionToken:I,onresumptiontoken:a}).catch(D=>this._onerror(new Error(`Failed to send cancellation: ${D}`))),o(J)};this._responseHandlers.set(N,J=>{var O;if(!(!((O=n?.signal)===null||O===void 0)&&O.aborted)){if(J instanceof Error)return o(J);try{let D=l.parse(J.result);s(D)}catch(D){o(D)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var J;Y((J=n?.signal)===null||J===void 0?void 0:J.reason)});let Q=(h=n?.timeout)!==null&&h!==void 0?h:IZn,H=()=>Y(new $E(qE.RequestTimeout,"Request timed out",{timeout:Q}));this._setupTimeout(N,Q,n?.maxTotalTimeout,H,(Z=n?.resetTimeoutOnProgress)!==null&&Z!==void 0?Z:!1),this._transport.send(y,{relatedRequestId:r,resumptionToken:I,onresumptiontoken:a}).catch(J=>{this._cleanupTimeout(N),o(J)})})}async notification(e,l){var n,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!l?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var o;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let d={...e,jsonrpc:"2.0"};(o=this._transport)===null||o===void 0||o.send(d,l).catch(u=>this._onerror(u))});return}let s={...e,jsonrpc:"2.0"};await this._transport.send(s,l)}setRequestHandler(e,l){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(r,I)=>Promise.resolve(l(e.parse(r),I)))}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,l){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(l(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function _St(t,e){return Object.entries(e).reduce((l,[n,r])=>(r&&typeof r=="object"?l[n]=l[n]?{...l[n],...r}:r:l[n]=r,l),{...t})}var YOt=lt(ROt(),1),i1e=class extends QYe{constructor(e,l){var n;super(l),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=l?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new YOt.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_St(this._capabilities,e)}assertCapability(e,l){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${l})`)}async connect(e,l){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:MK,capabilities:this._capabilities,clientInfo:this._clientInfo}},SPe,l);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!QSt.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 l,n,r,I,a;switch(e){case"logging/setLevel":if(!(!((l=this._serverCapabilities)===null||l===void 0)&&l.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(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.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(!(!((I=this._serverCapabilities)===null||I===void 0)&&I.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var l;switch(e){case"notifications/roots/list_changed":if(!(!((l=this._capabilities.roots)===null||l===void 0)&&l.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"},$9,e)}async complete(e,l){return this.request({method:"completion/complete",params:e},KPe,l)}async setLoggingLevel(e,l){return this.request({method:"logging/setLevel",params:{level:e}},$9,l)}async getPrompt(e,l){return this.request({method:"prompts/get",params:e},PPe,l)}async listPrompts(e,l){return this.request({method:"prompts/list",params:e},MPe,l)}async listResources(e,l){return this.request({method:"resources/list",params:e},OPe,l)}async listResourceTemplates(e,l){return this.request({method:"resources/templates/list",params:e},TPe,l)}async readResource(e,l){return this.request({method:"resources/read",params:e},UPe,l)}async subscribeResource(e,l){return this.request({method:"resources/subscribe",params:e},$9,l)}async unsubscribeResource(e,l){return this.request({method:"resources/unsubscribe",params:e},$9,l)}async callTool(e,l=VYe,n){let r=await this.request({method:"tools/call",params:e},l,n),I=this.getToolOutputValidator(e.name);if(I){if(!r.structuredContent&&!r.isError)throw new $E(qE.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!I(r.structuredContent))throw new $E(qE.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(I.errors)}`)}catch(a){throw a instanceof $E?a:new $E(qE.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return r}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let l of e)if(l.outputSchema)try{let n=this._ajv.compile(l.outputSchema);this._cachedToolOutputValidators.set(l.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,l){let n=await this.request({method:"tools/list",params:e},jPe,l);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var c1e=class{createClient(e,l){return new i1e(e,l)}};c();c();c();c();var d1e=class extends Error{constructor(e,l){super(e),this.name="ParseError",this.type=l.type,this.field=l.field,this.value=l.value,this.line=l.line}};function X6e(t){}function u1e(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=X6e,onError:l=X6e,onRetry:n=X6e,onComment:r}=t,I="",a=!0,s,o="",d="";function u(N){let y=a?N.replace(/^\xEF\xBB\xBF/,""):N,[Y,Q]=FEn(`${I}${y}`);for(let H of Y)b(H);I=Q,a=!1}function b(N){if(N===""){h();return}if(N.startsWith(":")){r&&r(N.slice(N.startsWith(": ")?2:1));return}let y=N.indexOf(":");if(y!==-1){let Y=N.slice(0,y),Q=N[y+1]===" "?2:1,H=N.slice(y+Q);p(Y,H,N);return}p(N,"",N)}function p(N,y,Y){switch(N){case"event":d=y;break;case"data":o=`${o}${y}
|
|
1960
1960
|
`;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):l(new d1e(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:Y}));break;default:l(new d1e(`Unknown field "${N.length>20?`${N.slice(0,20)}\u2026`:N}"`,{type:"unknown-field",field:N,value:y,line:Y}));break}}function h(){o.length>0&&e({id:s,event:d||void 0,data:o.endsWith(`
|
|
1961
1961
|
`)?o.slice(0,-1):o}),s=void 0,o="",d=""}function Z(N={}){I&&N.consume&&b(I),a=!0,s=void 0,o="",d="",I=""}return{feed:u,reset:Z}}function FEn(t){let e=[],l="",n=0;for(;n<t.length;){let r=t.indexOf("\r",n),I=t.indexOf(`
|
|
1962
1962
|
`,n),a=-1;if(r!==-1&&I!==-1?a=Math.min(r,I):r!==-1?a=r:I!==-1&&(a=I),a===-1){l=t.slice(n);break}else{let s=t.slice(n,a);e.push(s),n=a+1,t[n-1]==="\r"&&t[n]===`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@github/copilot",
|
|
3
3
|
"description": "GitHub Copilot CLI brings the power of Copilot coding agent directly to your terminal.",
|
|
4
|
-
"version": "0.0.343-
|
|
4
|
+
"version": "0.0.343-8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"sdk/**/*"
|
|
35
35
|
],
|
|
36
36
|
"buildMetadata": {
|
|
37
|
-
"gitCommit": "
|
|
37
|
+
"gitCommit": "283a16d"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"node-pty": "npm:@devm33/node-pty@^1.0.8",
|