alran 0.9.0 → 1.0.1
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/ALRAN_TOOLS_NOTICES.md +11 -0
- package/README.md +11 -16
- package/assets/agents/alran/skills/alran-code-product/SKILL.md +3 -3
- package/assets/agents/alran/skills/alran-code-product/references/account-models.md +19 -16
- package/chunks/{account-commands-JZ6NXTTK.js → account-commands-GW7N3MYC.js} +1 -1
- package/chunks/{anthropic-MN33DP4E.js → anthropic-63VE6MAE.js} +1 -1
- package/chunks/{application-ITGAJ4HC.js → application-WPPTE6LU.js} +1 -1
- package/chunks/{auth-command-V3RVPLZO.js → auth-command-36RMNQZW.js} +1 -1
- package/chunks/azure-openai-responses-OIP3KVKJ.js +2 -0
- package/chunks/chunk-2K5H5GA7.js +2 -0
- package/chunks/chunk-3GGKARES.js +2 -0
- package/chunks/chunk-5RIMHTEU.js +207 -0
- package/chunks/{chunk-EYK25HWR.js → chunk-5Y76VFHY.js} +1 -1
- package/chunks/{chunk-QIN5ZBE2.js → chunk-6DOVXX7W.js} +1 -1
- package/chunks/{chunk-E3GLGDGC.js → chunk-6PFI65C6.js} +1 -1
- package/chunks/{chunk-4PDIO3M6.js → chunk-6UXSIWCB.js} +1 -1
- package/chunks/{chunk-OQNU3VPS.js → chunk-C6LAAFG2.js} +2 -2
- package/chunks/{chunk-33CNY6GP.js → chunk-CUG7F2FN.js} +1 -1
- package/chunks/chunk-DFMYLGVU.js +249 -0
- package/chunks/{chunk-IIE366LR.js → chunk-G5MOGPZ3.js} +490 -485
- package/chunks/{chunk-FC4M2B7E.js → chunk-IC6A323Q.js} +1 -1
- package/chunks/{chunk-4X22UJQH.js → chunk-IN2Z5SSJ.js} +1 -1
- package/chunks/chunk-JSTSFMGK.js +70 -0
- package/chunks/{chunk-WWNUAU4P.js → chunk-LCC45PCZ.js} +1 -1
- package/chunks/{chunk-7QLAXRD2.js → chunk-MPQ6G7LH.js} +254 -254
- package/chunks/{chunk-FUERW2DW.js → chunk-MUXNNOSQ.js} +1 -1
- package/chunks/{chunk-44VPC5LA.js → chunk-NBONSNQZ.js} +1 -1
- package/chunks/chunk-NMKRNU5O.js +2 -0
- package/chunks/chunk-NVPGGFT3.js +2 -0
- package/chunks/chunk-NZXJAHTO.js +9 -0
- package/chunks/{chunk-6255CZPL.js → chunk-PCL2CVVE.js} +1 -1
- package/chunks/chunk-PXH4SBCS.js +3 -0
- package/chunks/chunk-RLJVY75P.js +28 -0
- package/chunks/{chunk-WYANV3IX.js → chunk-RLND4AYL.js} +1 -1
- package/chunks/chunk-TJC4LPRQ.js +2 -0
- package/chunks/chunk-U4PFHJ7Z.js +27 -0
- package/chunks/chunk-V2SB4U4D.js +2 -0
- package/chunks/chunk-VGKKKM2W.js +6 -0
- package/chunks/{chunk-XFCC2CI2.js → chunk-VUISZDXX.js} +1 -1
- package/chunks/chunk-XVGPB7TW.js +21 -0
- package/chunks/{chunk-CJM7ZJ6W.js → chunk-ZDI22NOK.js} +1 -1
- package/chunks/{data-dir-LDVKDCJ2.js → data-dir-OEPRRIOO.js} +1 -1
- package/chunks/{dist-2BRD4JFU.js → dist-VKYZJYR6.js} +1 -1
- package/chunks/{dist-EXKHRFQO.js → dist-WGTMUM3E.js} +1 -1
- package/chunks/{ffi-OUPK6AY6.js → ffi-EFLUAAVX.js} +1 -1
- package/chunks/{ffi-M5UP5J6C.js → ffi-QKKA5HYI.js} +1 -1
- package/chunks/{google-UJAPMFAB.js → google-RCR46TTQ.js} +1 -1
- package/chunks/{google-vertex-VLSF55PW.js → google-vertex-Y26T7YYR.js} +1 -1
- package/chunks/{install-source-JTIUC4G4.js → install-source-63OVVBMK.js} +1 -1
- package/chunks/launcher-2UG3JPYF.js +63 -0
- package/chunks/lifecycle-5IPJRP2V.js +2 -0
- package/chunks/{main-TQGGRHTS.js → main-7SGOQBHZ.js} +2 -2
- package/chunks/{mistral-ZJZUEF2X.js → mistral-NEBDKUEI.js} +1 -1
- package/chunks/{module-6F3E5H7Y-BN7QWGYB.js → module-6F3E5H7Y-FIMLNSCK.js} +1 -1
- package/chunks/{module-asyncify-R6PWJ6ZV-P4FWSBAY.js → module-asyncify-R6PWJ6ZV-Q2HJ3NOC.js} +1 -1
- package/chunks/{multipart-parser-L6M455MS.js → multipart-parser-JVSLI2CL.js} +1 -1
- package/chunks/{network-proxy-U72JCK2I.js → network-proxy-AJO7ZW3O.js} +1 -1
- package/chunks/openai-codex-responses-L2CIGCKO.js +2 -0
- package/chunks/openai-completions-C4PHW6MD.js +2 -0
- package/chunks/openai-responses-5NVFOW4Y.js +2 -0
- package/chunks/{openrouter-G2EHY5BD.js → openrouter-BKUGQT7Z.js} +1 -1
- package/chunks/{otel-OHXIZ666.js → otel-DRJM2PIX.js} +1 -1
- package/chunks/plugin-command-CIDTOPNB.js +2 -0
- package/chunks/provider-command-UZ7KQFAC.js +2 -0
- package/chunks/run-acp-command-AKDLHKMR.js +59 -0
- package/chunks/{run-exec-command-5ADSQR2Z.js → run-exec-command-UXTPS7LC.js} +1 -1
- package/chunks/{skills-command-XXXEZAG6.js → skills-command-57TF53NO.js} +1 -1
- package/chunks/src-5PSNGHHD.js +2 -0
- package/chunks/{src-IBHIRTD7.js → src-YZ26EVSY.js} +1 -1
- package/chunks/telemetry-3NXMCOVD.js +2 -0
- package/chunks/{telemetry-command-COQG2AKK.js → telemetry-command-CMDERYNN.js} +1 -1
- package/chunks/{tools-WDBB2JKV.js → tools-CRJR35HS.js} +1 -1
- package/chunks/{undici-TUGHZJSA.js → undici-O4OQVZ6I.js} +1 -1
- package/chunks/{update-NB6OD572.js → update-ACFAGV6F.js} +1 -1
- package/cli.js +2 -3
- package/embedded/alran-tools/cli.mjs +1 -5
- package/embedded/alran-tools/manifest.json +1 -1
- package/image-preview-worker.js +1 -1
- package/matrix-mcp-stdio.js +1 -1
- package/package.json +1 -1
- package/quickjs-worker.js +1 -1
- package/chunks/azure-openai-responses-OWHMUNKC.js +0 -2
- package/chunks/chunk-C3CMJAAV.js +0 -3
- package/chunks/chunk-ENHOPPS7.js +0 -16
- package/chunks/chunk-FSNYOJPJ.js +0 -2
- package/chunks/chunk-FXOH6TEQ.js +0 -21
- package/chunks/chunk-GRXX6I72.js +0 -2
- package/chunks/chunk-GSYHBK5Q.js +0 -6
- package/chunks/chunk-IWK7PZP7.js +0 -207
- package/chunks/chunk-KCLRJQ53.js +0 -59
- package/chunks/chunk-M7GW4VMR.js +0 -27
- package/chunks/chunk-QFUV5PX6.js +0 -2
- package/chunks/chunk-TW23QKAD.js +0 -3
- package/chunks/chunk-U7U3DJHF.js +0 -2
- package/chunks/chunk-WTAJMYF2.js +0 -249
- package/chunks/chunk-YLQXZBEL.js +0 -2
- package/chunks/chunk-Z6BHCXKT.js +0 -25
- package/chunks/chunk-Z6HBNJCA.js +0 -8
- package/chunks/launcher-FCZ3EDBF.js +0 -61
- package/chunks/lifecycle-GY435YMF.js +0 -2
- package/chunks/openai-codex-responses-FPCDNRL5.js +0 -2
- package/chunks/openai-completions-D32YW6KL.js +0 -2
- package/chunks/openai-responses-ZCGSENM4.js +0 -2
- package/chunks/plugin-command-OSAFHS7C.js +0 -2
- package/chunks/provider-command-SKTCHD4E.js +0 -2
- package/chunks/run-acp-command-SG2BDMFJ.js +0 -2
- package/chunks/src-DNIDEMVV.js +0 -2
- package/chunks/telemetry-J7ZLGF5X.js +0 -2
- /package/chunks/{chunk-EOR6EDNR.js → chunk-2AYWJZ72.js} +0 -0
- /package/chunks/{chunk-YPV2X2RG.js → chunk-4XP5XUIZ.js} +0 -0
- /package/chunks/{chunk-NWB7LFOK.js → chunk-5DQTVSQV.js} +0 -0
- /package/chunks/{chunk-OIQ336YE.js → chunk-EJN3SE5B.js} +0 -0
- /package/chunks/{chunk-A7GMJNA2.js → chunk-K5DTFR6D.js} +0 -0
- /package/chunks/{chunk-ZQOALVGL.js → chunk-R44C5DM6.js} +0 -0
- /package/chunks/{chunk-PNXZWSWT.js → chunk-UJCAE7SG.js} +0 -0
- /package/chunks/{chunk-J3KCPYZT.js → chunk-W5ZOLW7T.js} +0 -0
- /package/chunks/{chunk-XAGZ6ZEU.js → chunk-XLVABFJC.js} +0 -0
- /package/chunks/{chunk-N5SVBCUB.js → chunk-XSEU4WQD.js} +0 -0
- /package/chunks/{chunk-CSOUJVKM.js → chunk-Z5HOCNTZ.js} +0 -0
- /package/chunks/{emscripten-module-ZS3PMSDF.js → emscripten-module-3WGSFZYF.js} +0 -0
- /package/chunks/{emscripten-module-XPTEOIWW.js → emscripten-module-74WUXTHL.js} +0 -0
- /package/chunks/{emscripten-module-WYNDFH3N.js → emscripten-module-MCN4Y3N4.js} +0 -0
- /package/chunks/{emscripten-module-RD6P2XH5.js → emscripten-module-NEAT5LGD.js} +0 -0
- /package/chunks/{ffi-ORLOPBB3.js → ffi-JIGPPPF7.js} +0 -0
- /package/chunks/{ffi-IO7WZQNG.js → ffi-RLX77WFG.js} +0 -0
- /package/chunks/{pdfjs-SHZAF7PF.js → pdfjs-2UOWBGC2.js} +0 -0
- /package/chunks/{photon_rs-C52RL4CI.js → photon_rs-MVWYTYTO.js} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createRequire as __alran_cR } from "module"; import { basename as __alran_basename, dirname as __alran_dirname, join as __alran_join } from "path"; import { fileURLToPath as __alran_fileURLToPath, pathToFileURL as __alran_pathToFileURL } from "url"; const __alran_tuiCurrentModuleDir = __alran_dirname(__alran_fileURLToPath(import.meta.url)); const __alran_tuiPackageRoot = __alran_basename(__alran_tuiCurrentModuleDir) === "chunks" ? __alran_dirname(__alran_tuiCurrentModuleDir) : __alran_tuiCurrentModuleDir; const __alran_tuiPackageEntryUrl = __alran_pathToFileURL(__alran_join(__alran_tuiPackageRoot, "cli.js")).href; const require = __alran_cR(__alran_tuiPackageEntryUrl); const __dirname = __alran_tuiPackageRoot;
|
|
2
|
+
import{f as Pd,h as Od}from"./chunk-VLXX22YO.js";import{a as N$}from"./chunk-5DQTVSQV.js";import{b as Lg,c as qg}from"./chunk-2AYWJZ72.js";import{a as C$,c as R,d as _n,e as Td,f as re,g as ne,h as oe}from"./chunk-XQK7JM66.js";var ka=R(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:true});_e.regexpCode=_e.getEsmExportName=_e.getProperty=_e.safeStringify=_e.stringify=_e.strConcat=_e.addCodeArg=_e.str=_e._=_e.nil=_e._Code=_e.Name=_e.IDENTIFIER=_e._CodeOrName=void 0;var va=class{};_e._CodeOrName=va;_e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var ti=class extends va{constructor(t){super();if(!_e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}};_e.Name=ti;var vr=class extends va{constructor(t){super();this._items=typeof t==="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>{if(n instanceof ti)r[n.str]=(r[n.str]||0)+1;return r},{})}};_e._Code=vr;_e.nil=new vr("");function BI(e,...t){const r=[e[0]];let n=0;while(n<t.length){tf(r,t[n]);r.push(e[++n])}return new vr(r)}_e._=BI;var ef=new vr("+");function GI(e,...t){const r=[$a(e[0])];let n=0;while(n<t.length){r.push(ef);tf(r,t[n]);r.push(ef,$a(e[++n]))}qA(r);return new vr(r)}_e.str=GI;function tf(e,t){if(t instanceof vr)e.push(...t._items);else if(t instanceof ti)e.push(t);else e.push(BA(t))}_e.addCodeArg=tf;function qA(e){let t=1;while(t<e.length-1){if(e[t]===ef){const r=KA(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function KA(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof ti||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof ti))return`"${e}${t.slice(1)}`;return}function ZA(e,t){return t.emptyStr()?e:e.emptyStr()?t:GI`${e}${t}`}_e.strConcat=ZA;function BA(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:$a(Array.isArray(e)?e.join(","):e)}function GA(e){return new vr($a(e))}_e.stringify=GA;function $a(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}_e.safeStringify=$a;function VA(e){return typeof e=="string"&&_e.IDENTIFIER.test(e)?new vr(`.${e}`):BI`[${e}]`}_e.getProperty=VA;function HA(e){if(typeof e=="string"&&_e.IDENTIFIER.test(e)){return new vr(`${e}`)}throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}_e.getEsmExportName=HA;function WA(e){return new vr(e.toString())}_e.regexpCode=WA});var of=R(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:true});Xt.ValueScope=Xt.ValueScopeName=Xt.Scope=Xt.varKinds=Xt.UsedValueState=void 0;var Jt=ka();var rf=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`);this.value=t.value}};var Eu;(function(e){e[e["Started"]=0]="Started";e[e["Completed"]=1]="Completed"})(Eu||(Xt.UsedValueState=Eu={}));Xt.varKinds={const:new Jt.Name("const"),let:new Jt.Name("let"),var:new Jt.Name("var")};var zu=class{constructor({prefixes:t,parent:r}={}){this._names={};this._prefixes=t;this._parent=r}toName(t){return t instanceof Jt.Name?t:this.name(t)}name(t){return new Jt.Name(this._newName(t))}_newName(t){const r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0?void 0:n.has(t))||this._prefixes&&!this._prefixes.has(t)){throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`)}return this._names[t]={prefix:t,index:0}}};Xt.Scope=zu;var Cu=class extends Jt.Name{constructor(t,r){super(r);this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t;this.scopePath=(0,Jt._)`.${new Jt.Name(r)}[${n}]`}};Xt.ValueScopeName=Cu;var JA=(0,Jt._)`\n`;var nf=class extends zu{constructor(t){super(t);this._values={};this._scope=t.scope;this.opts={...t,_n:t.lines?JA:Jt.nil}}get(){return this._scope}name(t){return new Cu(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const o=this.toName(t);const{prefix:i}=o;const s=(n=r.key)!==null&&n!==void 0?n:r.ref;let a=this._values[i];if(a){const u=a.get(s);if(u)return u}else{a=this._values[i]=new Map}a.set(s,o);const c=this._scope[i]||(this._scope[i]=[]);const l=c.length;c[l]=r.ref;o.setValue(r,{property:i,itemIndex:l});return o}getValue(t,r){const n=this._values[t];if(!n)return;return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Jt._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=Jt.nil;for(const s in t){const a=t[s];if(!a)continue;const c=n[s]=n[s]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Eu.Started);let u=r(l);if(u){const d=this.opts.es5?Xt.varKinds.var:Xt.varKinds.const;i=(0,Jt._)`${i}${d} ${l} = ${u};${this.opts._n}`}else if(u=o===null||o===void 0?void 0:o(l)){i=(0,Jt._)`${i}${u}${this.opts._n}`}else{throw new rf(l)}c.set(l,Eu.Completed)})}return i}};Xt.ValueScope=nf});var G=R(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:true});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var le=ka();var Zr=of();var uo=ka();Object.defineProperty(V,"_",{enumerable:true,get:function(){return uo._}});Object.defineProperty(V,"str",{enumerable:true,get:function(){return uo.str}});Object.defineProperty(V,"strConcat",{enumerable:true,get:function(){return uo.strConcat}});Object.defineProperty(V,"nil",{enumerable:true,get:function(){return uo.nil}});Object.defineProperty(V,"getProperty",{enumerable:true,get:function(){return uo.getProperty}});Object.defineProperty(V,"stringify",{enumerable:true,get:function(){return uo.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:true,get:function(){return uo.regexpCode}});Object.defineProperty(V,"Name",{enumerable:true,get:function(){return uo.Name}});var Du=of();Object.defineProperty(V,"Scope",{enumerable:true,get:function(){return Du.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:true,get:function(){return Du.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:true,get:function(){return Du.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:true,get:function(){return Du.varKinds}});V.operators={GT:new le._Code(">"),GTE:new le._Code(">="),LT:new le._Code("<"),LTE:new le._Code("<="),EQ:new le._Code("==="),NEQ:new le._Code("!=="),NOT:new le._Code("!"),OR:new le._Code("||"),AND:new le._Code("&&"),ADD:new le._Code("+")};var Fn=class{optimizeNodes(){return this}optimizeNames(t,r){return this}};var sf=class extends Fn{constructor(t,r,n){super();this.varKind=t;this.name=r;this.rhs=n}render({es5:t,_n:r}){const n=t?Zr.varKinds.var:this.varKind;const o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(!t[this.name.str])return;if(this.rhs)this.rhs=ls(this.rhs,t,r);return this}get names(){return this.rhs instanceof le._CodeOrName?this.rhs.names:{}}};var Nu=class extends Fn{constructor(t,r,n){super();this.lhs=t;this.rhs=r;this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(this.lhs instanceof le.Name&&!t[this.lhs.str]&&!this.sideEffects)return;this.rhs=ls(this.rhs,t,r);return this}get names(){const t=this.lhs instanceof le.Name?{}:{...this.lhs.names};return ju(t,this.rhs)}};var af=class extends Nu{constructor(t,r,n,o){super(t,n,o);this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}};var cf=class extends Fn{constructor(t){super();this.label=t;this.names={}}render({_n:t}){return`${this.label}:`+t}};var uf=class extends Fn{constructor(t){super();this.label=t;this.names={}}render({_n:t}){const r=this.label?` ${this.label}`:"";return`break${r};`+t}};var lf=class extends Fn{constructor(t){super();this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}};var df=class extends Fn{constructor(t){super();this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){this.code=ls(this.code,t,r);return this}get names(){return this.code instanceof le._CodeOrName?this.code.names:{}}};var Ra=class extends Fn{constructor(t=[]){super();this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){const{nodes:t}=this;let r=t.length;while(r--){const n=t[r].optimizeNodes();if(Array.isArray(n))t.splice(r,1,...n);else if(n)t[r]=n;else t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){const{nodes:n}=this;let o=n.length;while(o--){const i=n[o];if(i.optimizeNames(t,r))continue;XA(t,i.names);n.splice(o,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>oi(t,r.names),{})}};var jn=class extends Ra{render(t){return"{"+t._n+super.render(t)+"}"+t._n}};var pf=class extends Ra{};var us=class extends jn{};us.kind="else";var ri=class e extends jn{constructor(t,r){super(r);this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);if(this.else)r+="else "+this.else.render(t);return r}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(t===true)return this.nodes;let r=this.else;if(r){const n=r.optimizeNodes();r=this.else=Array.isArray(n)?new us(n):n}if(r){if(t===false)return r instanceof e?r:r.nodes;if(this.nodes.length)return this;return new e(VI(t),r instanceof e?[r]:r.nodes)}if(t===false||!this.nodes.length)return void 0;return this}optimizeNames(t,r){var n;this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r);if(!(super.optimizeNames(t,r)||this.else))return;this.condition=ls(this.condition,t,r);return this}get names(){const t=super.names;ju(t,this.condition);if(this.else)oi(t,this.else.names);return t}};ri.kind="if";var ni=class extends jn{};ni.kind="for";var ff=class extends ni{constructor(t){super();this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(!super.optimizeNames(t,r))return;this.iteration=ls(this.iteration,t,r);return this}get names(){return oi(super.names,this.iteration.names)}};var mf=class extends ni{constructor(t,r,n,o){super();this.varKind=t;this.name=r;this.from=n;this.to=o}render(t){const r=t.es5?Zr.varKinds.var:this.varKind;const{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){const t=ju(super.names,this.from);return ju(t,this.to)}};var Fu=class extends ni{constructor(t,r,n,o){super();this.loop=t;this.varKind=r;this.name=n;this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(!super.optimizeNames(t,r))return;this.iterable=ls(this.iterable,t,r);return this}get names(){return oi(super.names,this.iterable.names)}};var Ma=class extends jn{constructor(t,r,n){super();this.name=t;this.args=r;this.async=n}render(t){const r=this.async?"async ":"";return`${r}function ${this.name}(${this.args})`+super.render(t)}};Ma.kind="func";var Aa=class extends Ra{render(t){return"return "+super.render(t)}};Aa.kind="return";var hf=class extends jn{render(t){let r="try"+super.render(t);if(this.catch)r+=this.catch.render(t);if(this.finally)r+=this.finally.render(t);return r}optimizeNodes(){var t,r;super.optimizeNodes();(t=this.catch)===null||t===void 0?void 0:t.optimizeNodes();(r=this.finally)===null||r===void 0?void 0:r.optimizeNodes();return this}optimizeNames(t,r){var n,o;super.optimizeNames(t,r);(n=this.catch)===null||n===void 0?void 0:n.optimizeNames(t,r);(o=this.finally)===null||o===void 0?void 0:o.optimizeNames(t,r);return this}get names(){const t=super.names;if(this.catch)oi(t,this.catch.names);if(this.finally)oi(t,this.finally.names);return t}};var Ea=class extends jn{constructor(t){super();this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ea.kind="catch";var za=class extends jn{render(t){return"finally"+super.render(t)}};za.kind="finally";var gf=class{constructor(t,r={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...r,_n:r.lines?"\n":""};this._extScope=t;this._scope=new Zr.Scope({parent:t});this._nodes=[new pf]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){const n=this._extScope.value(t,r);const o=this._values[n.prefix]||(this._values[n.prefix]=new Set);o.add(n);return n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){const i=this._scope.toName(r);if(n!==void 0&&o)this._constants[i.str]=n;this._leafNode(new sf(t,i,n));return i}const(t,r,n){return this._def(Zr.varKinds.const,t,r,n)}let(t,r,n){return this._def(Zr.varKinds.let,t,r,n)}var(t,r,n){return this._def(Zr.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Nu(t,r,n))}add(t,r){return this._leafNode(new af(t,V.operators.ADD,r))}code(t){if(typeof t=="function")t();else if(t!==le.nil)this._leafNode(new df(t));return this}object(...t){const r=["{"];for(const[n,o]of t){if(r.length>1)r.push(",");r.push(n);if(n!==o||this.opts.es5){r.push(":");(0,le.addCodeArg)(r,o)}}r.push("}");return new le._Code(r)}if(t,r,n){this._blockNode(new ri(t));if(r&&n){this.code(r).else().code(n).endIf()}else if(r){this.code(r).endIf()}else if(n){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(t){return this._elseNode(new ri(t))}else(){return this._elseNode(new us)}endIf(){return this._endBlockNode(ri,us)}_for(t,r){this._blockNode(t);if(r)this.code(r).endFor();return this}for(t,r){return this._for(new ff(t),r)}forRange(t,r,n,o,i=this.opts.es5?Zr.varKinds.var:Zr.varKinds.let){const s=this._scope.toName(t);return this._for(new mf(i,s,r,n),()=>o(s))}forOf(t,r,n,o=Zr.varKinds.const){const i=this._scope.toName(t);if(this.opts.es5){const s=r instanceof le.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,le._)`${s}.length`,a=>{this.var(i,(0,le._)`${s}[${a}]`);n(i)})}return this._for(new Fu("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?Zr.varKinds.var:Zr.varKinds.const){if(this.opts.ownProperties){return this.forOf(t,(0,le._)`Object.keys(${r})`,n)}const i=this._scope.toName(t);return this._for(new Fu("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(ni)}label(t){return this._leafNode(new cf(t))}break(t){return this._leafNode(new uf(t))}return(t){const r=new Aa;this._blockNode(r);this.code(t);if(r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Aa)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const o=new hf;this._blockNode(o);this.code(t);if(r){const i=this.name("e");this._currNode=o.catch=new Ea(i);r(i)}if(n){this._currNode=o.finally=new za;this.code(n)}return this._endBlockNode(Ea,za)}throw(t){return this._leafNode(new lf(t))}block(t,r){this._blockStarts.push(this._nodes.length);if(t)this.code(t).endBlock(r);return this}endBlock(t){const r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");const n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t){throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`)}this._nodes.length=r;return this}func(t,r=le.nil,n,o){this._blockNode(new Ma(t,r,n));if(o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(Ma)}optimize(t=1){while(t-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(t){this._currNode.nodes.push(t);return this}_blockNode(t){this._currNode.nodes.push(t);this._nodes.push(t)}_endBlockNode(t,r){const n=this._currNode;if(n instanceof t||r&&n instanceof r){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){const r=this._currNode;if(!(r instanceof ri)){throw new Error('CodeGen: "else" without "if"')}this._currNode=r.else=t;return this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const r=this._nodes;r[r.length-1]=t}};V.CodeGen=gf;function oi(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ju(e,t){return t instanceof le._CodeOrName?oi(e,t.names):e}function ls(e,t,r){if(e instanceof le.Name)return n(e);if(!o(e))return e;return new le._Code(e._items.reduce((i,s)=>{if(s instanceof le.Name)s=n(s);if(s instanceof le._Code)i.push(...s._items);else i.push(s);return i},[]));function n(i){const s=r[i.str];if(s===void 0||t[i.str]!==1)return i;delete t[i.str];return s}function o(i){return i instanceof le._Code&&i._items.some(s=>s instanceof le.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function XA(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function VI(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,le._)`!${yf(e)}`}V.not=VI;var YA=HI(V.operators.AND);function QA(...e){return e.reduce(YA)}V.and=QA;var eE=HI(V.operators.OR);function tE(...e){return e.reduce(eE)}V.or=tE;function HI(e){return(t,r)=>t===le.nil?r:r===le.nil?t:(0,le._)`${yf(t)} ${e} ${yf(r)}`}function yf(e){return e instanceof le.Name?e:(0,le._)`(${e})`}});var pe=R(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:true});W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;var Me=G();var rE=ka();function nE(e){const t={};for(const r of e)t[r]=true;return t}W.toHash=nE;function oE(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return true;XI(e,t);return!YI(t,e.self.RULES.all)}W.alwaysValidSchema=oE;function XI(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;const o=n.RULES.keywords;for(const i in t){if(!o[i])tw(e,`unknown keyword: "${i}"`)}}W.checkUnknownRules=XI;function YI(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return true;return false}W.schemaHasRules=YI;function iE(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return true;return false}W.schemaHasRulesButRef=iE;function sE({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Me._)`${r}`}return(0,Me._)`${e}${t}${(0,Me.getProperty)(n)}`}W.schemaRefOrVal=sE;function aE(e){return QI(decodeURIComponent(e))}W.unescapeFragment=aE;function cE(e){return encodeURIComponent(xf(e))}W.escapeFragment=cE;function xf(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=xf;function QI(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=QI;function uE(e,t){if(Array.isArray(e)){for(const r of e)t(r)}else{t(e)}}W.eachItem=uE;function WI({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{const c=s===void 0?i:s instanceof Me.Name?(i instanceof Me.Name?e(o,i,s):t(o,i,s),s):i instanceof Me.Name?(t(o,s,i),i):r(i,s);return a===Me.Name&&!(c instanceof Me.Name)?n(o,c):c}}W.mergeEvaluated={props:WI({mergeNames:(e,t,r)=>e.if((0,Me._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Me._)`${t} === true`,()=>e.assign(r,true),()=>e.assign(r,(0,Me._)`${r} || {}`).code((0,Me._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Me._)`${r} !== true`,()=>{if(t===true){e.assign(r,true)}else{e.assign(r,(0,Me._)`${r} || {}`);bf(e,r,t)}}),mergeValues:(e,t)=>e===true?true:{...e,...t},resultToName:ew}),items:WI({mergeNames:(e,t,r)=>e.if((0,Me._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Me._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Me._)`${r} !== true`,()=>e.assign(r,t===true?true:(0,Me._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===true?true:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function ew(e,t){if(t===true)return e.var("props",true);const r=e.var("props",(0,Me._)`{}`);if(t!==void 0)bf(e,r,t);return r}W.evaluatedPropsToName=ew;function bf(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Me._)`${t}${(0,Me.getProperty)(n)}`,true))}W.setEvaluated=bf;var JI={};function lE(e,t){return e.scopeValue("func",{ref:t,code:JI[t.code]||(JI[t.code]=new rE._Code(t.code))})}W.useFunc=lE;var _f;(function(e){e[e["Num"]=0]="Num";e[e["Str"]=1]="Str"})(_f||(W.Type=_f={}));function dE(e,t,r){if(e instanceof Me.Name){const n=t===_f.Num;return r?n?(0,Me._)`"[" + ${e} + "]"`:(0,Me._)`"['" + ${e} + "']"`:n?(0,Me._)`"/" + ${e}`:(0,Me._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Me.getProperty)(e).toString():"/"+xf(e)}W.getErrorPath=dE;function tw(e,t,r=e.opts.strictSchema){if(!r)return;t=`strict mode: ${t}`;if(r===true)throw new Error(t);e.self.logger.warn(t)}W.checkStrictMode=tw});var Dn=R(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:true});var Rt=G();var pE={data:new Rt.Name("data"),valCxt:new Rt.Name("valCxt"),instancePath:new Rt.Name("instancePath"),parentData:new Rt.Name("parentData"),parentDataProperty:new Rt.Name("parentDataProperty"),rootData:new Rt.Name("rootData"),dynamicAnchors:new Rt.Name("dynamicAnchors"),vErrors:new Rt.Name("vErrors"),errors:new Rt.Name("errors"),this:new Rt.Name("this"),self:new Rt.Name("self"),scope:new Rt.Name("scope"),json:new Rt.Name("json"),jsonPos:new Rt.Name("jsonPos"),jsonLen:new Rt.Name("jsonLen"),jsonPart:new Rt.Name("jsonPart")};If.default=pE});var Ca=R(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:true});Mt.extendErrors=Mt.resetErrorsCount=Mt.reportExtraError=Mt.reportError=Mt.keyword$DataError=Mt.keywordError=void 0;var fe=G();var Uu=pe();var Lt=Dn();Mt.keywordError={message:({keyword:e})=>(0,fe.str)`must pass "${e}" keyword validation`};Mt.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,fe.str)`"${e}" keyword must be ${t} ($data)`:(0,fe.str)`"${e}" keyword is invalid ($data)`};function fE(e,t=Mt.keywordError,r,n){const{it:o}=e;const{gen:i,compositeRule:s,allErrors:a}=o;const c=ow(e,t,r);if(n!==null&&n!==void 0?n:s||a){rw(i,c)}else{nw(o,(0,fe._)`[${c}]`)}}Mt.reportError=fE;function mE(e,t=Mt.keywordError,r){const{it:n}=e;const{gen:o,compositeRule:i,allErrors:s}=n;const a=ow(e,t,r);rw(o,a);if(!(i||s)){nw(n,Lt.default.vErrors)}}Mt.reportExtraError=mE;function hE(e,t){e.assign(Lt.default.errors,t);e.if((0,fe._)`${Lt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,fe._)`${Lt.default.vErrors}.length`,t),()=>e.assign(Lt.default.vErrors,null)))}Mt.resetErrorsCount=hE;function gE({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");const s=e.name("err");e.forRange("i",o,Lt.default.errors,a=>{e.const(s,(0,fe._)`${Lt.default.vErrors}[${a}]`);e.if((0,fe._)`${s}.instancePath === undefined`,()=>e.assign((0,fe._)`${s}.instancePath`,(0,fe.strConcat)(Lt.default.instancePath,i.errorPath)));e.assign((0,fe._)`${s}.schemaPath`,(0,fe.str)`${i.errSchemaPath}/${t}`);if(i.opts.verbose){e.assign((0,fe._)`${s}.schema`,r);e.assign((0,fe._)`${s}.data`,n)}})}Mt.extendErrors=gE;function rw(e,t){const r=e.const("err",t);e.if((0,fe._)`${Lt.default.vErrors} === null`,()=>e.assign(Lt.default.vErrors,(0,fe._)`[${r}]`),(0,fe._)`${Lt.default.vErrors}.push(${r})`);e.code((0,fe._)`${Lt.default.errors}++`)}function nw(e,t){const{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async){r.throw((0,fe._)`new ${e.ValidationError}(${t})`)}else{r.assign((0,fe._)`${n}.errors`,t);r.return(false)}}var ii={keyword:new fe.Name("keyword"),schemaPath:new fe.Name("schemaPath"),params:new fe.Name("params"),propertyName:new fe.Name("propertyName"),message:new fe.Name("message"),schema:new fe.Name("schema"),parentSchema:new fe.Name("parentSchema")};function ow(e,t,r){const{createErrors:n}=e.it;if(n===false)return(0,fe._)`{}`;return yE(e,t,r)}function yE(e,t,r={}){const{gen:n,it:o}=e;const i=[_E(o,r),xE(e,r)];bE(e,t,i);return n.object(...i)}function _E({errorPath:e},{instancePath:t}){const r=t?(0,fe.str)`${e}${(0,Uu.getErrorPath)(t,Uu.Type.Str)}`:e;return[Lt.default.instancePath,(0,fe.strConcat)(Lt.default.instancePath,r)]}function xE({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,fe.str)`${t}/${e}`;if(r){o=(0,fe.str)`${o}${(0,Uu.getErrorPath)(r,Uu.Type.Str)}`}return[ii.schemaPath,o]}function bE(e,{params:t,message:r},n){const{keyword:o,data:i,schemaValue:s,it:a}=e;const{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([ii.keyword,o],[ii.params,typeof t=="function"?t(e):t||(0,fe._)`{}`]);if(c.messages){n.push([ii.message,typeof r=="function"?r(e):r])}if(c.verbose){n.push([ii.schema,s],[ii.parentSchema,(0,fe._)`${u}${d}`],[Lt.default.data,i])}if(l)n.push([ii.propertyName,l])}});var sw=R(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:true});ds.boolOrEmptySchema=ds.topBoolOrEmptySchema=void 0;var IE=Ca();var wE=G();var SE=Dn();var TE={message:"boolean schema is false"};function PE(e){const{gen:t,schema:r,validateName:n}=e;if(r===false){iw(e,false)}else if(typeof r=="object"&&r.$async===true){t.return(SE.default.data)}else{t.assign((0,wE._)`${n}.errors`,null);t.return(true)}}ds.topBoolOrEmptySchema=PE;function OE(e,t){const{gen:r,schema:n}=e;if(n===false){r.var(t,false);iw(e)}else{r.var(t,true)}}ds.boolOrEmptySchema=OE;function iw(e,t){const{gen:r,data:n}=e;const o={gen:r,keyword:"false schema",data:n,schema:false,schemaCode:false,schemaValue:false,params:{},it:e};(0,IE.reportError)(o,TE,void 0,t)}});var wf=R(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:true});ps.getRules=ps.isJSONType=void 0;var vE=["string","number","integer","boolean","null","object","array"];var $E=new Set(vE);function kE(e){return typeof e=="string"&&$E.has(e)}ps.isJSONType=kE;function RE(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:true,boolean:true,null:true},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ps.getRules=RE});var Sf=R(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:true});lo.shouldUseRule=lo.shouldUseGroup=lo.schemaHasRulesForType=void 0;function ME({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==true&&aw(e,n)}lo.schemaHasRulesForType=ME;function aw(e,t){return t.rules.some(r=>cw(e,r))}lo.shouldUseGroup=aw;function cw(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}lo.shouldUseRule=cw});var Na=R(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:true});At.reportTypeError=At.checkDataTypes=At.checkDataType=At.coerceAndCheckDataType=At.getJSONTypes=At.getSchemaTypes=At.DataType=void 0;var AE=wf();var EE=Sf();var zE=Ca();var Z=G();var uw=pe();var fs;(function(e){e[e["Correct"]=0]="Correct";e[e["Wrong"]=1]="Wrong"})(fs||(At.DataType=fs={}));function CE(e){const t=lw(e.type);const r=t.includes("null");if(r){if(e.nullable===false)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0){throw new Error('"nullable" cannot be used without "type"')}if(e.nullable===true)t.push("null")}return t}At.getSchemaTypes=CE;function lw(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(AE.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}At.getJSONTypes=lw;function NE(e,t){const{gen:r,data:n,opts:o}=e;const i=FE(t,o.coerceTypes);const s=t.length>0&&!(i.length===0&&t.length===1&&(0,EE.schemaHasRulesForType)(e,t[0]));if(s){const a=Pf(t,n,o.strictNumbers,fs.Wrong);r.if(a,()=>{if(i.length)jE(e,t,i);else Of(e)})}return s}At.coerceAndCheckDataType=NE;var dw=new Set(["string","number","integer","boolean","null"]);function FE(e,t){return t?e.filter(r=>dw.has(r)||t==="array"&&r==="array"):[]}function jE(e,t,r){const{gen:n,data:o,opts:i}=e;const s=n.let("dataType",(0,Z._)`typeof ${o}`);const a=n.let("coerced",(0,Z._)`undefined`);if(i.coerceTypes==="array"){n.if((0,Z._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Z._)`${o}[0]`).assign(s,(0,Z._)`typeof ${o}`).if(Pf(t,o,i.strictNumbers),()=>n.assign(a,o)))}n.if((0,Z._)`${a} !== undefined`);for(const l of r){if(dw.has(l)||l==="array"&&i.coerceTypes==="array"){c(l)}}n.else();Of(e);n.endIf();n.if((0,Z._)`${a} !== undefined`,()=>{n.assign(o,a);DE(e,a)});function c(l){switch(l){case"string":n.elseIf((0,Z._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Z._)`"" + ${o}`).elseIf((0,Z._)`${o} === null`).assign(a,(0,Z._)`""`);return;case"number":n.elseIf((0,Z._)`${s} == "boolean" || ${o} === null
|
|
3
|
+
|| (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Z._)`+${o}`);return;case"integer":n.elseIf((0,Z._)`${s} === "boolean" || ${o} === null
|
|
4
|
+
|| (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Z._)`+${o}`);return;case"boolean":n.elseIf((0,Z._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,false).elseIf((0,Z._)`${o} === "true" || ${o} === 1`).assign(a,true);return;case"null":n.elseIf((0,Z._)`${o} === "" || ${o} === 0 || ${o} === false`);n.assign(a,null);return;case"array":n.elseIf((0,Z._)`${s} === "string" || ${s} === "number"
|
|
5
|
+
|| ${s} === "boolean" || ${o} === null`).assign(a,(0,Z._)`[${o}]`)}}}function DE({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,Z._)`${t} !== undefined`,()=>e.assign((0,Z._)`${t}[${r}]`,n))}function Tf(e,t,r,n=fs.Correct){const o=n===fs.Correct?Z.operators.EQ:Z.operators.NEQ;let i;switch(e){case"null":return(0,Z._)`${t} ${o} null`;case"array":i=(0,Z._)`Array.isArray(${t})`;break;case"object":i=(0,Z._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s((0,Z._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return(0,Z._)`typeof ${t} ${o} ${e}`}return n===fs.Correct?i:(0,Z.not)(i);function s(a=Z.nil){return(0,Z.and)((0,Z._)`typeof ${t} == "number"`,a,r?(0,Z._)`isFinite(${t})`:Z.nil)}}At.checkDataType=Tf;function Pf(e,t,r,n){if(e.length===1){return Tf(e[0],t,r,n)}let o;const i=(0,uw.toHash)(e);if(i.array&&i.object){const s=(0,Z._)`typeof ${t} != "object"`;o=i.null?s:(0,Z._)`!${t} || ${s}`;delete i.null;delete i.array;delete i.object}else{o=Z.nil}if(i.number)delete i.integer;for(const s in i)o=(0,Z.and)(o,Tf(s,t,r,n));return o}At.checkDataTypes=Pf;var UE={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Z._)`{type: ${e}}`:(0,Z._)`{type: ${t}}`};function Of(e){const t=LE(e);(0,zE.reportError)(t,UE)}At.reportTypeError=Of;function LE(e){const{gen:t,data:r,schema:n}=e;const o=(0,uw.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var fw=R(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:true});Lu.assignDefaults=void 0;var ms=G();var qE=pe();function KE(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r){for(const o in r){pw(e,o,r[o].default)}}else if(t==="array"&&Array.isArray(n)){n.forEach((o,i)=>pw(e,i,o.default))}}Lu.assignDefaults=KE;function pw(e,t,r){const{gen:n,compositeRule:o,data:i,opts:s}=e;if(r===void 0)return;const a=(0,ms._)`${i}${(0,ms.getProperty)(t)}`;if(o){(0,qE.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,ms._)`${a} === undefined`;if(s.useDefaults==="empty"){c=(0,ms._)`${c} || ${a} === null || ${a} === ""`}n.if(c,(0,ms._)`${a} = ${(0,ms.stringify)(r)}`)}});var $r=R(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:true});ke.validateUnion=ke.validateArray=ke.usePattern=ke.callValidateCode=ke.schemaProperties=ke.allSchemaProperties=ke.noPropertyInData=ke.propertyInData=ke.isOwnProperty=ke.hasPropFunc=ke.reportMissingProp=ke.checkMissingProp=ke.checkReportMissingProp=void 0;var je=G();var vf=pe();var po=Dn();var ZE=pe();function BE(e,t){const{gen:r,data:n,it:o}=e;r.if(kf(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,je._)`${t}`},true);e.error()})}ke.checkReportMissingProp=BE;function GE({gen:e,data:t,it:{opts:r}},n,o){return(0,je.or)(...n.map(i=>(0,je.and)(kf(e,t,i,r.ownProperties),(0,je._)`${o} = ${i}`)))}ke.checkMissingProp=GE;function VE(e,t){e.setParams({missingProperty:t},true);e.error()}ke.reportMissingProp=VE;function mw(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,je._)`Object.prototype.hasOwnProperty`})}ke.hasPropFunc=mw;function $f(e,t,r){return(0,je._)`${mw(e)}.call(${t}, ${r})`}ke.isOwnProperty=$f;function HE(e,t,r,n){const o=(0,je._)`${t}${(0,je.getProperty)(r)} !== undefined`;return n?(0,je._)`${o} && ${$f(e,t,r)}`:o}ke.propertyInData=HE;function kf(e,t,r,n){const o=(0,je._)`${t}${(0,je.getProperty)(r)} === undefined`;return n?(0,je.or)(o,(0,je.not)($f(e,t,r))):o}ke.noPropertyInData=kf;function hw(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ke.allSchemaProperties=hw;function WE(e,t){return hw(t).filter(r=>!(0,vf.alwaysValidSchema)(e,t[r]))}ke.schemaProperties=WE;function JE({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,l){const u=l?(0,je._)`${e}, ${t}, ${n}${o}`:t;const d=[[po.default.instancePath,(0,je.strConcat)(po.default.instancePath,i)],[po.default.parentData,s.parentData],[po.default.parentDataProperty,s.parentDataProperty],[po.default.rootData,po.default.rootData]];if(s.opts.dynamicRef)d.push([po.default.dynamicAnchors,po.default.dynamicAnchors]);const h=(0,je._)`${u}, ${r.object(...d)}`;return c!==je.nil?(0,je._)`${a}.call(${c}, ${h})`:(0,je._)`${a}(${h})`}ke.callValidateCode=JE;var XE=(0,je._)`new RegExp`;function YE({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"";const{regExp:o}=t.code;const i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,je._)`${o.code==="new RegExp"?XE:(0,ZE.useFunc)(e,o)}(${r}, ${n})`})}ke.usePattern=YE;function QE(e){const{gen:t,data:r,keyword:n,it:o}=e;const i=t.name("valid");if(o.allErrors){const a=t.let("valid",true);s(()=>t.assign(a,false));return a}t.var(i,true);s(()=>t.break());return i;function s(a){const c=t.const("len",(0,je._)`${r}.length`);t.forRange("i",0,c,l=>{e.subschema({keyword:n,dataProp:l,dataPropType:vf.Type.Num},i);t.if((0,je.not)(i),a)})}}ke.validateArray=QE;function ez(e){const{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const i=r.some(c=>(0,vf.alwaysValidSchema)(o,c));if(i&&!o.opts.unevaluated)return;const s=t.let("valid",false);const a=t.name("_valid");t.block(()=>r.forEach((c,l)=>{const u=e.subschema({keyword:n,schemaProp:l,compositeRule:true},a);t.assign(s,(0,je._)`${s} || ${a}`);const d=e.mergeValidEvaluated(u,a);if(!d)t.if((0,je.not)(s))}));e.result(s,()=>e.reset(),()=>e.error(true))}ke.validateUnion=ez});var _w=R(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:true});xn.validateKeywordUsage=xn.validSchemaType=xn.funcKeywordCode=xn.macroKeywordCode=void 0;var qt=G();var si=Dn();var tz=$r();var rz=Ca();function nz(e,t){const{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=e;const a=t.macro.call(s.self,o,i,s);const c=yw(r,n,a);if(s.opts.validateSchema!==false)s.self.validateSchema(a,true);const l=r.name("valid");e.subschema({schema:a,schemaPath:qt.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:true},l);e.pass(l,()=>e.error(true))}xn.macroKeywordCode=nz;function oz(e,t){var r;const{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=e;sz(c,t);const l=!a&&t.compile?t.compile.call(c.self,i,s,c):t.validate;const u=yw(n,o,l);const d=n.let("valid");e.block$data(d,h);e.ok((r=t.valid)!==null&&r!==void 0?r:d);function h(){if(t.errors===false){f();if(t.modifying)gw(e);g(()=>e.error())}else{const _=t.async?m():p();if(t.modifying)gw(e);g(()=>iz(e,_))}}function m(){const _=n.let("ruleErrs",null);n.try(()=>f((0,qt._)`await `),b=>n.assign(d,false).if((0,qt._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,qt._)`${b}.errors`),()=>n.throw(b)));return _}function p(){const _=(0,qt._)`${u}.errors`;n.assign(_,null);f(qt.nil);return _}function f(_=t.async?(0,qt._)`await `:qt.nil){const b=c.opts.passContext?si.default.this:si.default.self;const v=!("compile"in t&&!a||t.schema===false);n.assign(d,(0,qt._)`${_}${(0,tz.callValidateCode)(e,u,b,v)}`,t.modifying)}function g(_){var b;n.if((0,qt.not)((b=t.valid)!==null&&b!==void 0?b:d),_)}}xn.funcKeywordCode=oz;function gw(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,qt._)`${n.parentData}[${n.parentDataProperty}]`))}function iz(e,t){const{gen:r}=e;r.if((0,qt._)`Array.isArray(${t})`,()=>{r.assign(si.default.vErrors,(0,qt._)`${si.default.vErrors} === null ? ${t} : ${si.default.vErrors}.concat(${t})`).assign(si.default.errors,(0,qt._)`${si.default.vErrors}.length`);(0,rz.extendErrors)(e)},()=>e.error())}function sz({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function yw(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,qt.stringify)(r)})}function az(e,t,r=false){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e=="undefined")}xn.validSchemaType=az;function cz({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i){throw new Error("ajv implementation error")}const s=o.dependencies;if(s===null||s===void 0?void 0:s.some(a=>!Object.prototype.hasOwnProperty.call(e,a))){throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`)}if(o.validateSchema){const a=o.validateSchema(e[i]);if(!a){const c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}}xn.validateKeywordUsage=cz});var bw=R(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:true});fo.extendSubschemaMode=fo.extendSubschemaData=fo.getSubschema=void 0;var bn=G();var xw=pe();function uz(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(t!==void 0&&n!==void 0){throw new Error('both "keyword" and "schema" passed, only one allowed')}if(t!==void 0){const a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,bn._)`${e.schemaPath}${(0,bn.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,bn._)`${e.schemaPath}${(0,bn.getProperty)(t)}${(0,bn.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,xw.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0){throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"')}return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}fo.getSubschema=uz;function lz(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0){throw new Error('both "data" and "dataProp" passed, only one allowed')}const{gen:a}=t;if(r!==void 0){const{errorPath:l,dataPathArr:u,opts:d}=t;const h=a.let("data",(0,bn._)`${t.data}${(0,bn.getProperty)(r)}`,true);c(h);e.errorPath=(0,bn.str)`${l}${(0,xw.getErrorPath)(r,n,d.jsPropertySyntax)}`;e.parentDataProperty=(0,bn._)`${r}`;e.dataPathArr=[...u,e.parentDataProperty]}if(o!==void 0){const l=o instanceof bn.Name?o:a.let("data",o,true);c(l);if(s!==void 0)e.propertyName=s}if(i)e.dataTypes=i;function c(l){e.data=l;e.dataLevel=t.dataLevel+1;e.dataTypes=[];t.definedProperties=new Set;e.parentData=t.data;e.dataNames=[...t.dataNames,l]}}fo.extendSubschemaData=lz;function dz(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){if(n!==void 0)e.compositeRule=n;if(o!==void 0)e.createErrors=o;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t;e.jtdMetadata=r}fo.extendSubschemaMode=dz});var Rf=R((x5,Iw)=>{"use strict";Iw.exports=function e(t,r){if(t===r)return true;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return false;var n,o,i;if(Array.isArray(t)){n=t.length;if(n!=r.length)return false;for(o=n;o--!==0;)if(!e(t[o],r[o]))return false;return true}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();i=Object.keys(t);n=i.length;if(n!==Object.keys(r).length)return false;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return false;for(o=n;o--!==0;){var s=i[o];if(!e(t[s],r[s]))return false}return true}return t!==t&&r!==r}});var Sw=R((b5,ww)=>{"use strict";var mo=ww.exports=function(e,t,r){if(typeof t=="function"){r=t;t={}}r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){};var o=r.post||function(){};qu(t,n,o,e,"",e)};mo.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};mo.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};mo.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};mo.skipKeywords={default:true,enum:true,const:true,required:true,maximum:true,minimum:true,exclusiveMaximum:true,exclusiveMinimum:true,multipleOf:true,maxLength:true,minLength:true,pattern:true,format:true,maxItems:true,minItems:true,uniqueItems:true,maxProperties:true,minProperties:true};function qu(e,t,r,n,o,i,s,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,s,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in mo.arrayKeywords){for(var h=0;h<d.length;h++)qu(e,t,r,d[h],o+"/"+u+"/"+h,i,o,u,n,h)}}else if(u in mo.propsKeywords){if(d&&typeof d=="object"){for(var m in d)qu(e,t,r,d[m],o+"/"+u+"/"+pz(m),i,o,u,n,m)}}else if(u in mo.keywords||e.allKeys&&!(u in mo.skipKeywords)){qu(e,t,r,d,o+"/"+u,i,o,u,n)}}r(n,o,i,s,a,c,l)}}function pz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Fa=R(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:true});Yt.getSchemaRefs=Yt.resolveUrl=Yt.normalizeId=Yt._getFullPath=Yt.getFullPath=Yt.inlineRef=void 0;var fz=pe();var mz=Rf();var hz=Sw();var gz=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function yz(e,t=true){if(typeof e=="boolean")return true;if(t===true)return!Mf(e);if(!t)return false;return Tw(e)<=t}Yt.inlineRef=yz;var _z=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Mf(e){for(const t in e){if(_z.has(t))return true;const r=e[t];if(Array.isArray(r)&&r.some(Mf))return true;if(typeof r=="object"&&Mf(r))return true}return false}function Tw(e){let t=0;for(const r in e){if(r==="$ref")return Infinity;t++;if(gz.has(r))continue;if(typeof e[r]=="object"){(0,fz.eachItem)(e[r],n=>t+=Tw(n))}if(t===Infinity)return Infinity}return t}function Pw(e,t="",r){if(r!==false)t=hs(t);const n=e.parse(t);return Ow(e,n)}Yt.getFullPath=Pw;function Ow(e,t){const r=e.serialize(t);return r.split("#")[0]+"#"}Yt._getFullPath=Ow;var xz=/#\/?$/;function hs(e){return e?e.replace(xz,""):""}Yt.normalizeId=hs;function bz(e,t,r){r=hs(r);return e.resolve(t,r)}Yt.resolveUrl=bz;var Iz=/^[a-z_][-a-z0-9._]*$/i;function wz(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts;const o=hs(e[r]||t);const i={"":o};const s=Pw(n,o,false);const a={};const c=new Set;hz(e,{allKeys:true},(d,h,m,p)=>{if(p===void 0)return;const f=s+h;let g=i[p];if(typeof d[r]=="string")g=_.call(this,d[r]);b.call(this,d.$anchor);b.call(this,d.$dynamicAnchor);i[h]=g;function _(v){const A=this.opts.uriResolver.resolve;v=hs(g?A(g,v):v);if(c.has(v))throw u(v);c.add(v);let $=this.refs[v];if(typeof $=="string")$=this.refs[$];if(typeof $=="object"){l(d,$.schema,v)}else if(v!==hs(f)){if(v[0]==="#"){l(d,a[v],v);a[v]=d}else{this.refs[v]=f}}return v}function b(v){if(typeof v=="string"){if(!Iz.test(v))throw new Error(`invalid anchor "${v}"`);_.call(this,`#${v}`)}}});return a;function l(d,h,m){if(h!==void 0&&!mz(d,h))throw u(m)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Yt.getSchemaRefs=wz});var Ua=R(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:true});ho.getData=ho.KeywordCxt=ho.validateFunctionCode=void 0;var Mw=sw();var vw=Na();var Ef=Sf();var Ku=Na();var Sz=fw();var Da=_w();var Af=bw();var C=G();var L=Dn();var Tz=Fa();var Un=pe();var ja=Ca();function Pz(e){if(zw(e)){Cw(e);if(Ew(e)){$z(e);return}}Aw(e,()=>(0,Mw.topBoolOrEmptySchema)(e))}ho.validateFunctionCode=Pz;function Aw({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){if(o.code.es5){e.func(t,(0,C._)`${L.default.data}, ${L.default.valCxt}`,n.$async,()=>{e.code((0,C._)`"use strict"; ${$w(r,o)}`);vz(e,o);e.code(i)})}else{e.func(t,(0,C._)`${L.default.data}, ${Oz(o)}`,n.$async,()=>e.code($w(r,o)).code(i))}}function Oz(e){return(0,C._)`{${L.default.instancePath}="", ${L.default.parentData}, ${L.default.parentDataProperty}, ${L.default.rootData}=${L.default.data}${e.dynamicRef?(0,C._)`, ${L.default.dynamicAnchors}={}`:C.nil}}={}`}function vz(e,t){e.if(L.default.valCxt,()=>{e.var(L.default.instancePath,(0,C._)`${L.default.valCxt}.${L.default.instancePath}`);e.var(L.default.parentData,(0,C._)`${L.default.valCxt}.${L.default.parentData}`);e.var(L.default.parentDataProperty,(0,C._)`${L.default.valCxt}.${L.default.parentDataProperty}`);e.var(L.default.rootData,(0,C._)`${L.default.valCxt}.${L.default.rootData}`);if(t.dynamicRef)e.var(L.default.dynamicAnchors,(0,C._)`${L.default.valCxt}.${L.default.dynamicAnchors}`)},()=>{e.var(L.default.instancePath,(0,C._)`""`);e.var(L.default.parentData,(0,C._)`undefined`);e.var(L.default.parentDataProperty,(0,C._)`undefined`);e.var(L.default.rootData,L.default.data);if(t.dynamicRef)e.var(L.default.dynamicAnchors,(0,C._)`{}`)})}function $z(e){const{schema:t,opts:r,gen:n}=e;Aw(e,()=>{if(r.$comment&&t.$comment)Fw(e);Ez(e);n.let(L.default.vErrors,null);n.let(L.default.errors,0);if(r.unevaluated)kz(e);Nw(e);Nz(e)});return}function kz(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,C._)`${r}.evaluated`);t.if((0,C._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,C._)`${e.evaluated}.props`,(0,C._)`undefined`));t.if((0,C._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,C._)`${e.evaluated}.items`,(0,C._)`undefined`))}function $w(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,C._)`/*# sourceURL=${r} */`:C.nil}function Rz(e,t){if(zw(e)){Cw(e);if(Ew(e)){Mz(e,t);return}}(0,Mw.boolOrEmptySchema)(e,t)}function Ew({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return true;return false}function zw(e){return typeof e.schema!="boolean"}function Mz(e,t){const{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)Fw(e);zz(e);Cz(e);const i=n.const("_errs",L.default.errors);Nw(e,i);n.var(t,(0,C._)`${i} === ${L.default.errors}`)}function Cw(e){(0,Un.checkUnknownRules)(e);Az(e)}function Nw(e,t){if(e.opts.jtd)return kw(e,[],false,t);const r=(0,vw.getSchemaTypes)(e.schema);const n=(0,vw.coerceAndCheckDataType)(e,r);kw(e,r,!n,t)}function Az(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&(0,Un.schemaHasRulesButRef)(t,o.RULES)){o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}}function Ez(e){const{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema){(0,Un.checkStrictMode)(e,"default is ignored in the schema root")}}function zz(e){const t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,Tz.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function Cz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Fw({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const i=r.$comment;if(o.$comment===true){e.code((0,C._)`${L.default.self}.logger.log(${i})`)}else if(typeof o.$comment=="function"){const s=(0,C.str)`${n}/$comment`;const a=e.scopeValue("root",{ref:t.root});e.code((0,C._)`${L.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function Nz(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;if(r.$async){t.if((0,C._)`${L.default.errors} === 0`,()=>t.return(L.default.data),()=>t.throw((0,C._)`new ${o}(${L.default.vErrors})`))}else{t.assign((0,C._)`${n}.errors`,L.default.vErrors);if(i.unevaluated)Fz(e);t.return((0,C._)`${L.default.errors} === 0`)}}function Fz({gen:e,evaluated:t,props:r,items:n}){if(r instanceof C.Name)e.assign((0,C._)`${t}.props`,r);if(n instanceof C.Name)e.assign((0,C._)`${t}.items`,n)}function kw(e,t,r,n){const{gen:o,schema:i,data:s,allErrors:a,opts:c,self:l}=e;const{RULES:u}=l;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Un.schemaHasRulesButRef)(i,u))){o.block(()=>Dw(e,"$ref",u.all.$ref.definition));return}if(!c.jtd)jz(e,t);o.block(()=>{for(const h of u.rules)d(h);d(u.post)});function d(h){if(!(0,Ef.shouldUseGroup)(i,h))return;if(h.type){o.if((0,Ku.checkDataType)(h.type,s,c.strictNumbers));Rw(e,h);if(t.length===1&&t[0]===h.type&&r){o.else();(0,Ku.reportTypeError)(e)}o.endIf()}else{Rw(e,h)}if(!a)o.if((0,C._)`${L.default.errors} === ${n||0}`)}}function Rw(e,t){const{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)(0,Sz.assignDefaults)(e,t.type);r.block(()=>{for(const i of t.rules){if((0,Ef.shouldUseRule)(n,i)){Dw(e,i.keyword,i.definition,t.type)}}})}function jz(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;Dz(e,t);if(!e.opts.allowUnionTypes)Uz(e,t);Lz(e,e.dataTypes)}function Dz(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{if(!jw(e.dataTypes,r)){zf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}});Kz(e,t)}function Uz(e,t){if(t.length>1&&!(t.length===2&&t.includes("null"))){zf(e,"use allowUnionTypes to allow union type keyword")}}function Lz(e,t){const r=e.self.RULES.all;for(const n in r){const o=r[n];if(typeof o=="object"&&(0,Ef.shouldUseRule)(e.schema,o)){const{type:i}=o.definition;if(i.length&&!i.some(s=>qz(t,s))){zf(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}}function qz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function jw(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Kz(e,t){const r=[];for(const n of e.dataTypes){if(jw(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer")}e.dataTypes=r}function zf(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`;(0,Un.checkStrictMode)(e,t,e.opts.strictTypes)}var Zu=class{constructor(t,r,n){(0,Da.validateKeywordUsage)(t,r,n);this.gen=t.gen;this.allErrors=t.allErrors;this.keyword=n;this.data=t.data;this.schema=t.schema[n];this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data;this.schemaValue=(0,Un.schemaRefOrVal)(t,this.schema,n,this.$data);this.schemaType=r.schemaType;this.parentSchema=t.schema;this.params={};this.it=t;this.def=r;if(this.$data){this.schemaCode=t.gen.const("vSchema",Uw(this.$data,t))}else{this.schemaCode=this.schemaValue;if(!(0,Da.validSchemaType)(this.schema,r.schemaType,r.allowUndefined)){throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`)}}if("code"in r?r.trackErrors:r.errors!==false){this.errsCount=t.gen.const("_errs",L.default.errors)}}result(t,r,n){this.failResult((0,C.not)(t),r,n)}failResult(t,r,n){this.gen.if(t);if(n)n();else this.error();if(r){this.gen.else();r();if(this.allErrors)this.gen.endIf()}else{if(this.allErrors)this.gen.endIf();else this.gen.else()}}pass(t,r){this.failResult((0,C.not)(t),void 0,r)}fail(t){if(t===void 0){this.error();if(!this.allErrors)this.gen.if(false);return}this.gen.if(t);this.error();if(this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:r}=this;this.fail((0,C._)`${r} !== undefined && (${(0,C.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r);this._error(t,n);this.setParams({});return}this._error(t,n)}_error(t,r){;(t?ja.reportExtraError:ja.reportError)(this,this.def.error,r)}$dataError(){(0,ja.reportError)(this,this.def.$dataError||ja.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ja.resetErrorsCount)(this.gen,this.errsCount)}ok(t){if(!this.allErrors)this.gen.if(t)}setParams(t,r){if(r)Object.assign(this.params,t);else this.params=t}block$data(t,r,n=C.nil){this.gen.block(()=>{this.check$data(t,n);r()})}check$data(t=C.nil,r=C.nil){if(!this.$data)return;const{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,C.or)((0,C._)`${o} === undefined`,r));if(t!==C.nil)n.assign(t,true);if(i.length||s.validateSchema){n.elseIf(this.invalid$data());this.$dataError();if(t!==C.nil)n.assign(t,false)}n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,C.or)(s(),a());function s(){if(n.length){if(!(r instanceof C.Name))throw new Error("ajv implementation error");const c=Array.isArray(n)?n:[n];return(0,C._)`${(0,Ku.checkDataTypes)(c,r,i.opts.strictNumbers,Ku.DataType.Wrong)}`}return C.nil}function a(){if(o.validateSchema){const c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,C._)`!${c}(${r})`}return C.nil}}subschema(t,r){const n=(0,Af.getSubschema)(this.it,t);(0,Af.extendSubschemaData)(n,this.it,t);(0,Af.extendSubschemaMode)(n,t);const o={...this.it,...n,items:void 0,props:void 0};Rz(o,r);return o}mergeEvaluated(t,r){const{it:n,gen:o}=this;if(!n.opts.unevaluated)return;if(n.props!==true&&t.props!==void 0){n.props=Un.mergeEvaluated.props(o,t.props,n.props,r)}if(n.items!==true&&t.items!==void 0){n.items=Un.mergeEvaluated.items(o,t.items,n.items,r)}}mergeValidEvaluated(t,r){const{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==true||n.items!==true)){o.if(r,()=>this.mergeEvaluated(t,C.Name));return true}}};ho.KeywordCxt=Zu;function Dw(e,t,r,n){const o=new Zu(e,r,t);if("code"in r){r.code(o,n)}else if(o.$data&&r.validate){(0,Da.funcKeywordCode)(o,r)}else if("macro"in r){(0,Da.macroKeywordCode)(o,r)}else if(r.compile||r.validate){(0,Da.funcKeywordCode)(o,r)}}var Zz=/^\/(?:[^~]|~0|~1)*$/;var Bz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Uw(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o;let i;if(e==="")return L.default.rootData;if(e[0]==="/"){if(!Zz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e;i=L.default.rootData}else{const l=Bz.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);const u=+l[1];o=l[2];if(o==="#"){if(u>=t)throw new Error(c("property/index",u));return n[t-u]}if(u>t)throw new Error(c("data",u));i=r[t-u];if(!o)return i}let s=i;const a=o.split("/");for(const l of a){if(l){i=(0,C._)`${i}${(0,C.getProperty)((0,Un.unescapeJsonPointer)(l))}`;s=(0,C._)`${s} && ${i}`}}return s;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}ho.getData=Uw});var Bu=R(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:true});var Cf=class extends Error{constructor(t){super("validation failed");this.errors=t;this.ajv=this.validation=true}};Nf.default=Cf});var La=R(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:true});var Ff=Fa();var jf=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`);this.missingRef=(0,Ff.resolveUrl)(t,r,n);this.missingSchema=(0,Ff.normalizeId)((0,Ff.getFullPath)(t,this.missingRef))}};Df.default=jf});var Vu=R(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:true});kr.resolveSchema=kr.getCompilingSchema=kr.resolveRef=kr.compileSchema=kr.SchemaEnv=void 0;var Br=G();var Gz=Bu();var ai=Dn();var Gr=Fa();var Lw=pe();var Vz=Ua();var gs=class{constructor(t){var r;this.refs={};this.dynamicAnchors={};let n;if(typeof t.schema=="object")n=t.schema;this.schema=t.schema;this.schemaId=t.schemaId;this.root=t.root||this;this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Gr.normalizeId)(n===null||n===void 0?void 0:n[t.schemaId||"$id"]);this.schemaPath=t.schemaPath;this.localRefs=t.localRefs;this.meta=t.meta;this.$async=n===null||n===void 0?void 0:n.$async;this.refs={}}};kr.SchemaEnv=gs;function Lf(e){const t=qw.call(this,e);if(t)return t;const r=(0,Gr.getFullPath)(this.opts.uriResolver,e.root.baseId);const{es5:n,lines:o}=this.opts.code;const{ownProperties:i}=this.opts;const s=new Br.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i});let a;if(e.$async){a=s.scopeValue("Error",{ref:Gz.default,code:(0,Br._)`require("ajv/dist/runtime/validation_error").default`})}const c=s.scopeName("validate");e.validateName=c;const l={gen:s,allErrors:this.opts.allErrors,data:ai.default.data,parentData:ai.default.parentData,parentDataProperty:ai.default.parentDataProperty,dataNames:[ai.default.data],dataPathArr:[Br.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===true?{ref:e.schema,code:(0,Br.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Br.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Br._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(e);(0,Vz.validateFunctionCode)(l);s.optimize(this.opts.code.optimize);const d=s.toString();u=`${s.scopeRefs(ai.default.scope)}return ${d}`;if(this.opts.code.process)u=this.opts.code.process(u,e);const h=new Function(`${ai.default.self}`,`${ai.default.scope}`,u);const m=h(this,this.scope.get());this.scope.value(c,{ref:m});m.errors=null;m.schema=e.schema;m.schemaEnv=e;if(e.$async)m.$async=true;if(this.opts.code.source===true){m.source={validateName:c,validateCode:d,scopeValues:s._values}}if(this.opts.unevaluated){const{props:p,items:f}=l;m.evaluated={props:p instanceof Br.Name?void 0:p,items:f instanceof Br.Name?void 0:f,dynamicProps:p instanceof Br.Name,dynamicItems:f instanceof Br.Name};if(m.source)m.source.evaluated=(0,Br.stringify)(m.evaluated)}e.validate=m;return e}catch(d){delete e.validate;delete e.validateName;if(u)this.logger.error("Error compiling schema, function code:",u);throw d}finally{this._compilations.delete(e)}}kr.compileSchema=Lf;function Hz(e,t,r){var n;r=(0,Gr.resolveUrl)(this.opts.uriResolver,t,r);const o=e.refs[r];if(o)return o;let i=Xz.call(this,e,r);if(i===void 0){const s=(n=e.localRefs)===null||n===void 0?void 0:n[r];const{schemaId:a}=this.opts;if(s)i=new gs({schema:s,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=Wz.call(this,i)}kr.resolveRef=Hz;function Wz(e){if((0,Gr.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Lf.call(this,e)}function qw(e){for(const t of this._compilations){if(Jz(t,e))return t}}kr.getCompilingSchema=qw;function Jz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Xz(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Gu.call(this,e,t)}function Gu(e,t){const r=this.opts.uriResolver.parse(t);const n=(0,Gr._getFullPath)(this.opts.uriResolver,r);let o=(0,Gr.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o){return Uf.call(this,r,e)}const i=(0,Gr.normalizeId)(n);const s=this.refs[i]||this.schemas[i];if(typeof s=="string"){const a=Gu.call(this,e,s);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Uf.call(this,r,a)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)Lf.call(this,s);if(i===(0,Gr.normalizeId)(t)){const{schema:a}=s;const{schemaId:c}=this.opts;const l=a[c];if(l)o=(0,Gr.resolveUrl)(this.opts.uriResolver,o,l);return new gs({schema:a,schemaId:c,root:e,baseId:o})}return Uf.call(this,r,s)}kr.resolveSchema=Gu;var Yz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Uf(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(const a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;const c=r[(0,Lw.unescapeFragment)(a)];if(c===void 0)return;r=c;const l=typeof r==="object"&&r[this.opts.schemaId];if(!Yz.has(a)&&l){t=(0,Gr.resolveUrl)(this.opts.uriResolver,t,l)}}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Lw.schemaHasRulesButRef)(r,this.RULES)){const a=(0,Gr.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Gu.call(this,n,a)}const{schemaId:s}=this.opts;i=i||new gs({schema:r,schemaId:s,root:n,baseId:t});if(i.schema!==i.root.schema)return i;return void 0}});var Kw=R((O5,Qz)=>{Qz.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:false}});var Vf=R((v5,Jw)=>{"use strict";var eC=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);var Kf=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);var ci=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);var Zf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);var Bw=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);var Bf=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);var tC=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);var Qt=new Array(256);{const e="0123456789ABCDEF";for(let t=0;t<256;t++){Qt[t]="%"+e[t>>4]+e[t&15]}}function Et(e){if(e<2048){return Qt[192|e>>6]+Qt[128|e&63]}if(e<65536){return Qt[224|e>>12]+Qt[128|e>>6&63]+Qt[128|e&63]}return Qt[240|e>>18]+Qt[128|e>>12&63]+Qt[128|e>>6&63]+Qt[128|e&63]}function rC(e){let t="";let r=0;let n=0;for(n=0;n<e.length;n++){r=e[n].charCodeAt(0);if(r===48){continue}if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102)){return""}t+=e[n];break}for(n+=1;n<e.length;n++){r=e[n].charCodeAt(0);if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102)){return""}t+=e[n]}return t}var nC=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);var oC=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);var iC=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);var sC=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function aC(e){if(e.length===0)return false;for(let t=0;t<e.length;t++){if(iC(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&ci(e.slice(t+1,t+3))){t+=2;continue}return false}return true}function Zw(e){let t=-1;let r=0;let n=-1;let o=0;for(let a=0;a<e.length;a++){if(e[a]==="0"){if(n===-1)n=a;o++;if(o>r){r=o;t=n}}else{n=-1;o=0}}if(r<2)return e.join(":");const i=e.slice(0,t).join(":");const s=e.slice(t+r).join(":");return i+"::"+s}function cC(e){const t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return void 0;const r=t===-1?e.split(":"):e.slice(0,t).split(":");const n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}const o=r.concat(n);let i=0;for(let a=0;a<o.length;a++){const c=o[a];if(c==="")return void 0;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!Kf(c))return void 0;i+=2;continue}if(!nC(c))return void 0;o[a]=parseInt(c,16).toString(16);i++}if(t===-1){if(i!==8)return void 0;return Zw(o)}if(i>=8)return void 0;const s=o.slice(0,r.length);for(let a=i;a<8;a++)s.push("0");for(let a=r.length;a<o.length;a++)s.push(o[a]);return Zw(s)}function qf(e){const t=e[0]==="["&&e[e.length-1]==="]";const r=e[0]==="["||e[e.length-1]==="]";if(r&&!t)return{host:e,isIPV6:false,error:true};let n=t?e.slice(1,-1):e;if(t&&oC(n)){n=n.toLowerCase();return{host:`[${n}]`,escapedHost:n,isIPV6:false,isIPVFuture:true}}if(uC(n,":")<2){return{host:e,isIPV6:false,error:t}}let o="";const i=n.indexOf("%");if(i!==-1){const a=n.slice(i,i+3).toLowerCase()==="%25"?3:1;o=n.slice(i+a);if(!aC(o))return{host:e,isIPV6:false,error:true};n=n.slice(0,i)}const s=cC(n);if(s===void 0)return{host:e,isIPV6:false,error:true};return{host:s+(o?"%"+o:""),escapedHost:s+(o?"%25"+o:""),isIPV6:true}}function uC(e,t){let r=0;for(let n=0;n<e.length;n++){if(e[n]===t)r++}return r}function lC(e){let t=e;const r=[];let n=-1;let o=0;while(o=t.length){if(o===1){if(t==="."){break}else if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]==="."){break}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(o===3){if(t==="/.."){if(r.length!==0){r.pop()}r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){t=t.slice(3);if(r.length!==0){r.pop()}continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else{r.push(t.slice(0,n));t=t.slice(n)}}return r.join("")}var dC={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"};var pC=/[@/?#:]/g;var fC=/[@/?#]/g;function Gw(e,t){const r=t?fC:pC;r.lastIndex=0;return e.replace(r,n=>dC[n])}function Vw(e,t=false){if(e.indexOf("%")===-1){return e}let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){const o=e.slice(n+1,n+3);if(ci(o)){const i=o.toUpperCase();const s=String.fromCharCode(parseInt(i,16));if(t&&Zf(s)){r+=s}else{r+="%"+i}n+=2;continue}}r+=e[n]}return r}function mC(e){let t="";for(let r=0;r<e.length;r++){const n=e[r];if(n==="%"&&r+2<e.length){const o=e.slice(r+1,r+3);if(ci(o)){const i=o.toUpperCase();const s=String.fromCharCode(parseInt(i,16));if(s!=="."&&Zf(s)){t+=s}else{t+="%"+i}r+=2;continue}}if(Bw(n)){t+=n}else{const o=e.charCodeAt(r);if(o<128){t+=Ww(o)?n:Qt[o]}else if(o<55296||o>57343){t+=Et(o)}else if(o<=56319&&r+1<e.length){const i=e.charCodeAt(r+1);if(i>=56320&&i<=57343){t+=Et(65536+(o-55296<<10)+(i-56320));r++}else{t+=Et(65533)}}else{t+=Et(65533)}}}return t}function hC(e,t=false){let r="";let n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){const i=e[o];if(i==="%"&&o+2<e.length){const s=e.slice(o+1,o+3);if(ci(s)){r+="%"+s.toUpperCase();o+=2;continue}}if(i==="/"){n=false}if(Bw(i)&&(i!==":"||!n)){r+=i}else{const s=e.charCodeAt(o);if(s<128){r+=Qt[s]}else if(s<55296||s>57343){r+=Et(s)}else if(s<=56319&&o+1<e.length){const a=e.charCodeAt(o+1);if(a>=56320&&a<=57343){r+=Et(65536+(s-55296<<10)+(a-56320));o++}else{r+=Et(65533)}}else{r+=Et(65533)}}}return r}function Gf(e,t){let r="";for(let n=0;n<e.length;n++){const o=e[n];if(o==="%"&&n+2<e.length){const i=e.slice(n+1,n+3);if(ci(i)){r+="%"+i.toUpperCase();n+=2;continue}}if(t(o)){r+=o}else{const i=e.charCodeAt(n);if(i<128){r+=Qt[i]}else if(i<55296||i>57343){r+=Et(i)}else if(i<=56319&&n+1<e.length){const s=e.charCodeAt(n+1);if(s>=56320&&s<=57343){r+=Et(65536+(i-55296<<10)+(s-56320));n++}else{r+=Et(65533)}}else{r+=Et(65533)}}}return r}function Hw(e){return Gf(e,tC)}function gC(e){return Gf(e,Bf)}function yC(e){return Gf(e,Bf)}function Ww(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function _C(e){let t="";for(let r=0;r<e.length;r++){const n=e[r];if(n==="%"&&r+2<e.length){const o=e.slice(r+1,r+3);if(ci(o)){const i=o.toUpperCase();const s=String.fromCharCode(parseInt(i,16));if(Zf(s)){t+=s}else{t+="%"+i}r+=2;continue}}if(Bf(n)){t+=n}else{const o=e.charCodeAt(r);if(o<128){t+=Ww(o)?n:Qt[o]}else if(o<55296||o>57343){t+=Et(o)}else if(o<=56319&&r+1<e.length){const i=e.charCodeAt(r+1);if(i>=56320&&i<=57343){t+=Et(65536+(o-55296<<10)+(i-56320));r++}else{t+=Et(65533)}}else{t+=Et(65533)}}}return t}function xC(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){const n=e.slice(r+1,r+3);if(ci(n)){t+="%"+n.toUpperCase();r+=2;continue}}t+=escape(e[r])}return t}function bC(e){const t=[];if(e.userinfo!==void 0){t.push(Hw(e.userinfo));t.push("@")}if(e.host!==void 0){let r=e.host;if(!Kf(r)){let n=qf(r);if(n.isIPV6!==true&&n.isIPVFuture!==true){r=Vw(r,true);n=qf(r)}if(n.isIPV6===true||n.isIPVFuture===true){r=`[${n.escapedHost}]`}else{r=Gw(r,false)}}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){t.push(":");t.push(String(e.port))}return t.length?t.join(""):void 0}Jw.exports={nonSimpleDomain:sC,recomposeAuthority:bC,reescapeHostDelimiters:Gw,normalizePercentEncoding:Vw,normalizePathEncoding:mC,serializePathEncoding:hC,normalizeQueryFragmentEncoding:_C,encodeUserinfo:Hw,encodeQuery:gC,encodeFragment:yC,escapePreservingEscapes:xC,removeDotSegments:lC,isIPv4:Kf,isUUID:eC,normalizeIPv6:qf,stringArrayToHexStripped:rC}});var tS=R(($5,eS)=>{"use strict";var{isUUID:IC}=Vf();var wC=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;var SC=["http","https","ws","wss","urn","urn:uuid"];function TC(e){return SC.indexOf(e)!==-1}function Hf(e){if(e.secure===true){return true}else if(e.secure===false){return false}else if(e.scheme){return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S")}else{return false}}function Xw(e){if(!e.host){e.error=e.error||"HTTP URIs must have a host."}return e}function Yw(e){const t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port===""){e.port=void 0}if(!e.path){e.path="/"}return e}function PC(e){e.secure=Hf(e);e.resourceName=(e.path||"/")+(e.query?"?"+e.query:"");e.path=void 0;e.query=void 0;return e}function OC(e){if(e.port===(Hf(e)?443:80)||e.port===""){e.port=void 0}if(typeof e.secure==="boolean"){e.scheme=e.secure?"wss":"ws";e.secure=void 0}if(e.resourceName){const t=e.resourceName.indexOf("?");const r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0;e.query=t===-1?void 0:e.resourceName.slice(t+1);e.resourceName=void 0}e.fragment=void 0;return e}function vC(e,t){if(!e.path){e.error="URN can not be parsed";return e}const r=e.path.match(wC);if(r&&r[0]===e.path){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase();e.nss=r[2];const o=`${n}:${t.nid||e.nid}`;const i=Wf(o);e.path=void 0;if(i){e=i.parse(e,t)}}else{e.error=e.error||"URN can not be parsed."}return e}function $C(e,t){if(e.nid===void 0){throw new Error("URN without nid cannot be serialized")}const r=t.scheme||e.scheme||"urn";const n=e.nid.toLowerCase();const o=`${r}:${t.nid||n}`;const i=Wf(o);if(i){e=i.serialize(e,t)}const s=e;const a=e.nss;s.path=`${n||t.nid}:${a}`;t.skipEscape=true;return s}function kC(e,t){const r=e;r.uuid=r.nss;r.nss=void 0;if(!t.tolerant&&(!r.uuid||!IC(r.uuid))){r.error=r.error||"UUID is not valid."}return r}function RC(e){const t=e;t.nss=(e.uuid||"").toLowerCase();return t}var Qw={scheme:"http",domainHost:true,parse:Xw,serialize:Yw};var MC={scheme:"https",domainHost:Qw.domainHost,parse:Xw,serialize:Yw};var Hu={scheme:"ws",domainHost:true,parse:PC,serialize:OC};var AC={scheme:"wss",domainHost:Hu.domainHost,parse:Hu.parse,serialize:Hu.serialize};var EC={scheme:"urn",parse:vC,serialize:$C,skipNormalize:true};var zC={scheme:"urn:uuid",parse:kC,serialize:RC,skipNormalize:true};var Wu={http:Qw,https:MC,ws:Hu,wss:AC,urn:EC,"urn:uuid":zC};Object.setPrototypeOf(Wu,null);function Wf(e){return e&&(Wu[e]||Wu[e.toLowerCase()])||void 0}eS.exports={wsIsSecure:Hf,SCHEMES:Wu,isValidSchemeName:TC,getSchemeHandler:Wf}});var hS=R((k5,Yu)=>{"use strict";var{normalizeIPv6:sS,removeDotSegments:Ka,recomposeAuthority:CC,normalizePercentEncoding:aS,normalizePathEncoding:NC,serializePathEncoding:rS,normalizeQueryFragmentEncoding:nS,encodeQuery:FC,encodeFragment:jC,reescapeHostDelimiters:DC,isIPv4:cS,nonSimpleDomain:UC}=Vf();var{SCHEMES:uS,getSchemeHandler:Jf}=tS();var lS=/^[A-Za-z][A-Za-z0-9+.-]*$/u;var dS="URI scheme is malformed.";function oS(e){const t=unescape(String(e));if(!lS.test(t)){throw new TypeError(dS)}return t}function LC(e,t){if(typeof e==="string"){e=WC(e,t)}else if(typeof e==="object"){e=Xu(ui(e,t),t)}return e}function qC(e,t,r){const n=r?Object.assign({scheme:"null"},r):{scheme:"null"};const{parsed:o,malformedAuthorityOrPort:i,malformedPercentEncoding:s,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=Ju(e,n);const{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:h,malformedSchemeSpecific:m,malformedHost:p,malformedScheme:f}=Ju(t,n);if(i||d||s||h||a||m||c||p||l||f){throw new Error(o.error||u.error||"URI is malformed.")}const g=pS(o,u,n,true);const _=Jf(r&&r.scheme||g.scheme);const b=g.host;const v=b!==void 0&&b!==""&&(cS(b)||sS(b).isIPV6);fS(g,r||{},_,v);const A=b&&b.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(b);if(g.error&&!A){throw new Error(g.error)}n.skipEscape=true;return ui(g,n)}function pS(e,t,r,n){const o={};if(!n){e=Xu(ui(e,r),r);t=Xu(ui(t,r),r)}r=r||{};if(!r.tolerant&&t.scheme){o.scheme=t.scheme;o.userinfo=t.userinfo;o.host=t.host;o.port=t.port;o.path=Ka(t.path||"");o.query=t.query}else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0){o.userinfo=t.userinfo;o.host=t.host;o.port=t.port;o.path=Ka(t.path||"");o.query=t.query}else{if(!t.path){o.path=e.path;if(t.query!==void 0){o.query=t.query}else{o.query=e.query}}else{if(t.path[0]==="/"){o.path=Ka(t.path)}else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path){o.path="/"+t.path}else if(!e.path){o.path=t.path}else{o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path}o.path=Ka(o.path)}o.query=t.query}o.userinfo=e.userinfo;o.host=e.host;o.port=e.port}o.scheme=e.scheme}o.fragment=t.fragment;return o}function KC(e,t,r){const n=iS(e,r);const o=iS(t,r);return n!==void 0&&o!==void 0&&n===o}function ui(e,t){const r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""};const n=Object.assign({},t);const o=[];if(r.scheme){r.scheme=oS(r.scheme)}const i=Jf(n.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,n);const s=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0;const a=!n.skipEscape&&r.scheme===void 0&&!s;if(r.path!==void 0){if(!n.skipEscape){r.path=rS(r.path,a)}else{r.path=aS(r.path)}}if(n.reference!=="suffix"&&r.scheme){r.scheme=oS(r.scheme);o.push(r.scheme,":")}const c=CC(r);if(c!==void 0){if(n.reference!=="suffix"){o.push("//")}o.push(c);if(r.path&&r.path[0]!=="/"){o.push("/")}}if(r.path!==void 0){let l=r.path;if(!n.absolutePath&&(!i||!i.absolutePath)){l=Ka(l)}if(a){l=rS(l,true)}if(c===void 0&&l[0]==="/"&&l[1]==="/"){l="/%2F"+l.slice(2)}o.push(l)}if(r.query!==void 0){o.push("?",FC(r.query))}if(r.fragment!==void 0){o.push("#",jC(r.fragment))}return o.join("")}var ZC=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;var BC=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/;var GC=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function VC(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/"){return'URI path must start with "/" when authority is present.'}if(typeof e.port==="number"&&(e.port<0||e.port>65535)){return"URI port is malformed."}return void 0}function qa(e){if(e===void 0)return false;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3))){return true}t=e.indexOf("%",t+3)}return false}function HC(e){const t=e[4];return qa(e[3])||t!==void 0&&!(t[0]==="["&&t[t.length-1]==="]")&&qa(t)||qa(e[6])||qa(e[7])||qa(e[8])}function fS(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&e.host[0]!=="["&&(t.domainHost||r&&r.domainHost)&&n===false&&UC(e.host)){try{e.host=new URL("http://"+e.host).hostname}catch(o){e.error=e.error||"Host's domain name can not be converted to ASCII: "+o;return true}}return false}function Ju(e,t){const r=Object.assign({},t);const n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let o=false;let i=false;let s=false;let a=false;let c=false;let l=false;let u=false;if(r.reference==="suffix"){if(r.scheme){e=r.scheme+":"+e}else{e="//"+e}}const d=e.match(BC);if(d!==null&&d[1].indexOf("\\")!==-1){n.error="URI authority must not contain a literal backslash.";o=true}const h=e.match(GC);if(h!==null){const p=h[1];const f=p.replace(/[\t\n\r]/g,"");if(f.length>=2){if(f.slice(0,2)!=="//"){n.error=n.error||"URI authority must not contain a literal backslash.";o=true}else if(p.length!==f.length){n.error=n.error||"URI authority introducer must not contain whitespace.";o=true}}}const m=e.match(ZC);if(m){n.scheme=m[1];n.userinfo=m[3];n.host=m[4];n.port=parseInt(m[5],10);n.path=m[6]||"";n.query=m[7];n.fragment=m[8];if(n.scheme!==void 0){const g=unescape(n.scheme);if(lS.test(g)){n.scheme=g.toLowerCase()}else{n.error=n.error||dS;l=true}}i=HC(m);if(i){n.error=n.error||"URI contains malformed percent-encoding."}if(isNaN(n.port)){n.port=m[5]}const p=VC(n,m);if(p!==void 0){n.error=n.error||p;o=true}if(n.host){const g=cS(n.host);if(g===false){const _=n.host[0]==="["&&n.host[n.host.length-1]==="]";const b=sS(n.host);u=b.isIPV6||b.isIPVFuture===true;c=_&&b.error===true;n.host=u?b.host:b.host.toLowerCase();if(c){n.error=n.error||"URI host is malformed.";o=true}}else{u=true}}if(n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path){n.reference="same-document"}else if(n.scheme===void 0){n.reference="relative"}else if(n.fragment===void 0){n.reference="absolute"}else{n.reference="uri"}if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference){n.error=n.error||"URI is not a "+r.reference+" reference."}const f=Jf(r.scheme||n.scheme);a=fS(n,r,f,u);if(!f||f&&!f.skipNormalize){if(e.indexOf("%")!==-1){if(n.host!==void 0&&!c){const g=u?n.host:aS(n.host,true);n.host=DC(g,u)}}if(n.path){n.path=NC(n.path)}if(n.query){n.query=nS(n.query)}if(n.fragment){n.fragment=nS(n.fragment)}}if(f&&f.parse){f.parse(n,r);if(f===uS.urn&&n.nid===void 0){s=true}}}else{n.error=n.error||"URI can not be parsed."}return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:l}}function Xu(e,t){return Ju(e,t).parsed}function WC(e,t){return mS(e,t).normalized}function mS(e,t){const{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:s,malformedScheme:a}=Ju(e,t);return{normalized:n||o||i||s||a?e:ui(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:s,malformedScheme:a}}function iS(e,t){if(typeof e!=="string"&&typeof e!=="object"){return void 0}let r;try{r=typeof e==="string"?e:ui(e,t)}catch{return void 0}const{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:c}=mS(r,t);return o||i||s||a||c?void 0:n}var Xf={SCHEMES:uS,normalize:LC,resolve:qC,resolveComponent:pS,equal:KC,serialize:ui,parse:Xu};Yu.exports=Xf;Yu.exports.default=Xf;Yu.exports.fastUri=Xf});var yS=R(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:true});var gS=hS();gS.code='require("ajv/dist/runtime/uri").default';Yf.default=gS});var PS=R(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:true});Tt.CodeGen=Tt.Name=Tt.nil=Tt.stringify=Tt.str=Tt._=Tt.KeywordCxt=void 0;var JC=Ua();Object.defineProperty(Tt,"KeywordCxt",{enumerable:true,get:function(){return JC.KeywordCxt}});var ys=G();Object.defineProperty(Tt,"_",{enumerable:true,get:function(){return ys._}});Object.defineProperty(Tt,"str",{enumerable:true,get:function(){return ys.str}});Object.defineProperty(Tt,"stringify",{enumerable:true,get:function(){return ys.stringify}});Object.defineProperty(Tt,"nil",{enumerable:true,get:function(){return ys.nil}});Object.defineProperty(Tt,"Name",{enumerable:true,get:function(){return ys.Name}});Object.defineProperty(Tt,"CodeGen",{enumerable:true,get:function(){return ys.CodeGen}});var XC=Bu();var wS=La();var YC=wf();var Za=Vu();var QC=G();var Ba=Fa();var Qu=Na();var em=pe();var _S=Kw();var eN=yS();var SS=(e,t)=>new RegExp(e,t);SS.code="new RegExp";var tN=["removeAdditional","useDefaults","coerceTypes"];var rN=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]);var nN={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."};var oN={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var xS=200;function iN(e){var t,r,n,o,i,s,a,c,l,u,d,h,m,p,f,g,_,b,v,A,$,te,st,Yo,Ki;const Rn=e.strict;const Zi=(t=e.code)===null||t===void 0?void 0:t.optimize;const $c=Zi===true||Zi===void 0?1:Zi||0;const kc=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:SS;const z$=(o=e.uriResolver)!==null&&o!==void 0?o:eN.default;return{strictSchema:(s=(i=e.strictSchema)!==null&&i!==void 0?i:Rn)!==null&&s!==void 0?s:true,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Rn)!==null&&c!==void 0?c:true,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:Rn)!==null&&u!==void 0?u:"log",strictTuples:(h=(d=e.strictTuples)!==null&&d!==void 0?d:Rn)!==null&&h!==void 0?h:"log",strictRequired:(p=(m=e.strictRequired)!==null&&m!==void 0?m:Rn)!==null&&p!==void 0?p:false,code:e.code?{...e.code,optimize:$c,regExp:kc}:{optimize:$c,regExp:kc},loopRequired:(f=e.loopRequired)!==null&&f!==void 0?f:xS,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:xS,meta:(_=e.meta)!==null&&_!==void 0?_:true,messages:(b=e.messages)!==null&&b!==void 0?b:true,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:true,schemaId:(A=e.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:($=e.addUsedSchema)!==null&&$!==void 0?$:true,validateSchema:(te=e.validateSchema)!==null&&te!==void 0?te:true,validateFormats:(st=e.validateFormats)!==null&&st!==void 0?st:true,unicodeRegExp:(Yo=e.unicodeRegExp)!==null&&Yo!==void 0?Yo:true,int32range:(Ki=e.int32range)!==null&&Ki!==void 0?Ki:true,uriResolver:z$}}var Ga=class{constructor(t={}){this.schemas={};this.refs={};this.formats={};this._compilations=new Set;this._loading={};this._cache=new Map;t=this.opts={...t,...iN(t)};const{es5:r,lines:n}=this.opts.code;this.scope=new QC.ValueScope({scope:{},prefixes:rN,es5:r,lines:n});this.logger=dN(t.logger);const o=t.validateFormats;t.validateFormats=false;this.RULES=(0,YC.getRules)();bS.call(this,nN,t,"NOT SUPPORTED");bS.call(this,oN,t,"DEPRECATED","warn");this._metaOpts=uN.call(this);if(t.formats)aN.call(this);this._addVocabularies();this._addDefaultMetaSchema();if(t.keywords)cN.call(this,t.keywords);if(typeof t.meta=="object")this.addMetaSchema(t.meta);sN.call(this);t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:r,schemaId:n}=this.opts;let o=_S;if(n==="id"){o={..._S};o.id=o.$id;delete o.$id}if(r&&t)this.addMetaSchema(o,o[n],false)}defaultMeta(){const{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){n=this.getSchema(t);if(!n)throw new Error(`no schema with key or ref "${t}"`)}else{n=this.compile(t)}const o=n(r);if(!("$async"in n))this.errors=n.errors;return o}compile(t,r){const n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function"){throw new Error("options.loadSchema should be a function")}const{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(u,d){await i.call(this,u.$schema);const h=this._addSchema(u,d);return h.validate||s.call(this,h)}async function i(u){if(u&&!this.getSchema(u)){await o.call(this,{$ref:u},true)}}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof wS.default))throw d;a.call(this,d);await c.call(this,d.missingSchema);return s.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u]){throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}}async function c(u){const d=await l.call(this,u);if(!this.refs[u])await i.call(this,d.$schema);if(!this.refs[u])this.addSchema(d,u,r)}async function l(u){const d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(const s of t)this.addSchema(s,void 0,n,o);return this}let i;if(typeof t==="object"){const{schemaId:s}=this.opts;i=t[s];if(i!==void 0&&typeof i!="string"){throw new Error(`schema ${s} must be string`)}}r=(0,Ba.normalizeId)(r||i);this._checkUnique(r);this.schemas[r]=this._addSchema(t,n,r,o,true);return this}addMetaSchema(t,r,n=this.opts.validateSchema){this.addSchema(t,r,true,n);return this}validateSchema(t,r){if(typeof t=="boolean")return true;let n;n=t.$schema;if(n!==void 0&&typeof n!="string"){throw new Error("$schema must be a string")}n=n||this.opts.defaultMeta||this.defaultMeta();if(!n){this.logger.warn("meta-schema not available");this.errors=null;return true}const o=this.validate(n,t);if(!o&&r){const i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;while(typeof(r=IS.call(this,t))=="string")t=r;if(r===void 0){const{schemaId:n}=this.opts;const o=new Za.SchemaEnv({schema:{},schemaId:n});r=Za.resolveSchema.call(this,o,t);if(!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp){this._removeAllSchemas(this.schemas,t);this._removeAllSchemas(this.refs,t);return this}switch(typeof t){case"undefined":this._removeAllSchemas(this.schemas);this._removeAllSchemas(this.refs);this._cache.clear();return this;case"string":{const r=IS.call(this,t);if(typeof r=="object")this._cache.delete(r.schema);delete this.schemas[t];delete this.refs[t];return this}case"object":{const r=t;this._cache.delete(r);let n=t[this.opts.schemaId];if(n){n=(0,Ba.normalizeId)(n);delete this.schemas[n];delete this.refs[n]}return this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string"){n=t;if(typeof r=="object"){this.logger.warn("these parameters are deprecated, see docs for addKeyword");r.keyword=n}}else if(typeof t=="object"&&r===void 0){r=t;n=r.keyword;if(Array.isArray(n)&&!n.length){throw new Error("addKeywords: keyword must be string or non-empty array")}}else{throw new Error("invalid addKeywords parameters")}fN.call(this,n,r);if(!r){(0,em.eachItem)(n,i=>Qf.call(this,i));return this}hN.call(this,r);const o={...r,type:(0,Qu.getJSONTypes)(r.type),schemaType:(0,Qu.getJSONTypes)(r.schemaType)};(0,em.eachItem)(n,o.type.length===0?i=>Qf.call(this,i,o):i=>o.type.forEach(s=>Qf.call(this,i,o,s)));return this}getKeyword(t){const r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){const{RULES:r}=this;delete r.keywords[t];delete r.all[t];for(const n of r.rules){const o=n.rules.findIndex(i=>i.keyword===t);if(o>=0)n.rules.splice(o,1)}return this}addFormat(t,r){if(typeof r=="string")r=new RegExp(r);this.formats[t]=r;return this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){if(!t||t.length===0)return"No errors";return t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){const n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const o of r){const i=o.split("/").slice(1);let s=t;for(const a of i)s=s[a];for(const a in n){const c=n[a];if(typeof c!="object")continue;const{$data:l}=c.definition;const u=s[a];if(l&&u)s[a]=TS(u)}}return t}_removeAllSchemas(t,r){for(const n in t){const o=t[n];if(!r||r.test(n)){if(typeof o=="string"){delete t[n]}else if(o&&!o.meta){this._cache.delete(o.schema);delete t[n]}}}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s;const{schemaId:a}=this.opts;if(typeof t=="object"){s=t[a]}else{if(this.opts.jtd)throw new Error("schema must be object");else if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,Ba.normalizeId)(s||n);const l=Ba.getSchemaRefs.call(this,t,n);c=new Za.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:l});this._cache.set(c.schema,c);if(i&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=c}if(o)this.validateSchema(t,true);return c}_checkUnique(t){if(this.schemas[t]||this.refs[t]){throw new Error(`schema with key or id "${t}" already exists`)}}_compileSchemaEnv(t){if(t.meta)this._compileMetaSchema(t);else Za.compileSchema.call(this,t);if(!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const r=this.opts;this.opts=this._metaOpts;try{Za.compileSchema.call(this,t)}finally{this.opts=r}}};Ga.ValidationError=XC.default;Ga.MissingRefError=wS.default;Tt.default=Ga;function bS(e,t,r,n="error"){for(const o in e){const i=o;if(i in t)this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function IS(e){e=(0,Ba.normalizeId)(e);return this.schemas[e]||this.refs[e]}function sN(){const e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function aN(){for(const e in this.opts.formats){const t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function cN(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function uN(){const e={...this.opts};for(const t of tN)delete e[t];return e}var lN={log(){},warn(){},error(){}};function dN(e){if(e===false)return lN;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var pN=/^[a-z_$][a-z0-9_$:-]*$/i;function fN(e,t){const{RULES:r}=this;(0,em.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!pN.test(n))throw new Error(`Keyword ${n} has invalid name`)});if(!t)return;if(t.$data&&!("code"in t||"validate"in t)){throw new Error('$data keyword must have "code" or "validate" function')}}function Qf(e,t,r){var n;const o=t===null||t===void 0?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:i}=this;let s=o?i.post:i.rules.find(({type:c})=>c===r);if(!s){s={type:r,rules:[]};i.rules.push(s)}i.keywords[e]=true;if(!t)return;const a={keyword:e,definition:{...t,type:(0,Qu.getJSONTypes)(t.type),schemaType:(0,Qu.getJSONTypes)(t.schemaType)}};if(t.before)mN.call(this,s,a,t.before);else s.rules.push(a);i.all[e]=a;(n=t.implements)===null||n===void 0?void 0:n.forEach(c=>this.addKeyword(c))}function mN(e,t,r){const n=e.rules.findIndex(o=>o.keyword===r);if(n>=0){e.rules.splice(n,0,t)}else{e.rules.push(t);this.logger.warn(`rule ${r} is not defined`)}}function hN(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=TS(t);e.validateSchema=this.compile(t,true)}var gN={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function TS(e){return{anyOf:[e,gN]}}});var OS=R(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:true});var yN={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};tm.default=yN});var RS=R(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:true});li.callRef=li.getValidate=void 0;var _N=La();var vS=$r();var er=G();var _s=Dn();var $S=Vu();var el=pe();var xN={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e;const{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n;const{root:l}=i;if((r==="#"||r==="#/")&&o===l.baseId)return d();const u=$S.resolveRef.call(c,l,o,r);if(u===void 0)throw new _N.default(n.opts.uriResolver,o,r);if(u instanceof $S.SchemaEnv)return h(u);return m(u);function d(){if(i===l)return tl(e,s,i,i.$async);const p=t.scopeValue("root",{ref:l});return tl(e,(0,er._)`${p}.validate`,l,l.$async)}function h(p){const f=kS(e,p);tl(e,f,p,p.$async)}function m(p){const f=t.scopeValue("schema",a.code.source===true?{ref:p,code:(0,er.stringify)(p)}:{ref:p});const g=t.name("valid");const _=e.subschema({schema:p,dataTypes:[],schemaPath:er.nil,topSchemaRef:f,errSchemaPath:r},g);e.mergeEvaluated(_);e.ok(g)}}};function kS(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,er._)`${r.scopeValue("wrapper",{ref:t})}.validate`}li.getValidate=kS;function tl(e,t,r,n){const{gen:o,it:i}=e;const{allErrors:s,schemaEnv:a,opts:c}=i;const l=c.passContext?_s.default.this:er.nil;if(n)u();else d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");const p=o.let("valid");o.try(()=>{o.code((0,er._)`await ${(0,vS.callValidateCode)(e,t,l)}`);m(t);if(!s)o.assign(p,true)},f=>{o.if((0,er._)`!(${f} instanceof ${i.ValidationError})`,()=>o.throw(f));h(f);if(!s)o.assign(p,false)});e.ok(p)}function d(){e.result((0,vS.callValidateCode)(e,t,l),()=>m(t),()=>h(t))}function h(p){const f=(0,er._)`${p}.errors`;o.assign(_s.default.vErrors,(0,er._)`${_s.default.vErrors} === null ? ${f} : ${_s.default.vErrors}.concat(${f})`);o.assign(_s.default.errors,(0,er._)`${_s.default.vErrors}.length`)}function m(p){var f;if(!i.opts.unevaluated)return;const g=(f=r===null||r===void 0?void 0:r.validate)===null||f===void 0?void 0:f.evaluated;if(i.props!==true){if(g&&!g.dynamicProps){if(g.props!==void 0){i.props=el.mergeEvaluated.props(o,g.props,i.props)}}else{const _=o.var("props",(0,er._)`${p}.evaluated.props`);i.props=el.mergeEvaluated.props(o,_,i.props,er.Name)}}if(i.items!==true){if(g&&!g.dynamicItems){if(g.items!==void 0){i.items=el.mergeEvaluated.items(o,g.items,i.items)}}else{const _=o.var("items",(0,er._)`${p}.evaluated.items`);i.items=el.mergeEvaluated.items(o,_,i.items,er.Name)}}}}li.callRef=tl;li.default=xN});var MS=R(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:true});var bN=OS();var IN=RS();var wN=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",bN.default,IN.default];rm.default=wN});var AS=R(nm=>{"use strict";Object.defineProperty(nm,"__esModule",{value:true});var rl=G();var go=rl.operators;var nl={maximum:{okStr:"<=",ok:go.LTE,fail:go.GT},minimum:{okStr:">=",ok:go.GTE,fail:go.LT},exclusiveMaximum:{okStr:"<",ok:go.LT,fail:go.GTE},exclusiveMinimum:{okStr:">",ok:go.GT,fail:go.LTE}};var SN={message:({keyword:e,schemaCode:t})=>(0,rl.str)`must be ${nl[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,rl._)`{comparison: ${nl[e].okStr}, limit: ${t}}`};var TN={keyword:Object.keys(nl),type:"number",schemaType:"number",$data:true,error:SN,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,rl._)`${r} ${nl[t].fail} ${n} || isNaN(${r})`)}};nm.default=TN});var ES=R(om=>{"use strict";Object.defineProperty(om,"__esModule",{value:true});var Va=G();var PN={message:({schemaCode:e})=>(0,Va.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Va._)`{multipleOf: ${e}}`};var ON={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:PN,code(e){const{gen:t,data:r,schemaCode:n,it:o}=e;const i=o.opts.multipleOfPrecision;const s=t.let("res");const a=i?(0,Va._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Va._)`${s} !== parseInt(${s})`;e.fail$data((0,Va._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};om.default=ON});var CS=R(im=>{"use strict";Object.defineProperty(im,"__esModule",{value:true});function zS(e){const t=e.length;let r=0;let n=0;let o;while(n<t){r++;o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<t){o=e.charCodeAt(n);if((o&64512)===56320)n++}}return r}im.default=zS;zS.code='require("ajv/dist/runtime/ucs2length").default'});var NS=R(sm=>{"use strict";Object.defineProperty(sm,"__esModule",{value:true});var di=G();var vN=pe();var $N=CS();var kN={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,di.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,di._)`{limit: ${e}}`};var RN={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:kN,code(e){const{keyword:t,data:r,schemaCode:n,it:o}=e;const i=t==="maxLength"?di.operators.GT:di.operators.LT;const s=o.opts.unicode===false?(0,di._)`${r}.length`:(0,di._)`${(0,vN.useFunc)(e.gen,$N.default)}(${r})`;e.fail$data((0,di._)`${s} ${i} ${n}`)}};sm.default=RN});var FS=R(am=>{"use strict";Object.defineProperty(am,"__esModule",{value:true});var MN=$r();var AN=pe();var xs=G();var EN={message:({schemaCode:e})=>(0,xs.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,xs._)`{pattern: ${e}}`};var zN={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:EN,code(e){const{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:s}=e;const a=s.opts.unicodeRegExp?"u":"";if(n){const{regExp:c}=s.opts.code;const l=c.code==="new RegExp"?(0,xs._)`new RegExp`:(0,AN.useFunc)(t,c);const u=t.let("valid");t.try(()=>t.assign(u,(0,xs._)`${l}(${i}, ${a}).test(${r})`),()=>t.assign(u,false));e.fail$data((0,xs._)`!${u}`)}else{const c=(0,MN.usePattern)(e,o);e.fail$data((0,xs._)`!${c}.test(${r})`)}}};am.default=zN});var jS=R(cm=>{"use strict";Object.defineProperty(cm,"__esModule",{value:true});var Ha=G();var CN={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,Ha.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Ha._)`{limit: ${e}}`};var NN={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:CN,code(e){const{keyword:t,data:r,schemaCode:n}=e;const o=t==="maxProperties"?Ha.operators.GT:Ha.operators.LT;e.fail$data((0,Ha._)`Object.keys(${r}).length ${o} ${n}`)}};cm.default=NN});var DS=R(um=>{"use strict";Object.defineProperty(um,"__esModule",{value:true});var Wa=$r();var Ja=G();var FN=pe();var jN={message:({params:{missingProperty:e}})=>(0,Ja.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Ja._)`{missingProperty: ${e}}`};var DN={keyword:"required",type:"object",schemaType:"array",$data:true,error:jN,code(e){const{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:s}=e;const{opts:a}=s;if(!i&&r.length===0)return;const c=r.length>=a.loopRequired;if(s.allErrors)l();else u();if(a.strictRequired){const m=e.parentSchema.properties;const{definedProperties:p}=e.it;for(const f of r){if((m===null||m===void 0?void 0:m[f])===void 0&&!p.has(f)){const g=s.schemaEnv.baseId+s.errSchemaPath;const _=`required property "${f}" is not defined at "${g}" (strictRequired)`;(0,FN.checkStrictMode)(s,_,s.opts.strictRequired)}}}function l(){if(c||i){e.block$data(Ja.nil,d)}else{for(const m of r){(0,Wa.checkReportMissingProp)(e,m)}}}function u(){const m=t.let("missing");if(c||i){const p=t.let("valid",true);e.block$data(p,()=>h(m,p));e.ok(p)}else{t.if((0,Wa.checkMissingProp)(e,r,m));(0,Wa.reportMissingProp)(e,m);t.else()}}function d(){t.forOf("prop",n,m=>{e.setParams({missingProperty:m});t.if((0,Wa.noPropertyInData)(t,o,m,a.ownProperties),()=>e.error())})}function h(m,p){e.setParams({missingProperty:m});t.forOf(m,n,()=>{t.assign(p,(0,Wa.propertyInData)(t,o,m,a.ownProperties));t.if((0,Ja.not)(p),()=>{e.error();t.break()})},Ja.nil)}}};um.default=DN});var US=R(lm=>{"use strict";Object.defineProperty(lm,"__esModule",{value:true});var Xa=G();var UN={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,Xa.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Xa._)`{limit: ${e}}`};var LN={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:UN,code(e){const{keyword:t,data:r,schemaCode:n}=e;const o=t==="maxItems"?Xa.operators.GT:Xa.operators.LT;e.fail$data((0,Xa._)`${r}.length ${o} ${n}`)}};lm.default=LN});var ol=R(dm=>{"use strict";Object.defineProperty(dm,"__esModule",{value:true});var LS=Rf();LS.code='require("ajv/dist/runtime/equal").default';dm.default=LS});var qS=R(fm=>{"use strict";Object.defineProperty(fm,"__esModule",{value:true});var pm=Na();var Pt=G();var qN=pe();var KN=ol();var ZN={message:({params:{i:e,j:t}})=>(0,Pt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Pt._)`{i: ${e}, j: ${t}}`};var BN={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:ZN,code(e){const{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=e;if(!n&&!o)return;const c=t.let("valid");const l=i.items?(0,pm.getSchemaTypes)(i.items):[];e.block$data(c,u,(0,Pt._)`${s} === false`);e.ok(c);function u(){const p=t.let("i",(0,Pt._)`${r}.length`);const f=t.let("j");e.setParams({i:p,j:f});t.assign(c,true);t.if((0,Pt._)`${p} > 1`,()=>(d()?h:m)(p,f))}function d(){return l.length>0&&!l.some(p=>p==="object"||p==="array")}function h(p,f){const g=t.name("item");const _=(0,pm.checkDataTypes)(l,g,a.opts.strictNumbers,pm.DataType.Wrong);const b=t.const("indices",(0,Pt._)`{}`);t.for((0,Pt._)`;${p}--;`,()=>{t.let(g,(0,Pt._)`${r}[${p}]`);t.if(_,(0,Pt._)`continue`);if(l.length>1)t.if((0,Pt._)`typeof ${g} == "string"`,(0,Pt._)`${g} += "_"`);t.if((0,Pt._)`typeof ${b}[${g}] == "number"`,()=>{t.assign(f,(0,Pt._)`${b}[${g}]`);e.error();t.assign(c,false).break()}).code((0,Pt._)`${b}[${g}] = ${p}`)})}function m(p,f){const g=(0,qN.useFunc)(t,KN.default);const _=t.name("outer");t.label(_).for((0,Pt._)`;${p}--;`,()=>t.for((0,Pt._)`${f} = ${p}; ${f}--;`,()=>t.if((0,Pt._)`${g}(${r}[${p}], ${r}[${f}])`,()=>{e.error();t.assign(c,false).break(_)})))}}};fm.default=BN});var KS=R(hm=>{"use strict";Object.defineProperty(hm,"__esModule",{value:true});var mm=G();var GN=pe();var VN=ol();var HN={message:"must be equal to constant",params:({schemaCode:e})=>(0,mm._)`{allowedValue: ${e}}`};var WN={keyword:"const",$data:true,error:HN,code(e){const{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;if(n||i&&typeof i=="object"){e.fail$data((0,mm._)`!${(0,GN.useFunc)(t,VN.default)}(${r}, ${o})`)}else{e.fail((0,mm._)`${i} !== ${r}`)}}};hm.default=WN});var ZS=R(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:true});var Ya=G();var JN=pe();var XN=ol();var YN={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ya._)`{allowedValues: ${e}}`};var QN={keyword:"enum",schemaType:"array",$data:true,error:YN,code(e){const{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:s}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");const a=o.length>=s.opts.loopEnum;let c;const l=()=>c!==null&&c!==void 0?c:c=(0,JN.useFunc)(t,XN.default);let u;if(a||n){u=t.let("valid");e.block$data(u,d)}else{if(!Array.isArray(o))throw new Error("ajv implementation error");const m=t.const("vSchema",i);u=(0,Ya.or)(...o.map((p,f)=>h(m,f)))}e.pass(u);function d(){t.assign(u,false);t.forOf("v",i,m=>t.if((0,Ya._)`${l()}(${r}, ${m})`,()=>t.assign(u,true).break()))}function h(m,p){const f=o[p];return typeof f==="object"&&f!==null?(0,Ya._)`${l()}(${r}, ${m}[${p}])`:(0,Ya._)`${r} === ${f}`}}};gm.default=QN});var BS=R(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:true});var eF=AS();var tF=ES();var rF=NS();var nF=FS();var oF=jS();var iF=DS();var sF=US();var aF=qS();var cF=KS();var uF=ZS();var lF=[eF.default,tF.default,rF.default,nF.default,oF.default,iF.default,sF.default,aF.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},cF.default,uF.default];ym.default=lF});var xm=R(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:true});Qa.validateAdditionalItems=void 0;var pi=G();var _m=pe();var dF={message:({params:{len:e}})=>(0,pi.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,pi._)`{limit: ${e}}`};var pF={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:dF,code(e){const{parentSchema:t,it:r}=e;const{items:n}=t;if(!Array.isArray(n)){(0,_m.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}GS(e,n)}};function GS(e,t){const{gen:r,schema:n,data:o,keyword:i,it:s}=e;s.items=true;const a=r.const("len",(0,pi._)`${o}.length`);if(n===false){e.setParams({len:t.length});e.pass((0,pi._)`${a} <= ${t.length}`)}else if(typeof n=="object"&&!(0,_m.alwaysValidSchema)(s,n)){const l=r.var("valid",(0,pi._)`${a} <= ${t.length}`);r.if((0,pi.not)(l),()=>c(l));e.ok(l)}function c(l){r.forRange("i",t.length,a,u=>{e.subschema({keyword:i,dataProp:u,dataPropType:_m.Type.Num},l);if(!s.allErrors)r.if((0,pi.not)(l),()=>r.break())})}}Qa.validateAdditionalItems=GS;Qa.default=pF});var bm=R(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:true});ec.validateTuple=void 0;var VS=G();var il=pe();var fF=$r();var mF={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return HS(e,"additionalItems",t);r.items=true;if((0,il.alwaysValidSchema)(r,t))return;e.ok((0,fF.validateArray)(e))}};function HS(e,t,r=e.schema){const{gen:n,parentSchema:o,data:i,keyword:s,it:a}=e;u(o);if(a.opts.unevaluated&&r.length&&a.items!==true){a.items=il.mergeEvaluated.items(n,r.length,a.items)}const c=n.name("valid");const l=n.const("len",(0,VS._)`${i}.length`);r.forEach((d,h)=>{if((0,il.alwaysValidSchema)(a,d))return;n.if((0,VS._)`${l} > ${h}`,()=>e.subschema({keyword:s,schemaProp:h,dataProp:h},c));e.ok(c)});function u(d){const{opts:h,errSchemaPath:m}=a;const p=r.length;const f=p===d.minItems&&(p===d.maxItems||d[t]===false);if(h.strictTuples&&!f){const g=`"${s}" is ${p}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,il.checkStrictMode)(a,g,h.strictTuples)}}}ec.validateTuple=HS;ec.default=mF});var WS=R(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:true});var hF=bm();var gF={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,hF.validateTuple)(e,"items")};Im.default=gF});var XS=R(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:true});var JS=G();var yF=pe();var _F=$r();var xF=xm();var bF={message:({params:{len:e}})=>(0,JS.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,JS._)`{limit: ${e}}`};var IF={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:bF,code(e){const{schema:t,parentSchema:r,it:n}=e;const{prefixItems:o}=r;n.items=true;if((0,yF.alwaysValidSchema)(n,t))return;if(o)(0,xF.validateAdditionalItems)(e,o);else e.ok((0,_F.validateArray)(e))}};wm.default=IF});var YS=R(Sm=>{"use strict";Object.defineProperty(Sm,"__esModule",{value:true});var Rr=G();var sl=pe();var wF={message:({params:{min:e,max:t}})=>t===void 0?(0,Rr.str)`must contain at least ${e} valid item(s)`:(0,Rr.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Rr._)`{minContains: ${e}}`:(0,Rr._)`{minContains: ${e}, maxContains: ${t}}`};var SF={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:wF,code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;let s;let a;const{minContains:c,maxContains:l}=n;if(i.opts.next){s=c===void 0?1:c;a=l}else{s=1}const u=t.const("len",(0,Rr._)`${o}.length`);e.setParams({min:s,max:a});if(a===void 0&&s===0){(0,sl.checkStrictMode)(i,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(a!==void 0&&s>a){(0,sl.checkStrictMode)(i,`"minContains" > "maxContains" is always invalid`);e.fail();return}if((0,sl.alwaysValidSchema)(i,r)){let f=(0,Rr._)`${u} >= ${s}`;if(a!==void 0)f=(0,Rr._)`${f} && ${u} <= ${a}`;e.pass(f);return}i.items=true;const d=t.name("valid");if(a===void 0&&s===1){m(d,()=>t.if(d,()=>t.break()))}else if(s===0){t.let(d,true);if(a!==void 0)t.if((0,Rr._)`${o}.length > 0`,h)}else{t.let(d,false);h()}e.result(d,()=>e.reset());function h(){const f=t.name("_valid");const g=t.let("count",0);m(f,()=>t.if(f,()=>p(g)))}function m(f,g){t.forRange("i",0,u,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:sl.Type.Num,compositeRule:true},f);g()})}function p(f){t.code((0,Rr._)`${f}++`);if(a===void 0){t.if((0,Rr._)`${f} >= ${s}`,()=>t.assign(d,true).break())}else{t.if((0,Rr._)`${f} > ${a}`,()=>t.assign(d,false).break());if(s===1)t.assign(d,true);else t.if((0,Rr._)`${f} >= ${s}`,()=>t.assign(d,true))}}}};Sm.default=SF});var tT=R(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:true});In.validateSchemaDeps=In.validatePropertyDeps=In.error=void 0;var Tm=G();var TF=pe();var tc=$r();In.error={message:({params:{property:e,depsCount:t,deps:r}})=>{const n=t===1?"property":"properties";return(0,Tm.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Tm._)`{property: ${e},
|
|
6
|
+
missingProperty: ${n},
|
|
7
|
+
depsCount: ${t},
|
|
8
|
+
deps: ${r}}`};var PF={keyword:"dependencies",type:"object",schemaType:"object",error:In.error,code(e){const[t,r]=OF(e);QS(e,t);eT(e,r)}};function OF({schema:e}){const t={};const r={};for(const n in e){if(n==="__proto__")continue;const o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function QS(e,t=e.schema){const{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;const i=r.let("missing");for(const s in t){const a=t[s];if(a.length===0)continue;const c=(0,tc.propertyInData)(r,n,s,o.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")});if(o.allErrors){r.if(c,()=>{for(const l of a){(0,tc.checkReportMissingProp)(e,l)}})}else{r.if((0,Tm._)`${c} && (${(0,tc.checkMissingProp)(e,a,i)})`);(0,tc.reportMissingProp)(e,i);r.else()}}}In.validatePropertyDeps=QS;function eT(e,t=e.schema){const{gen:r,data:n,keyword:o,it:i}=e;const s=r.name("valid");for(const a in t){if((0,TF.alwaysValidSchema)(i,t[a]))continue;r.if((0,tc.propertyInData)(r,n,a,i.opts.ownProperties),()=>{const c=e.subschema({keyword:o,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,true));e.ok(s)}}In.validateSchemaDeps=eT;In.default=PF});var nT=R(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:true});var rT=G();var vF=pe();var $F={message:"property name must be valid",params:({params:e})=>(0,rT._)`{propertyName: ${e.propertyName}}`};var kF={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:$F,code(e){const{gen:t,schema:r,data:n,it:o}=e;if((0,vF.alwaysValidSchema)(o,r))return;const i=t.name("valid");t.forIn("key",n,s=>{e.setParams({propertyName:s});e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:true},i);t.if((0,rT.not)(i),()=>{e.error(true);if(!o.allErrors)t.break()})});e.ok(i)}};Pm.default=kF});var vm=R(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:true});var al=$r();var Vr=G();var RF=Dn();var cl=pe();var MF={message:"must NOT have additional properties",params:({params:e})=>(0,Vr._)`{additionalProperty: ${e.additionalProperty}}`};var AF={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:MF,code(e){const{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:a,opts:c}=s;s.props=true;if(c.removeAdditional!=="all"&&(0,cl.alwaysValidSchema)(s,r))return;const l=(0,al.allSchemaProperties)(n.properties);const u=(0,al.allSchemaProperties)(n.patternProperties);d();e.ok((0,Vr._)`${i} === ${RF.default.errors}`);function d(){t.forIn("key",o,g=>{if(!l.length&&!u.length)p(g);else t.if(h(g),()=>p(g))})}function h(g){let _;if(l.length>8){const b=(0,cl.schemaRefOrVal)(s,n.properties,"properties");_=(0,al.isOwnProperty)(t,b,g)}else if(l.length){_=(0,Vr.or)(...l.map(b=>(0,Vr._)`${g} === ${b}`))}else{_=Vr.nil}if(u.length){_=(0,Vr.or)(_,...u.map(b=>(0,Vr._)`${(0,al.usePattern)(e,b)}.test(${g})`))}return(0,Vr.not)(_)}function m(g){t.code((0,Vr._)`delete ${o}[${g}]`)}function p(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===false){m(g);return}if(r===false){e.setParams({additionalProperty:g});e.error();if(!a)t.break();return}if(typeof r=="object"&&!(0,cl.alwaysValidSchema)(s,r)){const _=t.name("valid");if(c.removeAdditional==="failing"){f(g,_,false);t.if((0,Vr.not)(_),()=>{e.reset();m(g)})}else{f(g,_);if(!a)t.if((0,Vr.not)(_),()=>t.break())}}}function f(g,_,b){const v={keyword:"additionalProperties",dataProp:g,dataPropType:cl.Type.Str};if(b===false){Object.assign(v,{compositeRule:true,createErrors:false,allErrors:false})}e.subschema(v,_)}}};Om.default=AF});var sT=R(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:true});var EF=Ua();var oT=$r();var $m=pe();var iT=vm();var zF={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;if(i.opts.removeAdditional==="all"&&n.additionalProperties===void 0){iT.default.code(new EF.KeywordCxt(i,iT.default,"additionalProperties"))}const s=(0,oT.allSchemaProperties)(r);for(const d of s){i.definedProperties.add(d)}if(i.opts.unevaluated&&s.length&&i.props!==true){i.props=$m.mergeEvaluated.props(t,(0,$m.toHash)(s),i.props)}const a=s.filter(d=>!(0,$m.alwaysValidSchema)(i,r[d]));if(a.length===0)return;const c=t.name("valid");for(const d of a){if(l(d)){u(d)}else{t.if((0,oT.propertyInData)(t,o,d,i.opts.ownProperties));u(d);if(!i.allErrors)t.else().var(c,true);t.endIf()}e.it.definedProperties.add(d);e.ok(c)}function l(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};km.default=zF});var lT=R(Rm=>{"use strict";Object.defineProperty(Rm,"__esModule",{value:true});var aT=$r();var ul=G();var cT=pe();var uT=pe();var CF={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:o,it:i}=e;const{opts:s}=i;const a=(0,aT.allSchemaProperties)(r);const c=a.filter(f=>(0,cT.alwaysValidSchema)(i,r[f]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===true)){return}const l=s.strictSchema&&!s.allowMatchingProperties&&o.properties;const u=t.name("valid");if(i.props!==true&&!(i.props instanceof ul.Name)){i.props=(0,uT.evaluatedPropsToName)(t,i.props)}const{props:d}=i;h();function h(){for(const f of a){if(l)m(f);if(i.allErrors){p(f)}else{t.var(u,true);p(f);t.if(u)}}}function m(f){for(const g in l){if(new RegExp(f).test(g)){(0,cT.checkStrictMode)(i,`property ${g} matches pattern ${f} (use allowMatchingProperties)`)}}}function p(f){t.forIn("key",n,g=>{t.if((0,ul._)`${(0,aT.usePattern)(e,f)}.test(${g})`,()=>{const _=c.includes(f);if(!_){e.subschema({keyword:"patternProperties",schemaProp:f,dataProp:g,dataPropType:uT.Type.Str},u)}if(i.opts.unevaluated&&d!==true){t.assign((0,ul._)`${d}[${g}]`,true)}else if(!_&&!i.allErrors){t.if((0,ul.not)(u),()=>t.break())}})})}}};Rm.default=CF});var dT=R(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:true});var NF=pe();var FF={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(e){const{gen:t,schema:r,it:n}=e;if((0,NF.alwaysValidSchema)(n,r)){e.fail();return}const o=t.name("valid");e.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},o);e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Mm.default=FF});var pT=R(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:true});var jF=$r();var DF={keyword:"anyOf",schemaType:"array",trackErrors:true,code:jF.validateUnion,error:{message:"must match a schema in anyOf"}};Am.default=DF});var fT=R(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:true});var ll=G();var UF=pe();var LF={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,ll._)`{passingSchemas: ${e.passing}}`};var qF={keyword:"oneOf",schemaType:"array",trackErrors:true,error:LF,code(e){const{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;const i=r;const s=t.let("valid",false);const a=t.let("passing",null);const c=t.name("_valid");e.setParams({passing:a});t.block(l);e.result(s,()=>e.reset(),()=>e.error(true));function l(){i.forEach((u,d)=>{let h;if((0,UF.alwaysValidSchema)(o,u)){t.var(c,true)}else{h=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:true},c)}if(d>0){t.if((0,ll._)`${c} && ${s}`).assign(s,false).assign(a,(0,ll._)`[${a}, ${d}]`).else()}t.if(c,()=>{t.assign(s,true);t.assign(a,d);if(h)e.mergeEvaluated(h,ll.Name)})})}}};Em.default=qF});var mT=R(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:true});var KF=pe();var ZF={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach((i,s)=>{if((0,KF.alwaysValidSchema)(n,i))return;const a=e.subschema({keyword:"allOf",schemaProp:s},o);e.ok(o);e.mergeEvaluated(a)})}};zm.default=ZF});var yT=R(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:true});var dl=G();var gT=pe();var BF={message:({params:e})=>(0,dl.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,dl._)`{failingKeyword: ${e.ifClause}}`};var GF={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:BF,code(e){const{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0){(0,gT.checkStrictMode)(n,'"if" without "then" and "else" is ignored')}const o=hT(n,"then");const i=hT(n,"else");if(!o&&!i)return;const s=t.let("valid",true);const a=t.name("_valid");c();e.reset();if(o&&i){const u=t.let("ifClause");e.setParams({ifClause:u});t.if(a,l("then",u),l("else",u))}else if(o){t.if(a,l("then"))}else{t.if((0,dl.not)(a),l("else"))}e.pass(s,()=>e.error(true));function c(){const u=e.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},a);e.mergeEvaluated(u)}function l(u,d){return()=>{const h=e.subschema({keyword:u},a);t.assign(s,a);e.mergeValidEvaluated(h,s);if(d)t.assign(d,(0,dl._)`${u}`);else e.setParams({ifClause:u})}}}};function hT(e,t){const r=e.schema[t];return r!==void 0&&!(0,gT.alwaysValidSchema)(e,r)}Cm.default=GF});var _T=R(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:true});var VF=pe();var HF={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,VF.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Nm.default=HF});var xT=R(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:true});var WF=xm();var JF=WS();var XF=bm();var YF=XS();var QF=YS();var e1=tT();var t1=nT();var r1=vm();var n1=sT();var o1=lT();var i1=dT();var s1=pT();var a1=fT();var c1=mT();var u1=yT();var l1=_T();function d1(e=false){const t=[i1.default,s1.default,a1.default,c1.default,u1.default,l1.default,t1.default,r1.default,e1.default,n1.default,o1.default];if(e)t.push(JF.default,YF.default);else t.push(WF.default,XF.default);t.push(QF.default);return t}Fm.default=d1});var bT=R(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:true});var tt=G();var p1={message:({schemaCode:e})=>(0,tt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,tt._)`{format: ${e}}`};var f1={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:p1,code(e,t){const{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=e;const{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;if(o)h();else m();function h(){const p=r.scopeValue("formats",{ref:d.formats,code:c.code.formats});const f=r.const("fDef",(0,tt._)`${p}[${s}]`);const g=r.let("fType");const _=r.let("format");r.if((0,tt._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(g,(0,tt._)`${f}.type || "string"`).assign(_,(0,tt._)`${f}.validate`),()=>r.assign(g,(0,tt._)`"string"`).assign(_,f));e.fail$data((0,tt.or)(b(),v()));function b(){if(c.strictSchema===false)return tt.nil;return(0,tt._)`${s} && !${_}`}function v(){const A=u.$async?(0,tt._)`(${f}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,tt._)`${_}(${n})`;const $=(0,tt._)`(typeof ${_} == "function" ? ${A} : ${_}.test(${n}))`;return(0,tt._)`${_} && ${_} !== true && ${g} === ${t} && !${$}`}}function m(){const p=d.formats[i];if(!p){b();return}if(p===true)return;const[f,g,_]=v(p);if(f===t)e.pass(A());function b(){if(c.strictSchema===false){d.logger.warn($());return}throw new Error($());function $(){return`unknown format "${i}" ignored in schema at path "${l}"`}}function v($){const te=$ instanceof RegExp?(0,tt.regexpCode)($):c.code.formats?(0,tt._)`${c.code.formats}${(0,tt.getProperty)(i)}`:void 0;const st=r.scopeValue("formats",{key:i,ref:$,code:te});if(typeof $=="object"&&!($ instanceof RegExp)){return[$.type||"string",$.validate,(0,tt._)`${st}.validate`]}return["string",$,st]}function A(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!u.$async)throw new Error("async format in sync schema");return(0,tt._)`await ${_}(${n})`}return typeof g=="function"?(0,tt._)`${_}(${n})`:(0,tt._)`${_}.test(${n})`}}}};jm.default=f1});var IT=R(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:true});var m1=bT();var h1=[m1.default];Dm.default=h1});var wT=R(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:true});bs.contentVocabulary=bs.metadataVocabulary=void 0;bs.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];bs.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var TT=R(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:true});var g1=MS();var y1=BS();var _1=xT();var x1=IT();var ST=wT();var b1=[g1.default,y1.default,(0,_1.default)(),x1.default,ST.metadataVocabulary,ST.contentVocabulary];Um.default=b1});var OT=R(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:true});pl.DiscrError=void 0;var PT;(function(e){e["Tag"]="tag";e["Mapping"]="mapping"})(PT||(pl.DiscrError=PT={}))});var $T=R(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:true});var Is=G();var Lm=OT();var vT=Vu();var I1=La();var w1=pe();var S1={message:({params:{discrError:e,tagName:t}})=>e===Lm.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Is._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`};var T1={keyword:"discriminator",type:"object",schemaType:"object",error:S1,code(e){const{gen:t,data:r,schema:n,parentSchema:o,it:i}=e;const{oneOf:s}=o;if(!i.opts.discriminator){throw new Error("discriminator: requires discriminator option")}const a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",false);const l=t.const("tag",(0,Is._)`${r}${(0,Is.getProperty)(a)}`);t.if((0,Is._)`typeof ${l} == "string"`,()=>u(),()=>e.error(false,{discrError:Lm.DiscrError.Tag,tag:l,tagName:a}));e.ok(c);function u(){const m=h();t.if(false);for(const p in m){t.elseIf((0,Is._)`${l} === ${p}`);t.assign(c,d(m[p]))}t.else();e.error(false,{discrError:Lm.DiscrError.Mapping,tag:l,tagName:a});t.endIf()}function d(m){const p=t.name("valid");const f=e.subschema({keyword:"oneOf",schemaProp:m},p);e.mergeEvaluated(f,Is.Name);return p}function h(){var m;const p={};const f=_(o);let g=true;for(let A=0;A<s.length;A++){let $=s[A];if(($===null||$===void 0?void 0:$.$ref)&&!(0,w1.schemaHasRulesButRef)($,i.self.RULES)){const st=$.$ref;$=vT.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,st);if($ instanceof vT.SchemaEnv)$=$.schema;if($===void 0)throw new I1.default(i.opts.uriResolver,i.baseId,st)}const te=(m=$===null||$===void 0?void 0:$.properties)===null||m===void 0?void 0:m[a];if(typeof te!="object"){throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`)}g=g&&(f||_($));b(te,A)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return p;function _({required:A}){return Array.isArray(A)&&A.includes(a)}function b(A,$){if(A.const){v(A.const,$)}else if(A.enum){for(const te of A.enum){v(te,$)}}else{throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}}function v(A,$){if(typeof A!="string"||A in p){throw new Error(`discriminator: "${a}" values must be unique strings`)}p[A]=$}}}};qm.default=T1});var kT=R((yW,P1)=>{P1.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:true,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:true,readOnly:{type:"boolean",default:false},examples:{type:"array",items:true},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:true},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:false},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:true,enum:{type:"array",items:true,minItems:1,uniqueItems:true},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:true}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:true}});var Zm=R((De,Km)=>{"use strict";Object.defineProperty(De,"__esModule",{value:true});De.MissingRefError=De.ValidationError=De.CodeGen=De.Name=De.nil=De.stringify=De.str=De._=De.KeywordCxt=De.Ajv=void 0;var O1=PS();var v1=TT();var $1=$T();var RT=kT();var k1=["/properties"];var fl="http://json-schema.org/draft-07/schema";var ws=class extends O1.default{_addVocabularies(){super._addVocabularies();v1.default.forEach(t=>this.addVocabulary(t));if(this.opts.discriminator)this.addKeyword($1.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();if(!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(RT,k1):RT;this.addMetaSchema(t,fl,false);this.refs["http://json-schema.org/schema"]=fl}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(fl)?fl:void 0)}};De.Ajv=ws;Km.exports=De=ws;Km.exports.Ajv=ws;Object.defineProperty(De,"__esModule",{value:true});De.default=ws;var R1=Ua();Object.defineProperty(De,"KeywordCxt",{enumerable:true,get:function(){return R1.KeywordCxt}});var Ss=G();Object.defineProperty(De,"_",{enumerable:true,get:function(){return Ss._}});Object.defineProperty(De,"str",{enumerable:true,get:function(){return Ss.str}});Object.defineProperty(De,"stringify",{enumerable:true,get:function(){return Ss.stringify}});Object.defineProperty(De,"nil",{enumerable:true,get:function(){return Ss.nil}});Object.defineProperty(De,"Name",{enumerable:true,get:function(){return Ss.Name}});Object.defineProperty(De,"CodeGen",{enumerable:true,get:function(){return Ss.CodeGen}});var M1=Bu();Object.defineProperty(De,"ValidationError",{enumerable:true,get:function(){return M1.default}});var A1=La();Object.defineProperty(De,"MissingRefError",{enumerable:true,get:function(){return A1.default}})});var jT=R(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:true});Sn.formatNames=Sn.fastFormats=Sn.fullFormats=void 0;function wn(e,t){return{validate:e,compare:t}}Sn.fullFormats={date:wn(zT,Hm),time:wn(Gm(true),Wm),"date-time":wn(MT(true),NT),"iso-time":wn(Gm(),CT),"iso-date-time":wn(MT(),FT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:j1,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:B1,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:D1,int32:{type:"number",validate:q1},int64:{type:"number",validate:K1},float:{type:"number",validate:ET},double:{type:"number",validate:ET},password:true,binary:true};Sn.fastFormats={...Sn.fullFormats,date:wn(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Hm),time:wn(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Wm),"date-time":wn(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,NT),"iso-time":wn(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,CT),"iso-date-time":wn(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,FT),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Sn.formatNames=Object.keys(Sn.fullFormats);function E1(e){return e%4===0&&(e%100!==0||e%400===0)}var z1=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;var C1=[0,31,28,31,30,31,30,31,31,30,31,30,31];function zT(e){const t=z1.exec(e);if(!t)return false;const r=+t[1];const n=+t[2];const o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&E1(r)?29:C1[n])}function Hm(e,t){if(!(e&&t))return void 0;if(e>t)return 1;if(e<t)return-1;return 0}var Bm=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Gm(e){return function t(r){const n=Bm.exec(r);if(!n)return false;const o=+n[1];const i=+n[2];const s=+n[3];const a=n[4];const c=n[5]==="-"?-1:1;const l=+(n[6]||0);const u=+(n[7]||0);if(l>23||u>59||e&&!a)return false;if(o<=23&&i<=59&&s<60)return true;const d=i-u*c;const h=o-l*c-(d<0?1:0);return(h===23||h===-1)&&(d===59||d===-1)&&s<61}}function Wm(e,t){if(!(e&&t))return void 0;const r=new Date("2020-01-01T"+e).valueOf();const n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return void 0;return r-n}function CT(e,t){if(!(e&&t))return void 0;const r=Bm.exec(e);const n=Bm.exec(t);if(!(r&&n))return void 0;e=r[1]+r[2]+r[3];t=n[1]+n[2]+n[3];if(e>t)return 1;if(e<t)return-1;return 0}var Vm=/t|\s/i;function MT(e){const t=Gm(e);return function r(n){const o=n.split(Vm);return o.length===2&&zT(o[0])&&t(o[1])}}function NT(e,t){if(!(e&&t))return void 0;const r=new Date(e).valueOf();const n=new Date(t).valueOf();if(!(r&&n))return void 0;return r-n}function FT(e,t){if(!(e&&t))return void 0;const[r,n]=e.split(Vm);const[o,i]=t.split(Vm);const s=Hm(r,o);if(s===void 0)return void 0;return s||Wm(n,i)}var N1=/\/|:/;var F1=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function j1(e){return N1.test(e)&&F1.test(e)}var AT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function D1(e){AT.lastIndex=0;return AT.test(e)}var U1=-(2**31);var L1=2**31-1;function q1(e){return Number.isInteger(e)&&e<=L1&&e>=U1}function K1(e){return Number.isInteger(e)}function ET(){return true}var Z1=/[^\\]\\Z/;function B1(e){if(Z1.test(e))return false;try{new RegExp(e);return true}catch(t){return false}}});var DT=R(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:true});Ts.formatLimitDefinition=void 0;var G1=Zm();var Hr=G();var yo=Hr.operators;var ml={formatMaximum:{okStr:"<=",ok:yo.LTE,fail:yo.GT},formatMinimum:{okStr:">=",ok:yo.GTE,fail:yo.LT},formatExclusiveMaximum:{okStr:"<",ok:yo.LT,fail:yo.GTE},formatExclusiveMinimum:{okStr:">",ok:yo.GT,fail:yo.LTE}};var V1={message:({keyword:e,schemaCode:t})=>(0,Hr.str)`should be ${ml[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Hr._)`{comparison: ${ml[e].okStr}, limit: ${t}}`};Ts.formatLimitDefinition={keyword:Object.keys(ml),type:"string",schemaType:"string",$data:true,error:V1,code(e){const{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e;const{opts:s,self:a}=i;if(!s.validateFormats)return;const c=new G1.KeywordCxt(i,a.RULES.all.format.definition,"format");if(c.$data)l();else u();function l(){const h=t.scopeValue("formats",{ref:a.formats,code:s.code.formats});const m=t.const("fmt",(0,Hr._)`${h}[${c.schemaCode}]`);e.fail$data((0,Hr.or)((0,Hr._)`typeof ${m} != "object"`,(0,Hr._)`${m} instanceof RegExp`,(0,Hr._)`typeof ${m}.compare != "function"`,d(m)))}function u(){const h=c.schema;const m=a.formats[h];if(!m||m===true)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function"){throw new Error(`"${o}": format "${h}" does not define "compare" function`)}const p=t.scopeValue("formats",{key:h,ref:m,code:s.code.formats?(0,Hr._)`${s.code.formats}${(0,Hr.getProperty)(h)}`:void 0});e.fail$data(d(p))}function d(h){return(0,Hr._)`${h}.compare(${r}, ${n}) ${ml[o].fail} 0`}},dependencies:["format"]};var H1=e=>{e.addKeyword(Ts.formatLimitDefinition);return e};Ts.default=H1});var KT=R((rc,qT)=>{"use strict";Object.defineProperty(rc,"__esModule",{value:true});var Ps=jT();var W1=DT();var Jm=G();var UT=new Jm.Name("fullFormats");var J1=new Jm.Name("fastFormats");var Xm=(e,t={keywords:true})=>{if(Array.isArray(t)){LT(e,t,Ps.fullFormats,UT);return e}const[r,n]=t.mode==="fast"?[Ps.fastFormats,J1]:[Ps.fullFormats,UT];const o=t.formats||Ps.formatNames;LT(e,o,r,n);if(t.keywords)(0,W1.default)(e);return e};Xm.get=(e,t="full")=>{const r=t==="fast"?Ps.fastFormats:Ps.fullFormats;const n=r[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function LT(e,t,r,n){var o;var i;(o=(i=e.opts.code).formats)!==null&&o!==void 0?o:i.formats=(0,Jm._)`require("ajv-formats/dist/formats").${n}`;for(const s of t)e.addFormat(s,r[s])}qT.exports=rc=Xm;Object.defineProperty(rc,"__esModule",{value:true});rc.default=Xm});import{delimiter as F9}from"node:path";var F={};_n(F,{BIGINT_FORMAT_RANGES:()=>Ec,CONSTANT_CATCH:()=>ey,Class:()=>kd,NUMBER_FORMAT_RANGES:()=>ea,aborted:()=>Ur,allowsEval:()=>zd,assert:()=>L$,assertEqual:()=>F$,assertIs:()=>D$,assertNever:()=>U$,assertNotEqual:()=>j$,assignProp:()=>cr,attachSchema:()=>ta,base64ToUint8Array:()=>Yg,base64urlToUint8Array:()=>sk,cached:()=>Hi,captureStackTrace:()=>Mc,cleanEnum:()=>ik,cleanRegex:()=>Qs,clone:()=>Tr,cloneDef:()=>Z$,codePointLength:()=>ra,constantCatch:()=>ty,createTransparentProxy:()=>J$,defineLazy:()=>Bg,defineLazyInternal:()=>ye,derived:()=>lk,esc:()=>Ad,escapeRegex:()=>En,explicitlyAborted:()=>Fd,extend:()=>Q$,finalizeIssue:()=>Lr,floatSafeRemainder:()=>Md,getElementAtPath:()=>B$,getEnumValues:()=>Gi,getLengthableOrigin:()=>na,getParsedType:()=>W$,getSizableOrigin:()=>Xg,hexToUint8Array:()=>ck,hide:()=>Nc,installLazyProp:()=>mk,isObject:()=>ei,isPlainObject:()=>no,issue:()=>Ji,joinValues:()=>Rc,jsonStringifyReplacer:()=>Vi,members:()=>Dd,merge:()=>tk,mergeDefs:()=>An,normalizeParams:()=>N,nullish:()=>Rd,numKeys:()=>H$,objectClone:()=>q$,omit:()=>Y$,optionalKeys:()=>Nd,own:()=>ro,parsedType:()=>jd,partial:()=>rk,pick:()=>X$,prefixIssues:()=>zn,primitiveTypes:()=>Wg,promiseAllObject:()=>G$,propertyKeyTypes:()=>Cd,randomString:()=>V$,rawShape:()=>Wi,required:()=>nk,safeExtend:()=>ek,shallowClone:()=>Hg,sizeCaps:()=>Cc,slugify:()=>Ed,stringifyPrimitive:()=>Ac,toZod:()=>Zg,uint8ArrayToBase64:()=>Qg,uint8ArrayToBase64url:()=>ak,uint8ArrayToHex:()=>uk,unwrapMessage:()=>Bi});function F$(e){return e}function j$(e){return e}function Zg(){return e=>e}function D$(e){}function U$(e){throw new Error("Unexpected value in exhaustive check")}function L$(e){}function Gi(e){const t=Object.values(e).filter(n=>typeof n==="number");const r=Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o);return r}function Rc(e,t="|"){return e.map(r=>Ac(r)).join(t)}function Vi(e,t){if(typeof t==="bigint")return t.toString();return t}var $d=class{constructor(t){this._getter=t;this._value=void 0}get value(){const t=this._getter;if(t!==void 0){this._value=t();this._getter=void 0}return this._value}};function Hi(e){return new $d(e)}function Rd(e){return e===null||e===void 0}function Qs(e){const t=e.startsWith("^")?1:0;const r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Md(e,t){const r=e/t;const n=Math.round(r);const o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}var Kg=Symbol("evaluating");function Bg(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===Kg){return void 0}if(n===void 0){n=Kg;n=r()}return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:true})}function q$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function cr(e,t,r){Object.defineProperty(e,t,{value:r,writable:true,enumerable:true,configurable:true})}function Wi(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Mn(e){return Wi(e._zod.def)??e._zod.def.shape}function Gg(e,t,r){Object.defineProperty(e,t,{get(){const n=r();cr(this,t,n);return n},enumerable:true,configurable:true})}function Vg(e,t,r){if(t in e)cr(e,t,r);else e[t]=r}function Qo(e,t,r,n){const o=Mn(t);for(const i of r){const s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get){Gg(e,i,()=>{const a=t._zod.def.shape[i];return n?n(a,i):a})}else Vg(e,i,n?n(s.value,i):s.value)}}function K$(e,t){for(const r of Reflect.ownKeys(t)){const n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Gg(e,r,()=>t[r]);else Vg(e,r,n.value)}}function An(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Z$(e){return An(e._zod.def)}function B$(e,t){if(!t)return e;return t.reduce((r,n)=>r?.[n],e)}function G$(e){const t=Object.keys(e);const r=t.map(n=>e[n]);return Promise.all(r).then(n=>{const o={};for(let i=0;i<t.length;i++){o[t[i]]=n[i]}return o})}function V$(e=10){const t="abcdefghijklmnopqrstuvwxyz";let r="";for(let n=0;n<e;n++){r+=t[Math.floor(Math.random()*t.length)]}return r}function Ad(e){return JSON.stringify(e)}function Ed(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Mc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ei(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var zd=Hi(()=>{if(Vt.jitless){return false}if(typeof navigator!=="undefined"&&navigator?.userAgent?.includes("Cloudflare")){return false}try{const e=Function;new e("");return true}catch(e){return false}});function no(e){if(ei(e)===false)return false;const t=e.constructor;if(t===void 0)return true;if(typeof t!=="function")return true;const r=t.prototype;if(ei(r)===false)return false;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===false){return false}return true}function Hg(e){if(no(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function H$(e){let t=0;for(const r in e){if(Object.prototype.hasOwnProperty.call(e,r)){t++}}return t}var W$=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e)){return"array"}if(e===null){return"null"}if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function"){return"promise"}if(typeof Map!=="undefined"&&e instanceof Map){return"map"}if(typeof Set!=="undefined"&&e instanceof Set){return"set"}if(typeof Date!=="undefined"&&e instanceof Date){return"date"}if(typeof File!=="undefined"&&e instanceof File){return"file"}return"object";default:throw new Error(`Unknown data type: ${t}`)}};var Cd=new Set(["string","number","symbol"]);var Wg=new Set(["string","number","bigint","boolean","symbol","undefined"]);function En(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Tr(e,t,r){const n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function N(e){const t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}delete t.message;if(typeof t.error==="string")return{...t,error:()=>t.error};return t}function J$(e){let t;return new Proxy({},{get(r,n,o){t??(t=e());return Reflect.get(t,n,o)},set(r,n,o,i){t??(t=e());return Reflect.set(t,n,o,i)},has(r,n){t??(t=e());return Reflect.has(t,n)},deleteProperty(r,n){t??(t=e());return Reflect.deleteProperty(t,n)},ownKeys(r){t??(t=e());return Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){t??(t=e());return Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){t??(t=e());return Reflect.defineProperty(t,n,o)}})}function Ac(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Nd(e){return Object.keys(e).filter(t=>{return e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional"})}var ea=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))();var Ec={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function X$(e,t){const r=e._zod.def;const n=r.checks;const o=n&&n.length>0;if(o){throw new Error(".pick() cannot be used on object schemas containing refinements")}const i={};Qo(i,e,zc(e,t));return Tr(e,An(r,{shape:i,checks:[]}))}function zc(e,t){const r=Mn(e);const n=[];for(const o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable){throw new Error(`Unrecognized key: "${String(o)}"`)}if(t[o])n.push(o)}return n}function Y$(e,t){const r=e._zod.def;const n=r.checks;const o=n&&n.length>0;if(o){throw new Error(".omit() cannot be used on object schemas containing refinements")}const i=new Set(zc(e,t));const s={};Qo(s,e,Reflect.ownKeys(Mn(e)).filter(a=>!i.has(a)));return Tr(e,An(r,{shape:s,checks:[]}))}function Q$(e,t){if(!no(t)){throw new Error("Invalid input to extend: expected a plain object")}const r=e._zod.def.checks;const n=r&&r.length>0;if(n){const o=Mn(e);for(const i of Reflect.ownKeys(t)){if(Object.getOwnPropertyDescriptor(o,i)!==void 0){throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}}}return Tr(e,An(e._zod.def,{shape:Jg(e,t)}))}function Jg(e,t){const r={};Qo(r,e,Reflect.ownKeys(Mn(e)));K$(r,t);return r}function ek(e,t){if(!no(t)){throw new Error("Invalid input to safeExtend: expected a plain object")}return Tr(e,An(e._zod.def,{shape:Jg(e,t)}))}function tk(e,t){if(!t?._zod?.def){throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.")}if(e._zod.def.checks?.length){throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.")}const r={};Qo(r,e,Reflect.ownKeys(Mn(e)));Qo(r,t,Reflect.ownKeys(Mn(t)));const n=An(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Tr(e,n)}function rk(e,t,r,n="partial"){const o=t._zod.def;const i=o.checks;const s=i&&i.length>0;if(s){throw new Error(`.${n}() cannot be used on object schemas containing refinements`)}const a=r?new Set(zc(t,r)):void 0;const c={};Qo(c,t,Reflect.ownKeys(Mn(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l})));return Tr(t,An(t._zod.def,{shape:c,checks:[]}))}function nk(e,t,r){const n=r?new Set(zc(t,r)):void 0;const o={};Qo(o,t,Reflect.ownKeys(Mn(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i}));return Tr(t,An(t._zod.def,{shape:o}))}function Ur(e,t=0){if(e.aborted===true)return true;for(let r=t;r<e.issues.length;r++){if(e.issues[r]?.continue!==true){return true}}return false}function Fd(e,t=0){if(e.aborted===true)return true;for(let r=t;r<e.issues.length;r++){if(e.issues[r]?.continue===false){return true}}return false}function zn(e,t){return t.map(r=>{var n;(n=r).path??(n.path=[]);r.path.unshift(e);return r})}function Bi(e){return typeof e==="string"?e:e?.message}function Cc(e){const t=[];for(const r of e??[]){const n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;const o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function ta(e,t,r){var n;for(let o=t;o<e.length;o++){(n=e[o]).schema??(n.schema=r)}}function Lr(e,t,r){var n;const o=e.inst?._zod?.traits;if(o?.has("$ZodType")){if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst}const i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0;const s=e.message?e.message:Bi(e.inst?._zod.def?.error?.(e))??Bi(i?.(e))??Bi(t?.error?.(e))??Bi(r.customError?.(e))??Bi(r.localeError?.(e))??"Invalid input";const a={};for(const c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}a.path??(a.path=[]);a.message=s;if(t?.reportInput){a.input=e.input}return a}function Xg(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var ok=/[\uD800-\uDBFF]/;function ra(e){const t=e.length;if(!ok.test(e))return t;let r=t;for(let n=0;n<t-1;n++){if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320){r--;n++}}return r}function na(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function jd(e){const t=typeof e;switch(t){case"number":{return Number.isNaN(e)?"nan":"number"}case"object":{if(e===null){return"null"}if(Array.isArray(e)){return"array"}const r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor){return r.constructor.name}}}return t}function Ji(...e){const[t,r,n]=e;if(typeof t==="string"){return{message:t,code:"custom",input:r,inst:n}}return{...t}}function ik(e){return Object.entries(e).filter(([t,r])=>{return Number.isNaN(Number.parseInt(t,10))}).map(t=>t[1])}function Yg(e){const t=atob(e);const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++){r[n]=t.charCodeAt(n)}return r}function Qg(e){let t="";for(let r=0;r<e.length;r++){t+=String.fromCharCode(e[r])}return btoa(t)}function sk(e){const t=e.replace(/-/g,"+").replace(/_/g,"/");const r="=".repeat((4-t.length%4)%4);return Yg(t+r)}function ak(e){return Qg(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ck(e){const t=e.replace(/^0x/,"");if(t.length%2!==0){throw new Error("Invalid hex string length")}const r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2){r[n/2]=Number.parseInt(t.slice(n,n+2),16)}return r}function uk(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var kd=class{constructor(...t){}};function Dd(e,t){for(const r in t){const n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:false});else dk(e,r,n.value)}}function ro(e,t,r,n=true){Object.defineProperty(e,t,{configurable:true,writable:true,enumerable:n,value:r});return r}function Nc(e,t,r){return ro(e,t,r,false)}function lk(e,t){for(const r in e){const n=e[r];Object.defineProperty(t,r,{configurable:true,enumerable:true,get(){return ro(this,r,n(this))},set(o){ro(this,r,o)}})}return t}function dk(e,t,r){Object.defineProperty(e,t,{configurable:true,get(){return this==null?r:ro(this,t,r.bind(this))},set(n){ro(this,t,n)}})}function pk(e,t){const r=Object.getPrototypeOf(e);return t in r?void 0:r}var vd;var to=false;var fk={configurable:true,get(){to=true;return void 0}};function ye(e,t,r){const n=Object.getPrototypeOf(e._zod);if(t in n&&vd!==e._zod){vd=void 0;return}vd=e._zod;Object.defineProperty(n,t,{configurable:true,get(){Object.defineProperty(this,t,fk);const o=to;to=false;try{const i=r(this);if(to)delete this[t];else Object.defineProperty(this,t,{configurable:true,writable:true,value:i});to=to||o;return i}catch(i){delete this[t];to=to||o;throw i}},set(o){Object.defineProperty(this,t,{configurable:true,writable:true,value:o})}})}function mk(e,t,r,n){const o=pk(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:true,get(){const i={configurable:true,writable:true,enumerable:n,value:void 0};Object.defineProperty(this,t,i);i.value=r(this);Object.defineProperty(this,t,i);return i.value},set(i){Object.defineProperty(this,t,{configurable:true,writable:true,enumerable:n,value:i})}})}var ey="~constantCatch";function ty(e){const t=()=>e;t[ey]=true;return t}var ry;var hk=Object.freeze({status:"aborted"});var Ud={value:void 0,enumerable:false};var ny="captureStackTrace"in Error?Error:null;function gk(e){const t=ny;if(t){const r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{ny=null;return new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function T(e,t,r,n){const o={};function i(h){this.def=h;this.constr=d;this.traits=new Set}i.prototype=o;const s=r;const a=s&&new WeakSet;function c(h,m){if(!h._zod){Ud.value=new i(m);try{Object.defineProperty(h,"_zod",Ud)}finally{Ud.value=void 0}}else if(h._zod.traits.has(e)){return}h._zod.traits.add(e);t(h,m);if(a){const f=Object.getPrototypeOf(h);const g=h._zod.constr.prototype;let _=f;while(_&&_!==g)_=Object.getPrototypeOf(_);const b=_??f;if(!a.has(b)){a.add(b);Dd(b,s)}}const p=d.prototype;for(const f in p){if(!Object.prototype.hasOwnProperty.call(p,f))continue;if(!(f in h)){h[f]=p[f].bind(h)}}}const l=n?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(h){const m=n?.Parent?gk(u):this;c(m,h);const p=m._zod.deferred;if(p){for(const g of p){g()}m._zod.deferred=void 0}const f=globalThis.__zod_globalConfig?.postProcessor;if(f)f(m);return m}Object.defineProperty(d,"init",{value:c});Object.defineProperty(d,Symbol.hasInstance,{value:h=>{if(n?.Parent&&h instanceof n.Parent)return true;return h?._zod?.traits?.has(e)}});Object.defineProperty(d,"name",{value:e});return d}var qr=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};var Xi=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`);this.name="ZodEncodeError"}};(ry=globalThis).__zod_globalConfig??(ry.__zod_globalConfig={});var Vt=globalThis.__zod_globalConfig;function Ht(e){if(e)Object.assign(Vt,e);return Vt}function yk(){const e=this._zod;e.message??(e.message=JSON.stringify(e.def,Vi,2));return e.message}function _k(e){this._zod.message=e}var xk={get:yk,set:_k,enumerable:true,configurable:true};var qd={value:void 0,enumerable:false};var oy=new WeakSet([Object.prototype,Error.prototype]);var iy=(e,t)=>{e.name="$ZodError";qd.value=t;Object.defineProperty(e,"issues",qd);qd.value=void 0;Object.defineProperty(e,"message",xk);const r=Object.getPrototypeOf(e);if(!oy.has(r)){oy.add(r);Object.defineProperty(r,"toString",{configurable:true,enumerable:false,get(){const n=()=>this.message;Object.defineProperty(this,"toString",{value:n,configurable:true,writable:true});return n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:true,writable:true})}})}};var sy=T("$ZodError",iy);var ay=T("$ZodError",iy,void 0,{Parent:Error});function bk(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t)){if(t==="__proto__"){Object.defineProperty(e,t,{value:r(),writable:true,enumerable:true,configurable:true})}else{e[t]=r()}}return e[t]}function Kd(e,t=r=>r.message){const r={};const n=[];for(const o of e.issues){if(o.path.length>0){bk(r,o.path[0],()=>[]).push(t(o))}else{n.push(t(o))}}return{formErrors:n,fieldErrors:r}}function Zd(e,t=r=>r.message){const r={_errors:[]};const n=(o,i=[])=>{for(const s of o.issues){if(s.code==="invalid_union"&&s.errors.length){s.errors.map(a=>n({issues:a},[...i,...s.path]))}else if(s.code==="invalid_key"){n({issues:s.issues},[...i,...s.path])}else if(s.code==="invalid_element"){n({issues:s.issues},[...i,...s.path])}else{const a=[...i,...s.path];if(a.length===0){r._errors.push(t(s))}else{let c=r;let l=0;while(l<a.length){const u=a[l];const d=l===a.length-1;if(u==="_errors"){if(d)c._errors.push(t(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u)){Object.defineProperty(c,u,{value:{_errors:[]},enumerable:true,writable:true,configurable:true})}const h=c[u];if(d){h._errors.push(t(s))}c=h;l++}}}}};n(e);return r}function Fc(e,t){return{callee:t?.callee??e,Err:t?.Err}}var jc=e=>{const t=(r,n,o,i)=>{const s=o?{...o,async:false}:{async:false};const a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise){throw new qr}if(a.issues.length){const c=new(i?.Err??e)(a.issues.map(l=>Lr(l,s,Ht())));Mc(c,i?.callee??t);throw c}return a.value};return t};var Dc=e=>{const t=async(r,n,o,i)=>{const s=o?{...o,async:true}:{async:true};let a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){const c=new(i?.Err??e)(a.issues.map(l=>Lr(l,s,Ht())));Mc(c,i?.callee??t);throw c}return a.value};return t};var oa=e=>(t,r,n)=>{const o=n?{...n,async:false}:{async:false};const i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise){throw new qr}return i.issues.length?cy(e,i.issues,o):{success:true,data:i.value}};var Bd=oa(ay);function cy(e,t,r){let n;return{success:false,get error(){if(!n){n=new e(t.map(o=>Lr(o,r,Ht())));t=void 0;r=void 0}return n},set error(o){n=o;t=void 0;r=void 0}}}var Uc=e=>async(t,r,n)=>{const o=n?{...n,async:true}:{async:true};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?cy(e,i.issues,o):{success:true,data:i.value}};var wk=Symbol.for("zod.compile.invalid");var Sk=Symbol.for("zod.compile.fallback");var Lc=((e,t,r)=>{const n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==wk)return true;if(n.definite===true&&r===void 0)return false}return Tk(e,t,r)});function Tk(e,t,r){const n=r?{...r,async:false,abortEarly:true}:{async:false,abortEarly:true};const o=e._zod.bag.fallbackRun;let i;if(o){n[Sk]=true;i=o({value:t,issues:[]},n)}else{i=e._zod.run({value:t,issues:[]},n)}if(i instanceof Promise){throw new qr}return i.issues.length===0}var qc=async(e,t,r)=>{const n=r?{...r,async:true,abortEarly:true}:{async:true,abortEarly:true};let o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0};var uy=e=>{const t=jc(e);const r=(n,o,i,s)=>{const a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,Fc(r,s))};return r};var ly=e=>{const t=jc(e);const r=(n,o,i,s)=>{return t(n,o,i,Fc(r,s))};return r};var dy=e=>{const t=Dc(e);const r=async(n,o,i,s)=>{const a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Fc(r,s))};return r};var py=e=>{const t=Dc(e);const r=async(n,o,i,s)=>{return await t(n,o,i,Fc(r,s))};return r};var fy=e=>(t,r,n)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return oa(e)(t,r,o)};var my=e=>(t,r,n)=>{return oa(e)(t,r,n)};var hy=e=>async(t,r,n)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return Uc(e)(t,r,o)};var gy=e=>async(t,r,n)=>{return Uc(e)(t,r,n)};var yy=/^[cC][0-9a-z]{6,}$/;var _y=/^[0-9a-z]+$/;var xy=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;var by=/^[0-9a-vA-V]{20}$/;var Iy=/^[A-Za-z0-9]{27}$/;var wy=/^[a-zA-Z0-9_-]{21}$/;function Sy(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ty=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Py=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;var Vd=e=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Oy=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Pk=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function vy(){return new RegExp(Pk,"u")}var $y=/^(?:(?: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])$/;var ky=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var Ry=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;var My=/^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;var Ay=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;var Ey=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var zy=/^https?$/;var Cy=/^\+[1-9]\d{6,14}$/;var Ny=`(?:(?:\\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])))`;function Ok(e){return new RegExp(`^${e}$`)}var Fy=Ok(Ny);function Gd(e){const t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;const r=typeof e.precision==="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;return r}function jy(e){return new RegExp(`^${Gd(e)}$`)}function Dy(e){const t=["Z"];if(e.offset)t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);const r=`${Gd({precision:e.precision,seconds:true})}(?:${t.join("|")})`;const n=e.local?`${r}|${Gd({precision:e.precision})}`:r;return new RegExp(`^${Ny}T(?:${n})$`)}var Uy=/^[\s\S]{0,}$/;var Ly=/^-?\d+n?$/;var Hd=/^-?\d+$/;var ia=/^-?\d+(?:\.\d+)?$/;var qy=/^(?:true|false)$/i;var Ky=/^null$/i;var Zy=/^[^A-Z]*$/;var By=/^[^a-z]*$/;var bt=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={});e._zod.def=t;(r=e._zod).onattach??(r.onattach=[])});var Wd=e=>{const t=e.value;return!Rd(t)&&t.length!==void 0};var Kc={number:"number",bigint:"bigint",object:"date"};var Jd=T("$ZodCheckLessThan",(e,t)=>{bt.init(e,t);const r=Kc[typeof t.value];e._zod.check=n=>{if(t.inclusive?n.value<=t.value:n.value<t.value){return}n.issues.push({origin:Kc[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var Xd=T("$ZodCheckGreaterThan",(e,t)=>{bt.init(e,t);const r=Kc[typeof t.value];e._zod.check=n=>{if(t.inclusive?n.value>=t.value:n.value>t.value){return}n.issues.push({origin:Kc[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var Gy=T("$ZodCheckMultipleOf",(e,t)=>{bt.init(e,t);e._zod.check=r=>{if(typeof r.value!==typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");const n=typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Md(r.value,t.value)===0;if(n)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}});var Vy=T("$ZodCheckNumberFormat",(e,t)=>{bt.init(e,t);t.format=t.format||"float64";const r=t.format?.includes("int");const n=r?"int":"number";const[o,i]=ea[t.format];e._zod.check=s=>{const a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:false,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0){s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:true,continue:!t.abort})}else{s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:true,continue:!t.abort})}return}}if(a<o){s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:true,inst:e,continue:!t.abort})}if(a>i){s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:true,inst:e,continue:!t.abort})}}});var Hy=T("$ZodCheckMaxLength",(e,t)=>{var r;bt.init(e,t);(r=e._zod.def).when??(r.when=Wd);e._zod.check=n=>{const o=n.value;const i=o.length;const s=typeof o==="string"&&i>t.maximum?ra(o):i;if(s<=t.maximum)return;const a=na(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:true,input:o,inst:e,continue:!t.abort})}});var Wy=T("$ZodCheckMinLength",(e,t)=>{var r;bt.init(e,t);(r=e._zod.def).when??(r.when=Wd);e._zod.check=n=>{const o=n.value;const i=o.length;const s=typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?ra(o):i;if(s>=t.minimum)return;const a=na(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:true,input:o,inst:e,continue:!t.abort})}});var Jy=T("$ZodCheckLengthEquals",(e,t)=>{var r;bt.init(e,t);(r=e._zod.def).when??(r.when=Wd);e._zod.check=n=>{const o=n.value;const i=o.length;const s=typeof o==="string"&&i>=t.length&&i<=t.length*2?ra(o):i;if(s===t.length)return;const a=na(o);const c=s>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:true,exact:true,input:n.value,inst:e,continue:!t.abort})}});var sa=T("$ZodCheckStringFormat",(e,t)=>{var r,n;bt.init(e,t);if(t.pattern)(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0;if(t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})});var Xy=T("$ZodCheckRegex",(e,t)=>{sa.init(e,t);e._zod.check=r=>{t.pattern.lastIndex=0;if(t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Yy=T("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Zy);sa.init(e,t)});var Qy=T("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=By);sa.init(e,t)});var e_=T("$ZodCheckIncludes",(e,t)=>{bt.init(e,t);const r=En(t.includes);const n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n;e._zod.check=o=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}});var t_=T("$ZodCheckStartsWith",(e,t)=>{bt.init(e,t);const r=new RegExp(`^${En(t.prefix)}.*`);t.pattern??(t.pattern=r);e._zod.check=n=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}});var r_=T("$ZodCheckEndsWith",(e,t)=>{bt.init(e,t);const r=new RegExp(`.*${En(t.suffix)}$`);t.pattern??(t.pattern=r);e._zod.check=n=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var n_=T("$ZodCheckOverwrite",(e,t)=>{bt.init(e,t);e._zod.check=r=>{r.value=t.tx(r.value)}});var Zc=class{constructor(t=[],r={}){this.content=[];this.indent=0;this.args=t;this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t==="function"){t(this,{execution:"sync"});t(this,{execution:"async"});return}const r=t;const n=r.split("\n").filter(s=>s);const o=Math.min(...n.map(s=>s.length-s.trimStart().length));const i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i){this.content.push(s)}}compile(){const t=Function;const r=this?.content??[``];const n=new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
9
|
+
${r.join("\n")}
|
|
10
|
+
};`);return n(...Object.values(this.closed))}};var i_={major:4,minor:6,patch:7};var $e=T("$ZodType",(e,t)=>{var r;e??(e={});e._zod.def=t;e._zod.bag=e._zod.bag||{};e._zod.version=i_;const n=e._zod.def.checks;const o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(const i of o){for(const s of i._zod.onattach){s(e)}}if(o.length===0){(r=e._zod).deferred??(r.deferred=[]);e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse})}else{const i=(a,c,l)=>{if(a.memo)return a;let u=Ur(a);let d;for(const h of c){if(h._zod.def.when){if(Fd(a))continue;const f=h._zod.def.when(a);if(!f)continue}else if(u){continue}const m=a.issues.length;const p=h._zod.check(a);if(p instanceof Promise&&l?.async===false){throw new qr}if(d||p instanceof Promise){d=(d??Promise.resolve()).then(async()=>{await p;const f=a.issues.length;if(f===m)return;ta(a.issues,m,e);if(!u)u=Ur(a,m)})}else{const f=a.issues.length;if(f===m)continue;ta(a.issues,m,e);if(!u)u=Ur(a,m)}}if(d){return d.then(()=>{return a})}return a};const s=(a,c,l)=>{if(Ur(a)){a.aborted=true;return a}const u=i(c,o,l);if(u instanceof Promise){if(l.async===false)throw new qr;return u.then(d=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks){return e._zod.parse(a,c)}if(c.direction==="backward"){const u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:true});if(u instanceof Promise){return u.then(d=>{return s(d,a,c)})}return s(u,a,c)}const l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===false)throw new qr;return l.then(u=>i(u,o,c))}return i(l,o,c)}}},{get"~standard"(){return Nc(this,"~standard",Qd(this))},set"~standard"(e){ro(this,"~standard",e)}});var g_=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Lr(r,t,Ht()))}:{value:e.value};async function vk(e,t){const r={async:true};return g_(await e._zod.run({value:t,issues:[]},r),r)}function Qd(e){return{validate:t=>{const r={async:false};try{const n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return g_(n,r)}catch(n){}return vk(e,t)},vendor:"zod",version:1}}var Hc=T("$ZodString",(e,t)=>{$e.init(e,t);e._zod.pattern=t.pattern??Uy;e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e});return r}});var Ne=T("$ZodStringFormat",(e,t)=>{sa.init(e,t);Hc.init(e,t)});var y_=T("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Py);Ne.init(e,t)});var __=T("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8};const n=r[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Vd(n))}else t.pattern??(t.pattern=Vd());Ne.init(e,t)});var x_=T("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Oy);Ne.init(e,t)});var b_=1;var Gc=2;function I_(e){try{if(typeof URL!=="undefined"&&typeof URL.canParse==="function")return URL.canParse(e);new URL(e);return true}catch{return false}}function $k(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)){return I_(e)||Gc}return kk(e,t)}function kk(e,t){if(!t.normalize&&t.protocol?.source===zy.source&&!/^https?:\/\//i.test(e)){return b_}try{if(typeof URL!=="undefined"){const r=URL;if(typeof r.parse==="function")return r.parse(e)??Gc}return new URL(e)}catch{return Gc}}var Rk=/[\t\n\r]/g;function s_(e){return e.replace(Rk,"")}function Mk(e,t){t.lastIndex=0;return t.test(e.hostname)}function Ak(e,t){t.lastIndex=0;return t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var w_=T("$ZodURL",(e,t)=>{Ne.init(e,t);e._zod.check=r=>{try{const n=r.value.trim();const o=$k(n,t);if(o===b_){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Gc){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===true){r.value=s_(n);return}if(t.hostname&&!Mk(o,t.hostname)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol&&!Ak(o,t.protocol)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}r.value=t.normalize?o.href:s_(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var S_=T("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=vy());Ne.init(e,t)});var T_=T("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?wy:Sy(t.length));Ne.init(e,t)});var P_=T("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=yy);Ne.init(e,t)});var O_=T("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_y);Ne.init(e,t)});var v_=T("$ZodULID",(e,t)=>{t.pattern??(t.pattern=xy);Ne.init(e,t)});var $_=T("$ZodXID",(e,t)=>{t.pattern??(t.pattern=by);Ne.init(e,t)});var k_=T("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Iy);Ne.init(e,t)});var R_=T("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Dy(t));Ne.init(e,t)});var M_=T("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Fy);Ne.init(e,t)});var A_=T("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=jy(t));Ne.init(e,t)});var E_=T("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ty);Ne.init(e,t)});var z_=T("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$y);Ne.init(e,t)});var Ek=/^[0-9a-fA-F:.]+$/;function C_(e){if(!Ek.test(e))return false;return I_(`http://[${e}]`)}var N_=T("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ky);Ne.init(e,t);e._zod.check=r=>{if(!C_(r.value)){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var F_=T("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ry);Ne.init(e,t)});function zk(e){const t=e.split("/");if(t.length!==2)return false;const[r,n]=t;if(!n)return false;const o=Number(n);if(`${o}`!==n)return false;if(o<0||o>128)return false;return C_(r)}var j_=T("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=My);Ne.init(e,t);e._zod.check=r=>{if(!zk(r.value)){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function D_(e){if(e==="")return true;if(/\s/.test(e))return false;if(e.length%4!==0)return false;try{atob(e);return true}catch{return false}}var ep=/^[0-9a-zA-Z+/]*={0,2}$/;var U_=T("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ep);Ne.init(e,t);e._zod.check=r=>{if(D_(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});var Wc=/^[A-Za-z0-9_-]*$/;function Ck(e){if(!Wc.test(e))return false;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/");const r=t.padEnd(Math.ceil(t.length/4)*4,"=");return D_(r)}var L_=T("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Wc);Ne.init(e,t);e._zod.check=r=>{if(Ck(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}});var q_=T("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cy);Ne.init(e,t)});function Nk(e,t=null){try{const r=e.split(".");if(r.length!==3)return false;const[n]=r;if(!n)return false;const o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return false;if(!o.alg)return false;if(t&&(!("alg"in o)||o.alg!==t))return false;return true}catch{return false}}var K_=T("$ZodJWT",(e,t)=>{Ne.init(e,t);e._zod.check=r=>{if(Nk(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var tp=T("$ZodNumber",(e,t)=>{$e.init(e,t);e._zod.pattern=ia;e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}const o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o)){return r}const i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}});return r}});var Z_=T("$ZodNumberFormat",(e,t)=>{Vy.init(e,t);tp.init(e,t)});var B_=T("$ZodBoolean",(e,t)=>{$e.init(e,t);e._zod.pattern=qy;e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}const o=r.value;if(typeof o==="boolean")return r;r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e});return r}});var G_=T("$ZodBigInt",(e,t)=>{$e.init(e,t);e._zod.pattern=Ly;e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(o){}if(typeof r.value==="bigint")return r;r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e});return r}});var V_=T("$ZodNull",(e,t)=>{$e.init(e,t);e._zod.pattern=Ky;e._zod.values=new Set([null]);e._zod.parse=(r,n)=>{const o=r.value;if(o===null)return r;r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e});return r}});var H_=T("$ZodAny",(e,t)=>{$e.init(e,t);e._zod.parse=r=>r});var W_=T("$ZodUnknown",(e,t)=>{$e.init(e,t);e._zod.parse=r=>r});var J_=T("$ZodNever",(e,t)=>{$e.init(e,t);e._zod.parse=(r,n)=>{r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e});return r}});var X_=T("$ZodDate",(e,t)=>{$e.init(e,t);e._zod.parse=(r,n)=>{if(t.coerce){try{r.value=new Date(r.value)}catch(a){}}const o=r.value;const i=o instanceof Date;const s=i&&!Number.isNaN(o.getTime());if(s)return r;r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e});return r}});function Fk(e,t){const r=Cc(e._zod.def.checks);if(!r.length)return;const n=Math.min(...r.map(i=>i[0]));const o=e._zod.parse;e._zod.parse=(i,s)=>{const a=t(i.value);if(a>n&&!s?.skipChecks&&s?.direction!=="backward"){for(const[c,l]of Cc(e._zod.def.checks)){if(a>c&&l._zod.def.when(i)){const u=i.issues.length;l._zod.check(i);i.issues[u].continue=false;ta(i.issues,u,e);return i}}}return o(i,s)}}var jk=e=>Array.isArray(e)?e.length:-1;function a_(e,t,r){if(e.issues.length){t.issues.push(...zn(r,e.issues))}t.value[r]=e.value}var Y_=T("$ZodArray",(e,t)=>{$e.init(e,t);const r=Vt.memoizer;r?.attach(e);e._zod.parse=(n,o)=>{const i=n.value;if(!Array.isArray(i)){n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e});return n}n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);const s=[];const a=o?.abortEarly;for(let c=0;c<i.length;c++){const l=i[c];const u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise){s.push(u.then(d=>a_(d,n,c)))}else{a_(u,n,c);if(a&&u.issues.length!==0&&Ur(u))break}}if(s.length){return Promise.all(s).then(()=>n)}return n};Fk(e,jk)});function Vc(e,t,r,n,o,i){const s=r in n;const a=i==="optional";if(!s&&a&&o==="optional"){return}if(e.issues.length){if(o!==void 0&&a&&!s){return}t.issues.push(...zn(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length){t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]})}return}if(e.value===void 0){if(s||o==="defaulted"&&!a){t.value[r]=void 0}}else{t.value[r]=e.value}}var Dk=[];function Q_(e){const t=Object.keys(e.shape);const r=Object.getOwnPropertySymbols(e.shape);const n=r.length?r:Dk;const o=n.length?[...t,...n]:t;for(const s of o){if(!e.shape?.[s]?._zod?.traits?.has("$ZodType")){throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`)}}const i=Nd(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ex(e,t,r,n,o,i,s){const a=[];const c=o.keySet;const l=o.catchall._zod;const u=l.def.type;const d=l.optin;const h=l.optout;let m=0;for(const p in t){if(s&&r.issues.length!==m){if(Ur(r,m))break;m=r.issues.length}if(c.has(p))continue;if(p==="__proto__"){if(u==="never")a.push(p);continue}if(u==="never"){a.push(p);continue}const f=l.run({value:t[p],issues:[]},n);if(f instanceof Promise){e.push(f.then(g=>Vc(g,r,p,t,d,h)))}else{Vc(f,r,p,t,d,h)}}if(a.length){r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:true})}if(!e.length)return r;return Promise.all(e).then(()=>{return r})}var Uk=T("$ZodObject",(e,t)=>{$e.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");const n=r?.get?r.get.raw:t.shape??{};if(n){const l=()=>{const u={...n};Object.defineProperty(t,"shape",{value:u});l.raw=u;return u};l.raw=n;Object.defineProperty(t,"shape",{get:l})}const o=Hi(()=>Q_(t));ye(e,"propValues",l=>{const u=l.def.shape;const d={};for(const h in u){const m=u[h]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(d,h)){cr(d,h,new Set)}for(const p of m.values)d[h].add(p);if(m.optin!==void 0)d[h].add(void 0)}}return d});const i=ei;const s=t.catchall;let a;const c=Vt.memoizer;c?.attach(e);e._zod.parse=(l,u)=>{a??(a=o.value);const d=l.value;if(!i(d)){l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e});return l}l.value=c?c.alloc(e,l,{},u):{};const h=[];const m=a.shape;const p=u?.abortEarly;let f=l.issues.length;for(const g of a.allKeys){if(p&&l.issues.length!==f){if(Ur(l,f))break;f=l.issues.length}if(g==="__proto__")continue;const _=m[g];const b=_._zod.optin;const v=_._zod.optout;const A=_._zod.run({value:d[g],issues:[]},u);if(A instanceof Promise){h.push(A.then($=>Vc($,l,g,d,b,v)))}else{Vc(A,l,g,d,b,v)}}if(!s){return h.length?Promise.all(h).then(()=>l):l}return ex(h,d,l,u,o.value,e,p===true)}});var tx=T("$ZodObjectJIT",(e,t)=>{Uk.init(e,t);const r=e._zod.parse;const n=Hi(()=>Q_(t));const o=Vt.memoizer;const i=m=>{const p=n.value;const f=p.symbolKeys;const g=new Zc(["payload","ctx"],{shape:m,inst:e,memo:o,syms:f});const _=$=>`shape[${$}]._zod.run({ value: input[${$}], issues: [] }, ctx)`;const b=($,te)=>`
|
|
11
|
+
let ${$}_ab = false;
|
|
12
|
+
for (let i = 0; i < ${$}.issues.length; i++) {
|
|
13
|
+
const iss = ${$}.issues[i];
|
|
14
|
+
iss.path = iss.path ? [${te}, ...iss.path] : [${te}];
|
|
15
|
+
payload.issues.push(iss);
|
|
16
|
+
if (iss.continue !== true) ${$}_ab = true;
|
|
17
|
+
}
|
|
18
|
+
if (${$}_ab && ctx && ctx.abortEarly) {
|
|
19
|
+
payload.value = newResult;
|
|
20
|
+
return payload;
|
|
21
|
+
}`;g.write(`const input = payload.value;`);const v=Object.create(null);let A=0;for(const $ of p.allKeys){v[$]=`key_${A++}`}g.write(o?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(const $ of p.allKeys){if($==="__proto__")continue;const te=v[$];const st=typeof $==="symbol"?`syms[${f.indexOf($)}]`:Ad($);const Yo=`${st} in input`;const Ki=m[$];const Rn=Ki?._zod?.optin;const Zi=Rn!==void 0;const $c=Ki?._zod?.optout==="optional";g.write(`const ${te} = ${_(st)};`);if(Zi&&$c){const kc=Rn==="optional"?`${te}_present`:`${te}.value !== undefined || ${te}_present`;g.write(`
|
|
22
|
+
const ${te}_present = ${Yo};
|
|
23
|
+
if (!${te}.issues.length || ${te}_present) {
|
|
24
|
+
if (${te}.issues.length) {${b(te,st)}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (${kc}) {
|
|
28
|
+
newResult[${st}] = ${te}.value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
`)}else if(!Zi){g.write(`
|
|
33
|
+
const ${te}_present = ${Yo};
|
|
34
|
+
if (${te}.issues.length) {${b(te,st)}
|
|
35
|
+
}
|
|
36
|
+
if (!${te}_present && !${te}.issues.length) {
|
|
37
|
+
payload.issues.push({
|
|
38
|
+
code: "invalid_type",
|
|
39
|
+
expected: "nonoptional",
|
|
40
|
+
input: undefined,
|
|
41
|
+
path: [${st}]
|
|
42
|
+
});
|
|
43
|
+
if (ctx && ctx.abortEarly) {
|
|
44
|
+
payload.value = newResult;
|
|
45
|
+
return payload;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (${te}_present) {
|
|
50
|
+
newResult[${st}] = ${te}.value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
`)}else{g.write(`
|
|
54
|
+
if (${te}.issues.length) {${b(te,st)}
|
|
55
|
+
}
|
|
56
|
+
`);if(Rn==="defaulted"){g.write(`newResult[${st}] = ${te}.value;`)}else{g.write(`
|
|
57
|
+
if (${te}.value !== undefined || ${Yo}) {
|
|
58
|
+
newResult[${st}] = ${te}.value;
|
|
59
|
+
}
|
|
60
|
+
`)}}}g.write(`payload.value = newResult;`);g.write(`return payload;`);return g.compile()};let s;const a=ei;const c=!Vt.jitless;const l=zd;const u=c&&l.value;const d=t.catchall;let h;e._zod.parse=(m,p)=>{h??(h=n.value);const f=m.value;if(!a(f)){m.issues.push({expected:"object",code:"invalid_type",input:f,inst:e});return m}if(c&&u&&p?.async===false&&p.jitless!==true){if(!s)s=i(t.shape);m=s(m,p);if(!d)return m;return ex([],f,m,p,h,e,p?.abortEarly===true)}return r(m,p)}});function c_(e,t,r,n){for(const i of e){if(i.issues.length===0){t.value=i.value;return t}}const o=e.filter(i=>!Ur(i));if(o.length===1){t.value=o[0].value;return o[0]}t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Lr(s,n,Ht())))});return t}var rp=T("$ZodUnion",(e,t)=>{$e.init(e,t);ye(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0);ye(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0);ye(e,"values",n=>{if(n.def.options.every(o=>o._zod.values)){return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}return void 0});ye(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){const o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Qs(i.source)).join("|")})$`)}return void 0});const r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r){return r(n,o)}let i=false;const s=[];for(const a of t.options){const c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise){s.push(c);i=true}else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return c_(s,n,e,o);return Promise.all(s).then(a=>{return c_(a,n,e,o)})}});function Lk(e){const t=new Map;for(const r of e.options){const n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(const o of n){if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else{t.set(o,r)}}}return t}var rx=T("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=false;rp.init(e,t);const r=e._zod.parse;ye(e,"propValues",o=>{const i={};let s=0;for(const a of o.def.options){const c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(const[l,u]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l)){cr(i,l,new Set)}for(const d of u){i[l].add(d)}}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i});t.options.forEach((o,i)=>{const s=Wi(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator)){throw new Error(`Invalid discriminated union option at index "${i}"`)}});const n=Hi(()=>Lk(t));e._zod.parse=(o,i)=>{const s=o.value;if(!ei(s)){o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e});return o}const a=s?.[t.discriminator];const c=n.value.get(a);if(c&&(a!==void 0||i.direction!=="backward")){return c._zod.run(o,i)}if(t.unionFallback||i.direction==="backward"){return r(o,i)}o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(l=>n.value.get(l)!==null),input:s,path:[t.discriminator],inst:e});return o}});var nx=T("$ZodIntersection",(e,t)=>{$e.init(e,t);e._zod.parse=(r,n)=>{const o=r.value;const i=t.left._zod.run({value:o,issues:[]},n);const s=t.right._zod.run({value:o,issues:[]},n);const a=i instanceof Promise||s instanceof Promise;if(a){return Promise.all([i,s]).then(([c,l])=>{return u_(r,c,l)})}return u_(r,i,s)}});function Yd(e,t){if(e===t){return{valid:true,data:e}}if(e instanceof Date&&t instanceof Date&&+e===+t){return{valid:true,data:e}}if(no(e)&&no(t)){const r=Object.keys(t);const n=Object.keys(e).filter(i=>r.indexOf(i)!==-1);const o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(const i of n){if(i==="__proto__")continue;const s=Yd(e[i],t[i]);if(!s.valid){return{valid:false,mergeErrorPath:[i,...s.mergeErrorPath]}}o[i]=s.data}return{valid:true,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length){return{valid:false,mergeErrorPath:[]}}const r=[];for(let n=0;n<e.length;n++){const o=e[n];const i=t[n];const s=Yd(o,i);if(!s.valid){return{valid:false,mergeErrorPath:[n,...s.mergeErrorPath]}}r.push(s.data)}return{valid:true,data:r}}return{valid:false,mergeErrorPath:[]}}function u_(e,t,r){const n=new Map;let o;const i=new Map;const s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length){o??(o=l);d=l.keys}else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){const h=String(l.path[0]);if(!i.has(h))i.set(h,l);d=[h]}else{return false}for(const h of d){if(!n.has(h))n.set(h,{});n.get(h)[u]=true}return true};for(const l of t.issues){if(!s(l,"l"))e.issues.push(l)}for(const l of r.issues){if(!s(l,"r"))e.issues.push(l)}const a=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){const l=o?a.filter(u=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(const u of a){if(!l.includes(u)&&i.has(u))e.issues.push(i.get(u))}}const c=Yd(t.value,r.value);if(!c.valid){if(Ur(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}e.value=c.data;return e}var ox=T("$ZodRecord",(e,t)=>{$e.init(e,t);const r=Vt.memoizer;r?.attach(e);e._zod.parse=(n,o)=>{const i=n.value;if(!no(i)){n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e});return n}const s=[];const a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};const c=new Set;for(const u of a){if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){c.add(typeof u==="number"?u.toString():u);if(u==="__proto__")continue;const d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(p=>Lr(p,o,Ht())),input:u,path:[u],inst:e});continue}const h=d.value;if(h==="__proto__")continue;const m=t.valueType._zod.run({value:i[u],issues:[]},o);if(m instanceof Promise){s.push(m.then(p=>{if(p.issues.length){n.issues.push(...zn(u,p.issues))}n.value[h]=p.value}))}else{if(m.issues.length){n.issues.push(...zn(u,m.issues))}n.value[h]=m.value}}}let l;for(const u in i){if(!c.has(u)){if(t.mode==="loose"){if(u==="__proto__")continue;n.value[u]=i[u]}else{l=l??[];l.push(u)}}}if(l&&l.length>0){n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:true})}}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(const l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}const d=typeof l==="string"&&ia.test(l)&&u.issues.length;if(d){const p=t.keyType._zod.run({value:Number(l),issues:[]},o);if(p instanceof Promise){throw new Error("Async schemas not supported in object keys currently")}if(p.issues.length===0){u=p}}if(u.issues.length){if(t.mode==="loose"){n.value[l]=i[l]}else if(a){c=c??[];c.push(l)}else{n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(p=>Lr(p,o,Ht())),input:l,path:[l],inst:e})}continue}const h=u.value;if(h==="__proto__")continue;const m=t.valueType._zod.run({value:i[l],issues:[]},o);if(m instanceof Promise){s.push(m.then(p=>{if(p.issues.length){n.issues.push(...zn(l,p.issues))}n.value[h]=p.value}))}else{if(m.issues.length){n.issues.push(...zn(l,m.issues))}n.value[h]=m.value}}if(c&&c.length>0){n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:true})}}if(s.length){return Promise.all(s).then(()=>n)}return n}});var ix=T("$ZodEnum",(e,t)=>{$e.init(e,t);const r=Gi(t.entries);const n=new Set(r);e._zod.values=n;ye(e,"pattern",o=>{const i=Gi(o.def.entries).filter(s=>Cd.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>En(s.toString())).join("|")})$`:"^[^\\s\\S]$")});e._zod.parse=(o,i)=>{const s=o.value;if(n.has(s)){return o}o.issues.push({code:"invalid_value",values:r,input:s,inst:e});return o}});var sx=T("$ZodLiteral",(e,t)=>{$e.init(e,t);const r=new Set(t.values);e._zod.values=r;ye(e,"pattern",n=>{const o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i==="string"?En(i):i?En(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")});e._zod.parse=(n,o)=>{const i=n.value;if(r.has(i)){return n}n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e});return n}});var ax=T("$ZodTransform",(e,t)=>{$e.init(e,t);e._zod.optin="optional";Vt.memoizer?.guard(e);e._zod.parse=(r,n)=>{if(n.direction==="backward"){throw new Xi(e.constructor.name)}const o=t.transform(r.value,r);if(n.async){const i=o instanceof Promise?o:Promise.resolve(o);return i.then(s=>{r.value=s;return r})}if(o instanceof Promise){throw new qr}r.value=o;return r}});function l_(e,t){e.value=t.issues.length?void 0:t.value;return e}var np=T("$ZodOptional",(e,t)=>{$e.init(e,t);ye(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional");e._zod.optout="optional";ye(e,"values",r=>{const n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0});ye(e,"pattern",r=>{const n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Qs(n.source)})?$`):void 0});e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;const o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then(i=>l_(r,i));return l_(r,o)}return t.innerType._zod.run(r,n)}});var cx=T("$ZodExactOptional",(e,t)=>{np.init(e,t);ye(e,"values",r=>r.def.innerType._zod.values);ye(e,"pattern",r=>r.def.innerType._zod.pattern);e._zod.parse=(r,n)=>{return t.innerType._zod.run(r,n)}});var ux=T("$ZodNullable",(e,t)=>{$e.init(e,t);ye(e,"optin",r=>r.def.innerType._zod.optin);ye(e,"optout",r=>r.def.innerType._zod.optout);ye(e,"pattern",r=>{const n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Qs(n.source)}|null)$`):void 0});ye(e,"values",r=>{return r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0});e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}});var lx=T("$ZodDefault",(e,t)=>{$e.init(e,t);e._zod.optin="defaulted";ye(e,"values",r=>r.def.innerType._zod.values);e._zod.parse=(r,n)=>{if(n.direction==="backward"){return t.innerType._zod.run(r,n)}if(r.value===void 0){r.value=t.defaultValue;return r}const o=t.innerType._zod.run(r,n);if(o instanceof Promise){return o.then(i=>d_(i,t))}return d_(o,t)}});function d_(e,t){if(e.value===void 0){e.value=t.defaultValue}return e}var dx=T("$ZodPrefault",(e,t)=>{$e.init(e,t);e._zod.optin="defaulted";ye(e,"values",r=>r.def.innerType._zod.values);e._zod.parse=(r,n)=>{if(n.direction==="backward"){return t.innerType._zod.run(r,n)}if(r.value===void 0){r.value=t.defaultValue}return t.innerType._zod.run(r,n)}});var px=T("$ZodNonOptional",(e,t)=>{$e.init(e,t);ye(e,"values",r=>{const n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0});e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);if(o instanceof Promise){return o.then(i=>p_(i,e))}return p_(o,e)}});function p_(e,t){if(!e.issues.length&&e.value===void 0){e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t})}return e}function f_(e,t,r,n){if(!t.issues.length){e.value=t.value;if(t.memo)e.memo=true;return e}e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Lr(o,n,Ht()))},input:e.value});return e}var fx=T("$ZodCatch",(e,t)=>{$e.init(e,t);ye(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional");ye(e,"optout",r=>r.def.innerType._zod.optout);ye(e,"values",r=>r.def.innerType._zod.values);e._zod.parse=(r,n)=>{if(n.direction==="backward"){return t.innerType._zod.run(r,n)}const o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise){return o.then(i=>f_(r,i,t,n))}return f_(r,o,t,n)}});var op=T("$ZodPipe",(e,t)=>{$e.init(e,t);ye(e,"values",r=>r.def.in._zod.values);ye(e,"optin",r=>r.def.in._zod.optin);ye(e,"optout",r=>r.def.out._zod.optout);ye(e,"propValues",r=>r.def.in._zod.propValues);e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);if(i instanceof Promise){return i.then(s=>Bc(s,t.in,n))}return Bc(i,t.in,n)}const o=t.in._zod.run(r,n);if(o instanceof Promise){return o.then(i=>Bc(i,t.out,n))}return Bc(o,t.out,n)}});function Bc(e,t,r){if(e.issues.some(n=>n.code!=="unrecognized_keys")){e.aborted=true;return e}return t._zod.run({value:e.value,issues:e.issues},r)}var mx=T("$ZodPreprocess",(e,t)=>{op.init(e,t)});var hx=T("$ZodReadonly",(e,t)=>{$e.init(e,t);ye(e,"propValues",r=>r.def.innerType._zod.propValues);ye(e,"values",r=>r.def.innerType._zod.values);ye(e,"optin",r=>r.def.innerType?._zod?.optin);ye(e,"optout",r=>r.def.innerType?._zod?.optout);e._zod.parse=(r,n)=>{if(n.direction==="backward"){return t.innerType._zod.run(r,n)}const o=t.innerType._zod.run(r,n);if(o instanceof Promise){return o.then(m_)}return m_(o)}});function m_(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var gx=T("$ZodCustom",(e,t)=>{bt.init(e,t);$e.init(e,t);e._zod.parse=(r,n)=>{return r};e._zod.check=r=>{const n=r.value;const o=t.fn(n);if(o instanceof Promise){return o.then(i=>h_(i,r,n,e))}h_(o,r,n,e);return}});function h_(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(Ji(o))}}var sp=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`);this.name="ZodCyclicError"}};var ap="~memo";var yx=[];function _x(e){return e!==null&&typeof e==="object"}function ip(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var xx=new WeakMap;var aa=0;var Yc=1;var ca=2;function Qc(e,t,r){const n=xx.get(e);if(n!==void 0)return n?ca:aa;if(t.has(e))return ca;t.add(e);let o=aa;const i=u=>{if(o!==ca&&u?._zod){const d=Qc(u,t,r);if(d>o)o=d}};const s=(u,d)=>{let h=aa;for(const m of Reflect.ownKeys(u)){const p=Object.getOwnPropertyDescriptor(u,m);if(d&&!p.enumerable)continue;const f=p.get?Yc:p.value?._zod?Qc(p.value,t,r):aa;if(f>h)h=f}return h};const a=u=>{if(u>o)o=u};const c=e._zod.def;const l=c.type;switch(l){case"object":{const u=Wi(c);a(u?s(u,true):Yc);i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(const u of c.items)i(u);i(c.rest);break;case"record":case"map":i(c.keyType);i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(const u of c.options)i(u);break;case"intersection":i(c.left);i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in);i(c.out);break;case"function":i(c.input);i(c.output);break;case"lazy":{const u=c._cachedInner??(r?e._zod.innerType:void 0);a(u?Qc(u,t,false):Yc);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:{l;for(const u in c){const d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;const h=d.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(const m of h)i(m)}}}t.delete(e);return qk(e,o)}function qk(e,t){if(t!==Yc)xx.set(e,t===ca);return t}function Kk(e,t){let r=e.buckets.get(t);if(!r){r=new WeakMap;e.buckets.set(t,r)}return r}var Jc;var Xc=[];var Zk={alloc(e,t,r){const n=Jc;if(!n)return r;Jc=void 0;const o={value:r,issues:null};n.set(t.value,o);Xc.push(o);return r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]);e._zod.deferred.push(()=>{const r=e._zod.parse;const n=(o,i)=>{if(i.direction!=="backward"&&Bk(i,o.value))throw new sp;return r(o,i)};e._zod.parse=n;if(e._zod.run===r)e._zod.run=n})},attach(e){var t;let r;let n=false;let o;let i;(t=e._zod).deferred??(t.deferred=[]);e._zod.deferred.push(()=>{const s=e._zod.parse;const a=(c,l)=>{if(r===void 0){const _=Qc(e,new Set,false);if(_===aa){e._zod.parse=s;if(e._zod.run===a)e._zod.run=s;return s(c,l)}if(_===ca||n)r=true;else n=true}const u=c.value;if(!_x(u))return s(c,l);let d=l[ap];if(!d){d={buckets:new WeakMap,backEdges:void 0};l[ap]=d}let h;if(o===l){h=i}else{h=Kk(d,e);o=l;i=h}const m=h.get(u);if(m){c.value=m.value;if(m.issues){if(m.issues.length)c.issues.push(...ip(m.issues))}else{c.memo=true;d.backEdges??(d.backEdges=new WeakSet);d.backEdges.add(m.value)}return c}Jc=h;const p=Xc.length;const f=s(c,l);Jc=void 0;const g=Xc.length>p?Xc.pop():void 0;if(f instanceof Promise){return f.then(_=>{if(g)g.issues=_.issues.length?ip(_.issues):yx;return _})}if(g)g.issues=f.issues.length?ip(f.issues):yx;return f};e._zod.parse=a;if(e._zod.run===s)e._zod.run=a})}};function cp(){return Zk}function Bk(e,t){const r=e[ap]?.backEdges;return r!==void 0&&_x(t)&&r.has(t)}var Gk=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"};const n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s)){return String(s)}return n[i]??i}return i=>{switch(i.code){case"invalid_type":{const s=o(i.expected);const a=jd(i.input);const c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Ac(i.values[0])}`;return`Invalid option: expected one of ${Rc(i.values,"|")}`;case"too_big":{const s=i.exact?"exactly ":i.inclusive?"<=":"<";const a=t(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{const s=i.exact?"exactly ":i.inclusive?">=":">";const a=t(i.origin);if(a){return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`}return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{const s=i;if(s.format==="starts_with"){return`Invalid string: must start with "${s.prefix}"`}if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Rc(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0){const s=i.options.map(a=>`'${a}'`).join(" | ");return`Invalid discriminator value. Expected ${s}`}if(i.inclusive===false){return"Invalid input: more than one option matched"}return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return`Invalid input`}}};function bx(){return{localeError:Gk()}}var Ix;var up=class{constructor(){this._map=new WeakMap;this._idmap=new Map}add(t,...r){const n=r[0];this._map.set(t,n);if(n&&typeof n==="object"&&"id"in n){this._idmap.set(n.id,t)}return this}clear(){this._map=new WeakMap;this._idmap=new Map;return this}remove(t){const r=this._map.get(t);if(r&&typeof r==="object"&&"id"in r){this._idmap.delete(r.id)}this._map.delete(t);return this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function wx(){return new up}(Ix=globalThis).__zod_globalRegistry??(Ix.__zod_globalRegistry=wx());var oo=globalThis.__zod_globalRegistry;function eu(e){if(e.checks)e.checks=[...e.checks];return e}function Sx(e,t){return new e(eu({type:"string",...N(t)}))}function Tx(e,t){return new e(eu({type:"string",coerce:true,...N(t)}))}function Px(e,t){return new e({type:"string",format:"email",check:"string_format",abort:false,...N(t)})}function Ox(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:false,...N(t)})}function vx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:false,...N(t)})}function $x(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:false,version:"v4",...N(t)})}function kx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:false,version:"v6",...N(t)})}function Rx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:false,version:"v7",...N(t)})}function lp(e,t){return new e({type:"string",format:"url",check:"string_format",abort:false,...N(t)})}function Mx(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:false,...N(t)})}function Ax(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:false,...N(t)})}function Ex(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:false,...N(t)})}function zx(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:false,...N(t)})}function Cx(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:false,...N(t)})}function Nx(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:false,...N(t)})}function Fx(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:false,...N(t)})}function jx(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:false,...N(t)})}function Dx(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:false,...N(t)})}function Ux(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:false,...N(t)})}function Lx(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:false,...N(t)})}function qx(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:false,...N(t)})}function Kx(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:false,...N(t)})}function Zx(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:false,...N(t)})}function Bx(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:false,...N(t)})}function tu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:false,local:false,precision:null,...N(t)})}function ru(e,t){return new e({type:"string",format:"date",check:"string_format",...N(t)})}function nu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...N(t)})}function ou(e,t){return new e({type:"string",format:"duration",check:"string_format",...N(t)})}function Gx(e,t){return new e(eu({type:"number",checks:[],...N(t)}))}function Vx(e,t){return new e(eu({type:"number",coerce:true,checks:[],...N(t)}))}function Hx(e,t){return new e({type:"number",check:"number_format",abort:false,format:"safeint",...N(t)})}function Wx(e,t){return new e({type:"boolean",...N(t)})}function Jx(e,t){return new e({type:"boolean",coerce:true,...N(t)})}function Xx(e,t){return new e({type:"bigint",coerce:true,...N(t)})}function Yx(e,t){return new e({type:"null",...N(t)})}function Qx(e){return new e({type:"any"})}function eb(e){return new e({type:"unknown"})}function tb(e,t){return new e({type:"never",...N(t)})}function rb(e,t){return new e({type:"date",coerce:true,...N(t)})}function Qi(e,t){return new Jd({check:"less_than",...N(t),value:e,inclusive:false})}function Cn(e,t){return new Jd({check:"less_than",...N(t),value:e,inclusive:true})}function es(e,t){return new Xd({check:"greater_than",...N(t),value:e,inclusive:false})}function Nn(e,t){return new Xd({check:"greater_than",...N(t),value:e,inclusive:true})}function ua(e,t){return new Gy({check:"multiple_of",...N(t),value:e})}function iu(e,t){const r=new Hy({check:"max_length",...N(t),maximum:e});return r}function ts(e,t){return new Wy({check:"min_length",...N(t),minimum:e})}function su(e,t){return new Jy({check:"length_equals",...N(t),length:e})}function dp(e,t){return new Xy({check:"string_format",format:"regex",...N(t),pattern:e})}function pp(e){return new Yy({check:"string_format",format:"lowercase",...N(e)})}function fp(e){return new Qy({check:"string_format",format:"uppercase",...N(e)})}function mp(e,t){return new e_({check:"string_format",format:"includes",...N(t),includes:e})}function hp(e,t){return new t_({check:"string_format",format:"starts_with",...N(t),prefix:e})}function gp(e,t){return new r_({check:"string_format",format:"ends_with",...N(t),suffix:e})}function io(e){return new n_({check:"overwrite",tx:e})}function yp(e){return io(t=>t.normalize(e))}function _p(){return io(e=>e.trim())}function xp(){return io(e=>e.toLowerCase())}function bp(){return io(e=>e.toUpperCase())}function Ip(){return io(e=>Ed(e))}function nb(e,t,r){return new e({type:"array",element:t,...N(r)})}function ob(e,t,r){const n=N(r);n.abort??(n.abort=true);const o=new e({type:"custom",check:"custom",fn:t,...n});return o}function ib(e,t,r){const n=new e({type:"custom",check:"custom",fn:t,...N(r)});return n}function sb(e,t){const r=Vk(n=>{n.addIssue=o=>{if(typeof o==="string"){n.issues.push(Ji(o,n.value,r._zod.def))}else{const i=o;if(i.fatal)i.continue=false;i.code??(i.code="custom");if(!("input"in i))i.input=n.value;i.inst??(i.inst=r);i.continue??(i.continue=!r._zod.def.abort);n.issues.push(Ji(i))}};return e(n.value,n)},t);return r}function Vk(e,t){const r=new bt({check:"custom",...N(t)});r._zod.check=e;return r}function la(e,...t){for(const r of t){for(const n of Reflect.ownKeys(r)){if(Object.prototype.propertyIsEnumerable.call(r,n)){cr(e,n,r[n])}}}return e}function Sp(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??oo,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Kr(e,t,r,n,o){const i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return false;if(i===void 0||i==="throw")throw new Error(o);Object.assign(r,i);return true}function et(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def;const i=t.seen.get(e);if(i){i.count++;const u=r.schemaPath.includes(e);if(u){i.cycle=r.path}return i.schema}const s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);t.sharedDefsExtractedFor=void 0;t.sharedEmitDoneFor=void 0;const a=e._zod.toJSONSchema?.();if(a){s.schema=a}else{const u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema){e._zod.processJSONSchema(t,s.schema,u)}else{const h=s.schema;const m=t.processors[o.type];if(!m){throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`)}m(e,t,h,u)}const d=e._zod.parent;if(d){if(!s.ref)s.ref=d;et(d,t,u);t.seen.get(d).isParent=true}}const c=t.metadataRegistry.get(e);if(c)la(s.schema,c);if(t.io==="input"&&Dt(e)){delete s.schema.examples;delete s.schema.default}if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);delete s.schema._prefault;const l=t.seen.get(e);return l.schema}function ab(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Tp(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const n=new Map;for(const s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const c=n.get(a);if(c&&c!==s[0]){throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`)}n.set(a,s[0])}}const o=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(s[0])?.id;const h=e.external.uri??(p=>p);if(d){return{ref:h(d)}}const m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;s[1].defId=m;return{defId:m,ref:`${h("__shared")}#/${a}/${ab(m)}`}}const c=`#`;const l=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id){return{ref:c}}const u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+ab(u)}};const i=s=>{if(s[1].schema.$ref){return}const a=s[1];const{ref:c,defId:l}=o(s);a.def={...a.schema};if(l)a.defId=l;const u=a.schema;for(const d in u){delete u[d]}u.$ref=c};if(e.cycles==="throw"){for(const s of e.seen.entries()){const a=s[1];if(a.cycle){throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
61
|
+
|
|
62
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}}}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){i(s);continue}if(e.external){const l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}const c=e.metadataRegistry.get(s[0])?.id;if(c){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref"){i(s)}}}if(e.external)e.sharedDefsExtractedFor=e.external}function lb(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const r=[];for(const n of t){if(!n||typeof n!=="object")return;lb(n);const o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;const i=n.type;for(const s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf;e.type=r.length===1?r[0]:r}var db=new Set(["type","properties","required","additionalProperties"]);var cb=["oneOf","anyOf"];function ub(e){const t=e.additionalProperties;if(t===void 0||t===false||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function wp(e){const t=[];for(const i of e){if(typeof i!=="object"||i.type!=="object")return null;for(const s in i){if(!db.has(s))return null}t.push(i)}const r={};const n=new Set;for(const i of t){for(const s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;const a=[];for(const l of t){const u=l.properties?.[s]??ub(l);if(u===null||u===void 0)continue;if(!a.some(d=>JSON.stringify(d)===JSON.stringify(u)))a.push(u)}const c=a.length===1?a[0]:wp(a)??{allOf:a};cr(r,s,c)}for(const s of i.required??[])n.add(s)}const o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every(i=>i.additionalProperties===false)){o.additionalProperties=false}else{const i=[];for(const s of t){const a=ub(s);if(a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function Hk(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of db)if(o in e)return;const r=t.filter(o=>cb.some(i=>Array.isArray(o[i])));let n=null;if(!r.length){n=wp(t)}else{const o=r[0];const i=cb.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;const s=t.filter(c=>c!==o);const a=o[i].map(c=>wp([...s,c]));if(a.some(c=>!c))return;n={[i]:a}}if(!n)return;delete e.allOf;la(e,n)}function Pp(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=a=>{const c=e.seen.get(a);if(c.ref===null)return;const l=c.def??c.schema;const u={...l};const d=c.ref;c.ref=null;if(d){n(d);const m=e.seen.get(d);const p=m.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")){l.allOf=l.allOf??[];l.allOf.push(p)}else{la(l,p)}la(l,u);const f=a._zod.parent===d;if(f){for(const g in l){if(g==="$ref"||g==="allOf")continue;if(!(g in u)){delete l[g]}}}if(p.$ref&&m.def){for(const g in l){if(g==="$ref"||g==="allOf")continue;if(g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g])){delete l[g]}}}}const h=a._zod.parent;if(h&&h!==d){n(h);const m=e.seen.get(h);if(m?.schema.$ref){l.$ref=m.schema.$ref;if(m.def){for(const p in l){if(p==="$ref"||p==="allOf")continue;if(p in m.def&&JSON.stringify(l[p])===JSON.stringify(m.def[p])){delete l[p]}}}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const a of[...e.seen.entries()].reverse()){n(a[0])}if(e.target!=="openapi-3.0"){for(const a of e.seen.entries()){lb(a[1].def??a[1].schema)}}for(const a of e.deferred)a();if(e.intersections.length){const a=new Map;for(const c of e.seen.values()){for(const l of[c.schema,c.def]){const u=l?.allOf;if(!Array.isArray(u))continue;const d=a.get(u);if(d)d.push(l);else a.set(u,[l])}}for(const c of e.intersections){for(const l of a.get(c)??[])Hk(l)}}}const o={};if(e.target==="draft-2020-12"){o.$schema="https://json-schema.org/draft/2020-12/schema"}else if(e.target==="draft-07"){o.$schema="http://json-schema.org/draft-07/schema#"}else if(e.target==="draft-04"){o.$schema="http://json-schema.org/draft-04/schema#"}else if(e.target==="openapi-3.0"){}else{}if(e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}la(o,r.defId?r.schema:r.def??r.schema);const i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;const s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const a of e.seen.entries()){const c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;cr(s,c.defId,c.def)}}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external){}else{if(Object.keys(s).length>0){if(e.target==="draft-2020-12"){o.$defs=s}else{o.definitions=s}}}try{const a=JSON.parse(JSON.stringify(o));Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:da(t,"input",e.processors),output:da(t,"output",e.processors)}},enumerable:false,writable:false});return a}catch(a){throw new Error("Error converting schema to JSON.")}}function Dt(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return false;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return true;if(n.type==="array")return Dt(n.element,r);if(n.type==="set")return Dt(n.valueType,r);if(n.type==="lazy")return Dt(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch"){return Dt(n.innerType,r)}if(n.type==="intersection"){return Dt(n.left,r)||Dt(n.right,r)}if(n.type==="record"||n.type==="map"){return Dt(n.keyType,r)||Dt(n.valueType,r)}if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return true;return Dt(n.in,r)||Dt(n.out,r)}if(n.type==="object"){for(const o in n.shape){if(Dt(n.shape[o],r))return true}return false}if(n.type==="union"){for(const o of n.options){if(Dt(o,r))return true}return false}if(n.type==="tuple"){for(const o of n.items){if(Dt(o,r))return true}if(n.rest&&Dt(n.rest,r))return true;return false}return false}var pb=(e,t={})=>r=>{const n=Sp({...r,processors:t});et(e,n);Tp(n,e);return Pp(n,e)};var da=(e,t,r={})=>n=>{const{libraryOptions:o,target:i}=n??{};const s=Sp({...o??{},target:i,io:t,processors:r});et(e,s);Tp(s,e);return Pp(s,e)};var rs=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r};var ns=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r};var fb=(e,t)=>{rs(e,"minimum",t);ns(e,"maximum",t)};var yb=(e,t)=>{e.multipleOf??(e.multipleOf=[]);if(!e.multipleOf.includes(t))e.multipleOf.push(t)};var _b=(e,t)=>{e.patterns??(e.patterns=new Set);e.patterns.add(t)};var xb=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]};var bb=(e,t)=>{e.format=t;if(t.includes("int"))e.isInt=true};var mb=(e,t)=>rs(e,"minimum",t.minimum);var hb=(e,t)=>ns(e,"maximum",t.maximum);var gb=e=>(t,r)=>{bb(t,r.format);const[n,o]=e[r.format];rs(t,"minimum",n);ns(t,"maximum",o)};var Wk={greater_than:(e,t)=>rs(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ns(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>yb(e,t.value),number_format:gb(ea),bigint_format:gb(Ec),min_length:mb,max_length:hb,length_equals:(e,t)=>fb(e,t.length),min_size:mb,max_size:hb,size_equals:(e,t)=>fb(e,t.size),string_format:(e,t)=>{bb(e,t.format);if(t.pattern)_b(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=true},mime_type:(e,t)=>xb(e,t.mime)};function It(e){const t={};const r=e._zod.def;const n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(const i of n)Wk[i._zod.def.check]?.(t,i._zod.def);const o=e._zod.bag;if(o.minimum!==void 0)rs(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)rs(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ns(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ns(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)yb(t,o.multipleOf);if(o.format!==void 0){t.format??(t.format=o.format);if(o.format.includes("int"))t.isInt=true}if(o.mime)xb(t,o.mime);for(const i of o.patterns??[])_b(t,i);return t}var Jk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};var Xk=new Map([[ep,Ay],[Wc,Ey]]);var Ib=e=>Xk.get(e)??e;var wb=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=It(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){o.format=Jk[a]??a;if(o.format==="")delete o.format;if(a==="time"||u){delete o.format}}if(l)o.contentEncoding=l;if(c&&c.size>0){const d=[...c].map(Ib);if(d.length===1)o.pattern=d[0].source;else if(d.length>1){o.allOf=[...d.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}}};var Sb=(e,t,r,n)=>{const o=r;const{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=It(e);o.type=u?"integer":"number";const d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY);const h=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY);const m=t.target==="draft-04"||t.target==="openapi-3.0";if(d){if(m){o.minimum=l;o.exclusiveMinimum=true}else{o.exclusiveMinimum=l}}else if(typeof i==="number"){o.minimum=i}if(h){if(m){o.maximum=c;o.exclusiveMaximum=true}else{o.exclusiveMaximum=c}}else if(typeof s==="number"){o.maximum=s}if(a){const p=new Set;for(const _ of a){if(Number.isFinite(_)&&_!==0)p.add(Math.abs(_));else Kr(e,t,o,n,`A multipleOf divisor of ${_} cannot be represented in JSON Schema`)}const[f,...g]=p;if(f!==void 0)o.multipleOf=f;if(g.length)o.allOf=[...o.allOf??[],...g.map(_=>({multipleOf:_}))]}};var Tb=(e,t,r,n)=>{r.type="boolean"};var Pb=(e,t,r,n)=>{Kr(e,t,r,n,"BigInt cannot be represented in JSON Schema")};var Ob=(e,t,r,n)=>{if(t.target==="openapi-3.0"){r.type="string";r.nullable=true;r.enum=[null]}else{r.type="null"}};var vb=(e,t,r,n)=>{r.not={}};var $b=(e,t,r,n)=>{};var kb=(e,t,r,n)=>{};var Rb=(e,t,r,n)=>{Kr(e,t,r,n,"Date cannot be represented in JSON Schema")};var Mb=(e,t,r,n)=>{const o=e._zod.def;const i=Gi(o.entries);if(i.length===0){r.not={};return}if(i.every(s=>typeof s==="number"))r.type="number";if(i.every(s=>typeof s==="string"))r.type="string";r.enum=i};var Ab=(e,t,r,n)=>{const o=e._zod.def;if(o.values.length===0){r.not={};return}const i=[];for(const s of o.values){if(s===void 0){if(Kr(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Kr(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else{i.push(s)}}if(i.length===0){}else if(i.length===1){const s=i[0];r.type=s===null?"null":typeof s;if(t.target==="draft-04"||t.target==="openapi-3.0"){r.enum=[s]}else{r.const=s}}else{if(i.every(s=>typeof s==="number"))r.type="number";if(i.every(s=>typeof s==="string"))r.type="string";if(i.every(s=>typeof s==="boolean"))r.type="boolean";if(i.every(s=>s===null))r.type="null";r.enum=i}};var Eb=(e,t,r,n)=>{Kr(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var zb=(e,t,r,n)=>{Kr(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Cb=(e,t,r,n)=>{const o=r;const i=e._zod.def;const{minimum:s,maximum:a}=It(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array";o.items=et(i.element,t,{...n,path:[...n.path,"items"]})};function au(e){const t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")){return au(t.out)}if(t.type==="catch"){return au(t.innerType)}return e._zod.optin}var Nb=(e,t,r,n)=>{const o=r;const i=e._zod.def;const s=i.shape;const a=Object.getOwnPropertySymbols(s);if(a.length&&Kr(e,t,o,n,"Symbol keys cannot be represented in JSON Schema")){return}o.type="object";o.properties={};for(const l in s){cr(o.properties,l,et(s[l],t,{...n,path:[...n.path,"properties",l]}))}const c=[];for(const l of Object.keys(s)){const u=i.shape[l];if(t.io==="input"?au(u)===void 0:u._zod.optout===void 0){c.push(l)}}if(c.length>0){o.required=c}if(i.catchall?._zod.def.type==="never"){o.additionalProperties=false}else if(!i.catchall){if(t.io==="output")o.additionalProperties=false}else if(i.catchall){o.additionalProperties=et(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})}};var Fb=(e,t,r,n)=>{const o=e._zod.def;const i=o.inclusive===false;const s=o.options.map((a,c)=>et(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));if(i){r.oneOf=s}else{r.anyOf=s}};var jb=(e,t,r,n)=>{const o=e._zod.def;const i=et(o.left,t,{...n,path:[...n.path,"allOf",0]});const s=et(o.right,t,{...n,path:[...n.path,"allOf",1]});const a=l=>"allOf"in l&&Object.keys(l).length===1;const c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c;t.intersections.push(c)};function Op(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);const p=e.get(t)?.def;if(!p)return t;const f=Op(e,p,r);return f===p?t:f}for(const p of["anyOf","oneOf"]){const f=t[p];if(!Array.isArray(f))continue;const g=f.map(_=>Op(e,_,r));if(g.some((_,b)=>_!==f[b]))t={...t,[p]:g}}const n=Array.isArray(t.type)?t.type:[t.type];const o=!n.includes("string")&&n.some(p=>p==="number"||p==="integer");const i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(p=>typeof p==="number"))return t;const{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:h,...m}=t;if(m.enum)m.enum=m.enum.map(p=>typeof p==="number"?String(p):p);else if(typeof m.const==="number")m.const=String(m.const);if(!o)return m;m.type="string";if(!i)m.pattern=(n.includes("number")?ia:Hd).source;return m}var vp=new WeakMap;function Yk(e){const t=new Map;for(const n of e.seen.values()){if(n.def&&!t.has(n.schema))t.set(n.schema,n)}const r=new Map;for(const n of vp.get(e)??[]){const o=e.seen.get(n);const i=(o?.def??o?.schema)?.propertyNames;if(!i||i===true||r.has(i))continue;const s=Op(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(const n of e.seen.values()){for(const o of[n.schema,n.def]){const i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}}var Db=(e,t,r,n)=>{const o=r;const i=e._zod.def;o.type="object";const s=i.keyType;const a=It(s).patterns;if(i.mode==="loose"&&a&&a.size>0){const u=et(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(const d of a){cr(o.patternProperties,Ib(d).source,u)}}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=et(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let u=vp.get(t);if(!u){u=[];vp.set(t,u);t.deferred.push(()=>Yk(t))}u.push(e)}o.additionalProperties=et(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}const c=s._zod.values;const l=t.io==="input"&&au(i.valueType)!==void 0;if(c&&!i.partial&&!l){const u=[...c].filter(d=>typeof d==="string"||typeof d==="number");if(u.length>0){o.required=u.map(String)}}};var Ub=(e,t,r,n)=>{const o=e._zod.def;const i=et(o.innerType,t,n);const s=t.seen.get(e);if(t.target==="openapi-3.0"){s.ref=o.innerType;r.nullable=true}else{r.anyOf=[i,{type:"null"}]}};var Lb=(e,t,r,n)=>{const o=e._zod.def;et(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType};var $p=Symbol();function qb(e,t,r,n,o){let i=false;const s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;i=true;return null});if(!i)return JSON.parse(s);Kr(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema");return $p}var Kb=(e,t,r,n)=>{const o=e._zod.def;et(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType;const s=qb(o.defaultValue,e,t,r,n);if(s!==$p)r.default=s};var Zb=(e,t,r,n)=>{const o=e._zod.def;et(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType;if(t.io!=="input")return;const s=qb(o.defaultValue,e,t,r,n);if(s!==$p)r._prefault=s};var Bb=(e,t,r,n)=>{const o=e._zod.def;et(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Kr(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s};var Gb=(e,t,r,n)=>{const o=e._zod.def;const i=o.in._zod.traits.has("$ZodTransform");const s=t.io==="input"?i?o.out:o.in:o.out;et(s,t,n);const a=t.seen.get(e);a.ref=s};var Vb=(e,t,r,n)=>{const o=e._zod.def;et(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType;r.readOnly=true};var kp=(e,t,r,n)=>{const o=e._zod.def;et(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType};function cu(e){const t=e;return!!t._zod}function so(e,t){if(cu(e)){const o=Bd(e,t);return o}const r=e;const n=r.safeParse(t);return n}function uu(e){if(!e)return void 0;let t;if(cu(e)){const r=e;t=r._zod?.def?.shape}else{const r=e;t=r.shape}if(!t)return void 0;if(typeof t==="function"){try{return t()}catch{return void 0}}return t}function lu(e){if(cu(e)){const o=e;const i=o._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0){return i.values[0]}}}const t=e;const r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0){return r.values[0]}}const n=e.value;if(n!==void 0)return n;return void 0}var Hb=new WeakSet([Object.prototype,Error.prototype]);function du(e,t,r){Object.defineProperty(e,t,{configurable:true,enumerable:false,get(){const n=r(this);Object.defineProperty(this,t,{value:n,configurable:true,writable:true});return n},set(n){Object.defineProperty(this,t,{value:n,configurable:true,writable:true})}})}var cR=(e,t)=>{sy.init(e,t);e.name="ZodError";const r=Object.getPrototypeOf(e);if(Hb.has(r))return;Hb.add(r);du(r,"format",n=>o=>Zd(n,o));du(r,"flatten",n=>o=>Kd(n,o));du(r,"addIssue",n=>o=>{n.issues.push(o);n.message=JSON.stringify(n.issues,Vi,2)});du(r,"addIssues",n=>o=>{n.issues.push(...o);n.message=JSON.stringify(n.issues,Vi,2)});Object.defineProperty(r,"isEmpty",{configurable:true,enumerable:false,get(){return this.issues.length===0}})};var ur=T("ZodError",cR,void 0,{Parent:Error});var Wb=jc(ur);var Jb=Dc(ur);var Xb=oa(ur);var Yb=Uc(ur);var Qb=uy(ur);var eI=ly(ur);var tI=dy(ur);var rI=py(ur);var nI=fy(ur);var oI=my(ur);var iI=hy(ur);var sI=gy(ur);function lR(){if(!Vt.localeError)Ht(bx())}function fu(){if(!Vt.memoizer)Ht({memoizer:cp()})}var Re=T("ZodType",(e,t)=>{lR();$e.init(e,t);e.def=t;e.type=t.type;return e},{check(...e){const t=this.def;return this.clone(F.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:true})},with(...e){return this.check(...e)},clone(e,t){return Tr(this,e,t)},brand(){return this},register(e,t){e.add(this,t);return this},refine(e,t){return this.check(XR(e,t))},superRefine(e,t){return this.check(YR(e,t))},overwrite(e){return this.check(io(e))},optional(){return Ge(this)},exactOptional(){return DR(this)},nullable(){return uI(this)},nullish(){return Ge(uI(this))},nonoptional(e){return BR(this,e)},array(){return ue(this)},or(e){return Fe([this,e])},and(e){return hu(this,e)},transform(e){return lI(this,_I(e))},default(e){return qR(this,e)},prefault(e){return ZR(this,e)},catch(e){return VR(this,e)},pipe(e){return lI(this,e)},readonly(){return JR(this)},describe(e){const t=this.clone();oo.add(t,{description:e});return t},meta(...e){if(e.length===0)return oo.get(this);const t=this.clone();oo.add(t,e[0]);return t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return F.hide(this,"~standard",{...Qd(this),jsonSchema:{input:da(this,"input"),output:da(this,"output")}})},set"~standard"(e){F.own(this,"~standard",e)},parse:function e(t,r){return Wb(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Jb(this,t,r,{callee:e})},safeParse(e,t){return Xb(this,e,t)},async safeParseAsync(e,t){return Yb(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){F.own(this,"spa",e)},validate(e,t){return Lc(this,e,t)},validateAsync(e,t){return qc(this,e,t)},encode:function e(t,r){return Qb(this,t,r,{callee:e})},decode:function e(t,r){return eI(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await tI(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await rI(this,t,r,{callee:e})},safeEncode(e,t){return nI(this,e,t)},safeDecode(e,t){return oI(this,e,t)},async safeEncodeAsync(e,t){return iI(this,e,t)},async safeDecodeAsync(e,t){return sI(this,e,t)},toJSONSchema(e){return pb(this,{})(e)},get description(){return oo.get(this)?.description},get _def(){return this._zod.def}});var dI=T("_ZodString",(e,t)=>{Hc.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>wb(e,r,n,o)},F.derived({format:e=>It(e).format??null,minLength:e=>It(e).minimum??null,maxLength:e=>It(e).maximum??null},{regex(...e){return this.check(dp(...e))},includes(...e){return this.check(mp(...e))},startsWith(...e){return this.check(hp(...e))},endsWith(...e){return this.check(gp(...e))},min(...e){return this.check(ts(...e))},max(...e){return this.check(iu(...e))},length(...e){return this.check(su(...e))},nonempty(...e){return this.check(ts(1,...e))},lowercase(e){return this.check(pp(e))},uppercase(e){return this.check(fp(e))},trim(){return this.check(_p())},normalize(...e){return this.check(yp(...e))},toLowerCase(){return this.check(xp())},toUpperCase(){return this.check(bp())},slugify(){return this.check(Ip())}}));var Mp=T("ZodString",(e,t)=>{Hc.init(e,t);dI.init(e,t)},{email(e){return this.check(Px(dR,e))},url(e){return this.check(lp(pI,e))},jwt(e){return this.check(Bx(vR,e))},emoji(e){return this.check(Mx(fR,e))},guid(e){return this.check(Ox(pR,e))},uuid(e){return this.check(vx(pu,e))},uuidv4(e){return this.check($x(pu,e))},uuidv6(e){return this.check(kx(pu,e))},uuidv7(e){return this.check(Rx(pu,e))},nanoid(e){return this.check(Ax(mR,e))},cuid(e){return this.check(Ex(hR,e))},cuid2(e){return this.check(zx(gR,e))},ulid(e){return this.check(Cx(yR,e))},base64(e){return this.check(qx(TR,e))},base64url(e){return this.check(Kx(PR,e))},xid(e){return this.check(Nx(_R,e))},ksuid(e){return this.check(Fx(xR,e))},ipv4(e){return this.check(jx(bR,e))},ipv6(e){return this.check(Dx(IR,e))},cidrv4(e){return this.check(Ux(wR,e))},cidrv6(e){return this.check(Lx(SR,e))},e164(e){return this.check(Zx(OR,e))},datetime(e){return this.check(tu(pa,e))},date(e){return this.check(ru(fa,e))},time(e){return this.check(nu(ma,e))},duration(e){return this.check(ou(ha,e))}});function S(e){return Sx(Mp,e)}var Je=T("ZodStringFormat",(e,t)=>{Ne.init(e,t);dI.init(e,t)});var pa=T("ZodISODateTime",(e,t)=>{R_.init(e,t);Je.init(e,t)});var fa=T("ZodISODate",(e,t)=>{M_.init(e,t);Je.init(e,t)});var ma=T("ZodISOTime",(e,t)=>{A_.init(e,t);Je.init(e,t)});var ha=T("ZodISODuration",(e,t)=>{E_.init(e,t);Je.init(e,t)});var dR=T("ZodEmail",(e,t)=>{x_.init(e,t);Je.init(e,t)});var pR=T("ZodGUID",(e,t)=>{y_.init(e,t);Je.init(e,t)});var pu=T("ZodUUID",(e,t)=>{__.init(e,t);Je.init(e,t)});var pI=T("ZodURL",(e,t)=>{w_.init(e,t);Je.init(e,t)});function lH(e){return lp(pI,e)}var fR=T("ZodEmoji",(e,t)=>{S_.init(e,t);Je.init(e,t)});var mR=T("ZodNanoID",(e,t)=>{T_.init(e,t);Je.init(e,t)});var hR=T("ZodCUID",(e,t)=>{P_.init(e,t);Je.init(e,t)});var gR=T("ZodCUID2",(e,t)=>{O_.init(e,t);Je.init(e,t)});var yR=T("ZodULID",(e,t)=>{v_.init(e,t);Je.init(e,t)});var _R=T("ZodXID",(e,t)=>{$_.init(e,t);Je.init(e,t)});var xR=T("ZodKSUID",(e,t)=>{k_.init(e,t);Je.init(e,t)});var bR=T("ZodIPv4",(e,t)=>{z_.init(e,t);Je.init(e,t)});var IR=T("ZodIPv6",(e,t)=>{N_.init(e,t);Je.init(e,t)});var wR=T("ZodCIDRv4",(e,t)=>{F_.init(e,t);Je.init(e,t)});var SR=T("ZodCIDRv6",(e,t)=>{j_.init(e,t);Je.init(e,t)});var TR=T("ZodBase64",(e,t)=>{U_.init(e,t);Je.init(e,t)});var PR=T("ZodBase64URL",(e,t)=>{L_.init(e,t);Je.init(e,t)});var OR=T("ZodE164",(e,t)=>{q_.init(e,t);Je.init(e,t)});var vR=T("ZodJWT",(e,t)=>{K_.init(e,t);Je.init(e,t)});var mu=T("ZodNumber",(e,t)=>{tp.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Sb(e,r,n,o);e.isFinite=true},F.derived({minValue:e=>{const{minimum:t,exclusiveMinimum:r}=It(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:r}=It(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:r}=It(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>It(e).format??null},{gt(e,t){return this.check(es(e,t))},gte(e,t){return this.check(Nn(e,t))},min(e,t){return this.check(Nn(e,t))},lt(e,t){return this.check(Qi(e,t))},lte(e,t){return this.check(Cn(e,t))},max(e,t){return this.check(Cn(e,t))},int(e){return this.check(aI(e))},safe(e){return this.check(aI(e))},positive(e){return this.check(es(0,e))},nonnegative(e){return this.check(Nn(0,e))},negative(e){return this.check(Qi(0,e))},nonpositive(e){return this.check(Cn(0,e))},multipleOf(e,t){return this.check(ua(e,t))},step(e,t){return this.check(ua(e,t))},finite(){return this}}));function Te(e){return Gx(mu,e)}var $R=T("ZodNumberFormat",(e,t)=>{Z_.init(e,t);mu.init(e,t)});function aI(e){return Hx($R,e)}var Ap=T("ZodBoolean",(e,t)=>{B_.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Tb(e,r,n,o)});function ft(e){return Wx(Ap,e)}var fI=T("ZodBigInt",(e,t)=>{G_.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Pb(e,r,n,o)},F.derived({minValue:e=>It(e).minimum??null,maxValue:e=>It(e).maximum??null,format:e=>It(e).format??null},{gte(e,t){return this.check(Nn(e,t))},min(e,t){return this.check(Nn(e,t))},gt(e,t){return this.check(es(e,t))},lt(e,t){return this.check(Qi(e,t))},lte(e,t){return this.check(Cn(e,t))},max(e,t){return this.check(Cn(e,t))},positive(e){return this.check(es(BigInt(0),e))},negative(e){return this.check(Qi(BigInt(0),e))},nonpositive(e){return this.check(Cn(BigInt(0),e))},nonnegative(e){return this.check(Nn(BigInt(0),e))},multipleOf(e,t){return this.check(ua(e,t))}}));var kR=T("ZodNull",(e,t)=>{V_.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Ob(e,r,n,o)});function mI(e){return Yx(kR,e)}var RR=T("ZodAny",(e,t)=>{H_.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>$b(e,r,n,o)});function dH(){return Qx(RR)}var MR=T("ZodUnknown",(e,t)=>{W_.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>kb(e,r,n,o)});function Be(){return eb(MR)}var AR=T("ZodNever",(e,t)=>{J_.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>vb(e,r,n,o)});function ER(e){return tb(AR,e)}var hI=T("ZodDate",(e,t)=>{X_.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Rb(e,r,n,o);e.min=(r,n)=>e.check(Nn(r,n));e.max=(r,n)=>e.check(Cn(r,n))},F.derived({minDate:e=>{const{minimum:t}=It(e);return t?new Date(t):null},maxDate:e=>{const{maximum:t}=It(e);return t?new Date(t):null}},{}));var zR=T("ZodArray",(e,t)=>{fu();Y_.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Cb(e,r,n,o);e.element=t.element},{min(e,t){return this.check(ts(e,t))},nonempty(e){return this.check(ts(1,e))},max(e,t){return this.check(iu(e,t))},length(e,t){return this.check(su(e,t))},unwrap(){return this.element}});function ue(e,t){return nb(zR,e,t)}var gI=T("ZodObject",(e,t)=>{fu();tx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Nb(e,r,n,o);F.installLazyProp(e,"shape",r=>r._zod.def.shape,false)},{keyof(){return Wt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(F.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(F.mergeDefs(this._zod.def,{catchall:Be()}))},loose(){return this.clone(F.mergeDefs(this._zod.def,{catchall:Be()}))},strict(){return this.clone(F.mergeDefs(this._zod.def,{catchall:ER()}))},strip(){return this.clone(F.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return F.extend(this,e)},safeExtend(e){return F.safeExtend(this,e)},merge(e){return F.merge(this,e)},pick(e){return F.pick(this,e)},omit(e){return F.omit(this,e)},partial(...e){return F.partial(xI,this,e[0])},exactPartial(...e){return F.partial(bI,this,e[0],"exactPartial")},required(...e){return F.required(II,this,e[0])}});function M(e,t){const r={type:"object",shape:e??{},...F.normalizeParams(t)};return new gI(r)}function Ut(e,t){return new gI({type:"object",shape:e,catchall:Be(),...F.normalizeParams(t)})}var yI=T("ZodUnion",(e,t)=>{rp.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Fb(e,r,n,o);e.options=t.options});function Fe(e,t){return new yI({type:"union",options:e,...F.normalizeParams(t)})}var CR=T("ZodDiscriminatedUnion",(e,t)=>{yI.init(e,t);rx.init(e,t)});function Ep(e,t,r){return new CR({type:"union",options:t,discriminator:e,...F.normalizeParams(r)})}var NR=T("ZodIntersection",(e,t)=>{nx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>jb(e,r,n,o)});function hu(e,t){return new NR({type:"intersection",left:e,right:t})}var cI=T("ZodRecord",(e,t)=>{fu();ox.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Db(e,r,n,o);e.keyType=t.keyType;e.valueType=t.valueType});function ze(e,t,r){if(!t||!t._zod){return new cI({type:"record",keyType:S(),valueType:e,...F.normalizeParams(t)})}return new cI({type:"record",keyType:e,valueType:t,...F.normalizeParams(r)})}var Rp=T("ZodEnum",(e,t)=>{ix.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(n,o,i)=>Mb(e,n,o,i);e.enum=t.entries;e.options=[...e._zod.values];const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const i={};for(const s of n){if(r.has(s)){i[s]=t.entries[s]}else throw new Error(`Key ${s} not found in enum`)}return new Rp({...t,checks:[],...F.normalizeParams(o),entries:i})};e.exclude=(n,o)=>{const i={...t.entries};for(const s of n){if(r.has(s)){delete i[s]}else throw new Error(`Key ${s} not found in enum`)}return new Rp({...t,checks:[],...F.normalizeParams(o),entries:i})}});function Wt(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Rp({type:"enum",entries:r,...F.normalizeParams(t)})}var FR=T("ZodLiteral",(e,t)=>{sx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Ab(e,r,n,o);e.values=new Set(t.values);Object.defineProperty(e,"value",{get(){if(t.values.length>1){throw new Error("This schema contains multiple valid literal values. Use `.values` instead.")}return t.values[0]}})});function z(e,t){return new FR({type:"literal",values:Array.isArray(e)?e:[e],...F.normalizeParams(t)})}var jR=T("ZodTransform",(e,t)=>{fu();ax.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>zb(e,r,n,o);e._zod.parse=(r,n)=>{if(n.direction==="backward"){throw new Xi(e.constructor.name)}r.addIssue=i=>{if(typeof i==="string"){r.issues.push(F.issue(i,r.value,t))}else{const s=i;if(s.fatal)s.continue=false;s.code??(s.code="custom");if(!("input"in s))s.input=r.value;s.inst??(s.inst=e);r.issues.push(F.issue(s))}};const o=t.transform(r.value,r);if(o instanceof Promise){return o.then(i=>{r.value=i;return r})}r.value=o;return r}});function _I(e){return new jR({type:"transform",transform:e})}var xI=T("ZodOptional",(e,t)=>{np.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>kp(e,r,n,o);e.unwrap=()=>e._zod.def.innerType});function Ge(e){return new xI({type:"optional",innerType:e})}var bI=T("ZodExactOptional",(e,t)=>{cx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>kp(e,r,n,o);e.unwrap=()=>e._zod.def.innerType});function DR(e){return new bI({type:"optional",innerType:e})}var UR=T("ZodNullable",(e,t)=>{ux.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Ub(e,r,n,o);e.unwrap=()=>e._zod.def.innerType});function uI(e){return new UR({type:"nullable",innerType:e})}var LR=T("ZodDefault",(e,t)=>{lx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Kb(e,r,n,o);e.unwrap=()=>e._zod.def.innerType;e.removeDefault=e.unwrap});function qR(e,t){return new LR({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():F.shallowClone(t)}})}var KR=T("ZodPrefault",(e,t)=>{dx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Zb(e,r,n,o);e.unwrap=()=>e._zod.def.innerType});function ZR(e,t){return new KR({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():F.shallowClone(t)}})}var II=T("ZodNonOptional",(e,t)=>{px.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Lb(e,r,n,o);e.unwrap=()=>e._zod.def.innerType});function BR(e,t){return new II({type:"nonoptional",innerType:e,...F.normalizeParams(t)})}var GR=T("ZodCatch",(e,t)=>{fx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Bb(e,r,n,o);e.unwrap=()=>e._zod.def.innerType;e.removeCatch=e.unwrap});function VR(e,t){return new GR({type:"catch",innerType:e,catchValue:typeof t==="function"?t:F.constantCatch(t)})}var wI=T("ZodPipe",(e,t)=>{op.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Gb(e,r,n,o);e.in=t.in;e.out=t.out});function lI(e,t){return new wI({type:"pipe",in:e,out:t})}var HR=T("ZodPreprocess",(e,t)=>{wI.init(e,t);mx.init(e,t)});var WR=T("ZodReadonly",(e,t)=>{hx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Vb(e,r,n,o);e.unwrap=()=>e._zod.def.innerType});function JR(e){return new WR({type:"readonly",innerType:e})}var SI=T("ZodCustom",(e,t)=>{gx.init(e,t);Re.init(e,t);e._zod.processJSONSchema=(r,n,o)=>Eb(e,r,n,o)});function TI(e,t){return ob(SI,e??(()=>true),t)}function XR(e,t={}){return ib(SI,e,t)}function YR(e,t){return sb(e,t)}function zp(e,t){return new HR({type:"pipe",in:_I(e),out:t})}var pH={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var PI;(function(e){})(PI||(PI={}));var gu={};_n(gu,{ZodISODate:()=>fa,ZodISODateTime:()=>pa,ZodISODuration:()=>ha,ZodISOTime:()=>ma,date:()=>tM,datetime:()=>eM,duration:()=>nM,time:()=>rM});function eM(e){return tu(pa,e)}function tM(e){return ru(fa,e)}function rM(e){return nu(ma,e)}function nM(e){return ou(ha,e)}var OI={};_n(OI,{bigint:()=>aM,boolean:()=>sM,date:()=>cM,number:()=>iM,string:()=>oM});function oM(e){return Tx(Mp,e)}function iM(e){return Vx(mu,e)}function sM(e){return Jx(Ap,e)}function aM(e){return Xx(fI,e)}function cM(e){return rb(hI,e)}var Np="2025-11-25";var vI=[Np,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"];var ao="io.modelcontextprotocol/related-task";var _u="2.0";var dt=TI(e=>e!==null&&(typeof e==="object"||typeof e==="function"));var $I=Fe([S(),Te().int()]);var kI=S();var NH=Ut({ttl:Te().optional(),pollInterval:Te().optional()});var uM=M({ttl:Te().optional()});var lM=M({taskId:S()});var Fp=Ut({progressToken:$I.optional(),[ao]:lM.optional()});var lr=M({_meta:Fp.optional()});var ga=lr.extend({task:uM.optional()});var RI=e=>ga.safeParse(e).success;var wt=M({method:S(),params:lr.loose().optional()});var Pr=M({_meta:Fp.optional()});var Or=M({method:S(),params:Pr.loose().optional()});var St=Ut({_meta:Fp.optional()});var xu=Fe([S(),Te().int()]);var MI=M({jsonrpc:z(_u),id:xu,...wt.shape}).strict();var jp=e=>MI.safeParse(e).success;var AI=M({jsonrpc:z(_u),...Or.shape}).strict();var EI=e=>AI.safeParse(e).success;var Dp=M({jsonrpc:z(_u),id:xu,result:St}).strict();var ya=e=>Dp.safeParse(e).success;var ie;(function(e){e[e["ConnectionClosed"]=-32e3]="ConnectionClosed";e[e["RequestTimeout"]=-32001]="RequestTimeout";e[e["ParseError"]=-32700]="ParseError";e[e["InvalidRequest"]=-32600]="InvalidRequest";e[e["MethodNotFound"]=-32601]="MethodNotFound";e[e["InvalidParams"]=-32602]="InvalidParams";e[e["InternalError"]=-32603]="InternalError";e[e["UrlElicitationRequired"]=-32042]="UrlElicitationRequired"})(ie||(ie={}));var Up=M({jsonrpc:z(_u),id:xu.optional(),error:M({code:Te().int(),message:S(),data:Be().optional()})}).strict();var zI=e=>Up.safeParse(e).success;var CI=Fe([MI,AI,Dp,Up]);var FH=Fe([Dp,Up]);var bu=St.strict();var dM=Pr.extend({requestId:xu.optional(),reason:S().optional()});var Iu=Or.extend({method:z("notifications/cancelled"),params:dM});var pM=M({src:S(),mimeType:S().optional(),sizes:ue(S()).optional(),theme:Wt(["light","dark"]).optional()});var _a=M({icons:ue(pM).optional()});var is=M({name:S(),title:S().optional()});var NI=is.extend({...is.shape,..._a.shape,version:S(),websiteUrl:S().optional(),description:S().optional()});var fM=hu(M({applyDefaults:ft().optional()}),ze(S(),Be()));var mM=zp(e=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0){return{form:{}}}}return e},hu(M({form:fM.optional(),url:dt.optional()}),ze(S(),Be()).optional()));var hM=Ut({list:dt.optional(),cancel:dt.optional(),requests:Ut({sampling:Ut({createMessage:dt.optional()}).optional(),elicitation:Ut({create:dt.optional()}).optional()}).optional()});var gM=Ut({list:dt.optional(),cancel:dt.optional(),requests:Ut({tools:Ut({call:dt.optional()}).optional()}).optional()});var yM=M({experimental:ze(S(),dt).optional(),sampling:M({context:dt.optional(),tools:dt.optional()}).optional(),elicitation:mM.optional(),roots:M({listChanged:ft().optional()}).optional(),tasks:hM.optional(),extensions:ze(S(),dt).optional()});var _M=lr.extend({protocolVersion:S(),capabilities:yM,clientInfo:NI});var Lp=wt.extend({method:z("initialize"),params:_M});var xM=M({experimental:ze(S(),dt).optional(),logging:dt.optional(),completions:dt.optional(),prompts:M({listChanged:ft().optional()}).optional(),resources:M({subscribe:ft().optional(),listChanged:ft().optional()}).optional(),tools:M({listChanged:ft().optional()}).optional(),tasks:gM.optional(),extensions:ze(S(),dt).optional()});var bM=St.extend({protocolVersion:S(),capabilities:xM,serverInfo:NI,instructions:S().optional()});var wu=Or.extend({method:z("notifications/initialized"),params:Pr.optional()});var jH=e=>wu.safeParse(e).success;var Su=wt.extend({method:z("ping"),params:lr.optional()});var IM=M({progress:Te(),total:Ge(Te()),message:Ge(S())});var wM=M({...Pr.shape,...IM.shape,progressToken:$I});var Tu=Or.extend({method:z("notifications/progress"),params:wM});var SM=lr.extend({cursor:kI.optional()});var xa=wt.extend({params:SM.optional()});var ba=St.extend({nextCursor:kI.optional()});var TM=Wt(["working","input_required","completed","failed","cancelled"]);var Ia=M({taskId:S(),status:TM,ttl:Fe([Te(),mI()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:Ge(Te()),statusMessage:Ge(S())});var ss=St.extend({task:Ia});var PM=Pr.merge(Ia);var wa=Or.extend({method:z("notifications/tasks/status"),params:PM});var Pu=wt.extend({method:z("tasks/get"),params:lr.extend({taskId:S()})});var Ou=St.merge(Ia);var vu=wt.extend({method:z("tasks/result"),params:lr.extend({taskId:S()})});var DH=St.loose();var $u=xa.extend({method:z("tasks/list")});var ku=ba.extend({tasks:ue(Ia)});var Ru=wt.extend({method:z("tasks/cancel"),params:lr.extend({taskId:S()})});var FI=St.merge(Ia);var jI=M({uri:S(),mimeType:Ge(S()),_meta:ze(S(),Be()).optional()});var DI=jI.extend({text:S()});var qp=S().refine(e=>{try{atob(e);return true}catch{return false}},{message:"Invalid Base64 string"});var UI=jI.extend({blob:qp});var Sa=Wt(["user","assistant"]);var as=M({audience:ue(Sa).optional(),priority:Te().min(0).max(1).optional(),lastModified:gu.datetime({offset:true}).optional()});var LI=M({...is.shape,..._a.shape,uri:S(),description:Ge(S()),mimeType:Ge(S()),size:Ge(Te()),annotations:as.optional(),_meta:Ge(Ut({}))});var OM=M({...is.shape,..._a.shape,uriTemplate:S(),description:Ge(S()),mimeType:Ge(S()),annotations:as.optional(),_meta:Ge(Ut({}))});var vM=xa.extend({method:z("resources/list")});var $M=ba.extend({resources:ue(LI)});var kM=xa.extend({method:z("resources/templates/list")});var RM=ba.extend({resourceTemplates:ue(OM)});var Kp=lr.extend({uri:S()});var MM=Kp;var AM=wt.extend({method:z("resources/read"),params:MM});var EM=St.extend({contents:ue(Fe([DI,UI]))});var zM=Or.extend({method:z("notifications/resources/list_changed"),params:Pr.optional()});var CM=Kp;var NM=wt.extend({method:z("resources/subscribe"),params:CM});var FM=Kp;var jM=wt.extend({method:z("resources/unsubscribe"),params:FM});var DM=Pr.extend({uri:S()});var UM=Or.extend({method:z("notifications/resources/updated"),params:DM});var LM=M({name:S(),description:Ge(S()),required:Ge(ft())});var qM=M({...is.shape,..._a.shape,description:Ge(S()),arguments:Ge(ue(LM)),_meta:Ge(Ut({}))});var KM=xa.extend({method:z("prompts/list")});var ZM=ba.extend({prompts:ue(qM)});var BM=lr.extend({name:S(),arguments:ze(S(),S()).optional()});var GM=wt.extend({method:z("prompts/get"),params:BM});var Zp=M({type:z("text"),text:S(),annotations:as.optional(),_meta:ze(S(),Be()).optional()});var Bp=M({type:z("image"),data:qp,mimeType:S(),annotations:as.optional(),_meta:ze(S(),Be()).optional()});var Gp=M({type:z("audio"),data:qp,mimeType:S(),annotations:as.optional(),_meta:ze(S(),Be()).optional()});var VM=M({type:z("tool_use"),name:S(),id:S(),input:ze(S(),Be()),_meta:ze(S(),Be()).optional()});var HM=M({type:z("resource"),resource:Fe([DI,UI]),annotations:as.optional(),_meta:ze(S(),Be()).optional()});var WM=LI.extend({type:z("resource_link")});var Vp=Fe([Zp,Bp,Gp,WM,HM]);var JM=M({role:Sa,content:Vp});var XM=St.extend({description:S().optional(),messages:ue(JM)});var YM=Or.extend({method:z("notifications/prompts/list_changed"),params:Pr.optional()});var QM=M({title:S().optional(),readOnlyHint:ft().optional(),destructiveHint:ft().optional(),idempotentHint:ft().optional(),openWorldHint:ft().optional()});var eA=M({taskSupport:Wt(["required","optional","forbidden"]).optional()});var qI=M({...is.shape,..._a.shape,description:S().optional(),inputSchema:M({type:z("object"),properties:ze(S(),dt).optional(),required:ue(S()).optional()}).catchall(Be()),outputSchema:M({type:z("object"),properties:ze(S(),dt).optional(),required:ue(S()).optional()}).catchall(Be()).optional(),annotations:QM.optional(),execution:eA.optional(),_meta:ze(S(),Be()).optional()});var Hp=xa.extend({method:z("tools/list")});var tA=ba.extend({tools:ue(qI)});var Mu=St.extend({content:ue(Vp).default([]),structuredContent:ze(S(),Be()).optional(),isError:ft().optional()});var UH=Mu.or(St.extend({toolResult:Be()}));var rA=ga.extend({name:S(),arguments:ze(S(),Be()).optional()});var Ta=wt.extend({method:z("tools/call"),params:rA});var nA=Or.extend({method:z("notifications/tools/list_changed"),params:Pr.optional()});var LH=M({autoRefresh:ft().default(true),debounceMs:Te().int().nonnegative().default(300)});var Pa=Wt(["debug","info","notice","warning","error","critical","alert","emergency"]);var oA=lr.extend({level:Pa});var Wp=wt.extend({method:z("logging/setLevel"),params:oA});var iA=Pr.extend({level:Pa,logger:S().optional(),data:Be()});var sA=Or.extend({method:z("notifications/message"),params:iA});var aA=M({name:S().optional()});var cA=M({hints:ue(aA).optional(),costPriority:Te().min(0).max(1).optional(),speedPriority:Te().min(0).max(1).optional(),intelligencePriority:Te().min(0).max(1).optional()});var uA=M({mode:Wt(["auto","required","none"]).optional()});var lA=M({type:z("tool_result"),toolUseId:S().describe("The unique identifier for the corresponding tool call."),content:ue(Vp).default([]),structuredContent:M({}).loose().optional(),isError:ft().optional(),_meta:ze(S(),Be()).optional()});var dA=Ep("type",[Zp,Bp,Gp]);var yu=Ep("type",[Zp,Bp,Gp,VM,lA]);var pA=M({role:Sa,content:Fe([yu,ue(yu)]),_meta:ze(S(),Be()).optional()});var fA=ga.extend({messages:ue(pA),modelPreferences:cA.optional(),systemPrompt:S().optional(),includeContext:Wt(["none","thisServer","allServers"]).optional(),temperature:Te().optional(),maxTokens:Te().int(),stopSequences:ue(S()).optional(),metadata:dt.optional(),tools:ue(qI).optional(),toolChoice:uA.optional()});var mA=wt.extend({method:z("sampling/createMessage"),params:fA});var Oa=St.extend({model:S(),stopReason:Ge(Wt(["endTurn","stopSequence","maxTokens"]).or(S())),role:Sa,content:dA});var Jp=St.extend({model:S(),stopReason:Ge(Wt(["endTurn","stopSequence","maxTokens","toolUse"]).or(S())),role:Sa,content:Fe([yu,ue(yu)])});var hA=M({type:z("boolean"),title:S().optional(),description:S().optional(),default:ft().optional()});var gA=M({type:z("string"),title:S().optional(),description:S().optional(),minLength:Te().optional(),maxLength:Te().optional(),format:Wt(["email","uri","date","date-time"]).optional(),default:S().optional()});var yA=M({type:Wt(["number","integer"]),title:S().optional(),description:S().optional(),minimum:Te().optional(),maximum:Te().optional(),default:Te().optional()});var _A=M({type:z("string"),title:S().optional(),description:S().optional(),enum:ue(S()),default:S().optional()});var xA=M({type:z("string"),title:S().optional(),description:S().optional(),oneOf:ue(M({const:S(),title:S()})),default:S().optional()});var bA=M({type:z("string"),title:S().optional(),description:S().optional(),enum:ue(S()),enumNames:ue(S()).optional(),default:S().optional()});var IA=Fe([_A,xA]);var wA=M({type:z("array"),title:S().optional(),description:S().optional(),minItems:Te().optional(),maxItems:Te().optional(),items:M({type:z("string"),enum:ue(S())}),default:ue(S()).optional()});var SA=M({type:z("array"),title:S().optional(),description:S().optional(),minItems:Te().optional(),maxItems:Te().optional(),items:M({anyOf:ue(M({const:S(),title:S()}))}),default:ue(S()).optional()});var TA=Fe([wA,SA]);var PA=Fe([bA,IA,TA]);var OA=Fe([PA,hA,gA,yA]);var vA=ga.extend({mode:z("form").optional(),message:S(),requestedSchema:M({type:z("object"),properties:ze(S(),OA),required:ue(S()).optional()})});var $A=ga.extend({mode:z("url"),message:S(),elicitationId:S(),url:S().url()});var kA=Fe([vA,$A]);var RA=wt.extend({method:z("elicitation/create"),params:kA});var MA=Pr.extend({elicitationId:S()});var AA=Or.extend({method:z("notifications/elicitation/complete"),params:MA});var cs=St.extend({action:Wt(["accept","decline","cancel"]),content:zp(e=>e===null?void 0:e,ze(S(),Fe([S(),Te(),ft(),ue(S())])).optional())});var EA=M({type:z("ref/resource"),uri:S()});var zA=M({type:z("ref/prompt"),name:S()});var CA=lr.extend({ref:Fe([zA,EA]),argument:M({name:S(),value:S()}),context:M({arguments:ze(S(),S()).optional()}).optional()});var NA=wt.extend({method:z("completion/complete"),params:CA});var FA=St.extend({completion:Ut({values:ue(S()).max(100),total:Ge(Te().int()),hasMore:Ge(ft())})});var jA=M({uri:S().startsWith("file://"),name:S().optional(),_meta:ze(S(),Be()).optional()});var DA=wt.extend({method:z("roots/list"),params:lr.optional()});var Xp=St.extend({roots:ue(jA)});var UA=Or.extend({method:z("notifications/roots/list_changed"),params:Pr.optional()});var qH=Fe([Su,Lp,NA,Wp,GM,KM,vM,kM,AM,NM,jM,Ta,Hp,Pu,vu,$u,Ru]);var KH=Fe([Iu,Tu,wu,UA,wa]);var ZH=Fe([bu,Oa,Jp,cs,Xp,Ou,ku,ss]);var BH=Fe([Su,mA,RA,DA,Pu,vu,$u,Ru]);var GH=Fe([Iu,Tu,sA,UM,zM,nA,YM,wa,AA]);var VH=Fe([bu,bM,FA,XM,ZM,$M,RM,EM,Mu,tA,Ou,ku,ss]);var K=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`);this.code=t;this.data=n;this.name="McpError"}static fromError(t,r,n){if(t===ie.UrlElicitationRequired&&n){const o=n;if(o.elicitations){return new Cp(o.elicitations,r)}}return new e(t,r,n)}};var Cp=class extends K{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(ie.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function co(e){return e==="completed"||e==="failed"||e==="cancelled"}function Yp(e){const t=uu(e);const r=t?.method;if(!r){throw new Error("Schema is missing a method literal")}const n=lu(r);if(typeof n!=="string"){throw new Error("Schema method literal must be a string")}return n}function Qp(e,t){const r=so(e,t);if(!r.success){throw r.error}return r.data}var LA=6e4;var Au=class{constructor(t){this._options=t;this._requestMessageId=0;this._requestHandlers=new Map;this._requestHandlerAbortControllers=new Map;this._notificationHandlers=new Map;this._responseHandlers=new Map;this._progressHandlers=new Map;this._timeoutInfo=new Map;this._pendingDebouncedNotifications=new Set;this._taskProgressTokens=new Map;this._requestResolvers=new Map;this.setNotificationHandler(Iu,r=>{this._oncancel(r)});this.setNotificationHandler(Tu,r=>{this._onprogress(r)});this.setRequestHandler(Su,r=>({}));this._taskStore=t?.taskStore;this._taskMessageQueue=t?.taskMessageQueue;if(this._taskStore){this.setRequestHandler(Pu,async(r,n)=>{const o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o){throw new K(ie.InvalidParams,"Failed to retrieve task: Task not found")}return{...o}});this.setRequestHandler(vu,async(r,n)=>{const o=async()=>{const i=r.params.taskId;if(this._taskMessageQueue){let a;while(a=await this._taskMessageQueue.dequeue(i,n.sessionId)){if(a.type==="response"||a.type==="error"){const c=a.message;const l=c.id;const u=this._requestResolvers.get(l);if(u){this._requestResolvers.delete(l);if(a.type==="response"){u(c)}else{const d=c;const h=new K(d.error.code,d.error.message,d.error.data);u(h)}}else{const d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}const s=await this._taskStore.getTask(i,n.sessionId);if(!s){throw new K(ie.InvalidParams,`Task not found: ${i}`)}if(!co(s.status)){await this._waitForTaskUpdate(i,n.signal);return await o()}if(co(s.status)){const a=await this._taskStore.getTaskResult(i,n.sessionId);this._clearTaskQueue(i);return{...a,_meta:{...a._meta,[ao]:{taskId:i}}}}return await o()};return await o()});this.setRequestHandler($u,async(r,n)=>{try{const{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new K(ie.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}});this.setRequestHandler(Ru,async(r,n)=>{try{const o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o){throw new K(ie.InvalidParams,`Task not found: ${r.params.taskId}`)}if(co(o.status)){throw new K(ie.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`)}await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId);this._clearTaskQueue(r.params.taskId);const i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i){throw new K(ie.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`)}return{_meta:{},...i}}catch(o){if(o instanceof K){throw o}throw new K(ie.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}}async _oncancel(t){if(!t.params.requestId){return}const r=this._requestHandlerAbortControllers.get(t.params.requestId);r?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=false){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){const r=this._timeoutInfo.get(t);if(!r)return false;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout){this._timeoutInfo.delete(t);throw K.fromError(ie.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n})}clearTimeout(r.timeoutId);r.timeoutId=setTimeout(r.onTimeout,r.timeout);return true}_cleanupTimeout(t){const r=this._timeoutInfo.get(t);if(r){clearTimeout(r.timeoutId);this._timeoutInfo.delete(t)}}async connect(t){if(this._transport){throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.")}this._transport=t;const r=this.transport?.onclose;this._transport.onclose=()=>{r?.();this._onclose()};const n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i);this._onerror(i)};const o=this._transport?.onmessage;this._transport.onmessage=(i,s)=>{o?.(i,s);if(ya(i)||zI(i)){this._onresponse(i)}else if(jp(i)){this._onrequest(i,s)}else if(EI(i)){this._onnotification(i)}else{this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))}};await this._transport.start()}_onclose(){const t=this._responseHandlers;this._responseHandlers=new Map;this._progressHandlers.clear();this._taskProgressTokens.clear();this._pendingDebouncedNotifications.clear();for(const n of this._timeoutInfo.values()){clearTimeout(n.timeoutId)}this._timeoutInfo.clear();for(const n of this._requestHandlerAbortControllers.values()){n.abort()}this._requestHandlerAbortControllers.clear();const r=K.fromError(ie.ConnectionClosed,"Connection closed");this._transport=void 0;this.onclose?.();for(const n of t.values()){n(r)}}_onerror(t){this.onerror?.(t)}_onnotification(t){const r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;if(r===void 0){return}Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){const n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler;const o=this._transport;const i=t.params?._meta?.[ao]?.taskId;if(n===void 0){const u={jsonrpc:"2.0",id:t.id,error:{code:ie.MethodNotFound,message:"Method not found"}};if(i&&this._taskMessageQueue){this._enqueueTaskMessage(i,{type:"error",message:u,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`)))}else{o?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)))}return}const s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);const a=RI(t.params)?t.params.task:void 0;const c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0;const l={signal:s.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async u=>{if(s.signal.aborted)return;const d={relatedRequestId:t.id};if(i){d.relatedTask={taskId:i}}await this.notification(u,d)},sendRequest:async(u,d,h)=>{if(s.signal.aborted){throw new K(ie.ConnectionClosed,"Request was cancelled")}const m={...h,relatedRequestId:t.id};if(i&&!m.relatedTask){m.relatedTask={taskId:i}}const p=m.relatedTask?.taskId??i;if(p&&c){await c.updateTaskStatus(p,"input_required")}return await this.request(u,d,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(a){this.assertTaskHandlerCapability(t.method)}}).then(()=>n(t,l)).then(async u=>{if(s.signal.aborted){return}const d={result:u,jsonrpc:"2.0",id:t.id};if(i&&this._taskMessageQueue){await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId)}else{await o?.send(d)}},async u=>{if(s.signal.aborted){return}const d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(u["code"])?u["code"]:ie.InternalError,message:u.message??"Internal error",...u["data"]!==void 0&&{data:u["data"]}}};if(i&&this._taskMessageQueue){await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId)}else{await o?.send(d)}}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(t.id)===s){this._requestHandlerAbortControllers.delete(t.id)}})}_onprogress(t){const{progressToken:r,...n}=t.params;const o=Number(r);const i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const s=this._responseHandlers.get(o);const a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress){try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o);this._progressHandlers.delete(o);this._cleanupTimeout(o);s(c);return}}i(n)}_onresponse(t){const r=Number(t.id);const n=this._requestResolvers.get(r);if(n){this._requestResolvers.delete(r);if(ya(t)){n(t)}else{const s=new K(t.error.code,t.error.message,t.error.data);n(s)}return}const o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r);this._cleanupTimeout(r);let i=false;if(ya(t)&&t.result&&typeof t.result==="object"){const s=t.result;if(s.task&&typeof s.task==="object"){const a=s.task;if(typeof a.taskId==="string"){i=true;this._taskProgressTokens.set(a.taskId,r)}}}if(!i){this._progressHandlers.delete(r)}if(ya(t)){o(t)}else{const s=K.fromError(t.error.code,t.error.message,t.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){const{task:o}=n??{};if(!o){try{const s=await this.request(t,r,n);yield{type:"result",result:s}}catch(s){yield{type:"error",error:s instanceof K?s:new K(ie.InternalError,String(s))}}return}let i;try{const s=await this.request(t,ss,n);if(s.task){i=s.task.taskId;yield{type:"taskCreated",task:s.task}}else{throw new K(ie.InternalError,"Task creation did not return a task")}while(true){const a=await this.getTask({taskId:i},n);yield{type:"taskStatus",task:a};if(co(a.status)){if(a.status==="completed"){const l=await this.getTaskResult({taskId:i},r,n);yield{type:"result",result:l}}else if(a.status==="failed"){yield{type:"error",error:new K(ie.InternalError,`Task ${i} failed`)}}else if(a.status==="cancelled"){yield{type:"error",error:new K(ie.InternalError,`Task ${i} was cancelled`)}}return}if(a.status==="input_required"){const l=await this.getTaskResult({taskId:i},r,n);yield{type:"result",result:l};return}const c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c));n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof K?s:new K(ie.InternalError,String(s))}}}request(t,r,n){const{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((l,u)=>{const d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===true){try{this.assertCapabilityForMethod(t.method);if(a){this.assertTaskCapability(t.method)}}catch(b){d(b);return}}n?.signal?.throwIfAborted();const h=this._requestMessageId++;const m={...t,jsonrpc:"2.0",id:h};if(n?.onprogress){this._progressHandlers.set(h,n.onprogress);m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:h}}}if(a){m.params={...m.params,task:a}}if(c){m.params={...m.params,_meta:{...m.params?._meta||{},[ao]:c}}}const p=b=>{this._responseHandlers.delete(h);this._progressHandlers.delete(h);this._cleanupTimeout(h);this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(b)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));const v=b instanceof K?b:new K(ie.RequestTimeout,String(b));u(v)};this._responseHandlers.set(h,b=>{if(n?.signal?.aborted){return}if(b instanceof Error){return u(b)}try{const v=so(r,b.result);if(!v.success){u(v.error)}else{l(v.data)}}catch(v){u(v)}});n?.signal?.addEventListener("abort",()=>{p(n?.signal?.reason)});const f=n?.timeout??LA;const g=()=>p(K.fromError(ie.RequestTimeout,"Request timed out",{timeout:f}));this._setupTimeout(h,f,n?.maxTotalTimeout,g,n?.resetTimeoutOnProgress??false);const _=c?.taskId;if(_){const b=v=>{const A=this._responseHandlers.get(h);if(A){A(v)}else{this._onerror(new Error(`Response handler missing for side-channeled request ${h}`))}};this._requestResolvers.set(h,b);this._enqueueTaskMessage(_,{type:"request",message:m,timestamp:Date.now()}).catch(v=>{this._cleanupTimeout(h);u(v)})}else{this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(b=>{this._cleanupTimeout(h);u(b)})}})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ou,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},ku,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},FI,r)}async notification(t,r){if(!this._transport){throw new Error("Not connected")}this.assertNotificationCapability(t.method);const n=r?.relatedTask?.taskId;if(n){const a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ao]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}const o=this._options?.debouncedNotificationMethods??[];const i=o.includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask;if(i){if(this._pendingDebouncedNotifications.has(t.method)){return}this._pendingDebouncedNotifications.add(t.method);Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method);if(!this._transport){return}let a={...t,jsonrpc:"2.0"};if(r?.relatedTask){a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ao]:r.relatedTask}}}}this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};if(r?.relatedTask){s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ao]:r.relatedTask}}}}await this._transport.send(s,r)}setRequestHandler(t,r){const n=Yp(t);this.assertRequestHandlerCapability(n);this._requestHandlers.set(n,(o,i)=>{const s=Qp(t,o);return Promise.resolve(r(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t)){throw new Error(`A request handler for ${t} already exists, which would be overridden`)}}setNotificationHandler(t,r){const n=Yp(t);this._notificationHandlers.set(n,o=>{const i=Qp(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const r=this._taskProgressTokens.get(t);if(r!==void 0){this._progressHandlers.delete(r);this._taskProgressTokens.delete(t)}}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue){throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured")}const o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){const n=await this._taskMessageQueue.dequeueAll(t,r);for(const o of n){if(o.type==="request"&&jp(o.message)){const i=o.message.id;const s=this._requestResolvers.get(i);if(s){s(new K(ie.InternalError,"Task cancelled or completed"));this._requestResolvers.delete(i)}else{this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{const o=await this._taskStore?.getTask(t);if(o?.pollInterval){n=o.pollInterval}}catch{}return new Promise((o,i)=>{if(r.aborted){i(new K(ie.InvalidRequest,"Request cancelled"));return}const s=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(s);i(new K(ie.InvalidRequest,"Request cancelled"))},{once:true})})}requestTaskStore(t,r){const n=this._taskStore;if(!n){throw new Error("No task store configured")}return{createTask:async o=>{if(!t){throw new Error("No request provided")}return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{const i=await n.getTask(o,r);if(!i){throw new K(ie.InvalidParams,"Failed to retrieve task: Task not found")}return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);const a=await n.getTask(o,r);if(a){const c=wa.parse({method:"notifications/tasks/status",params:a});await this.notification(c);if(co(a.status)){this._cleanupTaskProgressHandler(o)}}},getTaskResult:o=>{return n.getTaskResult(o,r)},updateTaskStatus:async(o,i,s)=>{const a=await n.getTask(o,r);if(!a){throw new K(ie.InvalidParams,`Task "${o}" not found - it may have been cleaned up`)}if(co(a.status)){throw new K(ie.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`)}await n.updateTaskStatus(o,i,s,r);const c=await n.getTask(o,r);if(c){const l=wa.parse({method:"notifications/tasks/status",params:c});await this.notification(l);if(co(c.status)){this._cleanupTaskProgressHandler(o)}}},listTasks:o=>{return n.listTasks(o,r)}}}};function KI(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ZI(e,t){const r={...e};for(const n in t){const o=n;const i=t[o];if(i===void 0)continue;const s=r[o];if(KI(s)&&KI(i)){r[o]={...s,...i}}else{r[o]=i}}return r}var ZT=Td(Zm(),1);var BT=Td(KT(),1);function X1(){const e=new ZT.default({strict:false,validateFormats:true,validateSchema:false,allErrors:true});const t=BT.default;t(e);return e}var hl=class{constructor(t){this._ajv=t??X1()}getValidator(t){const r="$id"in t&&typeof t.$id==="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>{const o=r(n);if(o){return{valid:true,data:n,errorMessage:void 0}}else{return{valid:false,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}}};var gl=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){const n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools){throw new Error("Client does not support sampling tools capability.")}if(t.messages.length>0){const o=t.messages[t.messages.length-1];const i=Array.isArray(o.content)?o.content:[o.content];const s=i.some(u=>u.type==="tool_result");const a=t.messages.length>1?t.messages[t.messages.length-2]:void 0;const c=a?Array.isArray(a.content)?a.content:[a.content]:[];const l=c.some(u=>u.type==="tool_use");if(s){if(i.some(u=>u.type!=="tool_result")){throw new Error("The last message must contain only tool_result content if any is present")}if(!l){throw new Error("tool_result blocks are not matching any tool_use from the previous message")}}if(l){const u=new Set(c.filter(h=>h.type==="tool_use").map(h=>h.id));const d=new Set(i.filter(h=>h.type==="tool_result").map(h=>h.toolUseId));if(u.size!==d.size||![...u].every(h=>d.has(h))){throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}}return this.requestStream({method:"sampling/createMessage",params:t},Oa,r)}elicitInputStream(t,r){const n=this._server.getClientCapabilities();const o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url){throw new Error("Client does not support url elicitation.")}break}case"form":{if(!n?.elicitation?.form){throw new Error("Client does not support form elicitation.")}break}}const i=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:i},cs,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function GT(e,t,r){if(!e){throw new Error(`${r} does not support task creation (required for ${t})`)}switch(t){case"tools/call":if(!e.tools?.call){throw new Error(`${r} does not support task creation for tools/call (required for ${t})`)}break;default:break}}function VT(e,t,r){if(!e){throw new Error(`${r} does not support task creation (required for ${t})`)}switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage){throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`)}break;case"elicitation/create":if(!e.elicitation?.create){throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`)}break;default:break}}var yl=class extends Au{constructor(t,r){super(r);this._serverInfo=t;this._loggingLevels=new Map;this.LOG_LEVEL_SEVERITY=new Map(Pa.options.map((n,o)=>[n,o]));this.isMessageIgnored=(n,o)=>{const i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):false};this._capabilities=r?.capabilities??{};this._instructions=r?.instructions;this._jsonSchemaValidator=r?.jsonSchemaValidator??new hl;this.setRequestHandler(Lp,n=>this._oninitialize(n));this.setNotificationHandler(wu,()=>this.oninitialized?.());if(this._capabilities.logging){this.setRequestHandler(Wp,async(n,o)=>{const i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0;const{level:s}=n.params;const a=Pa.safeParse(s);if(a.success){this._loggingLevels.set(i,a.data)}return{}})}}get experimental(){if(!this._experimental){this._experimental={tasks:new gl(this)}}return this._experimental}registerCapabilities(t){if(this.transport){throw new Error("Cannot register capabilities after connecting to transport")}this._capabilities=ZI(this._capabilities,t)}setRequestHandler(t,r){const n=uu(t);const o=n?.method;if(!o){throw new Error("Schema is missing a method literal")}const i=lu(o);if(typeof i!=="string"){throw new Error("Schema method literal must be a string")}const s=i;if(s==="tools/call"){const a=async(c,l)=>{const u=so(Ta,c);if(!u.success){const p=u.error instanceof Error?u.error.message:String(u.error);throw new K(ie.InvalidParams,`Invalid tools/call request: ${p}`)}const{params:d}=u.data;const h=await Promise.resolve(r(c,l));if(d.task){const p=so(ss,h);if(!p.success){const f=p.error instanceof Error?p.error.message:String(p.error);throw new K(ie.InvalidParams,`Invalid task creation result: ${f}`)}return p.data}const m=so(Mu,h);if(!m.success){const p=m.error instanceof Error?m.error.message:String(m.error);throw new K(ie.InvalidParams,`Invalid tools/call result: ${p}`)}return m.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling){throw new Error(`Client does not support sampling (required for ${t})`)}break;case"elicitation/create":if(!this._clientCapabilities?.elicitation){throw new Error(`Client does not support elicitation (required for ${t})`)}break;case"roots/list":if(!this._clientCapabilities?.roots){throw new Error(`Client does not support listing roots (required for ${t})`)}break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging){throw new Error(`Server does not support logging (required for ${t})`)}break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources){throw new Error(`Server does not support notifying about resources (required for ${t})`)}break;case"notifications/tools/list_changed":if(!this._capabilities.tools){throw new Error(`Server does not support notifying of tool list changes (required for ${t})`)}break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts){throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`)}break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url){throw new Error(`Client does not support URL elicitation (required for ${t})`)}break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(!this._capabilities){return}switch(t){case"completion/complete":if(!this._capabilities.completions){throw new Error(`Server does not support completions (required for ${t})`)}break;case"logging/setLevel":if(!this._capabilities.logging){throw new Error(`Server does not support logging (required for ${t})`)}break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts){throw new Error(`Server does not support prompts (required for ${t})`)}break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources){throw new Error(`Server does not support resources (required for ${t})`)}break;case"tools/call":case"tools/list":if(!this._capabilities.tools){throw new Error(`Server does not support tools (required for ${t})`)}break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks){throw new Error(`Server does not support tasks capability (required for ${t})`)}break;case"ping":case"initialize":break}}assertTaskCapability(t){VT(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){if(!this._capabilities){return}GT(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){const r=t.params.protocolVersion;this._clientCapabilities=t.params.capabilities;this._clientVersion=t.params.clientInfo;const n=vI.includes(r)?r:Np;return{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},bu)}async createMessage(t,r){if(t.tools||t.toolChoice){if(!this._clientCapabilities?.sampling?.tools){throw new Error("Client does not support sampling tools capability.")}}if(t.messages.length>0){const n=t.messages[t.messages.length-1];const o=Array.isArray(n.content)?n.content:[n.content];const i=o.some(l=>l.type==="tool_result");const s=t.messages.length>1?t.messages[t.messages.length-2]:void 0;const a=s?Array.isArray(s.content)?s.content:[s.content]:[];const c=a.some(l=>l.type==="tool_use");if(i){if(o.some(l=>l.type!=="tool_result")){throw new Error("The last message must contain only tool_result content if any is present")}if(!c){throw new Error("tool_result blocks are not matching any tool_use from the previous message")}}if(c){const l=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id));const u=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d))){throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}}if(t.tools){return this.request({method:"sampling/createMessage",params:t},Jp,r)}return this.request({method:"sampling/createMessage",params:t},Oa,r)}async elicitInput(t,r){const n=t.mode??"form";switch(n){case"url":{if(!this._clientCapabilities?.elicitation?.url){throw new Error("Client does not support url elicitation.")}const o=t;return this.request({method:"elicitation/create",params:o},cs,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form){throw new Error("Client does not support form elicitation.")}const o=t.mode==="form"?t:{...t,mode:"form"};const i=await this.request({method:"elicitation/create",params:o},cs,r);if(i.action==="accept"&&i.content&&o.requestedSchema){try{const s=this._jsonSchemaValidator.getValidator(o.requestedSchema);const a=s(i.content);if(!a.valid){throw new K(ie.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}}catch(s){if(s instanceof K){throw s}throw new K(ie.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url){throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)")}return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},Xp,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging){if(!this.isMessageIgnored(t.level,r)){return this.notification({method:"notifications/message",params:t})}}}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import WT from"node:process";var Y1=10*1024*1024;var _l=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??Y1}append(t){const r=(this._buffer?.length??0)+t.length;if(r>this._maxBufferSize){this.clear();throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`)}this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer){return null}const t=this._buffer.indexOf("\n");if(t===-1){return null}const r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");this._buffer=this._buffer.subarray(t+1);return Q1(r)}clear(){this._buffer=void 0}};function Q1(e){return CI.parse(JSON.parse(e))}function HT(e){return JSON.stringify(e)+"\n"}var xl=class{constructor(t=WT.stdin,r=WT.stdout,n){this._stdin=t;this._stdout=r;this._started=false;this._ondata=o=>{try{this._readBuffer.append(o);this.processReadBuffer()}catch(i){this.onerror?.(i);this.close().catch(()=>{})}};this._onerror=o=>{this.onerror?.(o)};this._readBuffer=new _l({maxBufferSize:n?.maxBufferSize})}async start(){if(this._started){throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.")}this._started=true;this._stdin.on("data",this._ondata);this._stdin.on("error",this._onerror)}processReadBuffer(){while(true){try{const t=this._readBuffer.readMessage();if(t===null){break}this.onmessage?.(t)}catch(t){this.onerror?.(t)}}}async close(){this._stdin.off("data",this._ondata);this._stdin.off("error",this._onerror);const t=this._stdin.listenerCount("data");if(t===0){this._stdin.pause()}this._readBuffer.clear();this.onclose?.()}send(t){return new Promise(r=>{const n=HT(t);if(this._stdout.write(n)){r()}else{this._stdout.once("drain",r)}})}};var Il=Td(N$(),1);var JT={cn:{dev:"https://matrix-test.example.invalid",test:"https://matrix-test.example.invalid",staging:"https://matrix-pre.example.invalid",prod:"https://api.ottili.one"},en:{dev:"https://matrix-overseas-test.example.invalid",test:"https://matrix-overseas-test.example.invalid",staging:"https://matrix-overseas-pre.example.invalid",prod:"https://api.ottili.one"}};var ej=new Set(["https://api.ottili.one"]);function nc(e){return e.trim().replace(/\/+$/u,"")}function bl(e=process.env){const t=e.MATRIX_BASE_URL?.trim();const r=t?nc(t):tj(e);const n=Ym(r);const o=n?void 0:e.MATRIX_TOKEN?.trim();return{baseUrl:r,managed:n,...o?{explicitToken:o}:{}}}function tj(e=process.env){return JT[rj(e.ALRAN_REGION)][nj(e.ALRAN_BUILD_ENV)]}function Ym(e){const t=nc(e);if(ej.has(t))return true;return Object.values(JT).some(r=>Object.values(r).some(n=>nc(n)===t))}function rj(e){return e==="cn"?"cn":"en"}function nj(e){if(e==="dev"||e==="test"||e==="staging"||e==="prod"){return e}return"dev"}var oj="AlranAgent";var ij=12e4;var sj=3e5;var aj=sj-2e4;var cj=15e3;var XT="/matrix/api/v1/mcp/";var YT="/alran/api/v1/mcp/";var eh=class extends Error{constructor(r,n,o,i=""){super(`Matrix backend ${r} HTTP ${n}: ${i}`);this.pathname=r;this.statusCode=n;this.errorCode=o;this.name="DesktopGatewayHttpError"}pathname;statusCode;errorCode};var Tn=class{baseUrl;explicitAccessToken;managedEndpoint;useManagedAuth;authContext;authContextGetter;timeoutMs;fetchImpl;dispatcherFactory;routingHeadersGetter;constructor(t={}){const r=dj(t);const n=t.accessToken?.trim()||r.explicitToken;this.baseUrl=r.baseUrl;this.explicitAccessToken=n;this.managedEndpoint=r.managed;this.useManagedAuth=r.managed&&!n;this.authContext=t.authContext;this.authContextGetter=t.authContextGetter;this.timeoutMs=t.timeoutMs??ij;this.fetchImpl=t.fetchImpl??Il.fetch;this.dispatcherFactory=t.dispatcherFactory??(o=>new Il.Agent({headersTimeout:o.headersTimeout,bodyTimeout:o.bodyTimeout}));this.routingHeadersGetter=t.routingHeadersGetter}async postJson(t,r,n,o){const i=await this.postGatewayJson(lj(t),r,n,o?.timeoutMs);return pj(i)}async postGatewayJson(t,r,n,o){const i=o??this.timeoutMs;const s=Qm(n,i);try{const a={method:"POST",headers:{...this.buildHeaders({"Content-Type":"application/json"}),...this.managedEndpoint?this.routingHeadersGetter?.()??{}:{}},body:JSON.stringify(r),signal:s.signal};const c=fj(i,this.dispatcherFactory);if(c!==void 0){mj(a,c)}const l=await this.fetchImpl(`${this.baseUrl}${t}`,a);const u=await l.text();if(!l.ok){throw new eh(t,l.status,uj(u),u.slice(0,500))}return u?JSON.parse(u):{}}finally{s.dispose()}}async putBytes(t,r,n,o,i){const s=Qm(o,i??this.timeoutMs);try{const a=await this.fetchImpl(t,{method:"PUT",body:r,headers:n,signal:s.signal,duplex:"half"});if(!a.ok){const c=await a.text().catch(()=>"");throw new Error(`Matrix upload PUT HTTP ${a.status}: ${c.slice(0,500)}`)}}finally{s.dispose()}}async getStream(t,r,n){const o=Qm(r,n??this.timeoutMs);try{const i=await this.fetchImpl(t,{method:"GET",signal:o.signal});if(!i.ok||!i.body){const c=await i.text().catch(()=>"");throw new Error(`Matrix download HTTP ${i.status}: ${c.slice(0,500)}`)}const s=i.headers.get("content-length");const a=s?Number.parseInt(s,10):void 0;return{body:i.body,dispose:o.dispose,...Number.isFinite(a)&&a!==void 0?{contentLength:a}:{}}}catch(i){o.dispose();throw i}}buildHeaders(t={}){const r=this.explicitAccessToken??this.getManagedAccessToken();if(!r){throw new Error(this.useManagedAuth?"Matrix tools require a managed-login access token.":"Matrix tools require MATRIX_TOKEN for non-managed MATRIX_BASE_URL.")}return{"User-Agent":oj,Authorization:`Bearer ${r}`,...t}}getManagedAccessToken(){if(!this.useManagedAuth)return void 0;const t=this.authContextGetter?this.authContextGetter():this.authContext;return t?.accessToken?.trim()||void 0}};function uj(e){if(!e)return void 0;try{const t=JSON.parse(e);return typeof t.error_code==="string"?t.error_code:void 0}catch{return void 0}}function lj(e){if(e.startsWith(XT)){return`${YT}${e.slice(XT.length)}`}if(e.startsWith(YT))return e;throw new Error(`Unsupported Matrix tool path: ${e}`)}function dj(e){if(e.baseUrl){return{baseUrl:nc(e.baseUrl),managed:Ym(e.baseUrl)}}return e.endpoint??bl()}function pj(e){if(e.base_resp!==void 0)return e;const t=e.code;if(typeof t!=="number")return e;const{code:r,message:n,...o}=e;return{base_resp:{status_code:t,...typeof n==="string"?{status_msg:n}:{}},...o}}function Qm(e,t){const r=new AbortController;const n=()=>r.abort();if(e?.aborted)n();e?.addEventListener("abort",n,{once:true});const o=setTimeout(n,t);return{signal:r.signal,dispose(){clearTimeout(o);e?.removeEventListener("abort",n)}}}function fj(e,t){if(!Number.isFinite(e)||e<aj)return void 0;const r=e+cj;return t({headersTimeout:r,bodyTimeout:r})}function mj(e,t){Object.assign(e,{dispatcher:t})}import{createReadStream as S9,createWriteStream as T9}from"node:fs";import{mkdir as P9,readFile as O9,stat as P$}from"node:fs/promises";import{basename as O$,dirname as v9,extname as $9}from"node:path";import{Readable as v$}from"node:stream";import{pipeline as k9}from"node:stream/promises";import{createHash as hj}from"node:crypto";var QT=Symbol.for("alran.programmaticTool.errorRaw");var e0=Symbol.for("alran.programmaticTool.errorData");function gj(e,t){if(t===void 0||e===null||typeof e!=="object")return false;if(!Object.isExtensible(e))return false;Object.defineProperty(e,QT,{value:t,enumerable:false,configurable:true});return true}function yj(e){if(e===null||typeof e!=="object")return void 0;return Reflect.get(e,QT)}function _j(e,t){if(e===null||typeof e!=="object"||!Object.isExtensible(e))return false;Object.defineProperty(e,e0,{value:t,enumerable:false,configurable:true});return true}function xj(e){if(e===null||typeof e!=="object")return void 0;const t=Reflect.get(e,e0);return t!==null&&typeof t==="object"&&!Array.isArray(t)?t:void 0}function bj(e,t){return{...e,programmatic:{...e.programmatic,...t}}}var t0=new WeakMap;function Ij(e,t,r){const n=th(e);const o=th(t);if(n===void 0||o===void 0||r.length===0)return;t0.set(t,{source:n,output:o,images:r})}function wj(e,t){if(t===void 0||e===null||typeof e!=="object"){return void 0}const r=t0.get(e);if(!r||r.source!==r0(t))return void 0;return r.output===th(e)?r.images:void 0}function th(e){try{const t=JSON.stringify(e);return t===void 0?void 0:r0(t)}catch{return void 0}}function r0(e){return hj("sha256").update(e).digest("hex")}var rh=12e4;var nh=36e5;function Sj(e){if(e===void 0)return{ms:rh,source:"default"};if(typeof e!=="number"||!Number.isFinite(e)||e<=0){return{ms:rh,source:"invalid"}}if(e>nh)return{ms:nh,source:"capped"};return{ms:e,source:"requested"}}function Tj(){const e=new Map;return{record(t,r){if(!t||r.length===0)return;const n=e.get(t)??[];e.set(t,[...n,...r])},read(t){return[...e.get(t)??[]]}}}function Pj(e){if(!Mr(e)||e.role!=="toolResult"||e.toolName!=="run_code"){return void 0}const t=Mr(e.details)?e.details:void 0;const r=t&&Mr(t.ptc)?t.ptc:void 0;if(!r||r.version!==1||!Array.isArray(r.child_calls)||!Array.isArray(r.retained_facts)||r.host_forced_content!==void 0&&typeof r.host_forced_content!=="string"){return void 0}const n=r.child_calls.filter(o0);const o=r.retained_facts.filter(i0);if(n.length!==r.child_calls.length||o.length!==r.retained_facts.length){return void 0}return{version:1,child_calls:n,retained_facts:o,...typeof r.host_forced_content==="string"?{host_forced_content:r.host_forced_content}:{}}}function Oj(e){if(!Mr(e)||!mt(e.tool_call_id)||!mt(e.parent_tool_call_id)||!Mr(e.result)){return void 0}const t=Mr(e.result.details)?e.result.details:void 0;const r=t&&Mr(t.ptc_child)?t.ptc_child:void 0;if(!r||r.version!==1||!o0(r.record)||!Array.isArray(r.retained_facts)){return void 0}const n=r.retained_facts.filter(i0);if(n.length!==r.retained_facts.length||r.record.child_tool_call_id!==e.tool_call_id||r.record.parent_tool_call_id!==e.parent_tool_call_id){return void 0}return{version:1,record:r.record,retained_facts:n}}function o0(e){if(!Mr(e))return false;return mt(e.child_tool_call_id)&&mt(e.parent_tool_call_id)&&mt(e.tool_name)&&(e.input===void 0||Mr(e.input))&&(e.status==="completed"||e.status==="failed"||e.status==="unknown")&&(e.is_error===void 0||typeof e.is_error==="boolean")&&(e.outcome_unknown===void 0||typeof e.outcome_unknown==="boolean")&&(e.result_ref===void 0||mt(e.result_ref))}function i0(e){if(!Mr(e)||typeof e.kind!=="string")return false;switch(e.kind){case"terminate_agent":return true;case"outcome_unknown":return mt(e.child_tool_call_id);case"child_error":return mt(e.child_tool_call_id)&&mt(e.code)&&(e.cancelled===void 0||typeof e.cancelled==="boolean")&&(e.tool_error_code===void 0||$j(e.tool_error_code));case"truncation":return mt(e.child_tool_call_id)&&(e.truncated==="true"||e.truncated==="unknown")&&(e.continuation===void 0||Mr(e.continuation));case"background_task":return mt(e.child_tool_call_id)&&mt(e.task_id);case"bash_exit":return mt(e.child_tool_call_id)&&(e.exit_code===null||n0(e.exit_code));case"media_delivery":return mt(e.child_tool_call_id)&&(e.status==="delivered"||e.status==="unavailable"||e.status==="budget_exceeded")&&(e.refs===void 0||Array.isArray(e.refs)&&e.refs.every(kj));case"approval":return mt(e.child_tool_call_id)&&(e.status==="denied"||e.status==="expired");case"plugin_feedback":return mt(e.child_tool_call_id)&&(e.phase==="additional_context"||e.phase==="post_tool_feedback"||e.phase==="updated_result")&&(e.text===void 0||typeof e.text==="string");case"delivery_incomplete":return e.reason==="outer_limit"&&(e.reference===void 0||mt(e.reference));case"budget_exceeded":return(e.budget==="tool_calls"||e.budget==="bridge"||e.budget==="code")&&(e.refused_calls===void 0||n0(e.refused_calls)&&e.refused_calls>0);default:return false}}var vj=128;function $j(e){return typeof e==="string"&&e.length>0&&e.length<=vj}function Mr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function mt(e){return typeof e==="string"&&e.length>0}function n0(e){return typeof e==="number"&&Number.isSafeInteger(e)}function kj(e){return Mr(e)&&mt(e.uri)&&(e.mimeType===void 0||typeof e.mimeType==="string")}var s0="terminates_turn";function Rj(e){if(typeof e!=="object"||e===null||Array.isArray(e))return false;return e[s0]===true}function Mj(e){const{name:t,label:r,description:n,schema:o,promptGuidelines:i,prepareArguments:s,executionMode:a,operationClassifier:c,source:l,execute:u}=e;const d={name:t,...r!==void 0?{label:r}:{},description:n,schema:o,...i!==void 0?{promptGuidelines:i}:{},...s!==void 0?{prepareArguments:s}:{},...a!==void 0?{executionMode:a}:{},...c!==void 0?{operationClassifier:c}:{}};return{def:d,impl:{execute:u},...l!==void 0?{source:l}:{}}}var a0=new WeakMap;function X(e){return function(t,r){a0.set(t,e);return t}}function at(e){const t=a0.get(e.constructor);if(!t){throw new Error(`toRuntimeTool: ${e.constructor.name} is missing the @bindTool(...) decorator`)}return{def:t,impl:e}}var zt={};_n(zt,{HasPropertyKey:()=>wl,IsArray:()=>rt,IsAsyncIterator:()=>oh,IsBigInt:()=>oc,IsBoolean:()=>Ln,IsDate:()=>fi,IsFunction:()=>ih,IsIterator:()=>sh,IsNull:()=>ah,IsNumber:()=>dr,IsObject:()=>Pe,IsRegExp:()=>ic,IsString:()=>Ae,IsSymbol:()=>ch,IsUint8Array:()=>qn,IsUndefined:()=>nt});function wl(e,t){return t in e}function oh(e){return Pe(e)&&!rt(e)&&!qn(e)&&Symbol.asyncIterator in e}function rt(e){return Array.isArray(e)}function oc(e){return typeof e==="bigint"}function Ln(e){return typeof e==="boolean"}function fi(e){return e instanceof globalThis.Date}function ih(e){return typeof e==="function"}function sh(e){return Pe(e)&&!rt(e)&&!qn(e)&&Symbol.iterator in e}function ah(e){return e===null}function dr(e){return typeof e==="number"}function Pe(e){return typeof e==="object"&&e!==null}function ic(e){return e instanceof globalThis.RegExp}function Ae(e){return typeof e==="string"}function ch(e){return typeof e==="symbol"}function qn(e){return e instanceof globalThis.Uint8Array}function nt(e){return e===void 0}function Aj(e){return e.map(t=>Sl(t))}function Ej(e){return new Date(e.getTime())}function zj(e){return new Uint8Array(e)}function Cj(e){return new RegExp(e.source,e.flags)}function Nj(e){const t={};for(const r of Object.getOwnPropertyNames(e)){t[r]=Sl(e[r])}for(const r of Object.getOwnPropertySymbols(e)){t[r]=Sl(e[r])}return t}function Sl(e){return rt(e)?Aj(e):fi(e)?Ej(e):qn(e)?zj(e):ic(e)?Cj(e):Pe(e)?Nj(e):e}function Ue(e){return Sl(e)}function Os(e,t){return t===void 0?Ue(e):Ue({...t,...e})}function Tl(e){return q(e)&&globalThis.Symbol.asyncIterator in e}function Pl(e){return q(e)&&globalThis.Symbol.iterator in e}function uh(e){return q(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function Ol(e){return e instanceof globalThis.Promise}function Kt(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function c0(e){return e instanceof globalThis.Map}function u0(e){return e instanceof globalThis.Set}function Ar(e){return globalThis.ArrayBuffer.isView(e)}function vs(e){return e instanceof globalThis.Uint8Array}function j(e,t){return t in e}function q(e){return e!==null&&typeof e==="object"}function D(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function Le(e){return e===void 0}function Kn(e){return e===null}function Pn(e){return typeof e==="boolean"}function qe(e){return typeof e==="number"}function vl(e){return globalThis.Number.isInteger(e)}function Wr(e){return typeof e==="bigint"}function Se(e){return typeof e==="string"}function _o(e){return typeof e==="function"}function Zn(e){return typeof e==="symbol"}function pr(e){return Wr(e)||Pn(e)||Kn(e)||qe(e)||Se(e)||Zn(e)||Le(e)}var ct;(function(e){e.InstanceMode="default";e.ExactOptionalPropertyTypes=false;e.AllowArrayObject=false;e.AllowNaN=false;e.AllowNullVoid=false;function t(s,a){return e.ExactOptionalPropertyTypes?a in s:s[a]!==void 0}e.IsExactOptionalProperty=t;function r(s){const a=q(s);return e.AllowArrayObject?a:a&&!D(s)}e.IsObjectLike=r;function n(s){return r(s)&&!(s instanceof Date)&&!(s instanceof Uint8Array)}e.IsRecordLike=n;function o(s){return e.AllowNaN?qe(s):Number.isFinite(s)}e.IsNumberLike=o;function i(s){const a=Le(s);return e.AllowNullVoid?a||s===null:a}e.IsVoidLike=i})(ct||(ct={}));function Fj(e){return globalThis.Object.freeze(e).map(t=>sc(t))}function jj(e){return e}function Dj(e){return e}function Uj(e){return e}function Lj(e){const t={};for(const r of Object.getOwnPropertyNames(e)){t[r]=sc(e[r])}for(const r of Object.getOwnPropertySymbols(e)){t[r]=sc(e[r])}return globalThis.Object.freeze(t)}function sc(e){return rt(e)?Fj(e):fi(e)?jj(e):qn(e)?Dj(e):ic(e)?Uj(e):Pe(e)?Lj(e):e}function P(e,t){const r=t!==void 0?{...t,...e}:e;switch(ct.InstanceMode){case"freeze":return sc(r);case"clone":return Ue(r);default:return r}}var U=class extends Error{constructor(t){super(t)}};var Ve=Symbol.for("TypeBox.Transform");var Jr=Symbol.for("TypeBox.Readonly");var Ot=Symbol.for("TypeBox.Optional");var Er=Symbol.for("TypeBox.Hint");var w=Symbol.for("TypeBox.Kind");function $s(e){return Pe(e)&&e[Jr]==="Readonly"}function tr(e){return Pe(e)&&e[Ot]==="Optional"}function lh(e){return se(e,"Any")}function dh(e){return se(e,"Argument")}function Xr(e){return se(e,"Array")}function mi(e){return se(e,"AsyncIterator")}function hi(e){return se(e,"BigInt")}function Bn(e){return se(e,"Boolean")}function Yr(e){return se(e,"Computed")}function Qr(e){return se(e,"Constructor")}function qj(e){return se(e,"Date")}function en(e){return se(e,"Function")}function tn(e){return se(e,"Integer")}function Xe(e){return se(e,"Intersect")}function gi(e){return se(e,"Iterator")}function se(e,t){return Pe(e)&&w in e&&e[w]===t}function $l(e){return Ln(e)||dr(e)||Ae(e)}function fr(e){return se(e,"Literal")}function mr(e){return se(e,"MappedKey")}function Ke(e){return se(e,"MappedResult")}function xo(e){return se(e,"Never")}function Kj(e){return se(e,"Not")}function ac(e){return se(e,"Null")}function rn(e){return se(e,"Number")}function ot(e){return se(e,"Object")}function yi(e){return se(e,"Promise")}function _i(e){return se(e,"Record")}function Qe(e){return se(e,"Ref")}function ph(e){return se(e,"RegExp")}function Gn(e){return se(e,"String")}function cc(e){return se(e,"Symbol")}function hr(e){return se(e,"TemplateLiteral")}function Zj(e){return se(e,"This")}function xe(e){return Pe(e)&&Ve in e}function gr(e){return se(e,"Tuple")}function Vn(e){return se(e,"Undefined")}function de(e){return se(e,"Union")}function Bj(e){return se(e,"Uint8Array")}function Gj(e){return se(e,"Unknown")}function Vj(e){return se(e,"Unsafe")}function Hj(e){return se(e,"Void")}function bo(e){return Pe(e)&&w in e&&Ae(e[w])}function He(e){return lh(e)||dh(e)||Xr(e)||Bn(e)||hi(e)||mi(e)||Yr(e)||Qr(e)||qj(e)||en(e)||tn(e)||Xe(e)||gi(e)||fr(e)||mr(e)||Ke(e)||xo(e)||Kj(e)||ac(e)||rn(e)||ot(e)||yi(e)||_i(e)||Qe(e)||ph(e)||Gn(e)||cc(e)||hr(e)||Zj(e)||gr(e)||Vn(e)||de(e)||Bj(e)||Gj(e)||Vj(e)||Hj(e)||bo(e)}var x={};_n(x,{IsAny:()=>f0,IsArgument:()=>m0,IsArray:()=>h0,IsAsyncIterator:()=>g0,IsBigInt:()=>y0,IsBoolean:()=>_0,IsComputed:()=>x0,IsConstructor:()=>b0,IsDate:()=>I0,IsFunction:()=>w0,IsImport:()=>eD,IsInteger:()=>S0,IsIntersect:()=>T0,IsIterator:()=>P0,IsKind:()=>X0,IsKindOf:()=>J,IsLiteral:()=>lc,IsLiteralBoolean:()=>tD,IsLiteralNumber:()=>v0,IsLiteralString:()=>O0,IsLiteralValue:()=>$0,IsMappedKey:()=>k0,IsMappedResult:()=>R0,IsNever:()=>M0,IsNot:()=>A0,IsNull:()=>E0,IsNumber:()=>z0,IsObject:()=>C0,IsOptional:()=>Qj,IsPromise:()=>N0,IsProperties:()=>kl,IsReadonly:()=>Yj,IsRecord:()=>F0,IsRecursive:()=>rD,IsRef:()=>j0,IsRegExp:()=>D0,IsSchema:()=>ht,IsString:()=>U0,IsSymbol:()=>L0,IsTemplateLiteral:()=>q0,IsThis:()=>K0,IsTransform:()=>Z0,IsTuple:()=>B0,IsUint8Array:()=>V0,IsUndefined:()=>G0,IsUnion:()=>gh,IsUnionLiteral:()=>nD,IsUnknown:()=>H0,IsUnsafe:()=>W0,IsVoid:()=>J0,TypeGuardUnknownTypeError:()=>fh});var fh=class extends U{};var Wj=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function l0(e){try{new RegExp(e);return true}catch{return false}}function mh(e){if(!Ae(e))return false;for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r>=7&&r<=13||r===27||r===127){return false}}return true}function d0(e){return hh(e)||ht(e)}function uc(e){return nt(e)||oc(e)}function Ee(e){return nt(e)||dr(e)}function hh(e){return nt(e)||Ln(e)}function Oe(e){return nt(e)||Ae(e)}function Jj(e){return nt(e)||Ae(e)&&mh(e)&&l0(e)}function Xj(e){return nt(e)||Ae(e)&&mh(e)}function p0(e){return nt(e)||ht(e)}function Yj(e){return Pe(e)&&e[Jr]==="Readonly"}function Qj(e){return Pe(e)&&e[Ot]==="Optional"}function f0(e){return J(e,"Any")&&Oe(e.$id)}function m0(e){return J(e,"Argument")&&dr(e.index)}function h0(e){return J(e,"Array")&&e.type==="array"&&Oe(e.$id)&&ht(e.items)&&Ee(e.minItems)&&Ee(e.maxItems)&&hh(e.uniqueItems)&&p0(e.contains)&&Ee(e.minContains)&&Ee(e.maxContains)}function g0(e){return J(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Oe(e.$id)&&ht(e.items)}function y0(e){return J(e,"BigInt")&&e.type==="bigint"&&Oe(e.$id)&&uc(e.exclusiveMaximum)&&uc(e.exclusiveMinimum)&&uc(e.maximum)&&uc(e.minimum)&&uc(e.multipleOf)}function _0(e){return J(e,"Boolean")&&e.type==="boolean"&&Oe(e.$id)}function x0(e){return J(e,"Computed")&&Ae(e.target)&&rt(e.parameters)&&e.parameters.every(t=>ht(t))}function b0(e){return J(e,"Constructor")&&e.type==="Constructor"&&Oe(e.$id)&&rt(e.parameters)&&e.parameters.every(t=>ht(t))&&ht(e.returns)}function I0(e){return J(e,"Date")&&e.type==="Date"&&Oe(e.$id)&&Ee(e.exclusiveMaximumTimestamp)&&Ee(e.exclusiveMinimumTimestamp)&&Ee(e.maximumTimestamp)&&Ee(e.minimumTimestamp)&&Ee(e.multipleOfTimestamp)}function w0(e){return J(e,"Function")&&e.type==="Function"&&Oe(e.$id)&&rt(e.parameters)&&e.parameters.every(t=>ht(t))&&ht(e.returns)}function eD(e){return J(e,"Import")&&wl(e,"$defs")&&Pe(e.$defs)&&kl(e.$defs)&&wl(e,"$ref")&&Ae(e.$ref)&&e.$ref in e.$defs}function S0(e){return J(e,"Integer")&&e.type==="integer"&&Oe(e.$id)&&Ee(e.exclusiveMaximum)&&Ee(e.exclusiveMinimum)&&Ee(e.maximum)&&Ee(e.minimum)&&Ee(e.multipleOf)}function kl(e){return Pe(e)&&Object.entries(e).every(([t,r])=>mh(t)&&ht(r))}function T0(e){return J(e,"Intersect")&&(Ae(e.type)&&e.type!=="object"?false:true)&&rt(e.allOf)&&e.allOf.every(t=>ht(t)&&!Z0(t))&&Oe(e.type)&&(hh(e.unevaluatedProperties)||p0(e.unevaluatedProperties))&&Oe(e.$id)}function P0(e){return J(e,"Iterator")&&e.type==="Iterator"&&Oe(e.$id)&&ht(e.items)}function J(e,t){return Pe(e)&&w in e&&e[w]===t}function O0(e){return lc(e)&&Ae(e.const)}function v0(e){return lc(e)&&dr(e.const)}function tD(e){return lc(e)&&Ln(e.const)}function lc(e){return J(e,"Literal")&&Oe(e.$id)&&$0(e.const)}function $0(e){return Ln(e)||dr(e)||Ae(e)}function k0(e){return J(e,"MappedKey")&&rt(e.keys)&&e.keys.every(t=>dr(t)||Ae(t))}function R0(e){return J(e,"MappedResult")&&kl(e.properties)}function M0(e){return J(e,"Never")&&Pe(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function A0(e){return J(e,"Not")&&ht(e.not)}function E0(e){return J(e,"Null")&&e.type==="null"&&Oe(e.$id)}function z0(e){return J(e,"Number")&&e.type==="number"&&Oe(e.$id)&&Ee(e.exclusiveMaximum)&&Ee(e.exclusiveMinimum)&&Ee(e.maximum)&&Ee(e.minimum)&&Ee(e.multipleOf)}function C0(e){return J(e,"Object")&&e.type==="object"&&Oe(e.$id)&&kl(e.properties)&&d0(e.additionalProperties)&&Ee(e.minProperties)&&Ee(e.maxProperties)}function N0(e){return J(e,"Promise")&&e.type==="Promise"&&Oe(e.$id)&&ht(e.item)}function F0(e){return J(e,"Record")&&e.type==="object"&&Oe(e.$id)&&d0(e.additionalProperties)&&Pe(e.patternProperties)&&(t=>{const r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&l0(r[0])&&Pe(t.patternProperties)&&ht(t.patternProperties[r[0]])})(e)}function rD(e){return Pe(e)&&Er in e&&e[Er]==="Recursive"}function j0(e){return J(e,"Ref")&&Oe(e.$id)&&Ae(e.$ref)}function D0(e){return J(e,"RegExp")&&Oe(e.$id)&&Ae(e.source)&&Ae(e.flags)&&Ee(e.maxLength)&&Ee(e.minLength)}function U0(e){return J(e,"String")&&e.type==="string"&&Oe(e.$id)&&Ee(e.minLength)&&Ee(e.maxLength)&&Jj(e.pattern)&&Xj(e.format)}function L0(e){return J(e,"Symbol")&&e.type==="symbol"&&Oe(e.$id)}function q0(e){return J(e,"TemplateLiteral")&&e.type==="string"&&Ae(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function K0(e){return J(e,"This")&&Oe(e.$id)&&Ae(e.$ref)}function Z0(e){return Pe(e)&&Ve in e}function B0(e){return J(e,"Tuple")&&e.type==="array"&&Oe(e.$id)&&dr(e.minItems)&&dr(e.maxItems)&&e.minItems===e.maxItems&&(nt(e.items)&&nt(e.additionalItems)&&e.minItems===0||rt(e.items)&&e.items.every(t=>ht(t)))}function G0(e){return J(e,"Undefined")&&e.type==="undefined"&&Oe(e.$id)}function nD(e){return gh(e)&&e.anyOf.every(t=>O0(t)||v0(t))}function gh(e){return J(e,"Union")&&Oe(e.$id)&&Pe(e)&&rt(e.anyOf)&&e.anyOf.every(t=>ht(t))}function V0(e){return J(e,"Uint8Array")&&e.type==="Uint8Array"&&Oe(e.$id)&&Ee(e.minByteLength)&&Ee(e.maxByteLength)}function H0(e){return J(e,"Unknown")&&Oe(e.$id)}function W0(e){return J(e,"Unsafe")}function J0(e){return J(e,"Void")&&e.type==="void"&&Oe(e.$id)}function X0(e){return Pe(e)&&w in e&&Ae(e[w])&&!Wj.includes(e[w])}function ht(e){return Pe(e)&&(f0(e)||m0(e)||h0(e)||_0(e)||y0(e)||g0(e)||x0(e)||b0(e)||I0(e)||w0(e)||S0(e)||T0(e)||P0(e)||lc(e)||k0(e)||R0(e)||M0(e)||A0(e)||E0(e)||z0(e)||C0(e)||N0(e)||F0(e)||j0(e)||D0(e)||U0(e)||L0(e)||q0(e)||K0(e)||B0(e)||G0(e)||gh(e)||V0(e)||H0(e)||W0(e)||J0(e)||X0(e))}var yh="(true|false)";var dc="(0|[1-9][0-9]*)";var _h="(.*)";var oD="(?!.*)";var uJ=`^${yh}$`;var Io=`^${dc}$`;var wo=`^${_h}$`;var Y0=`^${oD}$`;var So={};_n(So,{Clear:()=>sD,Delete:()=>aD,Entries:()=>iD,Get:()=>lD,Has:()=>cD,Set:()=>uD});var ks=new Map;function iD(){return new Map(ks)}function sD(){return ks.clear()}function aD(e){return ks.delete(e)}function cD(e){return ks.has(e)}function uD(e,t){ks.set(e,t)}function lD(e){return ks.get(e)}var nn={};_n(nn,{Clear:()=>pD,Delete:()=>fD,Entries:()=>dD,Get:()=>gD,Has:()=>mD,Set:()=>hD});var Rs=new Map;function dD(){return new Map(Rs)}function pD(){return Rs.clear()}function fD(e){return Rs.delete(e)}function mD(e){return Rs.has(e)}function hD(e,t){Rs.set(e,t)}function gD(e){return Rs.get(e)}function Q0(e,t){return e.includes(t)}function eP(e){return[...new Set(e)]}function yD(e,t){return e.filter(r=>t.includes(r))}function _D(e,t){return e.reduce((r,n)=>{return yD(r,n)},t)}function tP(e){return e.length===1?e[0]:e.length>1?_D(e.slice(1),e[0]):[]}function rP(e){const t=[];for(const r of e)t.push(...r);return t}function To(e){return P({[w]:"Any"},e)}function Ms(e,t){return P({[w]:"Array",type:"array",items:e},t)}function nP(e){return P({[w]:"Argument",index:e})}function As(e,t){return P({[w]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function Ce(e,t,r){return P({[w]:"Computed",target:e,parameters:t},r)}function xD(e,t){const{[t]:r,...n}=e;return n}function Ye(e,t){return t.reduce((r,n)=>xD(r,n),e)}function H(e){return P({[w]:"Never",not:{}},e)}function me(e){return P({[w]:"MappedResult",properties:e})}function Es(e,t,r){return P({[w]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function On(e,t,r){return P({[w]:"Function",type:"Function",parameters:e,returns:t},r)}function pc(e,t){return P({[w]:"Union",anyOf:e},t)}function bD(e){return e.some(t=>tr(t))}function oP(e){return e.map(t=>tr(t)?ID(t):t)}function ID(e){return Ye(e,[Ot])}function wD(e,t){const r=bD(e);return r?Ct(pc(oP(e),t)):pc(oP(e),t)}function vn(e,t){return e.length===1?P(e[0],t):e.length===0?H(t):wD(e,t)}function be(e,t){return e.length===0?H(t):e.length===1?P(e[0],t):pc(e,t)}var Rl=class extends U{};function SD(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function xh(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function Wn(e,t){return xh(e,t,"(")}function fc(e,t){return xh(e,t,")")}function iP(e,t){return xh(e,t,"|")}function TD(e){if(!(Wn(e,0)&&fc(e,e.length-1)))return false;let t=0;for(let r=0;r<e.length;r++){if(Wn(e,r))t+=1;if(fc(e,r))t-=1;if(t===0&&r!==e.length-1)return false}return true}function PD(e){return e.slice(1,e.length-1)}function OD(e){let t=0;for(let r=0;r<e.length;r++){if(Wn(e,r))t+=1;if(fc(e,r))t-=1;if(iP(e,r)&&t===0)return true}return false}function vD(e){for(let t=0;t<e.length;t++){if(Wn(e,t))return true}return false}function $D(e){let[t,r]=[0,0];const n=[];for(let i=0;i<e.length;i++){if(Wn(e,i))t+=1;if(fc(e,i))t-=1;if(iP(e,i)&&t===0){const s=e.slice(r,i);if(s.length>0)n.push(zs(s));r=i+1}}const o=e.slice(r);if(o.length>0)n.push(zs(o));if(n.length===0)return{type:"const",const:""};if(n.length===1)return n[0];return{type:"or",expr:n}}function kD(e){function t(o,i){if(!Wn(o,i))throw new Rl(`TemplateLiteralParser: Index must point to open parens`);let s=0;for(let a=i;a<o.length;a++){if(Wn(o,a))s+=1;if(fc(o,a))s-=1;if(s===0)return[i,a]}throw new Rl(`TemplateLiteralParser: Unclosed group parens in expression`)}function r(o,i){for(let s=i;s<o.length;s++){if(Wn(o,s))return[i,s]}return[i,o.length]}const n=[];for(let o=0;o<e.length;o++){if(Wn(e,o)){const[i,s]=t(e,o);const a=e.slice(i,s+1);n.push(zs(a));o=s}else{const[i,s]=r(e,o);const a=e.slice(i,s);if(a.length>0)n.push(zs(a));o=s-1}}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function zs(e){return TD(e)?zs(PD(e)):OD(e)?$D(e):vD(e)?kD(e):{type:"const",const:SD(e)}}function Cs(e){return zs(e.slice(1,e.length-1))}var bh=class extends U{};function RD(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function MD(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function AD(e){return e.type==="const"&&e.const===".*"}function xi(e){return RD(e)||AD(e)?false:MD(e)?true:e.type==="and"?e.expr.every(t=>xi(t)):e.type==="or"?e.expr.every(t=>xi(t)):e.type==="const"?true:(()=>{throw new bh(`Unknown expression type`)})()}function Ml(e){const t=Cs(e.pattern);return xi(t)}var Ih=class extends U{};function*sP(e){if(e.length===1)return yield*e[0];for(const t of e[0]){for(const r of sP(e.slice(1))){yield`${t}${r}`}}}function*ED(e){return yield*sP(e.expr.map(t=>[...mc(t)]))}function*zD(e){for(const t of e.expr)yield*mc(t)}function*CD(e){return yield e.const}function*mc(e){return e.type==="and"?yield*ED(e):e.type==="or"?yield*zD(e):e.type==="const"?yield*CD(e):(()=>{throw new Ih("Unknown expression")})()}function Ns(e){const t=Cs(e.pattern);return xi(t)?[...mc(t)]:[]}function ae(e,t){return P({[w]:"Literal",const:e,type:typeof e},t)}function Al(e){return P({[w]:"Boolean",type:"boolean"},e)}function Fs(e){return P({[w]:"BigInt",type:"bigint"},e)}function zr(e){return P({[w]:"Number",type:"number"},e)}function Zt(e){return P({[w]:"String",type:"string"},e)}function*ND(e){const t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield Al():t==="number"?yield zr():t==="bigint"?yield Fs():t==="string"?yield Zt():yield(()=>{const r=t.split("|").map(n=>ae(n.trim()));return r.length===0?H():r.length===1?r[0]:vn(r)})()}function*FD(e){if(e[1]!=="{"){const t=ae("$");const r=wh(e.slice(1));return yield*[t,...r]}for(let t=2;t<e.length;t++){if(e[t]==="}"){const r=ND(e.slice(2,t));const n=wh(e.slice(t+1));return yield*[...r,...n]}}yield ae(e)}function*wh(e){for(let t=0;t<e.length;t++){if(e[t]==="$"){const r=ae(e.slice(0,t));const n=FD(e.slice(t));return yield*[r,...n]}}yield ae(e)}function aP(e){return[...wh(e)]}var Sh=class extends U{};function jD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cP(e,t){return hr(e)?e.pattern.slice(1,e.pattern.length-1):de(e)?`(${e.anyOf.map(r=>cP(r,t)).join("|")})`:rn(e)?`${t}${dc}`:tn(e)?`${t}${dc}`:hi(e)?`${t}${dc}`:Gn(e)?`${t}${_h}`:fr(e)?`${t}${jD(e.const.toString())}`:Bn(e)?`${t}${yh}`:(()=>{throw new Sh(`Unexpected Kind '${e[w]}'`)})()}function Th(e){return`^${e.map(t=>cP(t,"")).join("")}$`}function bi(e){const t=Ns(e);const r=t.map(n=>ae(n));return vn(r)}function El(e,t){const r=Ae(e)?Th(aP(e)):Th(e);return P({[w]:"TemplateLiteral",type:"string",pattern:r},t)}function DD(e){const t=Ns(e);return t.map(r=>r.toString())}function UD(e){const t=[];for(const r of e)t.push(...rr(r));return t}function LD(e){return[e.toString()]}function rr(e){return[...new Set(hr(e)?DD(e):de(e)?UD(e.anyOf):fr(e)?LD(e.const):rn(e)?["[number]"]:tn(e)?["[number]"]:[])]}function qD(e,t,r){const n={};for(const o of Object.getOwnPropertyNames(t)){n[o]=Po(e,rr(t[o]),r)}return n}function KD(e,t,r){return qD(e,t.properties,r)}function uP(e,t,r){const n=KD(e,t,r);return me(n)}function dP(e,t){return e.map(r=>pP(r,t))}function ZD(e){return e.filter(t=>!xo(t))}function BD(e,t){return zl(ZD(dP(e,t)))}function GD(e){return e.some(t=>xo(t))?[]:e}function VD(e,t){return vn(GD(dP(e,t)))}function HD(e,t){return t in e?e[t]:t==="[number]"?vn(e):H()}function WD(e,t){return t==="[number]"?e:H()}function JD(e,t){return t in e?e[t]:H()}function pP(e,t){return Xe(e)?BD(e.allOf,t):de(e)?VD(e.anyOf,t):gr(e)?HD(e.items??[],t):Xr(e)?WD(e.items,t):ot(e)?JD(e.properties,t):H()}function hc(e,t){return t.map(r=>pP(e,r))}function lP(e,t){return vn(hc(e,t))}function Po(e,t,r){if(Qe(e)||Qe(t)){const n=`Index types using Ref parameters require both Type and Key to be of TSchema`;if(!He(e)||!He(t))throw new U(n);return Ce("Index",[e,t])}if(Ke(t))return uP(e,t,r);if(mr(t))return fP(e,t,r);return P(He(t)?lP(e,rr(t)):lP(e,t),r)}function XD(e,t,r){return{[t]:Po(e,[t],Ue(r))}}function YD(e,t,r){return t.reduce((n,o)=>{return{...n,...XD(e,o,r)}},{})}function QD(e,t,r){return YD(e,t.keys,r)}function fP(e,t,r){const n=QD(e,t,r);return me(n)}function js(e,t){return P({[w]:"Iterator",type:"Iterator",items:e},t)}function eU(e){return globalThis.Object.keys(e).filter(t=>!tr(e[t]))}function tU(e,t){const r=eU(e);const n=r.length>0?{[w]:"Object",type:"object",required:r,properties:e}:{[w]:"Object",type:"object",properties:e};return P(n,t)}var Ie=tU;function Cl(e,t){return P({[w]:"Promise",type:"Promise",item:e},t)}function rU(e){return P(Ye(e,[Jr]))}function nU(e){return P({...e,[Jr]:"Readonly"})}function oU(e,t){return t===false?rU(e):nU(e)}function nr(e,t){const r=t??true;return Ke(e)?mP(e,r):oU(e,r)}function iU(e,t){const r={};for(const n of globalThis.Object.getOwnPropertyNames(e))r[n]=nr(e[n],t);return r}function sU(e,t){return iU(e.properties,t)}function mP(e,t){const r=sU(e,t);return me(r)}function Cr(e,t){return P(e.length>0?{[w]:"Tuple",type:"array",items:e,additionalItems:false,minItems:e.length,maxItems:e.length}:{[w]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function hP(e,t){return e in t?Nr(e,t[e]):me(t)}function aU(e){return{[e]:ae(e)}}function cU(e){const t={};for(const r of e)t[r]=ae(r);return t}function uU(e,t){return Q0(t,e)?aU(e):cU(t)}function lU(e,t){const r=uU(e,t);return hP(e,r)}function gc(e,t){return t.map(r=>Nr(e,r))}function dU(e,t){const r={};for(const n of globalThis.Object.getOwnPropertyNames(t))r[n]=Nr(e,t[n]);return r}function Nr(e,t){const r={...t};return tr(t)?Ct(Nr(e,Ye(t,[Ot]))):$s(t)?nr(Nr(e,Ye(t,[Jr]))):Ke(t)?hP(e,t.properties):mr(t)?lU(e,t.keys):Qr(t)?Es(gc(e,t.parameters),Nr(e,t.returns),r):en(t)?On(gc(e,t.parameters),Nr(e,t.returns),r):mi(t)?As(Nr(e,t.items),r):gi(t)?js(Nr(e,t.items),r):Xe(t)?Nt(gc(e,t.allOf),r):de(t)?be(gc(e,t.anyOf),r):gr(t)?Cr(gc(e,t.items??[]),r):ot(t)?Ie(dU(e,t.properties),r):Xr(t)?Ms(Nr(e,t.items),r):yi(t)?Cl(Nr(e,t.item),r):t}function pU(e,t){const r={};for(const n of e)r[n]=Nr(n,t);return r}function gP(e,t,r){const n=He(e)?rr(e):e;const o=t({[w]:"MappedKey",keys:n});const i=pU(n,o);return Ie(i,r)}function fU(e){return P(Ye(e,[Ot]))}function mU(e){return P({...e,[Ot]:"Optional"})}function hU(e,t){return t===false?fU(e):mU(e)}function Ct(e,t){const r=t??true;return Ke(e)?yP(e,r):hU(e,r)}function gU(e,t){const r={};for(const n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ct(e[n],t);return r}function yU(e,t){return gU(e.properties,t)}function yP(e,t){const r=yU(e,t);return me(r)}function yc(e,t={}){const r=e.every(o=>ot(o));const n=He(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return P(t.unevaluatedProperties===false||He(t.unevaluatedProperties)||r?{...n,[w]:"Intersect",type:"object",allOf:e}:{...n,[w]:"Intersect",allOf:e},t)}function _U(e){return e.every(t=>tr(t))}function xU(e){return Ye(e,[Ot])}function _P(e){return e.map(t=>tr(t)?xU(t):t)}function bU(e,t){return _U(e)?Ct(yc(_P(e),t)):yc(_P(e),t)}function zl(e,t={}){if(e.length===1)return P(e[0],t);if(e.length===0)return H(t);if(e.some(r=>xe(r)))throw new Error("Cannot intersect transform types");return bU(e,t)}function Nt(e,t){if(e.length===1)return P(e[0],t);if(e.length===0)return H(t);if(e.some(r=>xe(r)))throw new Error("Cannot intersect transform types");return yc(e,t)}function $n(...e){const[t,r]=typeof e[0]==="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=="string")throw new U("Ref: $ref must be a string");return P({[w]:"Ref",$ref:t},r)}function IU(e,t){return Ce("Awaited",[Ce(e,t)])}function wU(e){return Ce("Awaited",[$n(e)])}function SU(e){return Nt(xP(e))}function TU(e){return be(xP(e))}function PU(e){return Ds(e)}function xP(e){return e.map(t=>Ds(t))}function Ds(e,t){return P(Yr(e)?IU(e.target,e.parameters):Xe(e)?SU(e.allOf):de(e)?TU(e.anyOf):yi(e)?PU(e.item):Qe(e)?wU(e.$ref):e,t)}function bP(e){const t=[];for(const r of e)t.push(or(r));return t}function OU(e){const t=bP(e);const r=rP(t);return r}function vU(e){const t=bP(e);const r=tP(t);return r}function $U(e){return e.map((t,r)=>r.toString())}function kU(e){return["[number]"]}function RU(e){return globalThis.Object.getOwnPropertyNames(e)}function MU(e){if(!Ph)return[];const t=globalThis.Object.getOwnPropertyNames(e);return t.map(r=>{return r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r})}function or(e){return Xe(e)?OU(e.allOf):de(e)?vU(e.anyOf):gr(e)?$U(e.items??[]):Xr(e)?kU(e.items):ot(e)?RU(e.properties):_i(e)?MU(e.patternProperties):[]}var Ph=false;function Us(e){Ph=true;const t=or(e);Ph=false;const r=t.map(n=>`(${n})`);return`^(${r.join("|")})$`}function AU(e,t){return Ce("KeyOf",[Ce(e,t)])}function EU(e){return Ce("KeyOf",[$n(e)])}function zU(e,t){const r=or(e);const n=CU(r);const o=vn(n);return P(o,t)}function CU(e){return e.map(t=>t==="[number]"?zr():ae(t))}function Ls(e,t){return Yr(e)?AU(e.target,e.parameters):Qe(e)?EU(e.$ref):Ke(e)?IP(e,t):zU(e,t)}function NU(e,t){const r={};for(const n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ls(e[n],Ue(t));return r}function FU(e,t){return NU(e.properties,t)}function IP(e,t){const r=FU(e,t);return me(r)}function Nl(e){const t=or(e);const r=hc(e,t);return t.map((n,o)=>[t[o],r[o]])}function jU(e){const t=[];for(const r of e)t.push(...or(r));return eP(t)}function DU(e){return e.filter(t=>!xo(t))}function UU(e,t){const r=[];for(const n of e)r.push(...hc(n,[t]));return DU(r)}function LU(e,t){const r={};for(const n of t){r[n]=zl(UU(e,n))}return r}function wP(e,t){const r=jU(e);const n=LU(e,r);const o=Ie(n,t);return o}function Fl(e){return P({[w]:"Date",type:"Date"},e)}function jl(e){return P({[w]:"Null",type:"null"},e)}function Dl(e){return P({[w]:"Symbol",type:"symbol"},e)}function Ul(e){return P({[w]:"Undefined",type:"undefined"},e)}function Ll(e){return P({[w]:"Uint8Array",type:"Uint8Array"},e)}function on(e){return P({[w]:"Unknown"},e)}function qU(e){return e.map(t=>Oh(t,false))}function KU(e){const t={};for(const r of globalThis.Object.getOwnPropertyNames(e))t[r]=nr(Oh(e[r],false));return t}function ql(e,t){return t===true?e:nr(e)}function Oh(e,t){return oh(e)?ql(To(),t):sh(e)?ql(To(),t):rt(e)?nr(Cr(qU(e))):qn(e)?Ll():fi(e)?Fl():Pe(e)?ql(Ie(KU(e)),t):ih(e)?ql(On([],on()),t):nt(e)?Ul():ah(e)?jl():ch(e)?Dl():oc(e)?Fs():dr(e)?ae(e):Ln(e)?ae(e):Ae(e)?ae(e):Ie({})}function SP(e,t){return P(Oh(e,true),t)}function TP(e,t){return Qr(e)?Cr(e.parameters,t):H(t)}function PP(e,t){if(nt(e))throw new Error("Enum undefined or empty");const r=globalThis.Object.getOwnPropertyNames(e).filter(i=>isNaN(i)).map(i=>e[i]);const n=[...new Set(r)];const o=n.map(i=>ae(i));return be(o,{...t,[Er]:"Enum"})}var $h=class extends U{};var O;(function(e){e[e["Union"]=0]="Union";e[e["True"]=1]="True";e[e["False"]=2]="False"})(O||(O={}));function Fr(e){return e===O.False?e:O.True}function qs(e){throw new $h(e)}function ut(e){return x.IsNever(e)||x.IsIntersect(e)||x.IsUnion(e)||x.IsUnknown(e)||x.IsAny(e)}function lt(e,t){return x.IsNever(t)?AP(e,t):x.IsIntersect(t)?Kl(e,t):x.IsUnion(t)?Ah(e,t):x.IsUnknown(t)?NP(e,t):x.IsAny(t)?Mh(e,t):qs("StructuralRight")}function Mh(e,t){return O.True}function ZU(e,t){return x.IsIntersect(t)?Kl(e,t):x.IsUnion(t)&&t.anyOf.some(r=>x.IsAny(r)||x.IsUnknown(r))?O.True:x.IsUnion(t)?O.Union:x.IsUnknown(t)?O.True:x.IsAny(t)?O.True:O.Union}function BU(e,t){return x.IsUnknown(e)?O.False:x.IsAny(e)?O.Union:x.IsNever(e)?O.True:O.False}function GU(e,t){return x.IsObject(t)&&Zl(t)?O.True:ut(t)?lt(e,t):!x.IsArray(t)?O.False:Fr(ve(e.items,t.items))}function VU(e,t){return ut(t)?lt(e,t):!x.IsAsyncIterator(t)?O.False:Fr(ve(e.items,t.items))}function HU(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsBigInt(t)?O.True:O.False}function RP(e,t){return x.IsLiteralBoolean(e)?O.True:x.IsBoolean(e)?O.True:O.False}function WU(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsBoolean(t)?O.True:O.False}function JU(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):!x.IsConstructor(t)?O.False:e.parameters.length>t.parameters.length?O.False:!e.parameters.every((r,n)=>Fr(ve(t.parameters[n],r))===O.True)?O.False:Fr(ve(e.returns,t.returns))}function XU(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsDate(t)?O.True:O.False}function YU(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):!x.IsFunction(t)?O.False:e.parameters.length>t.parameters.length?O.False:!e.parameters.every((r,n)=>Fr(ve(t.parameters[n],r))===O.True)?O.False:Fr(ve(e.returns,t.returns))}function MP(e,t){return x.IsLiteral(e)&&zt.IsNumber(e.const)?O.True:x.IsNumber(e)||x.IsInteger(e)?O.True:O.False}function QU(e,t){return x.IsInteger(t)||x.IsNumber(t)?O.True:ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):O.False}function Kl(e,t){return t.allOf.every(r=>ve(e,r)===O.True)?O.True:O.False}function eL(e,t){return e.allOf.some(r=>ve(r,t)===O.True)?O.True:O.False}function tL(e,t){return ut(t)?lt(e,t):!x.IsIterator(t)?O.False:Fr(ve(e.items,t.items))}function rL(e,t){return x.IsLiteral(t)&&t.const===e.const?O.True:ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsString(t)?CP(e,t):x.IsNumber(t)?EP(e,t):x.IsInteger(t)?MP(e,t):x.IsBoolean(t)?RP(e,t):O.False}function AP(e,t){return O.False}function nL(e,t){return O.True}function OP(e){let[t,r]=[e,0];while(true){if(!x.IsNot(t))break;t=t.not;r+=1}return r%2===0?t:on()}function oL(e,t){return x.IsNot(e)?ve(OP(e),t):x.IsNot(t)?ve(e,OP(t)):qs("Invalid fallthrough for Not")}function iL(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsNull(t)?O.True:O.False}function EP(e,t){return x.IsLiteralNumber(e)?O.True:x.IsNumber(e)||x.IsInteger(e)?O.True:O.False}function sL(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsInteger(t)||x.IsNumber(t)?O.True:O.False}function ir(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function vP(e){return Zl(e)}function $P(e){return ir(e,0)||ir(e,1)&&"description"in e.properties&&x.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(x.IsString(e.properties.description.anyOf[0])&&x.IsUndefined(e.properties.description.anyOf[1])||x.IsString(e.properties.description.anyOf[1])&&x.IsUndefined(e.properties.description.anyOf[0]))}function vh(e){return ir(e,0)}function kP(e){return ir(e,0)}function aL(e){return ir(e,0)}function cL(e){return ir(e,0)}function uL(e){return Zl(e)}function lL(e){const t=zr();return ir(e,0)||ir(e,1)&&"length"in e.properties&&Fr(ve(e.properties["length"],t))===O.True}function dL(e){return ir(e,0)}function Zl(e){const t=zr();return ir(e,0)||ir(e,1)&&"length"in e.properties&&Fr(ve(e.properties["length"],t))===O.True}function pL(e){const t=On([To()],To());return ir(e,0)||ir(e,1)&&"then"in e.properties&&Fr(ve(e.properties["then"],t))===O.True}function zP(e,t){return ve(e,t)===O.False?O.False:x.IsOptional(e)&&!x.IsOptional(t)?O.False:O.True}function Ft(e,t){return x.IsUnknown(e)?O.False:x.IsAny(e)?O.Union:x.IsNever(e)||x.IsLiteralString(e)&&vP(t)||x.IsLiteralNumber(e)&&vh(t)||x.IsLiteralBoolean(e)&&kP(t)||x.IsSymbol(e)&&$P(t)||x.IsBigInt(e)&&aL(t)||x.IsString(e)&&vP(t)||x.IsSymbol(e)&&$P(t)||x.IsNumber(e)&&vh(t)||x.IsInteger(e)&&vh(t)||x.IsBoolean(e)&&kP(t)||x.IsUint8Array(e)&&uL(t)||x.IsDate(e)&&cL(t)||x.IsConstructor(e)&&dL(t)||x.IsFunction(e)&&lL(t)?O.True:x.IsRecord(e)&&x.IsString(kh(e))?(()=>{return t[Er]==="Record"?O.True:O.False})():x.IsRecord(e)&&x.IsNumber(kh(e))?(()=>{return ir(t,0)?O.True:O.False})():O.False}function fL(e,t){return ut(t)?lt(e,t):x.IsRecord(t)?jr(e,t):!x.IsObject(t)?O.False:(()=>{for(const r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!x.IsOptional(t.properties[r])){return O.False}if(x.IsOptional(t.properties[r])){return O.True}if(zP(e.properties[r],t.properties[r])===O.False){return O.False}}return O.True})()}function mL(e,t){return ut(t)?lt(e,t):x.IsObject(t)&&pL(t)?O.True:!x.IsPromise(t)?O.False:Fr(ve(e.item,t.item))}function kh(e){return Io in e.patternProperties?zr():wo in e.patternProperties?Zt():qs("Unknown record key pattern")}function Rh(e){return Io in e.patternProperties?e.patternProperties[Io]:wo in e.patternProperties?e.patternProperties[wo]:qs("Unable to get record value schema")}function jr(e,t){const[r,n]=[kh(t),Rh(t)];return x.IsLiteralString(e)&&x.IsNumber(r)&&Fr(ve(e,n))===O.True?O.True:x.IsUint8Array(e)&&x.IsNumber(r)?ve(e,n):x.IsString(e)&&x.IsNumber(r)?ve(e,n):x.IsArray(e)&&x.IsNumber(r)?ve(e,n):x.IsObject(e)?(()=>{for(const o of Object.getOwnPropertyNames(e.properties)){if(zP(n,e.properties[o])===O.False){return O.False}}return O.True})():O.False}function hL(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):!x.IsRecord(t)?O.False:ve(Rh(e),Rh(t))}function gL(e,t){const r=x.IsRegExp(e)?Zt():e;const n=x.IsRegExp(t)?Zt():t;return ve(r,n)}function CP(e,t){return x.IsLiteral(e)&&zt.IsString(e.const)?O.True:x.IsString(e)?O.True:O.False}function yL(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsString(t)?O.True:O.False}function _L(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsSymbol(t)?O.True:O.False}function xL(e,t){return x.IsTemplateLiteral(e)?ve(bi(e),t):x.IsTemplateLiteral(t)?ve(e,bi(t)):qs("Invalid fallthrough for TemplateLiteral")}function bL(e,t){return x.IsArray(t)&&e.items!==void 0&&e.items.every(r=>ve(r,t.items)===O.True)}function IL(e,t){return x.IsNever(e)?O.True:x.IsUnknown(e)?O.False:x.IsAny(e)?O.Union:O.False}function wL(e,t){return ut(t)?lt(e,t):x.IsObject(t)&&Zl(t)?O.True:x.IsArray(t)&&bL(e,t)?O.True:!x.IsTuple(t)?O.False:zt.IsUndefined(e.items)&&!zt.IsUndefined(t.items)||!zt.IsUndefined(e.items)&&zt.IsUndefined(t.items)?O.False:zt.IsUndefined(e.items)&&!zt.IsUndefined(t.items)?O.True:e.items.every((r,n)=>ve(r,t.items[n])===O.True)?O.True:O.False}function SL(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsUint8Array(t)?O.True:O.False}function TL(e,t){return ut(t)?lt(e,t):x.IsObject(t)?Ft(e,t):x.IsRecord(t)?jr(e,t):x.IsVoid(t)?vL(e,t):x.IsUndefined(t)?O.True:O.False}function Ah(e,t){return t.anyOf.some(r=>ve(e,r)===O.True)?O.True:O.False}function PL(e,t){return e.anyOf.every(r=>ve(r,t)===O.True)?O.True:O.False}function NP(e,t){return O.True}function OL(e,t){return x.IsNever(t)?AP(e,t):x.IsIntersect(t)?Kl(e,t):x.IsUnion(t)?Ah(e,t):x.IsAny(t)?Mh(e,t):x.IsString(t)?CP(e,t):x.IsNumber(t)?EP(e,t):x.IsInteger(t)?MP(e,t):x.IsBoolean(t)?RP(e,t):x.IsArray(t)?BU(e,t):x.IsTuple(t)?IL(e,t):x.IsObject(t)?Ft(e,t):x.IsUnknown(t)?O.True:O.False}function vL(e,t){return x.IsUndefined(e)?O.True:x.IsUndefined(e)?O.True:O.False}function $L(e,t){return x.IsIntersect(t)?Kl(e,t):x.IsUnion(t)?Ah(e,t):x.IsUnknown(t)?NP(e,t):x.IsAny(t)?Mh(e,t):x.IsObject(t)?Ft(e,t):x.IsVoid(t)?O.True:O.False}function ve(e,t){return x.IsTemplateLiteral(e)||x.IsTemplateLiteral(t)?xL(e,t):x.IsRegExp(e)||x.IsRegExp(t)?gL(e,t):x.IsNot(e)||x.IsNot(t)?oL(e,t):x.IsAny(e)?ZU(e,t):x.IsArray(e)?GU(e,t):x.IsBigInt(e)?HU(e,t):x.IsBoolean(e)?WU(e,t):x.IsAsyncIterator(e)?VU(e,t):x.IsConstructor(e)?JU(e,t):x.IsDate(e)?XU(e,t):x.IsFunction(e)?YU(e,t):x.IsInteger(e)?QU(e,t):x.IsIntersect(e)?eL(e,t):x.IsIterator(e)?tL(e,t):x.IsLiteral(e)?rL(e,t):x.IsNever(e)?nL(e,t):x.IsNull(e)?iL(e,t):x.IsNumber(e)?sL(e,t):x.IsObject(e)?fL(e,t):x.IsRecord(e)?hL(e,t):x.IsString(e)?yL(e,t):x.IsSymbol(e)?_L(e,t):x.IsTuple(e)?wL(e,t):x.IsPromise(e)?mL(e,t):x.IsUint8Array(e)?SL(e,t):x.IsUndefined(e)?TL(e,t):x.IsUnion(e)?PL(e,t):x.IsUnknown(e)?OL(e,t):x.IsVoid(e)?$L(e,t):qs(`Unknown left type operand '${e[w]}'`)}function Oo(e,t){return ve(e,t)}function kL(e,t,r,n,o){const i={};for(const s of globalThis.Object.getOwnPropertyNames(e))i[s]=Ks(e[s],t,r,n,Ue(o));return i}function RL(e,t,r,n,o){return kL(e.properties,t,r,n,o)}function FP(e,t,r,n,o){const i=RL(e,t,r,n,o);return me(i)}function ML(e,t,r,n){const o=Oo(e,t);return o===O.Union?be([r,n]):o===O.True?r:n}function Ks(e,t,r,n,o){return Ke(e)?FP(e,t,r,n,o):mr(e)?P(jP(e,t,r,n,o)):P(ML(e,t,r,n),o)}function AL(e,t,r,n,o){return{[e]:Ks(ae(e),t,r,n,Ue(o))}}function EL(e,t,r,n,o){return e.reduce((i,s)=>{return{...i,...AL(s,t,r,n,o)}},{})}function zL(e,t,r,n,o){return EL(e.keys,t,r,n,o)}function jP(e,t,r,n,o){const i=zL(e,t,r,n,o);return me(i)}function CL(e){return e.allOf.every(t=>Ii(t))}function NL(e){return e.anyOf.some(t=>Ii(t))}function FL(e){return!Ii(e.not)}function Ii(e){return e[w]==="Intersect"?CL(e):e[w]==="Union"?NL(e):e[w]==="Not"?FL(e):e[w]==="Undefined"?true:false}function DP(e,t){return Zs(bi(e),t)}function jL(e,t){const r=e.filter(n=>Oo(n,t)===O.False);return r.length===1?r[0]:be(r)}function Zs(e,t,r={}){if(hr(e))return P(DP(e,t),r);if(Ke(e))return P(UP(e,t),r);return P(de(e)?jL(e.anyOf,t):Oo(e,t)!==O.False?H():e,r)}function DL(e,t){const r={};for(const n of globalThis.Object.getOwnPropertyNames(e))r[n]=Zs(e[n],t);return r}function UL(e,t){return DL(e.properties,t)}function UP(e,t){const r=UL(e,t);return me(r)}function LP(e,t){return Bs(bi(e),t)}function LL(e,t){const r=e.filter(n=>Oo(n,t)!==O.False);return r.length===1?r[0]:be(r)}function Bs(e,t,r){if(hr(e))return P(LP(e,t),r);if(Ke(e))return P(qP(e,t),r);return P(de(e)?LL(e.anyOf,t):Oo(e,t)!==O.False?e:H(),r)}function qL(e,t){const r={};for(const n of globalThis.Object.getOwnPropertyNames(e))r[n]=Bs(e[n],t);return r}function KL(e,t){return qL(e.properties,t)}function qP(e,t){const r=KL(e,t);return me(r)}function KP(e,t){return Qr(e)?P(e.returns,t):H(t)}function Bl(e){return nr(Ct(e))}function wi(e,t,r){return P({[w]:"Record",type:"object",patternProperties:{[e]:t}},r)}function Eh(e,t,r){const n={};for(const o of e)n[o]=t;return Ie(n,{...r,[Er]:"Record"})}function ZL(e,t,r){return Ml(e)?Eh(rr(e),t,r):wi(e.pattern,t,r)}function BL(e,t,r){return Eh(rr(be(e)),t,r)}function GL(e,t,r){return Eh([e.toString()],t,r)}function VL(e,t,r){return wi(e.source,t,r)}function HL(e,t,r){const n=nt(e.pattern)?wo:e.pattern;return wi(n,t,r)}function WL(e,t,r){return wi(wo,t,r)}function JL(e,t,r){return wi(Y0,t,r)}function XL(e,t,r){return Ie({true:t,false:t},r)}function YL(e,t,r){return wi(Io,t,r)}function QL(e,t,r){return wi(Io,t,r)}function Gl(e,t,r={}){return de(e)?BL(e.anyOf,t,r):hr(e)?ZL(e,t,r):fr(e)?GL(e.const,t,r):Bn(e)?XL(e,t,r):tn(e)?YL(e,t,r):rn(e)?QL(e,t,r):ph(e)?VL(e,t,r):Gn(e)?HL(e,t,r):lh(e)?WL(e,t,r):xo(e)?JL(e,t,r):H(r)}function Vl(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function ZP(e){const t=Vl(e);return t===wo?Zt():t===Io?zr():Zt({pattern:t})}function Hl(e){return e.patternProperties[Vl(e)]}function eq(e,t){t.parameters=_c(e,t.parameters);t.returns=sn(e,t.returns);return t}function tq(e,t){t.parameters=_c(e,t.parameters);t.returns=sn(e,t.returns);return t}function rq(e,t){t.allOf=_c(e,t.allOf);return t}function nq(e,t){t.anyOf=_c(e,t.anyOf);return t}function oq(e,t){if(nt(t.items))return t;t.items=_c(e,t.items);return t}function iq(e,t){t.items=sn(e,t.items);return t}function sq(e,t){t.items=sn(e,t.items);return t}function aq(e,t){t.items=sn(e,t.items);return t}function cq(e,t){t.item=sn(e,t.item);return t}function uq(e,t){const r=fq(e,t.properties);return{...t,...Ie(r)}}function lq(e,t){const r=sn(e,ZP(t));const n=sn(e,Hl(t));const o=Gl(r,n);return{...t,...o}}function dq(e,t){return t.index in e?e[t.index]:on()}function pq(e,t){const r=$s(t);const n=tr(t);const o=sn(e,t);return r&&n?Bl(o):r&&!n?nr(o):!r&&n?Ct(o):o}function fq(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>{return{...r,[n]:pq(e,t[n])}},{})}function _c(e,t){return t.map(r=>sn(e,r))}function sn(e,t){return Qr(t)?eq(e,t):en(t)?tq(e,t):Xe(t)?rq(e,t):de(t)?nq(e,t):gr(t)?oq(e,t):Xr(t)?iq(e,t):mi(t)?sq(e,t):gi(t)?aq(e,t):yi(t)?cq(e,t):ot(t)?uq(e,t):_i(t)?lq(e,t):dh(t)?dq(e,t):t}function BP(e,t){return sn(t,Os(e))}function GP(e){return P({[w]:"Integer",type:"integer"},e)}function mq(e,t,r){return{[e]:an(ae(e),t,Ue(r))}}function hq(e,t,r){const n=e.reduce((o,i)=>{return{...o,...mq(i,t,r)}},{});return n}function gq(e,t,r){return hq(e["keys"],t,r)}function VP(e,t,r){const n=gq(e,t,r);return me(n)}function yq(e){const[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function _q(e){const[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function xq(e){return e.toUpperCase()}function bq(e){return e.toLowerCase()}function Iq(e,t,r){const n=Cs(e.pattern);const o=xi(n);if(!o)return{...e,pattern:HP(e.pattern,t)};const i=[...mc(n)];const s=i.map(l=>ae(l));const a=WP(s,t);const c=be(a);return El([c],r)}function HP(e,t){return typeof e==="string"?t==="Uncapitalize"?yq(e):t==="Capitalize"?_q(e):t==="Uppercase"?xq(e):t==="Lowercase"?bq(e):e:e.toString()}function WP(e,t){return e.map(r=>an(r,t))}function an(e,t,r={}){return mr(e)?VP(e,t,r):hr(e)?Iq(e,t,r):de(e)?be(WP(e.anyOf,t),r):fr(e)?ae(HP(e.const,t),r):P(e,r)}function JP(e,t={}){return an(e,"Capitalize",t)}function XP(e,t={}){return an(e,"Lowercase",t)}function YP(e,t={}){return an(e,"Uncapitalize",t)}function QP(e,t={}){return an(e,"Uppercase",t)}function wq(e,t,r){const n={};for(const o of globalThis.Object.getOwnPropertyNames(e))n[o]=vo(e[o],t,Ue(r));return n}function Sq(e,t,r){return wq(e.properties,t,r)}function eO(e,t,r){const n=Sq(e,t,r);return me(n)}function Tq(e,t){return e.map(r=>zh(r,t))}function Pq(e,t){return e.map(r=>zh(r,t))}function Oq(e,t){const{[t]:r,...n}=e;return n}function vq(e,t){return t.reduce((r,n)=>Oq(r,n),e)}function $q(e,t,r){const n=Ye(e,[Ve,"$id","required","properties"]);const o=vq(r,t);return Ie(o,n)}function kq(e){const t=e.reduce((r,n)=>$l(n)?[...r,ae(n)]:r,[]);return be(t)}function zh(e,t){return Xe(e)?Nt(Tq(e.allOf,t)):de(e)?be(Pq(e.anyOf,t)):ot(e)?$q(e,t,e.properties):Ie({})}function vo(e,t,r){const n=rt(t)?kq(t):t;const o=He(t)?rr(t):t;const i=Qe(e);const s=Qe(t);return Ke(e)?eO(e,o,r):mr(t)?tO(e,t,r):i&&s?Ce("Omit",[e,n],r):!i&&s?Ce("Omit",[e,n],r):i&&!s?Ce("Omit",[e,n],r):P({...zh(e,o),...r})}function Rq(e,t,r){return{[t]:vo(e,[t],Ue(r))}}function Mq(e,t,r){return t.reduce((n,o)=>{return{...n,...Rq(e,o,r)}},{})}function Aq(e,t,r){return Mq(e,t.keys,r)}function tO(e,t,r){const n=Aq(e,t,r);return me(n)}function Eq(e,t,r){const n={};for(const o of globalThis.Object.getOwnPropertyNames(e))n[o]=$o(e[o],t,Ue(r));return n}function zq(e,t,r){return Eq(e.properties,t,r)}function rO(e,t,r){const n=zq(e,t,r);return me(n)}function Cq(e,t){return e.map(r=>Ch(r,t))}function Nq(e,t){return e.map(r=>Ch(r,t))}function Fq(e,t){const r={};for(const n of t)if(n in e)r[n]=e[n];return r}function jq(e,t,r){const n=Ye(e,[Ve,"$id","required","properties"]);const o=Fq(r,t);return Ie(o,n)}function Dq(e){const t=e.reduce((r,n)=>$l(n)?[...r,ae(n)]:r,[]);return be(t)}function Ch(e,t){return Xe(e)?Nt(Cq(e.allOf,t)):de(e)?be(Nq(e.anyOf,t)):ot(e)?jq(e,t,e.properties):Ie({})}function $o(e,t,r){const n=rt(t)?Dq(t):t;const o=He(t)?rr(t):t;const i=Qe(e);const s=Qe(t);return Ke(e)?rO(e,o,r):mr(t)?nO(e,t,r):i&&s?Ce("Pick",[e,n],r):!i&&s?Ce("Pick",[e,n],r):i&&!s?Ce("Pick",[e,n],r):P({...Ch(e,o),...r})}function Uq(e,t,r){return{[t]:$o(e,[t],Ue(r))}}function Lq(e,t,r){return t.reduce((n,o)=>{return{...n,...Uq(e,o,r)}},{})}function qq(e,t,r){return Lq(e,t.keys,r)}function nO(e,t,r){const n=qq(e,t,r);return me(n)}function Kq(e,t){return Ce("Partial",[Ce(e,t)])}function Zq(e){return Ce("Partial",[$n(e)])}function Bq(e){const t={};for(const r of globalThis.Object.getOwnPropertyNames(e))t[r]=Ct(e[r]);return t}function Gq(e,t){const r=Ye(e,[Ve,"$id","required","properties"]);const n=Bq(t);return Ie(n,r)}function oO(e){return e.map(t=>iO(t))}function iO(e){return Yr(e)?Kq(e.target,e.parameters):Qe(e)?Zq(e.$ref):Xe(e)?Nt(oO(e.allOf)):de(e)?be(oO(e.anyOf)):ot(e)?Gq(e,e.properties):hi(e)?e:Bn(e)?e:tn(e)?e:fr(e)?e:ac(e)?e:rn(e)?e:Gn(e)?e:cc(e)?e:Vn(e)?e:Ie({})}function Gs(e,t){if(Ke(e)){return sO(e,t)}else{return P({...iO(e),...t})}}function Vq(e,t){const r={};for(const n of globalThis.Object.getOwnPropertyNames(e))r[n]=Gs(e[n],Ue(t));return r}function Hq(e,t){return Vq(e.properties,t)}function sO(e,t){const r=Hq(e,t);return me(r)}function Wq(e,t){return Ce("Required",[Ce(e,t)])}function Jq(e){return Ce("Required",[$n(e)])}function Xq(e){const t={};for(const r of globalThis.Object.getOwnPropertyNames(e))t[r]=Ye(e[r],[Ot]);return t}function Yq(e,t){const r=Ye(e,[Ve,"$id","required","properties"]);const n=Xq(t);return Ie(n,r)}function aO(e){return e.map(t=>cO(t))}function cO(e){return Yr(e)?Wq(e.target,e.parameters):Qe(e)?Jq(e.$ref):Xe(e)?Nt(aO(e.allOf)):de(e)?be(aO(e.anyOf)):ot(e)?Yq(e,e.properties):hi(e)?e:Bn(e)?e:tn(e)?e:fr(e)?e:ac(e)?e:rn(e)?e:Gn(e)?e:cc(e)?e:Vn(e)?e:Ie({})}function Vs(e,t){if(Ke(e)){return uO(e,t)}else{return P({...cO(e),...t})}}function Qq(e,t){const r={};for(const n of globalThis.Object.getOwnPropertyNames(e))r[n]=Vs(e[n],t);return r}function e2(e,t){return Qq(e.properties,t)}function uO(e,t){const r=e2(e,t);return me(r)}function t2(e,t){return t.map(r=>{return Qe(r)?Nh(e,r.$ref):yr(e,r)})}function Nh(e,t){return t in e?Qe(e[t])?Nh(e,e[t].$ref):yr(e,e[t]):H()}function r2(e){return Ds(e[0])}function n2(e){return Po(e[0],e[1])}function o2(e){return Ls(e[0])}function i2(e){return Gs(e[0])}function s2(e){return vo(e[0],e[1])}function a2(e){return $o(e[0],e[1])}function c2(e){return Vs(e[0])}function u2(e,t,r){const n=t2(e,r);return t==="Awaited"?r2(n):t==="Index"?n2(n):t==="KeyOf"?o2(n):t==="Partial"?i2(n):t==="Omit"?s2(n):t==="Pick"?a2(n):t==="Required"?c2(n):H()}function l2(e,t){return Ms(yr(e,t))}function d2(e,t){return As(yr(e,t))}function p2(e,t,r){return Es(xc(e,t),yr(e,r))}function f2(e,t,r){return On(xc(e,t),yr(e,r))}function m2(e,t){return Nt(xc(e,t))}function h2(e,t){return js(yr(e,t))}function g2(e,t){return Ie(globalThis.Object.keys(t).reduce((r,n)=>{return{...r,[n]:yr(e,t[n])}},{}))}function y2(e,t){const[r,n]=[yr(e,Hl(t)),Vl(t)];const o=Os(t);o.patternProperties[n]=r;return o}function _2(e,t){return Qe(t)?{...Nh(e,t.$ref),[Ve]:t[Ve]}:t}function x2(e,t){return Cr(xc(e,t))}function b2(e,t){return be(xc(e,t))}function xc(e,t){return t.map(r=>yr(e,r))}function yr(e,t){return tr(t)?P(yr(e,Ye(t,[Ot])),t):$s(t)?P(yr(e,Ye(t,[Jr])),t):xe(t)?P(_2(e,t),t):Xr(t)?P(l2(e,t.items),t):mi(t)?P(d2(e,t.items),t):Yr(t)?P(u2(e,t.target,t.parameters)):Qr(t)?P(p2(e,t.parameters,t.returns),t):en(t)?P(f2(e,t.parameters,t.returns),t):Xe(t)?P(m2(e,t.allOf),t):gi(t)?P(h2(e,t.items),t):ot(t)?P(g2(e,t.properties),t):_i(t)?P(y2(e,t)):gr(t)?P(x2(e,t.items||[]),t):de(t)?P(b2(e,t.anyOf),t):t}function I2(e,t){return t in e?yr(e,e[t]):H()}function lO(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>{return{...t,[r]:I2(e,r)}},{})}var Fh=class{constructor(t){const r=lO(t);const n=this.WithIdentifiers(r);this.$defs=n}Import(t,r){const n={...this.$defs,[t]:P(this.$defs[t],r)};return P({[w]:"Import",$defs:n,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>{return{...r,[n]:{...t[n],$id:n}}},{})}};function dO(e){return new Fh(e)}function pO(e,t){return P({[w]:"Not",not:e},t)}function fO(e,t){return en(e)?Cr(e.parameters,t):H()}var w2=0;function mO(e,t={}){if(nt(t.$id))t.$id=`T${w2++}`;const r=Os(e({[w]:"This",$ref:`${t.$id}`}));r.$id=t.$id;return P({[Er]:"Recursive",...r},t)}function hO(e,t){const r=Ae(e)?new globalThis.RegExp(e):e;return P({[w]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function S2(e){return Xe(e)?e.allOf:de(e)?e.anyOf:gr(e)?e.items??[]:[]}function gO(e){return S2(e)}function yO(e,t){return en(e)?P(e.returns,t):H(t)}var jh=class{constructor(t){this.schema=t}Decode(t){return new Dh(this.schema,t)}};var Dh=class{constructor(t,r){this.schema=t;this.decode=r}EncodeTransform(t,r){const n=s=>r[Ve].Encode(t(s));const o=s=>this.decode(r[Ve].Decode(s));const i={Encode:n,Decode:o};return{...r,[Ve]:i}}EncodeSchema(t,r){const n={Decode:this.decode,Encode:t};return{...r,[Ve]:n}}Encode(t){return xe(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function _O(e){return new jh(e)}function xO(e={}){return P({[w]:e[w]??"Unsafe"},e)}function bO(e){return P({[w]:"Void",type:"void"},e)}var Uh={};_n(Uh,{Any:()=>To,Argument:()=>nP,Array:()=>Ms,AsyncIterator:()=>As,Awaited:()=>Ds,BigInt:()=>Fs,Boolean:()=>Al,Capitalize:()=>JP,Composite:()=>wP,Const:()=>SP,Constructor:()=>Es,ConstructorParameters:()=>TP,Date:()=>Fl,Enum:()=>PP,Exclude:()=>Zs,Extends:()=>Ks,Extract:()=>Bs,Function:()=>On,Index:()=>Po,InstanceType:()=>KP,Instantiate:()=>BP,Integer:()=>GP,Intersect:()=>Nt,Iterator:()=>js,KeyOf:()=>Ls,Literal:()=>ae,Lowercase:()=>XP,Mapped:()=>gP,Module:()=>dO,Never:()=>H,Not:()=>pO,Null:()=>jl,Number:()=>zr,Object:()=>Ie,Omit:()=>vo,Optional:()=>Ct,Parameters:()=>fO,Partial:()=>Gs,Pick:()=>$o,Promise:()=>Cl,Readonly:()=>nr,ReadonlyOptional:()=>Bl,Record:()=>Gl,Recursive:()=>mO,Ref:()=>$n,RegExp:()=>hO,Required:()=>Vs,Rest:()=>gO,ReturnType:()=>yO,String:()=>Zt,Symbol:()=>Dl,TemplateLiteral:()=>El,Transform:()=>_O,Tuple:()=>Cr,Uint8Array:()=>Ll,Uncapitalize:()=>YP,Undefined:()=>Ul,Union:()=>be,Unknown:()=>on,Unsafe:()=>xO,Uppercase:()=>QP,Void:()=>bO});var y=Uh;function T2(e){switch(e.errorType){case I.ArrayContains:return"Expected array to contain at least one matching value";case I.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case I.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case I.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case I.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case I.ArrayUniqueItems:return"Expected array elements to be unique";case I.Array:return"Expected array";case I.AsyncIterator:return"Expected AsyncIterator";case I.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case I.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case I.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case I.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case I.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case I.BigInt:return"Expected bigint";case I.Boolean:return"Expected boolean";case I.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case I.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case I.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case I.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case I.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case I.Date:return"Expected Date";case I.Function:return"Expected function";case I.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case I.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case I.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case I.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case I.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case I.Integer:return"Expected integer";case I.IntersectUnevaluatedProperties:return"Unexpected property";case I.Intersect:return"Expected all values to match";case I.Iterator:return"Expected Iterator";case I.Literal:return`Expected ${typeof e.schema.const==="string"?`'${e.schema.const}'`:e.schema.const}`;case I.Never:return"Never";case I.Not:return"Value should not match";case I.Null:return"Expected null";case I.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case I.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case I.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case I.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case I.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case I.Number:return"Expected number";case I.Object:return"Expected object";case I.ObjectAdditionalProperties:return"Unexpected property";case I.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case I.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case I.ObjectRequiredProperty:return"Expected required property";case I.Promise:return"Expected Promise";case I.RegExp:return"Expected string to match regular expression";case I.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case I.StringFormat:return`Expected string to match '${e.schema.format}' format`;case I.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case I.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case I.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case I.String:return"Expected string";case I.Symbol:return"Expected symbol";case I.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case I.Tuple:return"Expected tuple";case I.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case I.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case I.Uint8Array:return"Expected Uint8Array";case I.Undefined:return"Expected undefined";case I.Union:return"Expected union value";case I.Void:return"Expected void";case I.Kind:return`Expected kind '${e.schema[w]}'`;default:return"Unknown error type"}}var P2=T2;function IO(){return P2}var Lh=class extends U{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`);this.schema=t}};function O2(e,t){const r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new Lh(e);return we(r,t)}function gt(e,t){if(!Se(e.$id)||t.some(r=>r.$id===e.$id))return t;t.push(e);return t}function we(e,t){return e[w]==="This"||e[w]==="Ref"?O2(e,t):e}var qh=class extends U{constructor(t){super(`Unable to hash value`);this.value=t}};var _r;(function(e){e[e["Undefined"]=0]="Undefined";e[e["Null"]=1]="Null";e[e["Boolean"]=2]="Boolean";e[e["Number"]=3]="Number";e[e["String"]=4]="String";e[e["Object"]=5]="Object";e[e["Array"]=6]="Array";e[e["Date"]=7]="Date";e[e["Uint8Array"]=8]="Uint8Array";e[e["Symbol"]=9]="Symbol";e[e["BigInt"]=10]="BigInt"})(_r||(_r={}));var Hs=BigInt("14695981039346656037");var[v2,$2]=[BigInt("1099511628211"),BigInt("18446744073709551616")];var k2=Array.from({length:256}).map((e,t)=>BigInt(t));var wO=new Float64Array(1);var SO=new DataView(wO.buffer);var TO=new Uint8Array(wO.buffer);function*R2(e){const t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let r=0;r<t;r++){yield e>>8*(t-1-r)&255}}function M2(e){jt(_r.Array);for(const t of e){Ws(t)}}function A2(e){jt(_r.Boolean);jt(e?1:0)}function E2(e){jt(_r.BigInt);SO.setBigInt64(0,e);for(const t of TO){jt(t)}}function z2(e){jt(_r.Date);Ws(e.getTime())}function C2(e){jt(_r.Null)}function N2(e){jt(_r.Number);SO.setFloat64(0,e);for(const t of TO){jt(t)}}function F2(e){jt(_r.Object);for(const t of globalThis.Object.getOwnPropertyNames(e).sort()){Ws(t);Ws(e[t])}}function j2(e){jt(_r.String);for(let t=0;t<e.length;t++){for(const r of R2(e.charCodeAt(t))){jt(r)}}}function D2(e){jt(_r.Symbol);Ws(e.description)}function U2(e){jt(_r.Uint8Array);for(let t=0;t<e.length;t++){jt(e[t])}}function L2(e){return jt(_r.Undefined)}function Ws(e){if(D(e))return M2(e);if(Pn(e))return A2(e);if(Wr(e))return E2(e);if(Kt(e))return z2(e);if(Kn(e))return C2(e);if(qe(e))return N2(e);if(q(e))return F2(e);if(Se(e))return j2(e);if(Zn(e))return D2(e);if(vs(e))return U2(e);if(Le(e))return L2(e);throw new qh(e)}function jt(e){Hs=Hs^k2[e];Hs=Hs*v2%$2}function Js(e){Hs=BigInt("14695981039346656037");Ws(e);return Hs}var Kh=class extends U{constructor(t){super(`Unknown type`);this.schema=t}};function q2(e){return e[w]==="Any"||e[w]==="Unknown"}function Y(e){return e!==void 0}function K2(e,t,r){return true}function Z2(e,t,r){return true}function B2(e,t,r){if(!D(r))return false;if(Y(e.minItems)&&!(r.length>=e.minItems)){return false}if(Y(e.maxItems)&&!(r.length<=e.maxItems)){return false}for(const i of r){if(!yt(e.items,t,i))return false}if(e.uniqueItems===true&&!(function(){const i=new Set;for(const s of r){const a=Js(s);if(i.has(a)){return false}else{i.add(a)}}return true})()){return false}if(!(Y(e.contains)||qe(e.minContains)||qe(e.maxContains))){return true}const n=Y(e.contains)?e.contains:H();const o=r.reduce((i,s)=>yt(n,t,s)?i+1:i,0);if(o===0){return false}if(qe(e.minContains)&&o<e.minContains){return false}if(qe(e.maxContains)&&o>e.maxContains){return false}return true}function G2(e,t,r){return Tl(r)}function V2(e,t,r){if(!Wr(r))return false;if(Y(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)){return false}if(Y(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)){return false}if(Y(e.maximum)&&!(r<=e.maximum)){return false}if(Y(e.minimum)&&!(r>=e.minimum)){return false}if(Y(e.multipleOf)&&!(r%e.multipleOf===BigInt(0))){return false}return true}function H2(e,t,r){return Pn(r)}function W2(e,t,r){return yt(e.returns,t,r.prototype)}function J2(e,t,r){if(!Kt(r))return false;if(Y(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)){return false}if(Y(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)){return false}if(Y(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)){return false}if(Y(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)){return false}if(Y(e.multipleOfTimestamp)&&!(r.getTime()%e.multipleOfTimestamp===0)){return false}return true}function X2(e,t,r){return _o(r)}function Y2(e,t,r){const n=globalThis.Object.values(e.$defs);const o=e.$defs[e.$ref];return yt(o,[...t,...n],r)}function Q2(e,t,r){if(!vl(r)){return false}if(Y(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)){return false}if(Y(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)){return false}if(Y(e.maximum)&&!(r<=e.maximum)){return false}if(Y(e.minimum)&&!(r>=e.minimum)){return false}if(Y(e.multipleOf)&&!(r%e.multipleOf===0)){return false}return true}function eK(e,t,r){const n=e.allOf.every(o=>yt(o,t,r));if(e.unevaluatedProperties===false){const o=new RegExp(Us(e));const i=Object.getOwnPropertyNames(r).every(s=>o.test(s));return n&&i}else if(He(e.unevaluatedProperties)){const o=new RegExp(Us(e));const i=Object.getOwnPropertyNames(r).every(s=>o.test(s)||yt(e.unevaluatedProperties,t,r[s]));return n&&i}else{return n}}function tK(e,t,r){return Pl(r)}function rK(e,t,r){return r===e.const}function nK(e,t,r){return false}function oK(e,t,r){return!yt(e.not,t,r)}function iK(e,t,r){return Kn(r)}function sK(e,t,r){if(!ct.IsNumberLike(r))return false;if(Y(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)){return false}if(Y(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)){return false}if(Y(e.minimum)&&!(r>=e.minimum)){return false}if(Y(e.maximum)&&!(r<=e.maximum)){return false}if(Y(e.multipleOf)&&!(r%e.multipleOf===0)){return false}return true}function aK(e,t,r){if(!ct.IsObjectLike(r))return false;if(Y(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)){return false}if(Y(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)){return false}const n=Object.getOwnPropertyNames(e.properties);for(const o of n){const i=e.properties[o];if(e.required&&e.required.includes(o)){if(!yt(i,t,r[o])){return false}if((Ii(i)||q2(i))&&!(o in r)){return false}}else{if(ct.IsExactOptionalProperty(r,o)&&!yt(i,t,r[o])){return false}}}if(e.additionalProperties===false){const o=Object.getOwnPropertyNames(r);if(e.required&&e.required.length===n.length&&o.length===n.length){return true}else{return o.every(i=>n.includes(i))}}else if(typeof e.additionalProperties==="object"){const o=Object.getOwnPropertyNames(r);return o.every(i=>n.includes(i)||yt(e.additionalProperties,t,r[i]))}else{return true}}function cK(e,t,r){return Ol(r)}function uK(e,t,r){if(!ct.IsRecordLike(r)){return false}if(Y(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)){return false}if(Y(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)){return false}const[n,o]=Object.entries(e.patternProperties)[0];const i=new RegExp(n);const s=Object.entries(r).every(([l,u])=>{return i.test(l)?yt(o,t,u):true});const a=typeof e.additionalProperties==="object"?Object.entries(r).every(([l,u])=>{return!i.test(l)?yt(e.additionalProperties,t,u):true}):true;const c=e.additionalProperties===false?Object.getOwnPropertyNames(r).every(l=>{return i.test(l)}):true;return s&&a&&c}function lK(e,t,r){return yt(we(e,t),t,r)}function dK(e,t,r){const n=new RegExp(e.source,e.flags);if(Y(e.minLength)){if(!(r.length>=e.minLength))return false}if(Y(e.maxLength)){if(!(r.length<=e.maxLength))return false}return n.test(r)}function pK(e,t,r){if(!Se(r)){return false}if(Y(e.minLength)){if(!(r.length>=e.minLength))return false}if(Y(e.maxLength)){if(!(r.length<=e.maxLength))return false}if(Y(e.pattern)){const n=new RegExp(e.pattern);if(!n.test(r))return false}if(Y(e.format)){if(!So.Has(e.format))return false;const n=So.Get(e.format);return n(r)}return true}function fK(e,t,r){return Zn(r)}function mK(e,t,r){return Se(r)&&new RegExp(e.pattern).test(r)}function hK(e,t,r){return yt(we(e,t),t,r)}function gK(e,t,r){if(!D(r)){return false}if(e.items===void 0&&!(r.length===0)){return false}if(!(r.length===e.maxItems)){return false}if(!e.items){return true}for(let n=0;n<e.items.length;n++){if(!yt(e.items[n],t,r[n]))return false}return true}function yK(e,t,r){return Le(r)}function _K(e,t,r){return e.anyOf.some(n=>yt(n,t,r))}function xK(e,t,r){if(!vs(r)){return false}if(Y(e.maxByteLength)&&!(r.length<=e.maxByteLength)){return false}if(Y(e.minByteLength)&&!(r.length>=e.minByteLength)){return false}return true}function bK(e,t,r){return true}function IK(e,t,r){return ct.IsVoidLike(r)}function wK(e,t,r){if(!nn.Has(e[w]))return false;const n=nn.Get(e[w]);return n(e,r)}function yt(e,t,r){const n=Y(e.$id)?gt(e,t):t;const o=e;switch(o[w]){case"Any":return K2(o,n,r);case"Argument":return Z2(o,n,r);case"Array":return B2(o,n,r);case"AsyncIterator":return G2(o,n,r);case"BigInt":return V2(o,n,r);case"Boolean":return H2(o,n,r);case"Constructor":return W2(o,n,r);case"Date":return J2(o,n,r);case"Function":return X2(o,n,r);case"Import":return Y2(o,n,r);case"Integer":return Q2(o,n,r);case"Intersect":return eK(o,n,r);case"Iterator":return tK(o,n,r);case"Literal":return rK(o,n,r);case"Never":return nK(o,n,r);case"Not":return oK(o,n,r);case"Null":return iK(o,n,r);case"Number":return sK(o,n,r);case"Object":return aK(o,n,r);case"Promise":return cK(o,n,r);case"Record":return uK(o,n,r);case"Ref":return lK(o,n,r);case"RegExp":return dK(o,n,r);case"String":return pK(o,n,r);case"Symbol":return fK(o,n,r);case"TemplateLiteral":return mK(o,n,r);case"This":return hK(o,n,r);case"Tuple":return gK(o,n,r);case"Undefined":return yK(o,n,r);case"Union":return _K(o,n,r);case"Uint8Array":return xK(o,n,r);case"Unknown":return bK(o,n,r);case"Void":return IK(o,n,r);default:if(!nn.Has(o[w]))throw new Kh(o);return wK(o,n,r)}}function B(...e){return e.length===3?yt(e[0],e[1],e[2]):yt(e[0],[],e[1])}var I;(function(e){e[e["ArrayContains"]=0]="ArrayContains";e[e["ArrayMaxContains"]=1]="ArrayMaxContains";e[e["ArrayMaxItems"]=2]="ArrayMaxItems";e[e["ArrayMinContains"]=3]="ArrayMinContains";e[e["ArrayMinItems"]=4]="ArrayMinItems";e[e["ArrayUniqueItems"]=5]="ArrayUniqueItems";e[e["Array"]=6]="Array";e[e["AsyncIterator"]=7]="AsyncIterator";e[e["BigIntExclusiveMaximum"]=8]="BigIntExclusiveMaximum";e[e["BigIntExclusiveMinimum"]=9]="BigIntExclusiveMinimum";e[e["BigIntMaximum"]=10]="BigIntMaximum";e[e["BigIntMinimum"]=11]="BigIntMinimum";e[e["BigIntMultipleOf"]=12]="BigIntMultipleOf";e[e["BigInt"]=13]="BigInt";e[e["Boolean"]=14]="Boolean";e[e["DateExclusiveMaximumTimestamp"]=15]="DateExclusiveMaximumTimestamp";e[e["DateExclusiveMinimumTimestamp"]=16]="DateExclusiveMinimumTimestamp";e[e["DateMaximumTimestamp"]=17]="DateMaximumTimestamp";e[e["DateMinimumTimestamp"]=18]="DateMinimumTimestamp";e[e["DateMultipleOfTimestamp"]=19]="DateMultipleOfTimestamp";e[e["Date"]=20]="Date";e[e["Function"]=21]="Function";e[e["IntegerExclusiveMaximum"]=22]="IntegerExclusiveMaximum";e[e["IntegerExclusiveMinimum"]=23]="IntegerExclusiveMinimum";e[e["IntegerMaximum"]=24]="IntegerMaximum";e[e["IntegerMinimum"]=25]="IntegerMinimum";e[e["IntegerMultipleOf"]=26]="IntegerMultipleOf";e[e["Integer"]=27]="Integer";e[e["IntersectUnevaluatedProperties"]=28]="IntersectUnevaluatedProperties";e[e["Intersect"]=29]="Intersect";e[e["Iterator"]=30]="Iterator";e[e["Kind"]=31]="Kind";e[e["Literal"]=32]="Literal";e[e["Never"]=33]="Never";e[e["Not"]=34]="Not";e[e["Null"]=35]="Null";e[e["NumberExclusiveMaximum"]=36]="NumberExclusiveMaximum";e[e["NumberExclusiveMinimum"]=37]="NumberExclusiveMinimum";e[e["NumberMaximum"]=38]="NumberMaximum";e[e["NumberMinimum"]=39]="NumberMinimum";e[e["NumberMultipleOf"]=40]="NumberMultipleOf";e[e["Number"]=41]="Number";e[e["ObjectAdditionalProperties"]=42]="ObjectAdditionalProperties";e[e["ObjectMaxProperties"]=43]="ObjectMaxProperties";e[e["ObjectMinProperties"]=44]="ObjectMinProperties";e[e["ObjectRequiredProperty"]=45]="ObjectRequiredProperty";e[e["Object"]=46]="Object";e[e["Promise"]=47]="Promise";e[e["RegExp"]=48]="RegExp";e[e["StringFormatUnknown"]=49]="StringFormatUnknown";e[e["StringFormat"]=50]="StringFormat";e[e["StringMaxLength"]=51]="StringMaxLength";e[e["StringMinLength"]=52]="StringMinLength";e[e["StringPattern"]=53]="StringPattern";e[e["String"]=54]="String";e[e["Symbol"]=55]="Symbol";e[e["TupleLength"]=56]="TupleLength";e[e["Tuple"]=57]="Tuple";e[e["Uint8ArrayMaxByteLength"]=58]="Uint8ArrayMaxByteLength";e[e["Uint8ArrayMinByteLength"]=59]="Uint8ArrayMinByteLength";e[e["Uint8Array"]=60]="Uint8Array";e[e["Undefined"]=61]="Undefined";e[e["Union"]=62]="Union";e[e["Void"]=63]="Void"})(I||(I={}));var Zh=class extends U{constructor(t){super("Unknown type");this.schema=t}};function Jn(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Q(e){return e!==void 0}var ko=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){const t=this.iterator.next();return t.done?void 0:t.value}};function k(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:IO()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*SK(e,t,r,n){}function*TK(e,t,r,n){}function*PK(e,t,r,n){if(!D(n)){return yield k(I.Array,e,r,n)}if(Q(e.minItems)&&!(n.length>=e.minItems)){yield k(I.ArrayMinItems,e,r,n)}if(Q(e.maxItems)&&!(n.length<=e.maxItems)){yield k(I.ArrayMaxItems,e,r,n)}for(let s=0;s<n.length;s++){yield*_t(e.items,t,`${r}/${s}`,n[s])}if(e.uniqueItems===true&&!(function(){const s=new Set;for(const a of n){const c=Js(a);if(s.has(c)){return false}else{s.add(c)}}return true})()){yield k(I.ArrayUniqueItems,e,r,n)}if(!(Q(e.contains)||Q(e.minContains)||Q(e.maxContains))){return}const o=Q(e.contains)?e.contains:H();const i=n.reduce((s,a,c)=>_t(o,t,`${r}${c}`,a).next().done===true?s+1:s,0);if(i===0){yield k(I.ArrayContains,e,r,n)}if(qe(e.minContains)&&i<e.minContains){yield k(I.ArrayMinContains,e,r,n)}if(qe(e.maxContains)&&i>e.maxContains){yield k(I.ArrayMaxContains,e,r,n)}}function*OK(e,t,r,n){if(!Tl(n))yield k(I.AsyncIterator,e,r,n)}function*vK(e,t,r,n){if(!Wr(n))return yield k(I.BigInt,e,r,n);if(Q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)){yield k(I.BigIntExclusiveMaximum,e,r,n)}if(Q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)){yield k(I.BigIntExclusiveMinimum,e,r,n)}if(Q(e.maximum)&&!(n<=e.maximum)){yield k(I.BigIntMaximum,e,r,n)}if(Q(e.minimum)&&!(n>=e.minimum)){yield k(I.BigIntMinimum,e,r,n)}if(Q(e.multipleOf)&&!(n%e.multipleOf===BigInt(0))){yield k(I.BigIntMultipleOf,e,r,n)}}function*$K(e,t,r,n){if(!Pn(n))yield k(I.Boolean,e,r,n)}function*kK(e,t,r,n){yield*_t(e.returns,t,r,n.prototype)}function*RK(e,t,r,n){if(!Kt(n))return yield k(I.Date,e,r,n);if(Q(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)){yield k(I.DateExclusiveMaximumTimestamp,e,r,n)}if(Q(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)){yield k(I.DateExclusiveMinimumTimestamp,e,r,n)}if(Q(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)){yield k(I.DateMaximumTimestamp,e,r,n)}if(Q(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)){yield k(I.DateMinimumTimestamp,e,r,n)}if(Q(e.multipleOfTimestamp)&&!(n.getTime()%e.multipleOfTimestamp===0)){yield k(I.DateMultipleOfTimestamp,e,r,n)}}function*MK(e,t,r,n){if(!_o(n))yield k(I.Function,e,r,n)}function*AK(e,t,r,n){const o=globalThis.Object.values(e.$defs);const i=e.$defs[e.$ref];yield*_t(i,[...t,...o],r,n)}function*EK(e,t,r,n){if(!vl(n))return yield k(I.Integer,e,r,n);if(Q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)){yield k(I.IntegerExclusiveMaximum,e,r,n)}if(Q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)){yield k(I.IntegerExclusiveMinimum,e,r,n)}if(Q(e.maximum)&&!(n<=e.maximum)){yield k(I.IntegerMaximum,e,r,n)}if(Q(e.minimum)&&!(n>=e.minimum)){yield k(I.IntegerMinimum,e,r,n)}if(Q(e.multipleOf)&&!(n%e.multipleOf===0)){yield k(I.IntegerMultipleOf,e,r,n)}}function*zK(e,t,r,n){let o=false;for(const i of e.allOf){for(const s of _t(i,t,r,n)){o=true;yield s}}if(o){return yield k(I.Intersect,e,r,n)}if(e.unevaluatedProperties===false){const i=new RegExp(Us(e));for(const s of Object.getOwnPropertyNames(n)){if(!i.test(s)){yield k(I.IntersectUnevaluatedProperties,e,`${r}/${s}`,n)}}}if(typeof e.unevaluatedProperties==="object"){const i=new RegExp(Us(e));for(const s of Object.getOwnPropertyNames(n)){if(!i.test(s)){const a=_t(e.unevaluatedProperties,t,`${r}/${s}`,n[s]).next();if(!a.done)yield a.value}}}}function*CK(e,t,r,n){if(!Pl(n))yield k(I.Iterator,e,r,n)}function*NK(e,t,r,n){if(!(n===e.const))yield k(I.Literal,e,r,n)}function*FK(e,t,r,n){yield k(I.Never,e,r,n)}function*jK(e,t,r,n){if(_t(e.not,t,r,n).next().done===true)yield k(I.Not,e,r,n)}function*DK(e,t,r,n){if(!Kn(n))yield k(I.Null,e,r,n)}function*UK(e,t,r,n){if(!ct.IsNumberLike(n))return yield k(I.Number,e,r,n);if(Q(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)){yield k(I.NumberExclusiveMaximum,e,r,n)}if(Q(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)){yield k(I.NumberExclusiveMinimum,e,r,n)}if(Q(e.maximum)&&!(n<=e.maximum)){yield k(I.NumberMaximum,e,r,n)}if(Q(e.minimum)&&!(n>=e.minimum)){yield k(I.NumberMinimum,e,r,n)}if(Q(e.multipleOf)&&!(n%e.multipleOf===0)){yield k(I.NumberMultipleOf,e,r,n)}}function*LK(e,t,r,n){if(!ct.IsObjectLike(n))return yield k(I.Object,e,r,n);if(Q(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)){yield k(I.ObjectMinProperties,e,r,n)}if(Q(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)){yield k(I.ObjectMaxProperties,e,r,n)}const o=Array.isArray(e.required)?e.required:[];const i=Object.getOwnPropertyNames(e.properties);const s=Object.getOwnPropertyNames(n);for(const a of o){if(s.includes(a))continue;yield k(I.ObjectRequiredProperty,e.properties[a],`${r}/${Jn(a)}`,void 0)}if(e.additionalProperties===false){for(const a of s){if(!i.includes(a)){yield k(I.ObjectAdditionalProperties,e,`${r}/${Jn(a)}`,n[a])}}}if(typeof e.additionalProperties==="object"){for(const a of s){if(i.includes(a))continue;yield*_t(e.additionalProperties,t,`${r}/${Jn(a)}`,n[a])}}for(const a of i){const c=e.properties[a];if(e.required&&e.required.includes(a)){yield*_t(c,t,`${r}/${Jn(a)}`,n[a]);if(Ii(e)&&!(a in n)){yield k(I.ObjectRequiredProperty,c,`${r}/${Jn(a)}`,void 0)}}else{if(ct.IsExactOptionalProperty(n,a)){yield*_t(c,t,`${r}/${Jn(a)}`,n[a])}}}}function*qK(e,t,r,n){if(!Ol(n))yield k(I.Promise,e,r,n)}function*KK(e,t,r,n){if(!ct.IsRecordLike(n))return yield k(I.Object,e,r,n);if(Q(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)){yield k(I.ObjectMinProperties,e,r,n)}if(Q(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)){yield k(I.ObjectMaxProperties,e,r,n)}const[o,i]=Object.entries(e.patternProperties)[0];const s=new RegExp(o);for(const[a,c]of Object.entries(n)){if(s.test(a))yield*_t(i,t,`${r}/${Jn(a)}`,c)}if(typeof e.additionalProperties==="object"){for(const[a,c]of Object.entries(n)){if(!s.test(a))yield*_t(e.additionalProperties,t,`${r}/${Jn(a)}`,c)}}if(e.additionalProperties===false){for(const[a,c]of Object.entries(n)){if(s.test(a))continue;return yield k(I.ObjectAdditionalProperties,e,`${r}/${Jn(a)}`,c)}}}function*ZK(e,t,r,n){yield*_t(we(e,t),t,r,n)}function*BK(e,t,r,n){if(!Se(n))return yield k(I.String,e,r,n);if(Q(e.minLength)&&!(n.length>=e.minLength)){yield k(I.StringMinLength,e,r,n)}if(Q(e.maxLength)&&!(n.length<=e.maxLength)){yield k(I.StringMaxLength,e,r,n)}const o=new RegExp(e.source,e.flags);if(!o.test(n)){return yield k(I.RegExp,e,r,n)}}function*GK(e,t,r,n){if(!Se(n))return yield k(I.String,e,r,n);if(Q(e.minLength)&&!(n.length>=e.minLength)){yield k(I.StringMinLength,e,r,n)}if(Q(e.maxLength)&&!(n.length<=e.maxLength)){yield k(I.StringMaxLength,e,r,n)}if(Se(e.pattern)){const o=new RegExp(e.pattern);if(!o.test(n)){yield k(I.StringPattern,e,r,n)}}if(Se(e.format)){if(!So.Has(e.format)){yield k(I.StringFormatUnknown,e,r,n)}else{const o=So.Get(e.format);if(!o(n)){yield k(I.StringFormat,e,r,n)}}}}function*VK(e,t,r,n){if(!Zn(n))yield k(I.Symbol,e,r,n)}function*HK(e,t,r,n){if(!Se(n))return yield k(I.String,e,r,n);const o=new RegExp(e.pattern);if(!o.test(n)){yield k(I.StringPattern,e,r,n)}}function*WK(e,t,r,n){yield*_t(we(e,t),t,r,n)}function*JK(e,t,r,n){if(!D(n))return yield k(I.Tuple,e,r,n);if(e.items===void 0&&!(n.length===0)){return yield k(I.TupleLength,e,r,n)}if(!(n.length===e.maxItems)){return yield k(I.TupleLength,e,r,n)}if(!e.items){return}for(let o=0;o<e.items.length;o++){yield*_t(e.items[o],t,`${r}/${o}`,n[o])}}function*XK(e,t,r,n){if(!Le(n))yield k(I.Undefined,e,r,n)}function*YK(e,t,r,n){if(B(e,t,n))return;const o=e.anyOf.map(i=>new ko(_t(i,t,r,n)));yield k(I.Union,e,r,n,o)}function*QK(e,t,r,n){if(!vs(n))return yield k(I.Uint8Array,e,r,n);if(Q(e.maxByteLength)&&!(n.length<=e.maxByteLength)){yield k(I.Uint8ArrayMaxByteLength,e,r,n)}if(Q(e.minByteLength)&&!(n.length>=e.minByteLength)){yield k(I.Uint8ArrayMinByteLength,e,r,n)}}function*eZ(e,t,r,n){}function*tZ(e,t,r,n){if(!ct.IsVoidLike(n))yield k(I.Void,e,r,n)}function*rZ(e,t,r,n){const o=nn.Get(e[w]);if(!o(e,n))yield k(I.Kind,e,r,n)}function*_t(e,t,r,n){const o=Q(e.$id)?[...t,e]:t;const i=e;switch(i[w]){case"Any":return yield*SK(i,o,r,n);case"Argument":return yield*TK(i,o,r,n);case"Array":return yield*PK(i,o,r,n);case"AsyncIterator":return yield*OK(i,o,r,n);case"BigInt":return yield*vK(i,o,r,n);case"Boolean":return yield*$K(i,o,r,n);case"Constructor":return yield*kK(i,o,r,n);case"Date":return yield*RK(i,o,r,n);case"Function":return yield*MK(i,o,r,n);case"Import":return yield*AK(i,o,r,n);case"Integer":return yield*EK(i,o,r,n);case"Intersect":return yield*zK(i,o,r,n);case"Iterator":return yield*CK(i,o,r,n);case"Literal":return yield*NK(i,o,r,n);case"Never":return yield*FK(i,o,r,n);case"Not":return yield*jK(i,o,r,n);case"Null":return yield*DK(i,o,r,n);case"Number":return yield*UK(i,o,r,n);case"Object":return yield*LK(i,o,r,n);case"Promise":return yield*qK(i,o,r,n);case"Record":return yield*KK(i,o,r,n);case"Ref":return yield*ZK(i,o,r,n);case"RegExp":return yield*BK(i,o,r,n);case"String":return yield*GK(i,o,r,n);case"Symbol":return yield*VK(i,o,r,n);case"TemplateLiteral":return yield*HK(i,o,r,n);case"This":return yield*WK(i,o,r,n);case"Tuple":return yield*JK(i,o,r,n);case"Undefined":return yield*XK(i,o,r,n);case"Union":return yield*YK(i,o,r,n);case"Uint8Array":return yield*QK(i,o,r,n);case"Unknown":return yield*eZ(i,o,r,n);case"Void":return yield*tZ(i,o,r,n);default:if(!nn.Has(i[w]))throw new Zh(e);return yield*rZ(i,o,r,n)}}function Ro(...e){const t=e.length===3?_t(e[0],e[1],"",e[2]):_t(e[0],[],"",e[1]);return new ko(t)}var nZ=function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r};var OO=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)};var Bh;var Wl;var vO;var Gh=class extends U{constructor(t){const r=t.First();super(r===void 0?"Invalid Value":r.message);Bh.add(this);Wl.set(this,void 0);nZ(this,Wl,t,"f");this.error=r}Errors(){return new ko(OO(this,Bh,"m",vO).call(this))}};Wl=new WeakMap,Bh=new WeakSet,vO=function*e(){if(this.error)yield this.error;yield*OO(this,Wl,"f")};function PO(e,t,r){if(B(e,t,r))return;throw new Gh(Ro(e,t,r))}function Jl(...e){return e.length===3?PO(e[0],e[1],e[2]):PO(e[0],[],e[1])}function oZ(e){const t={};for(const r of Object.getOwnPropertyNames(e)){t[r]=he(e[r])}for(const r of Object.getOwnPropertySymbols(e)){t[r]=he(e[r])}return t}function iZ(e){return e.map(t=>he(t))}function sZ(e){return e.slice()}function aZ(e){return new Map(he([...e.entries()]))}function cZ(e){return new Set(he([...e.entries()]))}function uZ(e){return new Date(e.toISOString())}function lZ(e){return e}function he(e){if(D(e))return iZ(e);if(Kt(e))return uZ(e);if(Ar(e))return sZ(e);if(c0(e))return aZ(e);if(u0(e))return cZ(e);if(q(e))return oZ(e);if(pr(e))return lZ(e);throw new Error("ValueClone: Unable to clone value")}var xr=class extends U{constructor(t,r){super(r);this.schema=t}};function ge(e){return _o(e)?e():he(e)}function dZ(e,t){if(j(e,"default")){return ge(e.default)}else{return{}}}function pZ(e,t){return{}}function fZ(e,t){if(e.uniqueItems===true&&!j(e,"default")){throw new xr(e,"Array with the uniqueItems constraint requires a default value")}else if("contains"in e&&!j(e,"default")){throw new xr(e,"Array with the contains constraint requires a default value")}else if("default"in e){return ge(e.default)}else if(e.minItems!==void 0){return Array.from({length:e.minItems}).map(r=>{return br(e.items,t)})}else{return[]}}function mZ(e,t){if(j(e,"default")){return ge(e.default)}else{return(async function*(){})()}}function hZ(e,t){if(j(e,"default")){return ge(e.default)}else{return BigInt(0)}}function gZ(e,t){if(j(e,"default")){return ge(e.default)}else{return false}}function yZ(e,t){if(j(e,"default")){return ge(e.default)}else{const r=br(e.returns,t);if(typeof r==="object"&&!Array.isArray(r)){return class{constructor(){for(const[n,o]of Object.entries(r)){const i=this;i[n]=o}}}}else{return class{}}}}function _Z(e,t){if(j(e,"default")){return ge(e.default)}else if(e.minimumTimestamp!==void 0){return new Date(e.minimumTimestamp)}else{return new Date}}function xZ(e,t){if(j(e,"default")){return ge(e.default)}else{return()=>br(e.returns,t)}}function bZ(e,t){const r=globalThis.Object.values(e.$defs);const n=e.$defs[e.$ref];return br(n,[...t,...r])}function IZ(e,t){if(j(e,"default")){return ge(e.default)}else if(e.minimum!==void 0){return e.minimum}else{return 0}}function wZ(e,t){if(j(e,"default")){return ge(e.default)}else{const r=e.allOf.reduce((n,o)=>{const i=br(o,t);return typeof i==="object"?{...n,...i}:i},{});if(!B(e,t,r))throw new xr(e,"Intersect produced invalid value. Consider using a default value.");return r}}function SZ(e,t){if(j(e,"default")){return ge(e.default)}else{return(function*(){})()}}function TZ(e,t){if(j(e,"default")){return ge(e.default)}else{return e.const}}function PZ(e,t){if(j(e,"default")){return ge(e.default)}else{throw new xr(e,"Never types cannot be created. Consider using a default value.")}}function OZ(e,t){if(j(e,"default")){return ge(e.default)}else{throw new xr(e,"Not types must have a default value")}}function vZ(e,t){if(j(e,"default")){return ge(e.default)}else{return null}}function $Z(e,t){if(j(e,"default")){return ge(e.default)}else if(e.minimum!==void 0){return e.minimum}else{return 0}}function kZ(e,t){if(j(e,"default")){return ge(e.default)}else{const r=new Set(e.required);const n={};for(const[o,i]of Object.entries(e.properties)){if(!r.has(o))continue;n[o]=br(i,t)}return n}}function RZ(e,t){if(j(e,"default")){return ge(e.default)}else{return Promise.resolve(br(e.item,t))}}function MZ(e,t){if(j(e,"default")){return ge(e.default)}else{return{}}}function AZ(e,t){if(j(e,"default")){return ge(e.default)}else{return br(we(e,t),t)}}function EZ(e,t){if(j(e,"default")){return ge(e.default)}else{throw new xr(e,"RegExp types cannot be created. Consider using a default value.")}}function zZ(e,t){if(e.pattern!==void 0){if(!j(e,"default")){throw new xr(e,"String types with patterns must specify a default value")}else{return ge(e.default)}}else if(e.format!==void 0){if(!j(e,"default")){throw new xr(e,"String types with formats must specify a default value")}else{return ge(e.default)}}else{if(j(e,"default")){return ge(e.default)}else if(e.minLength!==void 0){return Array.from({length:e.minLength}).map(()=>" ").join("")}else{return""}}}function CZ(e,t){if(j(e,"default")){return ge(e.default)}else if("value"in e){return Symbol.for(e.value)}else{return Symbol()}}function NZ(e,t){if(j(e,"default")){return ge(e.default)}if(!Ml(e))throw new xr(e,"Can only create template literals that produce a finite variants. Consider using a default value.");const r=Ns(e);return r[0]}function FZ(e,t){if($O++>BZ)throw new xr(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");if(j(e,"default")){return ge(e.default)}else{return br(we(e,t),t)}}function jZ(e,t){if(j(e,"default")){return ge(e.default)}if(e.items===void 0){return[]}else{return Array.from({length:e.minItems}).map((r,n)=>br(e.items[n],t))}}function DZ(e,t){if(j(e,"default")){return ge(e.default)}else{return void 0}}function UZ(e,t){if(j(e,"default")){return ge(e.default)}else if(e.anyOf.length===0){throw new Error("ValueCreate.Union: Cannot create Union with zero variants")}else{return br(e.anyOf[0],t)}}function LZ(e,t){if(j(e,"default")){return ge(e.default)}else if(e.minByteLength!==void 0){return new Uint8Array(e.minByteLength)}else{return new Uint8Array(0)}}function qZ(e,t){if(j(e,"default")){return ge(e.default)}else{return{}}}function KZ(e,t){if(j(e,"default")){return ge(e.default)}else{return void 0}}function ZZ(e,t){if(j(e,"default")){return ge(e.default)}else{throw new Error("User defined types must specify a default value")}}function br(e,t){const r=gt(e,t);const n=e;switch(n[w]){case"Any":return dZ(n,r);case"Argument":return pZ(n,r);case"Array":return fZ(n,r);case"AsyncIterator":return mZ(n,r);case"BigInt":return hZ(n,r);case"Boolean":return gZ(n,r);case"Constructor":return yZ(n,r);case"Date":return _Z(n,r);case"Function":return xZ(n,r);case"Import":return bZ(n,r);case"Integer":return IZ(n,r);case"Intersect":return wZ(n,r);case"Iterator":return SZ(n,r);case"Literal":return TZ(n,r);case"Never":return PZ(n,r);case"Not":return OZ(n,r);case"Null":return vZ(n,r);case"Number":return $Z(n,r);case"Object":return kZ(n,r);case"Promise":return RZ(n,r);case"Record":return MZ(n,r);case"Ref":return AZ(n,r);case"RegExp":return EZ(n,r);case"String":return zZ(n,r);case"Symbol":return CZ(n,r);case"TemplateLiteral":return NZ(n,r);case"This":return FZ(n,r);case"Tuple":return jZ(n,r);case"Undefined":return DZ(n,r);case"Union":return UZ(n,r);case"Uint8Array":return LZ(n,r);case"Unknown":return qZ(n,r);case"Void":return KZ(n,r);default:if(!nn.Has(n[w]))throw new xr(n,"Unknown type");return ZZ(n,r)}}var BZ=512;var $O=0;function cn(...e){$O=0;return e.length===2?br(e[0],e[1]):br(e[0],[])}var Xl=class extends U{constructor(t,r){super(r);this.schema=t}};function kO(e,t,r){if(e[w]==="Object"&&typeof r==="object"&&!Kn(r)){const n=e;const o=Object.getOwnPropertyNames(r);const i=Object.entries(n.properties);return i.reduce((s,[a,c])=>{const l=c[w]==="Literal"&&c.const===r[a]?100:0;const u=B(c,t,r[a])?10:0;const d=o.includes(a)?1:0;return s+(l+u+d)},0)}else if(e[w]==="Union"){const n=e.anyOf.map(i=>we(i,t));const o=n.map(i=>kO(i,t,r));return Math.max(...o)}else{return B(e,t,r)?1:0}}function GZ(e,t,r){const n=e.anyOf.map(s=>we(s,t));let[o,i]=[n[0],0];for(const s of n){const a=kO(s,t,r);if(a>i){o=s;i=a}}return o}function VZ(e,t,r){if("default"in e){return typeof r==="function"?e.default:he(e.default)}else{const n=GZ(e,t,r);return bc(n,t,r)}}function HZ(e,t,r){return B(e,t,r)?he(r):cn(e,t)}function WZ(e,t,r){return B(e,t,r)?r:cn(e,t)}function JZ(e,t,r){if(B(e,t,r))return he(r);const n=D(r)?he(r):cn(e,t);const o=qe(e.minItems)&&n.length<e.minItems?[...n,...Array.from({length:e.minItems-n.length},()=>null)]:n;const i=qe(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o;const s=i.map(c=>un(e.items,t,c));if(e.uniqueItems!==true)return s;const a=[...new Set(s)];if(!B(e,t,a))throw new Xl(e,"Array cast produced invalid data due to uniqueItems constraint");return a}function XZ(e,t,r){if(B(e,t,r))return cn(e,t);const n=new Set(e.returns.required||[]);const o=function(){};for(const[i,s]of Object.entries(e.returns.properties)){if(!n.has(i)&&r.prototype[i]===void 0)continue;o.prototype[i]=un(s,t,r.prototype[i])}return o}function YZ(e,t,r){const n=globalThis.Object.values(e.$defs);const o=e.$defs[e.$ref];return un(o,[...t,...n],r)}function RO(e,t){if(q(e)&&!q(t)||!q(e)&&q(t))return e;if(!q(e)||!q(t))return t;return globalThis.Object.getOwnPropertyNames(e).reduce((r,n)=>{const o=n in t?RO(e[n],t[n]):e[n];return{...r,[n]:o}},{})}function QZ(e,t,r){if(B(e,t,r))return r;const n=cn(e,t);const o=RO(n,r);return B(e,t,o)?o:n}function e4(e,t,r){throw new Xl(e,"Never types cannot be cast")}function t4(e,t,r){if(B(e,t,r))return r;if(r===null||typeof r!=="object")return cn(e,t);const n=new Set(e.required||[]);const o={};for(const[i,s]of Object.entries(e.properties)){if(!n.has(i)&&r[i]===void 0)continue;o[i]=un(s,t,r[i])}if(typeof e.additionalProperties==="object"){const i=Object.getOwnPropertyNames(e.properties);for(const s of Object.getOwnPropertyNames(r)){if(i.includes(s))continue;o[s]=un(e.additionalProperties,t,r[s])}}return o}function r4(e,t,r){if(B(e,t,r))return he(r);if(r===null||typeof r!=="object"||Array.isArray(r)||r instanceof Date)return cn(e,t);const n=Object.getOwnPropertyNames(e.patternProperties)[0];const o=e.patternProperties[n];const i={};for(const[s,a]of Object.entries(r)){i[s]=un(o,t,a)}return i}function n4(e,t,r){return un(we(e,t),t,r)}function o4(e,t,r){return un(we(e,t),t,r)}function i4(e,t,r){if(B(e,t,r))return he(r);if(!D(r))return cn(e,t);if(e.items===void 0)return[];return e.items.map((n,o)=>un(n,t,r[o]))}function s4(e,t,r){return B(e,t,r)?he(r):VZ(e,t,r)}function un(e,t,r){const n=Se(e.$id)?gt(e,t):t;const o=e;switch(e[w]){case"Array":return JZ(o,n,r);case"Constructor":return XZ(o,n,r);case"Import":return YZ(o,n,r);case"Intersect":return QZ(o,n,r);case"Never":return e4(o,n,r);case"Object":return t4(o,n,r);case"Record":return r4(o,n,r);case"Ref":return n4(o,n,r);case"This":return o4(o,n,r);case"Tuple":return i4(o,n,r);case"Union":return s4(o,n,r);case"Date":case"Symbol":case"Uint8Array":return HZ(e,t,r);default:return WZ(o,n,r)}}function bc(...e){return e.length===3?un(e[0],e[1],e[2]):un(e[0],[],e[1])}function a4(e){return bo(e)&&e[w]!=="Unsafe"}function c4(e,t,r){if(!D(r))return r;return r.map(n=>sr(e.items,t,n))}function u4(e,t,r){const n=globalThis.Object.values(e.$defs);const o=e.$defs[e.$ref];return sr(o,[...t,...n],r)}function l4(e,t,r){const n=e.unevaluatedProperties;const o=e.allOf.map(a=>sr(a,t,he(r)));const i=o.reduce((a,c)=>q(c)?{...a,...c}:c,{});if(!q(r)||!q(i)||!bo(n))return i;const s=or(e);for(const a of Object.getOwnPropertyNames(r)){if(s.includes(a))continue;if(B(n,t,r[a])){i[a]=sr(n,t,r[a])}}return i}function d4(e,t,r){if(!q(r)||D(r))return r;const n=e.additionalProperties;for(const o of Object.getOwnPropertyNames(r)){if(j(e.properties,o)){r[o]=sr(e.properties[o],t,r[o]);continue}if(bo(n)&&B(n,t,r[o])){r[o]=sr(n,t,r[o]);continue}delete r[o]}return r}function p4(e,t,r){if(!q(r))return r;const n=e.additionalProperties;const o=Object.getOwnPropertyNames(r);const[i,s]=Object.entries(e.patternProperties)[0];const a=new RegExp(i);for(const c of o){if(a.test(c)){r[c]=sr(s,t,r[c]);continue}if(bo(n)&&B(n,t,r[c])){r[c]=sr(n,t,r[c]);continue}delete r[c]}return r}function f4(e,t,r){return sr(we(e,t),t,r)}function m4(e,t,r){return sr(we(e,t),t,r)}function h4(e,t,r){if(!D(r))return r;if(Le(e.items))return[];const n=Math.min(r.length,e.items.length);for(let o=0;o<n;o++){r[o]=sr(e.items[o],t,r[o])}return r.length>n?r.slice(0,n):r}function g4(e,t,r){for(const n of e.anyOf){if(a4(n)&&B(n,t,r)){return sr(n,t,r)}}return r}function sr(e,t,r){const n=Se(e.$id)?gt(e,t):t;const o=e;switch(o[w]){case"Array":return c4(o,n,r);case"Import":return u4(o,n,r);case"Intersect":return l4(o,n,r);case"Object":return d4(o,n,r);case"Record":return p4(o,n,r);case"Ref":return f4(o,n,r);case"This":return m4(o,n,r);case"Tuple":return h4(o,n,r);case"Union":return g4(o,n,r);default:return r}}function Yl(...e){return e.length===3?sr(e[0],e[1],e[2]):sr(e[0],[],e[1])}function Ql(e){return Se(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function y4(e){return Wr(e)||Pn(e)||qe(e)}function Ic(e){return e===true||qe(e)&&e===1||Wr(e)&&e===BigInt("1")||Se(e)&&(e.toLowerCase()==="true"||e==="1")}function wc(e){return e===false||qe(e)&&(e===0||Object.is(e,-0))||Wr(e)&&e===BigInt("0")||Se(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function _4(e){return Se(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function x4(e){return Se(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function b4(e){return Se(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function I4(e){return Se(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function w4(e){return Se(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function S4(e,t){const r=AO(e);return r===t?r:e}function T4(e,t){const r=EO(e);return r===t?r:e}function P4(e,t){const r=MO(e);return r===t?r:e}function O4(e,t){return Se(e.const)?S4(t,e.const):qe(e.const)?T4(t,e.const):Pn(e.const)?P4(t,e.const):t}function MO(e){return Ic(e)?true:wc(e)?false:e}function v4(e){const t=r=>r.split(".")[0];return Ql(e)?BigInt(t(e)):qe(e)?BigInt(Math.trunc(e)):wc(e)?BigInt(0):Ic(e)?BigInt(1):e}function AO(e){return Zn(e)&&e.description!==void 0?e.description.toString():y4(e)?e.toString():e}function EO(e){return Ql(e)?parseFloat(e):Ic(e)?1:wc(e)?0:e}function $4(e){return Ql(e)?parseInt(e):qe(e)?Math.trunc(e):Ic(e)?1:wc(e)?0:e}function k4(e){return Se(e)&&e.toLowerCase()==="null"?null:e}function R4(e){return Se(e)&&e==="undefined"?void 0:e}function M4(e){return Kt(e)?e:qe(e)?new Date(e):Ic(e)?new Date(1):wc(e)?new Date(0):Ql(e)?new Date(parseInt(e)):x4(e)?new Date(`1970-01-01T${e}.000Z`):_4(e)?new Date(`1970-01-01T${e}`):I4(e)?new Date(`${e}.000Z`):b4(e)?new Date(e):w4(e)?new Date(`${e}T00:00:00.000Z`):e}function A4(e){return e}function E4(e,t,r){const n=D(r)?r:[r];return n.map(o=>ln(e.items,t,o))}function z4(e,t,r){return v4(r)}function C4(e,t,r){return MO(r)}function N4(e,t,r){return M4(r)}function F4(e,t,r){const n=globalThis.Object.values(e.$defs);const o=e.$defs[e.$ref];return ln(o,[...t,...n],r)}function j4(e,t,r){return $4(r)}function D4(e,t,r){return e.allOf.reduce((n,o)=>ln(o,t,n),r)}function U4(e,t,r){return O4(e,r)}function L4(e,t,r){return k4(r)}function q4(e,t,r){return EO(r)}function K4(e,t,r){if(!q(r)||D(r))return r;for(const n of Object.getOwnPropertyNames(e.properties)){if(!j(r,n))continue;r[n]=ln(e.properties[n],t,r[n])}return r}function Z4(e,t,r){const n=q(r)&&!D(r);if(!n)return r;const o=Object.getOwnPropertyNames(e.patternProperties)[0];const i=e.patternProperties[o];for(const[s,a]of Object.entries(r)){r[s]=ln(i,t,a)}return r}function B4(e,t,r){return ln(we(e,t),t,r)}function G4(e,t,r){return AO(r)}function V4(e,t,r){return Se(r)||qe(r)?Symbol(r):r}function H4(e,t,r){return ln(we(e,t),t,r)}function W4(e,t,r){const n=D(r)&&!Le(e.items);if(!n)return r;return r.map((o,i)=>{return i<e.items.length?ln(e.items[i],t,o):o})}function J4(e,t,r){return R4(r)}function X4(e,t,r){for(const n of e.anyOf){if(B(n,t,r)){return r}}for(const n of e.anyOf){const o=ln(n,t,he(r));if(!B(n,t,o))continue;return o}return r}function ln(e,t,r){const n=gt(e,t);const o=e;switch(e[w]){case"Array":return E4(o,n,r);case"BigInt":return z4(o,n,r);case"Boolean":return C4(o,n,r);case"Date":return N4(o,n,r);case"Import":return F4(o,n,r);case"Integer":return j4(o,n,r);case"Intersect":return D4(o,n,r);case"Literal":return U4(o,n,r);case"Null":return L4(o,n,r);case"Number":return q4(o,n,r);case"Object":return K4(o,n,r);case"Record":return Z4(o,n,r);case"Ref":return B4(o,n,r);case"String":return G4(o,n,r);case"Symbol":return V4(o,n,r);case"This":return H4(o,n,r);case"Tuple":return W4(o,n,r);case"Undefined":return J4(o,n,r);case"Union":return X4(o,n,r);default:return A4(r)}}function ed(...e){return e.length===3?ln(e[0],e[1],e[2]):ln(e[0],[],e[1])}var td=class extends U{constructor(t,r,n){super(`Unable to decode value as it does not match the expected schema`);this.schema=t;this.value=r;this.error=n}};var Vh=class extends U{constructor(t,r,n,o){super(o instanceof Error?o.message:"Unknown error");this.schema=t;this.path=r;this.value=n;this.error=o}};function We(e,t,r){try{return xe(e)?e[Ve].Decode(r):r}catch(n){throw new Vh(e,t,r,n)}}function Y4(e,t,r,n){return D(n)?We(e,r,n.map((o,i)=>dn(e.items,t,`${r}/${i}`,o))):We(e,r,n)}function Q4(e,t,r,n){if(!q(n)||pr(n))return We(e,r,n);const o=Nl(e);const i=o.map(u=>u[0]);const s={...n};for(const[u,d]of o)if(u in s){s[u]=dn(d,t,`${r}/${u}`,s[u])}if(!xe(e.unevaluatedProperties)){return We(e,r,s)}const a=Object.getOwnPropertyNames(s);const c=e.unevaluatedProperties;const l={...s};for(const u of a)if(!i.includes(u)){l[u]=We(c,`${r}/${u}`,l[u])}return We(e,r,l)}function eB(e,t,r,n){const o=globalThis.Object.values(e.$defs);const i=e.$defs[e.$ref];const s=dn(i,[...t,...o],r,n);return We(e,r,s)}function tB(e,t,r,n){return We(e,r,dn(e.not,t,r,n))}function rB(e,t,r,n){if(!q(n))return We(e,r,n);const o=or(e);const i={...n};for(const l of o){if(!j(i,l))continue;if(Le(i[l])&&(!Vn(e.properties[l])||ct.IsExactOptionalProperty(i,l)))continue;i[l]=dn(e.properties[l],t,`${r}/${l}`,i[l])}if(!He(e.additionalProperties)){return We(e,r,i)}const s=Object.getOwnPropertyNames(i);const a=e.additionalProperties;const c={...i};for(const l of s)if(!o.includes(l)){c[l]=We(a,`${r}/${l}`,c[l])}return We(e,r,c)}function nB(e,t,r,n){if(!q(n))return We(e,r,n);const o=Object.getOwnPropertyNames(e.patternProperties)[0];const i=new RegExp(o);const s={...n};for(const u of Object.getOwnPropertyNames(n))if(i.test(u)){s[u]=dn(e.patternProperties[o],t,`${r}/${u}`,s[u])}if(!He(e.additionalProperties)){return We(e,r,s)}const a=Object.getOwnPropertyNames(s);const c=e.additionalProperties;const l={...s};for(const u of a)if(!i.test(u)){l[u]=We(c,`${r}/${u}`,l[u])}return We(e,r,l)}function oB(e,t,r,n){const o=we(e,t);return We(e,r,dn(o,t,r,n))}function iB(e,t,r,n){const o=we(e,t);return We(e,r,dn(o,t,r,n))}function sB(e,t,r,n){return D(n)&&D(e.items)?We(e,r,e.items.map((o,i)=>dn(o,t,`${r}/${i}`,n[i]))):We(e,r,n)}function aB(e,t,r,n){for(const o of e.anyOf){if(!B(o,t,n))continue;const i=dn(o,t,r,n);return We(e,r,i)}return We(e,r,n)}function dn(e,t,r,n){const o=gt(e,t);const i=e;switch(e[w]){case"Array":return Y4(i,o,r,n);case"Import":return eB(i,o,r,n);case"Intersect":return Q4(i,o,r,n);case"Not":return tB(i,o,r,n);case"Object":return rB(i,o,r,n);case"Record":return nB(i,o,r,n);case"Ref":return oB(i,o,r,n);case"Symbol":return We(i,r,n);case"This":return iB(i,o,r,n);case"Tuple":return sB(i,o,r,n);case"Union":return aB(i,o,r,n);default:return We(i,r,n)}}function rd(e,t,r){return dn(e,t,"",r)}var nd=class extends U{constructor(t,r,n){super(`The encoded value does not match the expected schema`);this.schema=t;this.value=r;this.error=n}};var Hh=class extends U{constructor(t,r,n,o){super(`${o instanceof Error?o.message:"Unknown error"}`);this.schema=t;this.path=r;this.value=n;this.error=o}};function vt(e,t,r){try{return xe(e)?e[Ve].Encode(r):r}catch(n){throw new Hh(e,t,r,n)}}function cB(e,t,r,n){const o=vt(e,r,n);return D(o)?o.map((i,s)=>pn(e.items,t,`${r}/${s}`,i)):o}function uB(e,t,r,n){const o=globalThis.Object.values(e.$defs);const i=e.$defs[e.$ref];const s=vt(e,r,n);return pn(i,[...t,...o],r,s)}function lB(e,t,r,n){const o=vt(e,r,n);if(!q(n)||pr(n))return o;const i=Nl(e);const s=i.map(d=>d[0]);const a={...o};for(const[d,h]of i)if(d in a){a[d]=pn(h,t,`${r}/${d}`,a[d])}if(!xe(e.unevaluatedProperties)){return a}const c=Object.getOwnPropertyNames(a);const l=e.unevaluatedProperties;const u={...a};for(const d of c)if(!s.includes(d)){u[d]=vt(l,`${r}/${d}`,u[d])}return u}function dB(e,t,r,n){return vt(e.not,r,vt(e,r,n))}function pB(e,t,r,n){const o=vt(e,r,n);if(!q(o))return o;const i=or(e);const s={...o};for(const u of i){if(!j(s,u))continue;if(Le(s[u])&&(!Vn(e.properties[u])||ct.IsExactOptionalProperty(s,u)))continue;s[u]=pn(e.properties[u],t,`${r}/${u}`,s[u])}if(!He(e.additionalProperties)){return s}const a=Object.getOwnPropertyNames(s);const c=e.additionalProperties;const l={...s};for(const u of a)if(!i.includes(u)){l[u]=vt(c,`${r}/${u}`,l[u])}return l}function fB(e,t,r,n){const o=vt(e,r,n);if(!q(n))return o;const i=Object.getOwnPropertyNames(e.patternProperties)[0];const s=new RegExp(i);const a={...o};for(const d of Object.getOwnPropertyNames(n))if(s.test(d)){a[d]=pn(e.patternProperties[i],t,`${r}/${d}`,a[d])}if(!He(e.additionalProperties)){return a}const c=Object.getOwnPropertyNames(a);const l=e.additionalProperties;const u={...a};for(const d of c)if(!s.test(d)){u[d]=vt(l,`${r}/${d}`,u[d])}return u}function mB(e,t,r,n){const o=we(e,t);const i=pn(o,t,r,n);return vt(e,r,i)}function hB(e,t,r,n){const o=we(e,t);const i=pn(o,t,r,n);return vt(e,r,i)}function gB(e,t,r,n){const o=vt(e,r,n);return D(e.items)?e.items.map((i,s)=>pn(i,t,`${r}/${s}`,o[s])):[]}function yB(e,t,r,n){for(const o of e.anyOf){if(!B(o,t,n))continue;const i=pn(o,t,r,n);return vt(e,r,i)}for(const o of e.anyOf){const i=pn(o,t,r,n);if(!B(e,t,i))continue;return vt(e,r,i)}return vt(e,r,n)}function pn(e,t,r,n){const o=gt(e,t);const i=e;switch(e[w]){case"Array":return cB(i,o,r,n);case"Import":return uB(i,o,r,n);case"Intersect":return lB(i,o,r,n);case"Not":return dB(i,o,r,n);case"Object":return pB(i,o,r,n);case"Record":return fB(i,o,r,n);case"Ref":return mB(i,o,r,n);case"This":return hB(i,o,r,n);case"Tuple":return gB(i,o,r,n);case"Union":return yB(i,o,r,n);default:return vt(i,r,n)}}function od(e,t,r){return pn(e,t,"",r)}function _B(e,t){return xe(e)||pt(e.items,t)}function xB(e,t){return xe(e)||pt(e.items,t)}function bB(e,t){return xe(e)||pt(e.returns,t)||e.parameters.some(r=>pt(r,t))}function IB(e,t){return xe(e)||pt(e.returns,t)||e.parameters.some(r=>pt(r,t))}function wB(e,t){return xe(e)||xe(e.unevaluatedProperties)||e.allOf.some(r=>pt(r,t))}function SB(e,t){const r=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,i)=>[...o,e.$defs[i]],[]);const n=e.$defs[e.$ref];return xe(e)||pt(n,[...r,...t])}function TB(e,t){return xe(e)||pt(e.items,t)}function PB(e,t){return xe(e)||pt(e.not,t)}function OB(e,t){return xe(e)||Object.values(e.properties).some(r=>pt(r,t))||He(e.additionalProperties)&&pt(e.additionalProperties,t)}function vB(e,t){return xe(e)||pt(e.item,t)}function $B(e,t){const r=Object.getOwnPropertyNames(e.patternProperties)[0];const n=e.patternProperties[r];return xe(e)||pt(n,t)||He(e.additionalProperties)&&xe(e.additionalProperties)}function kB(e,t){if(xe(e))return true;return pt(we(e,t),t)}function RB(e,t){if(xe(e))return true;return pt(we(e,t),t)}function MB(e,t){return xe(e)||!Le(e.items)&&e.items.some(r=>pt(r,t))}function AB(e,t){return xe(e)||e.anyOf.some(r=>pt(r,t))}function pt(e,t){const r=gt(e,t);const n=e;if(e.$id&&Wh.has(e.$id))return false;if(e.$id)Wh.add(e.$id);switch(e[w]){case"Array":return _B(n,r);case"AsyncIterator":return xB(n,r);case"Constructor":return bB(n,r);case"Function":return IB(n,r);case"Import":return SB(n,r);case"Intersect":return wB(n,r);case"Iterator":return TB(n,r);case"Not":return PB(n,r);case"Object":return OB(n,r);case"Promise":return vB(n,r);case"Record":return $B(n,r);case"Ref":return kB(n,r);case"This":return RB(n,r);case"Tuple":return MB(n,r);case"Union":return AB(n,r);default:return xe(e)}}var Wh=new Set;function Si(e,t){Wh.clear();return pt(e,t)}function zO(...e){const[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!B(t,r,n))throw new td(t,n,Ro(t,r,n).First());return Si(t,r)?rd(t,r,n):n}function Xn(e,t){const r=j(e,"default")?e.default:void 0;const n=_o(r)?r():he(r);return Le(t)?n:q(t)&&q(n)?Object.assign(n,t):t}function Jh(e){return bo(e)&&"default"in e}function EB(e,t,r){if(D(r)){for(let o=0;o<r.length;o++){r[o]=Bt(e.items,t,r[o])}return r}const n=Xn(e,r);if(!D(n))return n;for(let o=0;o<n.length;o++){n[o]=Bt(e.items,t,n[o])}return n}function zB(e,t,r){return Kt(r)?r:Xn(e,r)}function CB(e,t,r){const n=globalThis.Object.values(e.$defs);const o=e.$defs[e.$ref];return Bt(o,[...t,...n],r)}function NB(e,t,r){const n=Xn(e,r);return e.allOf.reduce((o,i)=>{const s=Bt(i,t,n);return q(s)?{...o,...s}:s},{})}function FB(e,t,r){const n=Xn(e,r);if(!q(n))return n;const o=Object.getOwnPropertyNames(e.properties);for(const i of o){const s=Bt(e.properties[i],t,n[i]);if(Le(s))continue;n[i]=Bt(e.properties[i],t,n[i])}if(!Jh(e.additionalProperties))return n;for(const i of Object.getOwnPropertyNames(n)){if(o.includes(i))continue;n[i]=Bt(e.additionalProperties,t,n[i])}return n}function jB(e,t,r){const n=Xn(e,r);if(!q(n))return n;const o=e.additionalProperties;const[i,s]=Object.entries(e.patternProperties)[0];const a=new RegExp(i);for(const c of Object.getOwnPropertyNames(n)){if(!(a.test(c)&&Jh(s)))continue;n[c]=Bt(s,t,n[c])}if(!Jh(o))return n;for(const c of Object.getOwnPropertyNames(n)){if(a.test(c))continue;n[c]=Bt(o,t,n[c])}return n}function DB(e,t,r){return Bt(we(e,t),t,Xn(e,r))}function UB(e,t,r){return Bt(we(e,t),t,r)}function LB(e,t,r){const n=Xn(e,r);if(!D(n)||Le(e.items))return n;const[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let s=0;s<i;s++){if(s<o.length)n[s]=Bt(o[s],t,n[s])}return n}function qB(e,t,r){const n=Xn(e,r);for(const o of e.anyOf){const i=Bt(o,t,he(n));if(B(o,t,i)){return i}}return n}function Bt(e,t,r){const n=gt(e,t);const o=e;switch(o[w]){case"Array":return EB(o,n,r);case"Date":return zB(o,n,r);case"Import":return CB(o,n,r);case"Intersect":return NB(o,n,r);case"Object":return FB(o,n,r);case"Record":return jB(o,n,r);case"Ref":return DB(o,n,r);case"This":return UB(o,n,r);case"Tuple":return LB(o,n,r);case"Union":return qB(o,n,r);default:return Xn(o,r)}}function id(...e){return e.length===3?Bt(e[0],e[1],e[2]):Bt(e[0],[],e[1])}var fn={};_n(fn,{Delete:()=>ZB,Format:()=>Sc,Get:()=>GB,Has:()=>BB,Set:()=>KB,ValuePointerRootDeleteError:()=>ad,ValuePointerRootSetError:()=>sd});var sd=class extends U{constructor(t,r,n){super("Cannot set root value");this.value=t;this.path=r;this.update=n}};var ad=class extends U{constructor(t,r){super("Cannot delete root value");this.value=t;this.path=r}};function CO(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*Sc(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;n<e.length;n++){const o=e.charAt(n);if(o==="/"){if(n===0){t=n+1}else{r=n;yield CO(e.slice(t,r));t=n+1}}else{r=n}}yield CO(e.slice(t))}function KB(e,t,r){if(t==="")throw new sd(e,t,r);let[n,o,i]=[null,e,""];for(const s of Sc(t)){if(o[s]===void 0)o[s]={};n=o;o=o[s];i=s}n[i]=r}function ZB(e,t){if(t==="")throw new ad(e,t);let[r,n,o]=[null,e,""];for(const i of Sc(t)){if(n[i]===void 0||n[i]===null)return;r=n;n=n[i];o=i}if(Array.isArray(r)){const i=parseInt(o);r.splice(i,1)}else{delete r[o]}}function BB(e,t){if(t==="")return true;let[r,n,o]=[null,e,""];for(const i of Sc(t)){if(n[i]===void 0)return false;r=n;n=n[i];o=i}return Object.getOwnPropertyNames(r).includes(o)}function GB(e,t){if(t==="")return e;let r=e;for(const n of Sc(t)){if(r[n]===void 0)return void 0;r=r[n]}return r}function VB(e,t){if(!q(t))return false;const r=[...Object.keys(e),...Object.getOwnPropertySymbols(e)];const n=[...Object.keys(t),...Object.getOwnPropertySymbols(t)];if(r.length!==n.length)return false;return r.every(o=>Ti(e[o],t[o]))}function HB(e,t){return Kt(t)&&e.getTime()===t.getTime()}function WB(e,t){if(!D(t)||e.length!==t.length)return false;return e.every((r,n)=>Ti(r,t[n]))}function JB(e,t){if(!Ar(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name)return false;return e.every((r,n)=>Ti(r,t[n]))}function XB(e,t){return e===t}function Ti(e,t){if(Kt(e))return HB(e,t);if(Ar(e))return JB(e,t);if(D(e))return WB(e,t);if(q(e))return VB(e,t);if(pr(e))return XB(e,t);throw new Error("ValueEquals: Unable to compare value")}var YB=Ie({type:ae("insert"),path:Zt(),value:on()});var QB=Ie({type:ae("update"),path:Zt(),value:on()});var eG=Ie({type:ae("delete"),path:Zt()});var FO=be([YB,QB,eG]);var cd=class extends U{constructor(t,r){super(r);this.value=t}};function ud(e,t){return{type:"update",path:e,value:t}}function jO(e,t){return{type:"insert",path:e,value:t}}function DO(e){return{type:"delete",path:e}}function NO(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new cd(e,"Cannot diff objects with symbols")}function*tG(e,t,r){NO(t);NO(r);if(!uh(r))return yield ud(e,r);const n=globalThis.Object.getOwnPropertyNames(t);const o=globalThis.Object.getOwnPropertyNames(r);for(const i of o){if(j(t,i))continue;yield jO(`${e}/${i}`,r[i])}for(const i of n){if(!j(r,i))continue;if(Ti(t,r))continue;yield*ld(`${e}/${i}`,t[i],r[i])}for(const i of n){if(j(r,i))continue;yield DO(`${e}/${i}`)}}function*rG(e,t,r){if(!D(r))return yield ud(e,r);for(let n=0;n<Math.min(t.length,r.length);n++){yield*ld(`${e}/${n}`,t[n],r[n])}for(let n=0;n<r.length;n++){if(n<t.length)continue;yield jO(`${e}/${n}`,r[n])}for(let n=t.length-1;n>=0;n--){if(n<r.length)continue;yield DO(`${e}/${n}`)}}function*nG(e,t,r){if(!Ar(r)||t.length!==r.length||globalThis.Object.getPrototypeOf(t).constructor.name!==globalThis.Object.getPrototypeOf(r).constructor.name)return yield ud(e,r);for(let n=0;n<Math.min(t.length,r.length);n++){yield*ld(`${e}/${n}`,t[n],r[n])}}function*oG(e,t,r){if(t===r)return;yield ud(e,r)}function*ld(e,t,r){if(uh(t))return yield*tG(e,t,r);if(D(t))return yield*rG(e,t,r);if(Ar(t))return yield*nG(e,t,r);if(pr(t))return yield*oG(e,t,r);throw new cd(t,"Unable to diff value")}function UO(e,t){return[...ld("",e,t)]}function iG(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function sG(e){return e.length===0}function LO(e,t){if(iG(t)){return he(t[0].value)}if(sG(t)){return he(e)}const r=he(e);for(const n of t){switch(n.type){case"insert":{fn.Set(r,n.path,n.value);break}case"update":{fn.Set(r,n.path,n.value);break}case"delete":{fn.Delete(r,n.path);break}}}return r}function qO(...e){const[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];const o=Si(t,r)?od(t,r,n):n;if(!B(t,r,o))throw new nd(t,o,Ro(t,r,o).First());return o}function dd(e){return q(e)&&!D(e)}var pd=class extends U{constructor(t){super(t)}};function aG(e,t,r,n){if(!dd(r)){fn.Set(e,t,he(n))}else{const o=Object.getOwnPropertyNames(r);const i=Object.getOwnPropertyNames(n);for(const s of o){if(!i.includes(s)){delete r[s]}}for(const s of i){if(!o.includes(s)){r[s]=null}}for(const s of i){Xh(e,`${t}/${s}`,r[s],n[s])}}}function cG(e,t,r,n){if(!D(r)){fn.Set(e,t,he(n))}else{for(let o=0;o<n.length;o++){Xh(e,`${t}/${o}`,r[o],n[o])}r.splice(n.length)}}function uG(e,t,r,n){if(Ar(r)&&r.length===n.length){for(let o=0;o<r.length;o++){r[o]=n[o]}}else{fn.Set(e,t,he(n))}}function lG(e,t,r,n){if(r===n)return;fn.Set(e,t,n)}function Xh(e,t,r,n){if(D(n))return cG(e,t,r,n);if(Ar(n))return uG(e,t,r,n);if(dd(n))return aG(e,t,r,n);if(pr(n))return lG(e,t,r,n)}function KO(e){return Ar(e)||pr(e)}function dG(e,t){return dd(e)&&D(t)||D(e)&&dd(t)}function ZO(e,t){if(KO(e)||KO(t))throw new pd("Only object and array types can be mutated at the root level");if(dG(e,t))throw new pd("Cannot assign due type mismatch of assignable values");Xh(e,"",e,t)}var fd=class extends U{constructor(t){super(t)}};var Yh;(function(e){const t=new Map([["Assert",(i,s,a)=>{Jl(i,s,a);return a}],["Cast",(i,s,a)=>bc(i,s,a)],["Clean",(i,s,a)=>Yl(i,s,a)],["Clone",(i,s,a)=>he(a)],["Convert",(i,s,a)=>ed(i,s,a)],["Decode",(i,s,a)=>Si(i,s)?rd(i,s,a):a],["Default",(i,s,a)=>id(i,s,a)],["Encode",(i,s,a)=>Si(i,s)?od(i,s,a):a]]);function r(i){t.delete(i)}e.Delete=r;function n(i,s){t.set(i,s)}e.Set=n;function o(i){return t.get(i)}e.Get=o})(Yh||(Yh={}));var BO=["Clone","Clean","Default","Convert","Assert","Decode"];function pG(e,t,r,n){return e.reduce((o,i)=>{const s=Yh.Get(i);if(Le(s))throw new fd(`Unable to find Parse operation '${i}'`);return s(t,r,o)},n)}function GO(...e){const[t,r,n,o]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?D(e[0])?[e[0],e[1],[],e[2]]:[BO,e[0],e[1],e[2]]:e.length===2?[BO,e[0],[],e[1]]:(()=>{throw new fd("Invalid Arguments")})();return pG(t,r,n,o)}var Pi={};_n(Pi,{Assert:()=>Jl,Cast:()=>bc,Check:()=>B,Clean:()=>Yl,Clone:()=>he,Convert:()=>ed,Create:()=>cn,Decode:()=>zO,Default:()=>id,Diff:()=>UO,Edit:()=>FO,Encode:()=>qO,Equal:()=>Ti,Errors:()=>Ro,Hash:()=>Js,Mutate:()=>ZO,Parse:()=>GO,Patch:()=>LO,ValueErrorIterator:()=>ko});var VO=new Map;function fG(e,t){return(r,n,o)=>{if(r.api!==e){throw new Error(`Mismatched api: ${r.api} expected ${e}`)}return t(r,n,o)}}function mG(e,t){return(r,n,o)=>{if(r.api!==e){throw new Error(`Mismatched api: ${r.api} expected ${e}`)}return t(r,n,o)}}function mn(e,t){VO.set(e.api,{provider:{api:e.api,stream:fG(e.api,e.stream),streamSimple:mG(e.api,e.streamSimple)},sourceId:t})}function HO(e){return VO.get(e)?.provider}var hd=null;var eg=null;var tg=null;var Qh=e=>import(e);var hG="node:fs";var gG="node:os";var yG="node:path";if(typeof process!=="undefined"&&(process.versions?.node||process.versions?.bun)){Qh(hG).then(e=>{hd=e.existsSync});Qh(gG).then(e=>{eg=e.homedir});Qh(yG).then(e=>{tg=e.join})}var md=null;function Ir(e){if(!process.versions?.bun)return void 0;if(typeof process==="undefined")return void 0;if(Object.keys(process.env).length>0)return void 0;if(md===null){md=new Map;try{const{readFileSync:t}=C$("node:fs");const r=t("/proc/self/environ","utf-8");for(const n of r.split("\0")){const o=n.indexOf("=");if(o>0){md.set(n.slice(0,o),n.slice(o+1))}}}catch{}}return md.get(e)}var Tc=null;function _G(){if(Tc===null){if(!hd||!eg||!tg){const t=typeof process!=="undefined"&&(process.versions?.node||process.versions?.bun);if(!t){Tc=false}return false}const e=process.env.GOOGLE_APPLICATION_CREDENTIALS||Ir("GOOGLE_APPLICATION_CREDENTIALS");if(e){Tc=hd(e)}else{Tc=hd(tg(eg(),".config","gcloud","application_default_credentials.json"))}}return Tc}function xG(e){if(e==="github-copilot"){return["COPILOT_GITHUB_TOKEN"]}if(e==="anthropic"){return["ANTHROPIC_OAUTH_TOKEN","ANTHROPIC_API_KEY"]}const t={"ant-ling":"ANT_LING_API_KEY",openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",nvidia:"NVIDIA_API_KEY",deepseek:"DEEPSEEK_API_KEY",google:"GEMINI_API_KEY","google-vertex":"GOOGLE_CLOUD_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY","vercel-ai-gateway":"AI_GATEWAY_API_KEY",zai:"ZAI_API_KEY","zai-coding-cn":"ZAI_CODING_CN_API_KEY",mistral:"MISTRAL_API_KEY",alran:"ALRAN_API_KEY","alran-cn":"ALRAN_CN_API_KEY",moonshotai:"MOONSHOT_API_KEY","moonshotai-cn":"MOONSHOT_API_KEY",huggingface:"HF_TOKEN",fireworks:"FIREWORKS_API_KEY",together:"TOGETHER_API_KEY",opencode:"OPENCODE_API_KEY","opencode-go":"OPENCODE_API_KEY","kimi-coding":"KIMI_API_KEY","cloudflare-workers-ai":"CLOUDFLARE_API_KEY","cloudflare-ai-gateway":"CLOUDFLARE_API_KEY",xiaomi:"XIAOMI_API_KEY","xiaomi-token-plan-cn":"XIAOMI_TOKEN_PLAN_CN_API_KEY","xiaomi-token-plan-ams":"XIAOMI_TOKEN_PLAN_AMS_API_KEY","xiaomi-token-plan-sgp":"XIAOMI_TOKEN_PLAN_SGP_API_KEY"};const r=t[e];return r?[r]:void 0}function bG(e){const t=xG(e);if(!t)return void 0;const r=t.filter(n=>!!process.env[n]||!!Ir(n));return r.length>0?r:void 0}function rg(e){const t=bG(e);if(t?.[0]){return process.env[t[0]]||Ir(t[0])}if(e==="google-vertex"){const r=_G();const n=!!(process.env.GOOGLE_CLOUD_PROJECT||process.env.GCLOUD_PROJECT||Ir("GOOGLE_CLOUD_PROJECT")||Ir("GCLOUD_PROJECT"));const o=!!(process.env.GOOGLE_CLOUD_LOCATION||Ir("GOOGLE_CLOUD_LOCATION"));if(r&&n&&o){return"<authenticated>"}}if(e==="amazon-bedrock"){if(process.env.AWS_PROFILE||process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY||process.env.AWS_BEARER_TOKEN_BEDROCK||process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI||process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI||process.env.AWS_WEB_IDENTITY_TOKEN_FILE||Ir("AWS_PROFILE")||Ir("AWS_ACCESS_KEY_ID")&&Ir("AWS_SECRET_ACCESS_KEY")||Ir("AWS_BEARER_TOKEN_BEDROCK")||Ir("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI")||Ir("AWS_CONTAINER_CREDENTIALS_FULL_URI")||Ir("AWS_WEB_IDENTITY_TOKEN_FILE")){return"<authenticated>"}}return void 0}var WO={openrouter:{"black-forest-labs/flux.2-flex":{id:"black-forest-labs/flux.2-flex",name:"Black Forest Labs: FLUX.2 Flex",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-klein-4b":{id:"black-forest-labs/flux.2-klein-4b",name:"Black Forest Labs: FLUX.2 Klein 4B",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-max":{id:"black-forest-labs/flux.2-max",name:"Black Forest Labs: FLUX.2 Max",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-pro":{id:"black-forest-labs/flux.2-pro",name:"Black Forest Labs: FLUX.2 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"bytedance-seed/seedream-4.5":{id:"bytedance-seed/seedream-4.5",name:"ByteDance Seed: Seedream 4.5",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"google/gemini-2.5-flash-image":{id:"google/gemini-2.5-flash-image",name:"Google: Nano Banana (Gemini 2.5 Flash Image)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.08333333333333334}},"google/gemini-3-pro-image-preview":{id:"google/gemini-3-pro-image-preview",name:"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375}},"google/gemini-3.1-flash-image-preview":{id:"google/gemini-3.1-flash-image-preview",name:"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:.5,output:3,cacheRead:0,cacheWrite:0}},"microsoft/mai-image-2.5":{id:"microsoft/mai-image-2.5",name:"Microsoft: MAI-Image-2.5",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:5,output:0,cacheRead:0,cacheWrite:0}},"openai/gpt-5-image":{id:"openai/gpt-5-image",name:"OpenAI: GPT-5 Image",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:10,output:10,cacheRead:1.25,cacheWrite:0}},"openai/gpt-5-image-mini":{id:"openai/gpt-5-image-mini",name:"OpenAI: GPT-5 Image Mini",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:2.5,output:2,cacheRead:.25,cacheWrite:0}},"openai/gpt-5.4-image-2":{id:"openai/gpt-5.4-image-2",name:"OpenAI: GPT-5.4 Image 2",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:8,output:15,cacheRead:2,cacheWrite:0}},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0}},"recraft/recraft-v3":{id:"recraft/recraft-v3",name:"Recraft: Recraft V3",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4":{id:"recraft/recraft-v4",name:"Recraft: Recraft V4",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-pro":{id:"recraft/recraft-v4-pro",name:"Recraft: Recraft V4 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-pro-vector":{id:"recraft/recraft-v4-pro-vector",name:"Recraft: Recraft V4 Pro Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-vector":{id:"recraft/recraft-v4-vector",name:"Recraft: Recraft V4 Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1":{id:"recraft/recraft-v4.1",name:"Recraft: Recraft V4.1",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-pro":{id:"recraft/recraft-v4.1-pro",name:"Recraft: Recraft V4.1 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-pro-vector":{id:"recraft/recraft-v4.1-pro-vector",name:"Recraft: Recraft V4.1 Pro Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-utility":{id:"recraft/recraft-v4.1-utility",name:"Recraft: Recraft V4.1 Utility",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-utility-pro":{id:"recraft/recraft-v4.1-utility-pro",name:"Recraft: Recraft V4.1 Utility Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-vector":{id:"recraft/recraft-v4.1-vector",name:"Recraft: Recraft V4.1 Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-fast":{id:"sourceful/riverflow-v2-fast",name:"Sourceful: Riverflow V2 Fast",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-fast-preview":{id:"sourceful/riverflow-v2-fast-preview",name:"Sourceful: Riverflow V2 Fast Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-max-preview":{id:"sourceful/riverflow-v2-max-preview",name:"Sourceful: Riverflow V2 Max Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-pro":{id:"sourceful/riverflow-v2-pro",name:"Sourceful: Riverflow V2 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-standard-preview":{id:"sourceful/riverflow-v2-standard-preview",name:"Sourceful: Riverflow V2 Standard Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2.5-fast":{id:"sourceful/riverflow-v2.5-fast",name:"Sourceful: Riverflow V2.5 Fast",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2.5-pro":{id:"sourceful/riverflow-v2.5-pro",name:"Sourceful: Riverflow V2.5 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"x-ai/grok-imagine-image-quality":{id:"x-ai/grok-imagine-image-quality",name:"xAI: Grok Imagine Image Quality",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}}}};var IG=new Map;for(const[e,t]of Object.entries(WO)){const r=new Map;for(const[n,o]of Object.entries(t)){r.set(n,o)}IG.set(e,r)}var wG=new Map;function SG(e,t){return(r,n,o)=>{if(r.api!==e){throw new Error(`Mismatched api: ${r.api} expected ${e}`)}return t(r,n,o)}}function JO(e,t){wG.set(e.api,{provider:{api:e.api,generateImages:SG(e.api,e.generateImages)},sourceId:t})}var XO;function TG(e,t){return{api:e.api,provider:e.provider,model:e.id,output:[],stopReason:"error",errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function PG(){XO||=import("./openrouter-BKUGQT7Z.js").then(e=>e);return XO}var OG=async(e,t,r)=>{try{const n=await PG();return await n.generateImagesOpenRouter(e,t,r)}catch(n){return TG(e,n)}};function vG(){JO({api:"openrouter-images",generateImages:OG})}vG();var $G=e=>{const t=__alran_tuiPackageEntryUrl.endsWith(".js")?e.replace(/\.ts$/,".js"):e;return import(t)};var YO;var QO;var ev;var tv;var rv;var nv;var ov;var iv;var sv;var av;function cv(e,t){(async()=>{for await(const r of t){e.push(r)}e.end()})()}function uv(e,t){return{role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function Yn(e){return(t,r,n)=>{const o=new Pd;e().then(i=>{const s=i.stream(t,r,n);cv(o,s)}).catch(i=>{Od(n?.onProviderError,i,t);const s=uv(t,i);o.push({type:"error",reason:"error",error:s});o.end(s)});return o}}function Qn(e){return(t,r,n)=>{const o=new Pd;e().then(i=>{const s=i.streamSimple(t,r,n);cv(o,s)}).catch(i=>{const s=uv(t,i);o.push({type:"error",reason:"error",error:s});o.end(s)});return o}}function lv(){YO||=import("./anthropic-63VE6MAE.js").then(e=>{const t=e;return{stream:t.streamAnthropic,streamSimple:t.streamSimpleAnthropic}});return YO}function dv(){QO||=import("./azure-openai-responses-OIP3KVKJ.js").then(e=>{const t=e;return{stream:t.streamAzureOpenAIResponses,streamSimple:t.streamSimpleAzureOpenAIResponses}});return QO}function pv(){ev||=import("./google-RCR46TTQ.js").then(e=>{const t=e;return{stream:t.streamGoogle,streamSimple:t.streamSimpleGoogle}});return ev}function fv(){tv||=import("./google-vertex-Y26T7YYR.js").then(e=>{const t=e;return{stream:t.streamGoogleVertex,streamSimple:t.streamSimpleGoogleVertex}});return tv}function mv(){rv||=import("./mistral-NEBDKUEI.js").then(e=>{const t=e;return{stream:t.streamMistral,streamSimple:t.streamSimpleMistral}});return rv}function hv(){nv||=import("./openai-codex-responses-L2CIGCKO.js").then(e=>{const t=e;return{stream:t.streamOpenAICodexResponses,streamSimple:t.streamSimpleOpenAICodexResponses}});return nv}function gv(){ov||=import("./openai-completions-C4PHW6MD.js").then(e=>{const t=e;return{stream:t.streamOpenAICompletions,streamSimple:t.streamSimpleOpenAICompletions}});return ov}function yv(){iv||=import("./openai-responses-5NVFOW4Y.js").then(e=>{const t=e;return{stream:t.streamOpenAIResponses,streamSimple:t.streamSimpleOpenAIResponses}});return iv}function _v(){if(sv){return Promise.resolve(sv)}av||=$G("./amazon-bedrock.ts").then(e=>{const t=e;return{stream:t.streamBedrock,streamSimple:t.streamSimpleBedrock}});return av}var kG=Yn(lv);var RG=Qn(lv);var MG=Yn(dv);var AG=Qn(dv);var EG=Yn(pv);var zG=Qn(pv);var CG=Yn(fv);var NG=Qn(fv);var FG=Yn(mv);var jG=Qn(mv);var DG=Yn(hv);var UG=Qn(hv);var LG=Yn(gv);var qG=Qn(gv);var KG=Yn(yv);var ZG=Qn(yv);var BG=Yn(_v);var GG=Qn(_v);function VG(){mn({api:"anthropic-messages",stream:kG,streamSimple:RG});mn({api:"openai-completions",stream:LG,streamSimple:qG});mn({api:"mistral-conversations",stream:FG,streamSimple:jG});mn({api:"openai-responses",stream:KG,streamSimple:ZG});mn({api:"azure-openai-responses",stream:MG,streamSimple:AG});mn({api:"openai-codex-responses",stream:DG,streamSimple:UG});mn({api:"google-generative-ai",stream:EG,streamSimple:zG});mn({api:"google-vertex",stream:CG,streamSimple:NG});mn({api:"bedrock-converse-stream",stream:BG,streamSimple:GG})}VG();function HG(e){return typeof e==="string"&&e.trim().length>0}function WG(e,t){if(HG(t?.apiKey))return t;const r=rg(e.provider);if(!r)return t;return{...t,apiKey:r}}function JG(e){const t=HO(e);if(!t){throw new Error(`No API provider registered for api: ${e}`)}return t}function XG(e,t,r){const n=JG(e.api);return n.streamSimple(e,t,WG(e,r))}async function _ce(e,t,r){const n=XG(e,t,r);return n.result()}var YG=[/prompt is too long/i,/request_too_large/i,/input is too long for requested model/i,/exceeds the context window/i,/exceeds (?:the )?(?:model'?s )?maximum context length of [\d,]+ tokens?/i,/input token count.*exceeds the maximum/i,/maximum prompt length is \d+/i,/reduce the length of the messages/i,/maximum context length is \d+ tokens/i,/exceeds (?:the )?maximum allowed input length of [\d,]+ tokens?/i,/input \(\d+ tokens\) is longer than the model'?s context length \(\d+ tokens\)/i,/exceeds the limit of \d+/i,/exceeds the available context size/i,/greater than the context length/i,/context window exceeds limit/i,/exceeded model token limit/i,/too large for model with \d+ maximum context length/i,/model_context_window_exceeded/i,/prompt too long; exceeded (?:max )?context length/i,/context[_ ]length[_ ]exceeded/i,/too many tokens/i,/token limit exceeded/i,/^4(?:00|13)\s*(?:status code)?\s*\(no body\)/i];var QG=[/^(Throttling error|Service unavailable):/i,/rate limit/i,/too many requests/i];function Ice(e,t){if(e.stopReason==="error"&&e.errorMessage){const r=QG.some(n=>n.test(e.errorMessage));if(!r&&YG.some(n=>n.test(e.errorMessage))){return true}}if(t&&e.stopReason==="stop"){const r=e.usage.input+e.usage.cacheRead;if(r>t){return true}}if(t&&e.stopReason==="length"&&e.usage.output===0){const r=e.usage.input+e.usage.cacheRead;if(r>=t*.99){return true}}return false}var xv=new WeakMap;var tV=Symbol.for("TypeBox.Kind");function Oi(e){return typeof e==="object"&&e!==null}function ng(e){return Oi(e)}function rV(e){return Oi(e)&&Object.getOwnPropertySymbols(e).includes(tV)}function nV(e){if(typeof e.type==="string"){return[e.type]}if(Array.isArray(e.type)){return e.type.filter(t=>typeof t==="string")}return[]}function oV(e,t){switch(t){case"number":return typeof e==="number";case"integer":return typeof e==="number"&&Number.isInteger(e);case"boolean":return typeof e==="boolean";case"string":return typeof e==="string";case"null":return e===null;case"array":return Array.isArray(e);case"object":return Oi(e)&&!Array.isArray(e);default:return false}}function iV(e){return Oi(e)}function sV(e){if(!iV(e)){return void 0}try{return Iv(e)}catch{return void 0}}function aV(e,t){switch(t){case"number":{if(e===null){return 0}if(typeof e==="string"&&e.trim()!==""){const r=Number(e);if(Number.isFinite(r)){return r}}if(typeof e==="boolean"){return e?1:0}return e}case"integer":{if(e===null){return 0}if(typeof e==="string"&&e.trim()!==""){const r=Number(e);if(Number.isInteger(r)){return r}}if(typeof e==="boolean"){return e?1:0}return e}case"boolean":{if(e===null){return false}if(typeof e==="string"){if(e==="true"){return true}if(e==="false"){return false}}if(typeof e==="number"){if(e===1){return true}if(e===0){return false}}return e}case"string":{if(e===null){return""}if(typeof e==="number"||typeof e==="boolean"){return String(e)}return e}case"null":{if(e===""||e===0||e===false){return null}return e}default:return e}}function cV(e,t){const r=t.properties;const n=new Set(r?Object.keys(r):[]);if(r){for(const[o,i]of Object.entries(r)){if(!(o in e)){continue}e[o]=vi(e[o],i)}}if(t.additionalProperties&&ng(t.additionalProperties)){for(const[o,i]of Object.entries(e)){if(n.has(o)){continue}e[o]=vi(i,t.additionalProperties)}}}function uV(e,t){if(Array.isArray(t.items)){for(let r=0;r<e.length;r++){const n=t.items[r];if(!n){continue}e[r]=vi(e[r],n)}return}if(ng(t.items)){for(let r=0;r<e.length;r++){e[r]=vi(e[r],t.items)}}}function bv(e,t){for(const r of t){const n=structuredClone(e);const o=vi(n,r);const i=sV(r);if(i?.Check(o)){return o}}return e}function vi(e,t){let r=e;if(Array.isArray(t.allOf)){for(const i of t.allOf){r=vi(r,i)}}if(Array.isArray(t.anyOf)){r=bv(r,t.anyOf)}if(Array.isArray(t.oneOf)){r=bv(r,t.oneOf)}const n=nV(t);const o=n.length>1&&n.some(i=>oV(r,i));if(n.length>0&&!o){for(const i of n){const s=aV(r,i);if(s!==r){r=s;break}}}if(n.includes("object")&&Oi(r)&&!Array.isArray(r)){cV(r,t)}if(n.includes("array")&&Array.isArray(r)){uV(r,t)}return r}function Iv(e){const t=e;const r=xv.get(t);if(r){return r}const n=qg(e);xv.set(t,n);return n}function lV(e){if(e.keyword==="required"){const r=e.params.requiredProperties;const n=r?.[0];if(n){const o=e.instancePath.replace(/^\//,"").replace(/\//g,".");return o?`${o}.${n}`:n}}const t=e.instancePath.replace(/^\//,"").replace(/\//g,".");return t||"root"}function wv(e,t){const r=structuredClone(t.arguments);Lg.Convert(e.parameters,r);const n=Iv(e.parameters);if(!rV(e.parameters)&&ng(e.parameters)){const s=vi(r,e.parameters);if(s!==r){if(Oi(r)&&Oi(s)){for(const a of Object.keys(r)){delete r[a]}Object.assign(r,s)}else{return n.Check(s)?s:r}}}if(n.Check(r)){return r}const o=n.Errors(r).map(s=>` - ${lV(s)}: ${s.message}`).join("\n")||"Unknown validation error";const i=`Validation failed for tool "${t.name}":
|
|
63
|
+
${o}
|
|
64
|
+
|
|
65
|
+
Received arguments:
|
|
66
|
+
${JSON.stringify(t.arguments,null,2)}`;throw new Error(i)}function dV(e,t){if(!pV(e)||!gd(t))return t;const r=w in e;if(r&&Pi.Check(e,t))return t;let n;try{n=wv(mV(gV(e)),hV(t))}catch{return t}if(!og(t,n))return t;if(r)return Pi.Check(e,n)?n:t;return fV(t,n)?t:n}function og(e,t){if(Object.is(e,t))return true;if(typeof e==="string"){return typeof t==="number"&&Number.isFinite(t)&&String(t)===e.trim()}if(Array.isArray(e)){return Array.isArray(t)&&t.length===e.length&&e.every((r,n)=>og(r,t[n]))}if(gd(e)){if(!gd(t))return false;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return false;return r.every(n=>Object.hasOwn(t,n)&&og(e[n],t[n]))}return false}var Sv=new WeakMap;function pV(e){return gd(e)}function fV(e,t){return JSON.stringify(e)===JSON.stringify(t)}function mV(e){return{name:"nested",description:"",parameters:e}}function hV(e){return{type:"toolCall",id:"nested",name:"nested",arguments:e}}function gV(e){if(!(w in e))return e;let t=Sv.get(e);if(t===void 0){t=JSON.parse(JSON.stringify(e));Sv.set(e,t)}return t}function gd(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function yV(e,t,r){const n=e.find(o=>o.def.name===t);return Boolean(n&&Pi.Check(n.def.schema,r))}var xV={name:"read",executionMode:"parallel",description:"Read the contents of a file. Supports text, images (jpg, png, gif, webp), and video (mp4, avi, mov, mkv) when the active model declares video support; otherwise video files are read as a text-only placeholder. Output is truncated to a maximum number of lines/bytes \u2014 use `offset` and `limit` to page through long files.",schema:y.Object({path:y.String({description:"Absolute or workspace-relative file path."}),offset:y.Optional(y.Number({description:"The line number to start reading from (1-indexed). Only provide if the file is too large to read at once."})),limit:y.Optional(y.Number({description:"The number of lines to read. Only provide if the file is too large to read at once."}))})};var bV={name:"write",executionMode:"sequential",description:"Write content to a file. Creates the file if it does not exist, overwrites it if it does, and creates parent directories as needed. Prefer the edit tool for modifying existing files; only use write for new files or complete rewrites. If the file already exists, read it first before overwriting; writing replaces the entire previous content. Content is written literally, including line endings; NEVER include the line-number prefixes shown by the read tool. Do not proactively create documentation files (*.md, README) unless explicitly requested.",schema:y.Object({path:y.String({description:"Absolute or workspace-relative file path."}),content:y.String({description:"Full file content to write."})})};var sue=y.Object({path:y.String({description:"Absolute or workspace-relative file path."}),edits:y.Array(y.Object({oldText:y.String({description:"Exact existing text to replace."}),newText:y.String({description:"Replacement text."})}),{description:"Ordered list of replacements; all must succeed."})});var IV={name:"bash",executionMode:"sequential",description:"Execute a bash command. Returns combined stdout + stderr after the command exits. Supports an optional timeout in seconds. IMPORTANT: each invocation is stateless with respect to the working directory \u2014 every command starts from the same fixed default directory in a fresh shell, NOT from where a previous command left off. A `cd` (e.g. `cd ..`) only affects that single command and does NOT change the cwd of the next call. To operate in a different directory, scope it within the same call (e.g. `cd subdir && some-command`) or use absolute paths.",schema:y.Object({command:y.String({description:"Shell command line to execute."}),timeout:y.Optional(y.Number({description:"Timeout in seconds. Default is host-defined."}))})};var wV={name:"grep",executionMode:"parallel",description:"Search file contents for a regex pattern using ripgrep. Respects .gitignore. Output is truncated to a maximum number of matches/bytes; long lines are clipped.",schema:y.Object({pattern:y.String({description:"Regex pattern (or literal if `literal=true`)."}),path:y.Optional(y.String({description:"Directory or file to search. Defaults to cwd."})),glob:y.Optional(y.String({description:"File-glob filter, e.g. '*.ts' or '**/*.spec.ts'."})),ignoreCase:y.Optional(y.Boolean({description:"Case-insensitive search."})),literal:y.Optional(y.Boolean({description:"Treat pattern as literal string instead of regex."})),context:y.Optional(y.Number({description:"Lines of context before and after each match."})),limit:y.Optional(y.Number({description:"Maximum number of matches to return."}))})};var SV={name:"glob",executionMode:"parallel",description:"Search for files by glob pattern. Respects .gitignore. Returns file paths relative to the search root, truncated when results exceed the limit.",schema:y.Object({pattern:y.String({description:"Glob pattern, e.g. '**/*.ts' or 'src/**/*.tsx'."}),path:y.Optional(y.String({description:"Search root. Defaults to cwd."})),limit:y.Optional(y.Number({description:"Maximum number of file paths to return."}))})};var TV={name:"todowrite",executionMode:"sequential",description:"Create or update a structured task list for a complex coding session. Use it for multi-step work or explicit user task lists; skip it for single, trivial, or purely conversational requests. Keep exactly one task in_progress and update statuses as work progresses.",schema:y.Object({todos:y.Array(y.Object({content:y.String({description:"Brief description of the task"}),status:y.String({description:"Current status of the task: pending, in_progress, completed, cancelled"}),priority:y.String({description:"Priority level of the task: high, medium, low"})}),{description:"The updated todo list"})})};var PV=`Launch a new agent to handle complex, multistep tasks autonomously.
|
|
67
|
+
|
|
68
|
+
Use this for broad research, parallelizable investigation, or delegated implementation. Do not use it for targeted file reads, grep-style code searches, or work that is simpler to do directly.
|
|
69
|
+
|
|
70
|
+
Each invocation is a stateless, one-shot task. The sub-agent's result is returned only to you, so summarize any user-visible outcome yourself.`;var OV={name:"task",executionMode:"sequential",description:PV,schema:y.Object({description:y.String({description:"A short (3-5 words) description of the task"}),prompt:y.String({description:"The task for the agent to perform"}),subagent_type:y.String({description:"The type of specialized agent to use for this task"})})};var Tv={name:"web_search",description:["Search the web for external facts and current information such as news, prices, places, and recent posts.","Use before answering or asking for clarification when external facts are unfamiliar or unsupported, including recent, changeable, niche, or user-provided claims. Skip verification when facts are clearly stable or already supported by the conversation, local files, or stable general knowledge.","Prefer primary or authoritative sources. For important, surprising, disputed, or source-dependent claims, cross-check key facts across multiple reliable sources when practical. State when sources conflict or only one reliable source is available.","Search misses do not prove non-existence. If results are inconclusive, inspect an authoritative source with an available page-reading tool, or state that the claim could not be verified.","Report only searches actually performed and cite URLs returned by tools. A search result does not establish that its source page was opened or verified; claim that only after a tool actually read the page."].join("\n"),schema:y.Object({query:y.String({description:"Search query."}),count:y.Optional(y.Integer({description:"Max results (default 10)."})),freshness:y.Optional(y.String({description:"noLimit (default) | day | week | month | year."})),search_type:y.Optional(y.String({description:"search (default) | videos | places | news | shopping."}))})};var vV=y.Object({file_path:y.String({description:"Local workspace path of the image file to analyze."}),prompt:y.Optional(y.String({description:'Defaults to "Describe this content" if omitted.'}))});var Pv=y.Object({file_path:y.String({description:"Local workspace path of the audio file to analyze."}),prompt:y.Optional(y.String({description:'Defaults to "Describe this content" if omitted.'}))});var $V=y.Object({file_path:y.String({description:"Local workspace path of the video file to analyze."}),prompt:y.Optional(y.String({description:'Defaults to "Describe this content" if omitted.'}))});var Xs=Tv;var Mo={name:"images_understand",description:"Offload local image FILES to a separate vision model for text descriptions. You are already multimodal: if an image is visible in this conversation (you can see it, or it was already loaded/read), describe it yourself and do NOT call this tool. Use this ONLY for image files on disk whose pixels you have not actually seen \u2014 never to re-analyze an image already in your context.",schema:y.Object({image_info:y.Array(vV,{description:"Batch of local image file inputs (up to 10). Always batch when you have multiple images. Include only images you cannot already see directly."})})};var kn="Paths outside the session workspace (e.g. /tmp or input attachment directories) are rejected.";var kV=y.Object({prompt:y.String({description:"Synthesis prompt."}),output_file_path:y.String({description:`Where to save the generated image: a workspace-relative path like "art/cover.png". ${kn}`}),input_file_paths:y.Optional(y.Array(y.String(),{description:"Local workspace paths of reference images (max 4)."})),aspect_ratio:y.Optional(y.String({description:'e.g. "16:9", "1:1".'})),resolution:y.Optional(y.String({description:'"1K" | "2K" | "4K".'}))});var ki={name:"image_synthesize",description:"Generate images from prompts, optionally conditioned on local reference images.",schema:y.Object({requests:y.Array(kV,{description:"Up to 10 synthesis requests."})})};var RV=y.Object({query:y.String({description:"Search keywords."}),output_dir_path:y.String({description:`Directory to save this query's downloaded images (created if missing): a workspace-relative path like "downloads/cats". ${kn}`}),prompt:y.Optional(y.String({description:"Description of desired images; server defaults to `query` when empty."}))});var Ri={name:"images_search_and_download",description:"Search the web for images and save top hits to local disk.",schema:y.Object({queries:y.Array(RV,{description:"Up to 10 image search queries."}),providers:y.Optional(y.Array(y.String(),{description:'Override auto-selection, e.g. ["tencent","serper"].'}))})};var Mi={name:"image_reverse_search",description:"Given a local image, find visually similar images and pages on the web. Writes a markdown report of the matches to `output_file_path`.",schema:y.Object({image_file_path:y.String({description:"Local workspace path of the image to reverse search."}),output_file_path:y.String({description:`Where to write the formatted markdown report: a workspace-relative .md path like "reports/matches.md". ${kn}`})})};var yd=7e3;var sg=3;var ag=12;var Dr="Alran-H3";var xt="Alran-Video-2.3";function ar(e){return e===Dr}var ig="Across reference_image_paths, reference_video_paths, and reference_audio_paths, allow at most 12 files total.";var MV="Required and must be chosen in a separate first step. We recommend Alran-H3 for quality: it is newer and more capable. Alran-H3 natively generates synchronized audio together with the video directly from the prompt, without reference_audio_paths; reference audio is optional guidance, not a prerequisite for sound. Alran-Video-2.3 accepts exactly one image; Alran-H3 supports either first/last-frame keyframes or multimodal references: 1-9 reference images, 1-3 reference videos, and 1-3 reference audio files only together with reference images/videos, with at most 12 files total across all reference collections. If the user did not choose a model, explain only these model differences and ask which model to use. Do not ask about resolution, duration, keyframes, or reference media until the model is selected. After Alran-H3 is selected, ask for input mode, an integer duration from 4 through 15, and a resolution of 768P or 2K; offer a concrete ratio for text-only mode and adaptive or a concrete ratio for reference mode. Use Alran-H3 as the Tool and Matrix model value.";var Ov=y.Union([y.Literal(Dr),y.Literal(xt)],{description:MV});var Ai={name:"submit_video_generation",description:["Submit exactly one asynchronous video task and return task_id immediately.","For Alran-H3 this Tool adapts the official POST /v2/video_generation contract to the current Matrix MCP wrapper: one required non-empty prompt becomes the single text content item, and frame/reference path fields become image_url/video_url/audio_url content roles.","Use a strict two-step conversation: first resolve the video model; after the user selects a model, ask only that model's remaining applicable options.","The video model choice is mandatory unless the current user request or terminal `<video-generation-options>` explicitly names H3.0 (Alran-H3) or H2.3 (Alran-Video-2.3). Never infer a default model from the Plugin name, a recommendation, or an omitted value.",'When the video model is missing and the `ask_user` tool is available, make one actual `ask_user` tool call before any submission. Use this exact call shape, keeping `steps` and every `options` value as literal JSON arrays: { "mode": "questionnaire", "title": "Video specifications", "steps": [{ "question": "Which model?", "options": [{ "label": "H3.0 (Recommended)" }, { "label": "H2.3" }], "selectionMode": "single" }] }. Never wrap either array in an `item` container such as `{ "item": [...] }`. Use `selectionMode`; never `multiSelect`.',"Write the questionnaire in the same language as the user. H3.0 maps to `Alran-H3`; H2.3 maps to `Alran-Video-2.3`. Do not call `submit_video_generation` until the user replies. When `ask_user` is unavailable, ask the same unresolved choices in concise prose and wait for the reply.","Alran-H3 is recommended for quality and supports 768P or 2K; ask the user to choose a resolution unless it is already explicit or delegated. When the user delegates or omits the choice, use 2K.","Alran-H3 natively generates synchronized audio together with the video. Put requested dialogue, ambience, and sound effects in the prompt; native sound works without reference_audio_paths. Reference audio is optional guidance, not a prerequisite for an audible video. Do not use a separate audio-generation tool unless the user explicitly asks for a separate audio output.","After Alran-H3 is selected, first ask whether the input mode is text-only, first-frame, last-frame, first+last-frame, or multimodal reference, then ask for an integer duration from 4 through 15 and a resolution. Text-only mode uses one non-adaptive ratio from 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16 and defaults to 16:9 when omitted or delegated. Keyframe mode is always adaptive. Reference mode defaults to adaptive and also accepts any concrete ratio.","Reference images allow 1-9 items, reference videos allow 1-3 items, reference audio allows 1-3 items and must accompany reference images or videos, and all reference collections together allow at most 12 files total. Do not submit until duration and applicable media choices are explicit; ratio and resolution may use their documented defaults when omitted or delegated.","The official V2 video_url content item contains only url and role. The current Matrix wrapper additionally requires duration_seconds on each reference_videos item; this is Matrix wrapper metadata, not a Video Generation V2 content field. Workspace MP4/MOV duration is inspected automatically before upload; for public reference-video URLs, supply reference_video_duration_seconds in the same order because those URLs must not be downloaded or re-uploaded.","Every media input accepts either a public HTTP/HTTPS URL or a workspace-relative path. Public URLs are passed through unchanged without downloading or uploading them again. Every workspace media path, including first/last keyframes and image/video/audio references, is fenced, validated, and uploaded through the dedicated temporary public upload flow before submission; internal OSS hosts are never sent upstream. The agent Tool intentionally does not expose mm_file:// or data URI inputs because its supported local-file path must use the workspace fence and real temporary public upload flow.","A submit attempt is terminal for that exact request in the current turn. If submit returns any error, timeout, or HTTP failure, report it without inferring that a task was created and never retry submit automatically. Retry only after a new explicit user request in a later turn. Call `query_video_generation` only when submit returned a task_id; never repeat submit to check status."].join(" "),schema:y.Object({model:Ov,prompt:y.String({minLength:1,maxLength:yd,description:"The one required non-empty V2 text/prompt item, up to 7000 characters. For Alran-H3 native audio generation, describe the desired dialogue, ambience, and sound effects here; reference audio is optional."}),input_image_path:y.Optional(y.String({description:"Optional public HTTP/HTTPS URL or workspace-relative path to a first-frame or last-frame image. Public URLs pass through unchanged; a workspace path is automatically uploaded to a temporary public URL before submission. Alran-H3 accepts .jpg/.jpeg/.png/.webp/.heic/.heif. Alran-Video-2.3 accepts .jpg/.png/.webp and exactly one image for first-frame or legacy subject mode. Alran-H3 uses this only for a keyframe, not as multimodal reference media. Cannot be combined with reference collections."})),last_frame_image_path:y.Optional(y.String({description:"Alran-H3 first+last-frame mode only. Public HTTP/HTTPS URL or workspace-relative .jpg/.jpeg/.png/.webp/.heic/.heif path for the ending frame. Public URLs pass through unchanged; a workspace path is automatically uploaded to a temporary public URL. Requires input_image_path as the first frame; reference_type must be first_frame or omitted. Cannot be combined with reference collections."})),reference_type:y.Optional(y.Union([y.Literal("first_frame"),y.Literal("last_frame"),y.Literal("subject")],{description:"How input_image_path is used. Alran-H3 supports first_frame or last_frame keyframes; omit it to default input_image_path to first_frame. Alran-Video-2.3 supports first_frame or legacy subject mode. Requires input_image_path and cannot be combined with reference collections."})),reference_image_paths:y.Optional(y.Array(y.String(),{minItems:1,maxItems:9,description:`Alran-H3 only. 1-9 public HTTP/HTTPS URLs or workspace-relative reference image paths; local paths are automatically uploaded to temporary public URLs. Each must be .jpg/.jpeg/.png/.webp/.heic/.heif, no larger than 30 MB, with width and height each in [256, 5760] and width/height ratio in [0.4, 2.5]. ${ig} Alran-Video-2.3 does not accept this collection. Cannot be combined with keyframes.`})),reference_video_paths:y.Optional(y.Array(y.String(),{minItems:1,maxItems:3,description:`Alran-H3 only. 1-3 public HTTP/HTTPS URLs or workspace-relative .mp4/.mov video paths; local paths are automatically uploaded to temporary public URLs. Videos must use H.264/AVC or H.265/HEVC (embedded audio AAC/MP3); each no larger than 50 MB and 2-15 seconds, total video duration at most 15 seconds, width and height each in [256, 5760], aspect ratio in [0.4, 2.5], and frame rate in [23.976, 60]. ${ig} Workspace MP4/MOV size and duration are checked before upload. Every public URL requires a same-index value in reference_video_duration_seconds. Dimensions, frame rate, and codecs are validated upstream. Cannot be combined with keyframes.`})),reference_video_duration_seconds:y.Optional(y.Array(y.Number({minimum:2,maximum:15}),{minItems:1,maxItems:3,description:"Alran-H3 Matrix-wrapper reference-video durations in seconds, in the same order as reference_video_paths. A value is required for every public URL because URLs are passed through without downloading; workspace MP4/MOV durations are inspected automatically when this field is omitted. When provided, the array length must equal reference_video_paths length and every value must be between 2 and 15."})),reference_audio_paths:y.Optional(y.Array(y.String(),{minItems:1,maxItems:sg,description:`Alran-H3 only. Optional audio guidance; it is not required for native audio generation because Alran-H3 can generate synchronized sound directly from the prompt. Accepts 1-3 public HTTP/HTTPS URLs or workspace-relative .wav/.mp3 reference audio paths; local paths are automatically uploaded to temporary public URLs. Each must be no larger than 15 MB and 2-15 seconds, with total audio duration at most 15 seconds. ${ig} Reference audio cannot be used alone: include at least one reference image or video. Duration is validated upstream. Cannot be combined with keyframes.`})),duration:y.Integer({minimum:4,maximum:15,description:"Required after model selection. Alran-H3 supports an integer from 4 through 15 seconds. Alran-Video-2.3 supports exactly 6s or 10s."}),resolution:y.Optional(y.Union([y.Literal("768P"),y.Literal("1080P"),y.Literal("2K")],{description:"Alran-H3 supports 768P or 2K and defaults to 2K when omitted or delegated. Alran-Video-2.3 supports 768P (default) or 1080P; 10s requires 768P."})),ratio:y.Optional(y.Union([y.Literal("21:9"),y.Literal("16:9"),y.Literal("4:3"),y.Literal("1:1"),y.Literal("3:4"),y.Literal("9:16"),y.Literal("adaptive")],{description:"Alran-H3 text-only mode accepts 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16, defaults to 16:9 when omitted, and cannot use adaptive. Keyframe mode is forced to adaptive. Reference mode defaults to adaptive and also accepts any concrete ratio."})),aigc_watermark:y.Optional(y.Boolean({description:"Alran-H3 V2 AIGC watermark switch. Omit or set false for the upstream default; set true only when the user requests the AIGC watermark.",default:false}))},{additionalProperties:false})};var Ei={name:"query_video_generation",description:"Query one previously submitted video task once. This read-only call does not create another charge. Pass the same model returned by submit and keep using the same output_file_path while polling. Returns queued/running/failed/cancelled without writing a file. When status is succeeded, downloads video_url immediately to output_file_path because Alran-H3 signed URLs are valid for only about 9 hours.",schema:y.Object({task_id:y.String({description:"Task ID returned by submit_video_generation."}),model:Ov,output_file_path:y.String({description:`Required workspace-relative path for the generated mp4, such as "videos/result.mp4". Keep the same path on every query; the file is written only after status becomes succeeded. ${kn}`})},{additionalProperties:false})};var AV=y.Object({prompt:y.String({description:"Video prompt."}),output_file_path:y.String({description:`Where to save the generated video: a workspace-relative path like "clips/intro.mp4". ${kn}`}),input_image_path:y.Optional(y.String({description:"Local workspace path of a reference image (image-to-video). Omit for pure text-to-video."})),reference_type:y.Optional(y.String({description:'"first_frame" (default) | "last_frame".'})),duration:y.Optional(y.Integer({description:"6 (default) | 10."})),resolution:y.Optional(y.String({description:'"768P" (default) | "1080P".'})),model:y.Optional(y.String({description:"Override default model."}))});var zi={name:"gen_videos",description:"Generate videos from prompts, optionally seeded with a local reference image. Generation is async on the server and may take many minutes.",schema:y.Object({requests:y.Array(AV,{description:"Up to 5 video generation requests."})})};var Ci={name:"batch_text_to_video",description:"Batch text-to-video using parallel lists. Items at the same index form one video.",schema:y.Object({prompt_list:y.Array(y.String(),{description:"One prompt per video."}),output_file_path_list:y.Array(y.String(),{description:`One workspace-relative output path per video (e.g. "clips/scene-1.mp4"), parallel to \`prompt_list\`. ${kn}`}),duration_list:y.Optional(y.Array(y.Integer(),{description:"Optional durations, parallel to `prompt_list`."})),resolution_list:y.Optional(y.Array(y.String(),{description:"Optional resolutions, parallel to `prompt_list`."}))})};var Ni={name:"batch_image_to_video",description:"Batch image-to-video using each local image as the first frame. Items at the same index form one video.",schema:y.Object({image_file_path_list:y.Array(y.String(),{description:"Local workspace paths of input images (first_frame source) per video."}),output_file_path_list:y.Array(y.String(),{description:`One workspace-relative output path per video (e.g. "clips/scene-1.mp4"), parallel to \`image_file_path_list\`. ${kn}`}),prompt_list:y.Optional(y.Array(y.String(),{description:"Optional prompts, parallel to `image_file_path_list`."})),reference_type_list:y.Optional(y.Array(y.String(),{description:"Optional reference types, parallel to `image_file_path_list`."})),duration_list:y.Optional(y.Array(y.Integer(),{description:"Optional durations, parallel to `image_file_path_list`."})),resolution_list:y.Optional(y.Array(y.String(),{description:"Optional resolutions, parallel to `image_file_path_list`."}))})};var Ao={name:"get_voice_list",description:"List the voice presets (voice_id + voice_name) available to `synthesize_speech` and the batch TTS tools.",schema:y.Object({})};var vv=y.Object({text:y.String({description:"Text to synthesize."}),output_file_path:y.String({description:`Where to save the generated mp3: a workspace-relative path like "audio/speech.mp3". ${kn}`}),voice_id:y.Optional(y.String({description:'Default "male-qn-qingse".'})),speed:y.Optional(y.Number({description:"[0.5, 2.0] default 1.0."})),volume:y.Optional(y.Number({description:"[0.0, 10.0] default 1.0."})),pitch:y.Optional(y.Integer({description:"[-12, 12] default 0."})),emotion:y.Optional(y.String({description:"happy | sad | angry | fearful | disgusted | surprised | neutral."}))});var Fi={name:"batch_text_to_audio",description:"Batch text-to-speech, with voice and audio parameters configurable per request.",schema:y.Object({requests:y.Array(vv,{description:"Up to 10 TTS requests."})})};var EV=y.Object({prompt:y.String({description:"Music prompt, length [10, 300]."}),output_file_path:y.String({description:`Where to save the generated music file: a workspace-relative path like "music/track.mp3". ${kn}`}),lyrics:y.Optional(y.String({description:"Lyrics text, length [10, 600] when set; omit for pure instrumental / background music."})),sample_rate:y.Optional(y.Integer({description:"{16000, 24000, 32000, 44100}."})),bitrate:y.Optional(y.Integer({description:"{32000, 64000, 128000, 256000}."})),format:y.Optional(y.String({description:"mp3 | wav | pcm."}))});var ji={name:"batch_text_to_music",description:"Generate music tracks from text prompts, optionally with lyrics.",schema:y.Object({requests:y.Array(EV,{description:"Up to 5 music generation requests."})})};var Di={name:"synthesize_speech",description:"Convert a single text input to speech. Use `batch_synthesize_speech` for multiple texts.",schema:y.Object({text:y.String({description:"Text to synthesize."}),output_file_path:y.String({description:`Where to save the generated mp3: a workspace-relative path like "audio/speech.mp3". ${kn}`}),voice_id:y.Optional(y.String()),speed:y.Optional(y.Number({description:"[0.5, 2.0] default 1.0."})),volume:y.Optional(y.Number({description:"[0.0, 10.0] default 1.0."})),pitch:y.Optional(y.Integer({description:"[-12, 12] default 0."})),emotion:y.Optional(y.String({description:"happy | sad | angry | fearful | disgusted | surprised | neutral."}))})};var Ui={name:"batch_synthesize_speech",description:"Batch text-to-speech. Prefer this over calling `synthesize_speech` in a loop.",schema:y.Object({requests:y.Array(vv,{description:"Up to 10 synthesize requests."})})};var Li={name:"audios_understand",description:"Analyze local audio files and return one description per audio.",schema:y.Object({audio_info:y.Array(Pv,{description:"Batch of audio inputs (up to 10). Always batch when you have multiple audios."})})};var Eo={name:"videos_understand",description:"Offload local video FILES to a separate vision model for text descriptions. If a video (or its frames) is already visible in this conversation, or you have already analyzed it, describe it yourself and do NOT call this tool. Use this ONLY for video files on disk whose content you have not actually seen \u2014 never to re-analyze a video already in your context.",schema:y.Object({video_info:y.Array($V,{description:"Batch of local video file inputs (up to 5). Always batch when you have multiple videos. Include only videos you cannot already see directly."})})};var eo={name:"transcribe_audio",description:"Transcribe a single local audio file to text.",schema:y.Object({audio_info:Pv})};var ee={[Xs.name]:"/matrix/api/v1/mcp/web_search",[Mo.name]:"/matrix/api/v1/mcp/images_understand",[ki.name]:"/matrix/api/v1/mcp/image_synthesize",[Ri.name]:"/matrix/api/v1/mcp/images_search_and_download",[Mi.name]:"/matrix/api/v1/mcp/image_reverse_search",[Ai.name]:"/matrix/api/v1/mcp/submit_video_generation",[Ei.name]:"/matrix/api/v1/mcp/query_video_generation",[zi.name]:"/matrix/api/v1/mcp/gen_videos",[Ci.name]:"/matrix/api/v1/mcp/batch_text_to_video",[Ni.name]:"/matrix/api/v1/mcp/batch_image_to_video",[Ao.name]:"/matrix/api/v1/mcp/get_voice_list",[Fi.name]:"/matrix/api/v1/mcp/batch_text_to_audio",[ji.name]:"/matrix/api/v1/mcp/batch_text_to_music",[Di.name]:"/matrix/api/v1/mcp/synthesize_speech",[Ui.name]:"/matrix/api/v1/mcp/batch_synthesize_speech",[Li.name]:"/matrix/api/v1/mcp/audios_understand",[Eo.name]:"/matrix/api/v1/mcp/videos_understand",[eo.name]:"/matrix/api/v1/mcp/listen_audio"};var hn=6e5;var $i=12e4;var $v={[Xs.name]:$i,[Mo.name]:$i,[ki.name]:hn,[Ri.name]:hn,[Mi.name]:hn,[Ai.name]:hn,[Ei.name]:$i,[zi.name]:hn,[Ci.name]:hn,[Ni.name]:hn,[Ao.name]:$i,[Fi.name]:hn,[ji.name]:hn,[Di.name]:hn,[Ui.name]:hn,[Li.name]:$i,[Eo.name]:$i,[eo.name]:$i};var Rv="MATRIX_TOOL_REQUEST_FAILED";var Mv="MATRIX_TOOL_BUSINESS_FAILED";var kv="MATRIX_TOOL_REQUEST_FAILED: Matrix tool request failed.";var zV="MATRIX_TOOL_BUSINESS_FAILED: Matrix tool request was rejected.";async function wr(e){const{toolName:t,path:r,input:n,archonServer:o,signal:i}=e;if(i?.aborted)throw new Error("Operation aborted");const s=Date.now();Ev(e);let a;try{a=await o.postJson(r,n,i,{timeoutMs:ug(e)})}catch(h){const m=Fv(h);Cv(e,s,m);if(i?.aborted)throw h;return Nv(t,r,m)}const c=Av(a.base_resp)?a.base_resp:void 0;const l=c?.status_code??0;zv(e,s,a,l);if(l!==0){return cg(t,r,{statusCode:l})}const u={...a};delete u.base_resp;const d=JSON.stringify(u,null,2);return{tool_name:t,text:d,content:[{type:"text",text:d}],details:{ok:true,path:r},programmatic:{data:u}}}async function Ze(e){const{toolName:t,path:r,input:n,archonServer:o,signal:i}=e;if(i?.aborted)throw new Error("Operation aborted");const s=Date.now();Ev(e);let a;try{a=await o.postJson(r,n,i,{timeoutMs:ug(e)})}catch(h){const m=Fv(h);Cv(e,s,m);if(i?.aborted)throw h;return{ok:false,result:Nv(t,r,m)}}const c=Av(a.base_resp)?a.base_resp:void 0;const l=c?.status_code??0;zv(e,s,a,l);if(l!==0){return{ok:false,result:cg(t,r,{statusCode:l})}}const u={...a};delete u.base_resp;const d=typeof u.code==="number"&&Number.isInteger(u.code)?u.code:0;if(d!==0){e.ctx.matrixLogger?.warn(e.ctx,`matrix-tools biz_error tool=${t} path=${r} code=${Mv} payload_code=${d} session=${e.ctx.sessionId} turn=${e.ctx.turnId}`);return{ok:false,result:cg(t,r,{payloadCode:d})}}return{ok:true,response:u}}function ug(e){if(typeof e.timeoutMs==="number"&&Number.isFinite(e.timeoutMs)&&e.timeoutMs>0){return e.timeoutMs}return $v[e.toolName]}function Av(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Ev(e){const{toolName:t,path:r,ctx:n}=e;const o=jv(e.input);const i=ug(e);n.matrixLogger?.info(n,`matrix-tools request tool=${t} path=${r} body_bytes=${o} timeout_ms=${i??"default"} session=${n.sessionId} turn=${n.turnId}`)}function zv(e,t,r,n){const{toolName:o,path:i,ctx:s}=e;const a=Date.now()-t;const c=jv(r);const l=n===0;s.matrixLogger?.info(s,`matrix-tools response tool=${o} path=${i} ok=${l} status_code=${n} duration_ms=${a} resp_bytes=${c} session=${s.sessionId} turn=${s.turnId}`)}function Cv(e,t,r){const{toolName:n,path:o,ctx:i,signal:s}=e;const a=Date.now()-t;i.matrixLogger?.warn(i,`matrix-tools error tool=${n} path=${o} stage=request code=${Rv} http_status=${r??"none"} duration_ms=${a} aborted=${s?.aborted===true} session=${i.sessionId} turn=${i.turnId}`)}function Nv(e,t,r){return{tool_name:e,text:kv,content:[{type:"text",text:kv}],details:{ok:false,path:t,error_code:Rv,...r!==void 0?{http_status:r}:{}}}}function cg(e,t,r){const n=r.payloadCode===402?"Insufficient credits (code 402): account credits are insufficient. Please top up credits first. Do NOT retry the same request until credits are available.":zV;return{tool_name:e,text:n,content:[{type:"text",text:n}],details:{ok:false,path:t,error_code:Mv,...r.statusCode!==void 0?{status_code:r.statusCode}:{},...r.payloadCode!==void 0?{code:r.payloadCode}:{}}}}function Fv(e){if(!(e instanceof Error))return void 0;const t=/\bHTTP\s+(\d{3})\b/i.exec(e.message);return t?Number(t[1]):void 0}function jv(e){try{return Buffer.byteLength(JSON.stringify(e)??"","utf8")}catch{return-1}}import{writeFile as DV}from"node:fs/promises";import{fileURLToPath as UV}from"node:url";var Gt=class extends Error{constructor(r,n,o){super(n);this.kind=r;this.name="MatrixMediaError";if(o!==void 0)this.underlying=o}kind;underlying};function Pc(e){if(e instanceof Gt)return e.kind;if(e&&typeof e==="object"){const t=e.kind;return typeof t==="string"?t:void 0}return void 0}import{realpath as Dv}from"node:fs/promises";import{basename as CV,dirname as NV,isAbsolute as lg,relative as FV,resolve as _d,sep as jV}from"node:path";function Oc(e){return typeof e==="string"?e:e.workspaceRoot}function vc(e){if(typeof e==="string")return[e];return[e.workspaceRoot,...e.extraInputRoots??[]]}async function xd(e,t){const r=lg(e)?e:_d(Oc(t),e);let n;for(const o of vc(t)){try{await Uv(r,o);return r}catch(i){n??=i}}throw n instanceof Error?n:new Error(`Workspace path escapes Matrix tool root: ${e}`)}async function Uv(e,t){const r=await Dv(t);let n=_d(e);const o=[];while(true){let i;try{i=await Dv(n)}catch(c){const l=c.code;if(l!=="ENOENT"&&l!=="ENOTDIR")throw c;const u=NV(n);if(u===n){throw new Error(`Workspace path escapes Matrix tool root: ${e}`)}o.unshift(CV(n));n=u;continue}const s=o.length===0?i:_d(i,...o);const a=FV(r,s);if(a===".."||a.startsWith(`..${jV}`)||lg(a)){throw new Error(`Workspace path escapes Matrix tool root: ${e}`)}return}}async function dg(e,t){const r=lg(e)?e:_d(t,e);await Uv(r,t);return r}var E=class extends Error{kind;underlying;constructor(t,r,n){super(r);this.name="FileTransferError";this.kind=t;if(n!==void 0)this.underlying=n}};async function gn(e,t,r,n){const o=LV(e);let i;try{i=await xd(o,t)}catch(s){throw new E("path_escapes_workspace",`Input file path '${e}' is outside the workspace. Provide a path under one of: '${vc(t).join("', '")}'.`,s)}try{const{ossKey:s,signedUrl:a,inlineData:c,mimeType:l,bytes:u}=await r.uploadFile(i,n);return{absolutePath:i,signedUrl:a,inlineData:c,mimeType:l,ossKey:s,bytes:u}}catch(s){if(Pc(s)==="file_not_found"){throw new E("input_not_found",`Input file does not exist at '${i}'. Make sure the file was written before calling this tool.`,s)}throw new E("input_upload_failed",`Failed to upload input file '${i}' to temporary storage: ${bd(s)}. Please retry.`,s)}}async function yn(e,t,r,n){const o=[];for(const i of e){o.push(await gn(i,t,r,n))}return o}function Sr(e,t){const r={};if(e.inlineData){r.data=e.inlineData;if(e.mimeType)r.mime_type=e.mimeType}else if(e.signedUrl){r.url=e.signedUrl;if(e.mimeType)r.mime_type=e.mimeType}else{throw new E("input_upload_failed",`Failed to prepare input file '${e.absolutePath}': no URL or inline data was returned.`)}if(t!==void 0)r.prompt=t;return r}function qi(e){if(e.signedUrl)return e.signedUrl;throw new E("input_upload_failed",`Failed to upload input file '${e.absolutePath}' to temporary storage: no URL was returned.`)}async function it(e,t,r,n,o){const i=Oc(r);let s;try{s=await dg(t,i)}catch(a){throw new E("path_escapes_workspace",`Output file path '${t}' is outside the workspace. Provide a path under '${i}'.`,a)}try{const{bytes:a}=await n.downloadToFile(e,s,{...o?.signal?{signal:o.signal}:{},...o?.timeoutMs!==void 0?{timeoutMs:o.timeoutMs}:{}});return{absolutePath:s,bytes:a}}catch(a){if(Pc(a)==="aborted"){throw a}if(Pc(a)==="write_failed"){throw new E("output_write_failed",`Failed to write output file '${s}': ${bd(a)}.`,a)}throw new E("output_download_failed",`Failed to download generated content from server to '${s}': ${bd(a)}. The remote content may have expired or the network failed; please retry the tool.`,a)}}async function pg(e,t,r){const n=Oc(r);let o;try{o=await dg(t,n)}catch(s){throw new E("path_escapes_workspace",`Output file path '${t}' is outside the workspace. Provide a path under '${n}'.`,s)}const i=Buffer.from(e,"utf8");try{await DV(o,i)}catch(s){throw new E("output_write_failed",`Failed to write output file '${o}': ${bd(s)}.`,s)}return{absolutePath:o,bytes:i.length}}function ce(e,t,r){return{tool_name:e,text:r.message,content:[{type:"text",text:r.message}],details:{ok:false,path:t,reason:r.kind}}}function bd(e){if(e===null||e===void 0)return"unknown error";if(e instanceof Error)return e.message||e.name;if(typeof e==="string")return e;return String(e)}function LV(e){if(!e.startsWith("file://"))return e;return UV(e)}var Lv,fg;Lv=[X(Li)];var zo=class{constructor(t,r,n){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n}archonServer;ossMediaClient;workspaceScope;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Li.name;const i=ee[o];try{const s=await yn(r.audio_info.map(c=>c.file_path),this.workspaceScope,this.ossMediaClient);const a={audio_info:r.audio_info.map((c,l)=>Sr(s[l],c.prompt))};return await wr({toolName:o,path:i,input:a,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}})}catch(s){if(s instanceof E){return ce(o,i,s)}throw s}}};fg=re(null);zo=oe(fg,0,"MatrixAudiosUnderstandTool",Lv,zo);ne(fg,1,zo);import{basename as KV}from"node:path";var qV="cloud-runtime/v5-aigc";async function $t(e){const t=e.oss.clean_oss_key;if(!t)return;if(!e.registerService)return;try{await e.registerService.registerDownloadedAsset({oss:e.oss,absolutePath:e.absolutePath,fileName:e.fileName,sizeBytes:e.sizeBytes,mime:e.mime,sessionId:e.sessionId,toolName:e.toolName,producerVersion:qV})}catch(r){void r}}function kt(e){const t=e.toLowerCase();if(t.endsWith(".png"))return"image/png";if(t.endsWith(".jpg")||t.endsWith(".jpeg"))return"image/jpeg";if(t.endsWith(".webp"))return"image/webp";if(t.endsWith(".mp4"))return"video/mp4";if(t.endsWith(".mov"))return"video/quicktime";if(t.endsWith(".webm"))return"video/webm";if(t.endsWith(".mp3"))return"audio/mpeg";if(t.endsWith(".wav"))return"audio/wav";if(t.endsWith(".flac"))return"audio/flac";if(t.endsWith(".m4a"))return"audio/m4a";if(t.endsWith(".pcm"))return"audio/pcm";if(t.endsWith(".ogg")||t.endsWith(".oga"))return"audio/ogg";return"application/octet-stream"}function qv(e){if(typeof e!=="string")return null;const t=e.match(/^slot_(\d+)\./);return t?Number(t[1]):null}var Kv,mg;Kv=[X(Ni)];var Co=class{constructor(t,r,n,o=null){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n;this.aigcRegisterServiceGetter=o}archonServer;ossMediaClient;workspaceScope;aigcRegisterServiceGetter;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Ni.name;const i=ee[o];const s=r.image_file_path_list.length;const a=r.output_file_path_list.length;if(s!==a){const _=`image_file_path_list (${s} items) and output_file_path_list (${a} items) must be the same length.`;return{tool_name:o,text:_,content:[{type:"text",text:_}],details:{ok:false,path:i,reason:"length_mismatch"}}}let c;try{const _=await yn(r.image_file_path_list,this.workspaceScope,this.ossMediaClient);c=_.map(b=>Sr(b))}catch(_){if(_ instanceof E){return ce(o,i,_)}throw _}const l={image_list:c,output_file_list:r.output_file_path_list.map((_,b)=>`slot_${b}.mp4`)};if(r.prompt_list!==void 0)l.prompt_list=r.prompt_list;if(r.reference_type_list!==void 0)l.reference_type_list=r.reference_type_list;if(r.duration_list!==void 0)l.duration_list=r.duration_list;if(r.resolution_list!==void 0)l.resolution_list=r.resolution_list;const u=await Ze({toolName:o,path:i,input:l,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!u.ok)return u.result;const d=Array.isArray(u.response.success_items)?u.response.success_items:[];const h=Array.isArray(u.response.failed_items)?u.response.failed_items:[];const m=r.output_file_path_list.map((_,b)=>({index:b,output_file_path:_,status:"missing"}));for(const _ of d){const b=qv(_.output_file);if(b===null||b<0||b>=m.length)continue;const v=m[b];const A=_.output_url??"";if(!A){v.status="failed";v.error="server reported success but output_url is empty";continue}try{const $=await it(A,v.output_file_path,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});v.status="downloaded";v.bytes=$.bytes;v.output_file_path=$.absolutePath;await $t({oss:{clean_oss_key:_.clean_oss_key,visible_oss_key:_.visible_oss_key},absolutePath:$.absolutePath,fileName:KV($.absolutePath),sizeBytes:$.bytes,mime:kt($.absolutePath),sessionId:t.sessionId,toolName:o,registerService:this.aigcRegisterServiceGetter?this.aigcRegisterServiceGetter():null})}catch($){if($ instanceof E){if($.kind==="path_escapes_workspace"){return ce(o,i,$)}v.status="failed";v.error=$.message;continue}throw $}}for(const _ of h){const b=qv(_.output_file);if(b===null||b<0||b>=m.length)continue;const v=m[b];v.status="failed";v.error=_.error_msg??"unknown server error"}const p=m.filter(_=>_.status==="downloaded").length;const f=m.filter(_=>_.status!=="downloaded").length;const g=`${p}/${m.length} videos saved (${f} failed/missing).`;return{tool_name:o,text:g,content:[{type:"text",text:g}],details:{ok:true,path:i,total_succeeded:p,total_failed:f,per_request:m}}}};mg=re(null);Co=oe(mg,0,"MatrixBatchImageToVideoTool",Kv,Co);ne(mg,1,Co);import{basename as ZV}from"node:path";function Zv(e){if(typeof e!=="string")return null;const t=e.match(/^slot_(\d+)\./);return t?Number(t[1]):null}var Bv,hg;Bv=[X(Ui)];var No=class{constructor(t,r,n,o=null){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n;this.aigcRegisterServiceGetter=o}archonServer;ossMediaClient;workspaceScope;aigcRegisterServiceGetter;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Ui.name;const i=ee[o];const s={requests:r.requests.map((p,f)=>{const g={text:p.text,output_file:`slot_${f}.mp3`};if(p.voice_id!==void 0)g.voice_id=p.voice_id;if(p.speed!==void 0)g.speed=p.speed;if(p.volume!==void 0)g.volume=p.volume;if(p.pitch!==void 0)g.pitch=p.pitch;if(p.emotion!==void 0)g.emotion=p.emotion;return g})};const a=await Ze({toolName:o,path:i,input:s,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!a.ok)return a.result;const c=Array.isArray(a.response.success_items)?a.response.success_items:[];const l=Array.isArray(a.response.failed_items)?a.response.failed_items:[];const u=r.requests.map((p,f)=>({index:f,output_file_path:p.output_file_path,status:"missing"}));for(const p of c){const f=Zv(p.output_file);if(f===null||f<0||f>=u.length)continue;const g=u[f];const _=p.output_url??"";if(!_){g.status="failed";g.error="server reported success but output_url is empty";continue}try{const b=await it(_,g.output_file_path,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});g.status="downloaded";g.bytes=b.bytes;g.output_file_path=b.absolutePath;await $t({oss:{clean_oss_key:p.clean_oss_key,visible_oss_key:p.visible_oss_key},absolutePath:b.absolutePath,fileName:ZV(b.absolutePath),sizeBytes:b.bytes,mime:kt(b.absolutePath),sessionId:t.sessionId,toolName:o,registerService:this.aigcRegisterServiceGetter?this.aigcRegisterServiceGetter():null})}catch(b){if(b instanceof E){if(b.kind==="path_escapes_workspace"){return ce(o,i,b)}g.status="failed";g.error=b.message;continue}throw b}}for(const p of l){const f=Zv(p.output_file);if(f===null||f<0||f>=u.length)continue;const g=u[f];g.status="failed";g.error=p.error_msg??"unknown server error"}const d=u.filter(p=>p.status==="downloaded").length;const h=u.filter(p=>p.status!=="downloaded").length;const m=`${d}/${u.length} succeeded (${h} failed/missing).`;return{tool_name:o,text:m,content:[{type:"text",text:m}],details:{ok:true,path:i,total_succeeded:d,total_failed:h,per_request:u}}}};hg=re(null);No=oe(hg,0,"MatrixBatchSynthesizeSpeechTool",Bv,No);ne(hg,1,No);import{basename as BV}from"node:path";function Gv(e){if(typeof e!=="string")return null;const t=e.match(/^slot_(\d+)\./);return t?Number(t[1]):null}var Vv,gg;Vv=[X(Fi)];var Fo=class{constructor(t,r,n,o=null){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n;this.aigcRegisterServiceGetter=o}archonServer;ossMediaClient;workspaceScope;aigcRegisterServiceGetter;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Fi.name;const i=ee[o];const s={requests:r.requests.map((p,f)=>{const g={text:p.text,output_file:`slot_${f}.mp3`};if(p.voice_id!==void 0)g.voice_id=p.voice_id;if(p.speed!==void 0)g.speed=p.speed;if(p.volume!==void 0)g.volume=p.volume;if(p.pitch!==void 0)g.pitch=p.pitch;if(p.emotion!==void 0)g.emotion=p.emotion;return g})};const a=await Ze({toolName:o,path:i,input:s,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!a.ok)return a.result;const c=Array.isArray(a.response.success_items)?a.response.success_items:[];const l=Array.isArray(a.response.failed_items)?a.response.failed_items:[];const u=r.requests.map((p,f)=>({index:f,output_file_path:p.output_file_path,status:"missing"}));for(const p of c){const f=Gv(p.output_file);if(f===null||f<0||f>=u.length)continue;const g=u[f];const _=p.output_url??"";if(!_){g.status="failed";g.error="server reported success but output_url is empty";continue}try{const b=await it(_,g.output_file_path,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});g.status="downloaded";g.bytes=b.bytes;g.output_file_path=b.absolutePath;await $t({oss:{clean_oss_key:p.clean_oss_key,visible_oss_key:p.visible_oss_key},absolutePath:b.absolutePath,fileName:BV(b.absolutePath),sizeBytes:b.bytes,mime:kt(b.absolutePath),sessionId:t.sessionId,toolName:o,registerService:this.aigcRegisterServiceGetter?this.aigcRegisterServiceGetter():null})}catch(b){if(b instanceof E){if(b.kind==="path_escapes_workspace"){return ce(o,i,b)}g.status="failed";g.error=b.message;continue}throw b}}for(const p of l){const f=Gv(p.output_file);if(f===null||f<0||f>=u.length)continue;const g=u[f];g.status="failed";g.error=p.error_msg??"unknown server error"}const d=u.filter(p=>p.status==="downloaded").length;const h=u.filter(p=>p.status!=="downloaded").length;const m=`${d}/${u.length} succeeded (${h} failed/missing).`;return{tool_name:o,text:m,content:[{type:"text",text:m}],details:{ok:true,path:i,total_succeeded:d,total_failed:h,per_request:u}}}};gg=re(null);Fo=oe(gg,0,"MatrixBatchTextToAudioTool",Vv,Fo);ne(gg,1,Fo);import{basename as GV}from"node:path";function VV(e){const t=(e??"mp3").toLowerCase();return t==="wav"||t==="pcm"?t:"mp3"}function Hv(e){if(typeof e!=="string")return null;const t=e.match(/^slot_(\d+)\./);return t?Number(t[1]):null}var Wv,yg;Wv=[X(ji)];var jo=class{constructor(t,r,n,o=null){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n;this.aigcRegisterServiceGetter=o}archonServer;ossMediaClient;workspaceScope;aigcRegisterServiceGetter;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=ji.name;const i=ee[o];const s={requests:r.requests.map((p,f)=>{const g={prompt:p.prompt,output_file:`slot_${f}.${VV(p.format)}`};if(p.lyrics!==void 0)g.lyrics=p.lyrics;if(p.sample_rate!==void 0)g.sample_rate=p.sample_rate;if(p.bitrate!==void 0)g.bitrate=p.bitrate;if(p.format!==void 0)g.format=p.format;return g})};const a=await Ze({toolName:o,path:i,input:s,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!a.ok)return a.result;const c=Array.isArray(a.response.success_items)?a.response.success_items:[];const l=Array.isArray(a.response.failed_items)?a.response.failed_items:[];const u=r.requests.map((p,f)=>({index:f,output_file_path:p.output_file_path,status:"missing"}));for(const p of c){const f=Hv(p.output_file);if(f===null||f<0||f>=u.length)continue;const g=u[f];const _=p.output_url??"";if(!_){g.status="failed";g.error="server reported success but output_url is empty";continue}try{const b=await it(_,g.output_file_path,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});g.status="downloaded";g.bytes=b.bytes;g.output_file_path=b.absolutePath;await $t({oss:{clean_oss_key:p.clean_oss_key,visible_oss_key:p.visible_oss_key},absolutePath:b.absolutePath,fileName:GV(b.absolutePath),sizeBytes:b.bytes,mime:kt(b.absolutePath),sessionId:t.sessionId,toolName:o,registerService:this.aigcRegisterServiceGetter?this.aigcRegisterServiceGetter():null})}catch(b){if(b instanceof E){if(b.kind==="path_escapes_workspace"){return ce(o,i,b)}g.status="failed";g.error=b.message;continue}throw b}}for(const p of l){const f=Hv(p.output_file);if(f===null||f<0||f>=u.length)continue;const g=u[f];g.status="failed";g.error=p.error_msg??"unknown server error"}const d=u.filter(p=>p.status==="downloaded").length;const h=u.filter(p=>p.status!=="downloaded").length;const m=`${d}/${u.length} succeeded (${h} failed/missing).`;return{tool_name:o,text:m,content:[{type:"text",text:m}],details:{ok:true,path:i,total_succeeded:d,total_failed:h,per_request:u}}}};yg=re(null);jo=oe(yg,0,"MatrixBatchTextToMusicTool",Wv,jo);ne(yg,1,jo);import{basename as HV}from"node:path";function Jv(e){if(typeof e!=="string")return null;const t=e.match(/^slot_(\d+)\./);return t?Number(t[1]):null}var Xv,_g;Xv=[X(Ci)];var Do=class{constructor(t,r,n,o=null){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n;this.aigcRegisterServiceGetter=o}archonServer;ossMediaClient;workspaceScope;aigcRegisterServiceGetter;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Ci.name;const i=ee[o];const s=r.prompt_list.length;const a=r.output_file_path_list.length;if(s!==a){const g=`prompt_list (${s} items) and output_file_path_list (${a} items) must be the same length.`;return{tool_name:o,text:g,content:[{type:"text",text:g}],details:{ok:false,path:i,reason:"length_mismatch"}}}const c={prompt_list:r.prompt_list,output_file_list:r.prompt_list.map((g,_)=>`slot_${_}.mp4`)};if(r.duration_list!==void 0)c.duration_list=r.duration_list;if(r.resolution_list!==void 0)c.resolution_list=r.resolution_list;const l=await Ze({toolName:o,path:i,input:c,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!l.ok)return l.result;const u=Array.isArray(l.response.success_items)?l.response.success_items:[];const d=Array.isArray(l.response.failed_items)?l.response.failed_items:[];const h=r.output_file_path_list.map((g,_)=>({index:_,output_file_path:g,status:"missing"}));for(const g of u){const _=Jv(g.output_file);if(_===null||_<0||_>=h.length)continue;const b=h[_];const v=g.output_url??"";if(!v){b.status="failed";b.error="server reported success but output_url is empty";continue}try{const A=await it(v,b.output_file_path,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});b.status="downloaded";b.bytes=A.bytes;b.output_file_path=A.absolutePath;await $t({oss:{clean_oss_key:g.clean_oss_key,visible_oss_key:g.visible_oss_key},absolutePath:A.absolutePath,fileName:HV(A.absolutePath),sizeBytes:A.bytes,mime:kt(A.absolutePath),sessionId:t.sessionId,toolName:o,registerService:this.aigcRegisterServiceGetter?this.aigcRegisterServiceGetter():null})}catch(A){if(A instanceof E){if(A.kind==="path_escapes_workspace"){return ce(o,i,A)}b.status="failed";b.error=A.message;continue}throw A}}for(const g of d){const _=Jv(g.output_file);if(_===null||_<0||_>=h.length)continue;const b=h[_];b.status="failed";b.error=g.error_msg??"unknown server error"}const m=h.filter(g=>g.status==="downloaded").length;const p=h.filter(g=>g.status!=="downloaded").length;const f=`${m}/${h.length} succeeded (${p} failed/missing).`;return{tool_name:o,text:f,content:[{type:"text",text:f}],details:{ok:true,path:i,total_succeeded:m,total_failed:p,per_request:h}}}};_g=re(null);Do=oe(_g,0,"MatrixBatchTextToVideoTool",Xv,Do);ne(_g,1,Do);import{basename as WV}from"node:path";function Yv(e){if(typeof e!=="string")return null;const t=e.match(/^slot_(\d+)\./);return t?Number(t[1]):null}var Qv,xg;Qv=[X(zi)];var Uo=class{constructor(t,r,n,o=null){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n;this.aigcRegisterServiceGetter=o}archonServer;ossMediaClient;workspaceScope;aigcRegisterServiceGetter;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=zi.name;const i=ee[o];const s=[];try{for(const f of r.requests){if(f.input_image_path){const g=await gn(f.input_image_path,this.workspaceScope,this.ossMediaClient);s.push(Sr(g))}else{s.push(void 0)}}}catch(f){if(f instanceof E){return ce(o,i,f)}throw f}const a={requests:r.requests.map((f,g)=>{const _={prompt:f.prompt,output_file:`slot_${g}.mp4`};const b=s[g];if(b)_.input_image=b;if(f.reference_type!==void 0)_.reference_type=f.reference_type;if(f.duration!==void 0)_.duration=f.duration;if(f.resolution!==void 0)_.resolution=f.resolution;if(f.model!==void 0)_.model=f.model;return _})};const c=await Ze({toolName:o,path:i,input:a,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!c.ok)return c.result;const l=Array.isArray(c.response.success_items)?c.response.success_items:[];const u=Array.isArray(c.response.failed_items)?c.response.failed_items:[];const d=r.requests.map((f,g)=>({index:g,output_file_path:f.output_file_path,status:"missing"}));for(const f of l){const g=Yv(f.output_file);if(g===null||g<0||g>=d.length)continue;const _=d[g];const b=f.output_url??"";if(!b){_.status="failed";_.error="server reported success but output_url is empty";continue}try{const v=await it(b,_.output_file_path,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});_.status="downloaded";_.bytes=v.bytes;_.output_file_path=v.absolutePath;await $t({oss:{clean_oss_key:f.clean_oss_key,visible_oss_key:f.visible_oss_key},absolutePath:v.absolutePath,fileName:WV(v.absolutePath),sizeBytes:v.bytes,mime:kt(v.absolutePath),sessionId:t.sessionId,toolName:o,registerService:this.aigcRegisterServiceGetter?this.aigcRegisterServiceGetter():null})}catch(v){if(v instanceof E){if(v.kind==="path_escapes_workspace"){return ce(o,i,v)}_.status="failed";_.error=v.message;continue}throw v}}for(const f of u){const g=Yv(f.output_file);if(g===null||g<0||g>=d.length)continue;const _=d[g];_.status="failed";_.error=f.error_msg??"unknown server error"}const h=d.filter(f=>f.status==="downloaded").length;const m=d.filter(f=>f.status!=="downloaded").length;const p=`${h}/${d.length} videos saved (${m} failed/missing).`;return{tool_name:o,text:p,content:[{type:"text",text:p}],details:{ok:true,path:i,total_succeeded:h,total_failed:m,per_request:d}}}};xg=re(null);Uo=oe(xg,0,"MatrixGenVideosTool",Qv,Uo);ne(xg,1,Uo);var e$,bg;e$=[X(Ao)];var Lo=class{constructor(t,r,n){this.archonServer=t;this._ossMediaClient=r;this._workspaceScope=n}archonServer;_ossMediaClient;_workspaceScope;execute(t,r,n){return wr({toolName:Ao.name,path:ee[Ao.name],input:r,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}})}};bg=re(null);Lo=oe(bg,0,"MatrixGetVoiceListTool",e$,Lo);ne(bg,1,Lo);function JV(e){const t=["# Reverse Image Search Results",""];if(e.length===0){t.push("_No results._","");return t.join("\n")}e.forEach((r,n)=>{const o=`## ${n+1}. ${r.title??"(untitled)"}`;t.push(o);if(r.link)t.push(`- **Link:** ${r.link}`);if(r.source)t.push(`- **Source:** ${r.source}`);if(r.image_url)t.push(`- **Image:** ${r.image_url}`);if(r.snippet)t.push(`- **Snippet:** ${r.snippet}`);t.push("")});return t.join("\n")}var t$,Ig;t$=[X(Mi)];var qo=class{constructor(t,r,n){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n}archonServer;ossMediaClient;workspaceScope;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Mi.name;const i=ee[o];try{const s=await gn(r.image_file_path,this.workspaceScope,this.ossMediaClient,{forceRemoteUrl:true});const a={image_url:qi(s)};const c=await Ze({toolName:o,path:i,input:a,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!c.ok)return c.result;const l=Array.isArray(c.response.data)?c.response.data:[];const u=JV(l);const d=await pg(u,r.output_file_path,this.workspaceScope);const h=`wrote ${l.length} result(s) (${d.bytes} bytes) to ${d.absolutePath}.`;return{tool_name:o,text:h,content:[{type:"text",text:h}],details:{ok:true,path:i,output_file_path:d.absolutePath,bytes:d.bytes,result_count:l.length}}}catch(s){if(s instanceof E){return ce(o,i,s)}throw s}}};Ig=re(null);qo=oe(Ig,0,"MatrixImageReverseSearchTool",t$,qo);ne(Ig,1,qo);import{basename as XV}from"node:path";function r$(e){if(typeof e!=="string")return null;const t=e.match(/^slot_(\d+)\./);return t?Number(t[1]):null}var n$,wg;n$=[X(ki)];var Ko=class{constructor(t,r,n,o=null){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n;this.aigcRegisterServiceGetter=o}archonServer;ossMediaClient;workspaceScope;aigcRegisterServiceGetter;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=ki.name;const i=ee[o];const s=[];try{for(const f of r.requests){if(f.input_file_paths&&f.input_file_paths.length>0){const g=await yn(f.input_file_paths,this.workspaceScope,this.ossMediaClient,{forceRemoteUrl:true});s.push(g.map(_=>qi(_)))}else{s.push([])}}}catch(f){if(f instanceof E){return ce(o,i,f)}throw f}const a={requests:r.requests.map((f,g)=>{const _={prompt:f.prompt,output_file:`slot_${g}.png`};if(s[g].length>0){_.input_urls=s[g]}if(f.aspect_ratio!==void 0)_.aspect_ratio=f.aspect_ratio;if(f.resolution!==void 0)_.resolution=f.resolution;return _})};const c=await Ze({toolName:o,path:i,input:a,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!c.ok)return c.result;const l=Array.isArray(c.response.success_items)?c.response.success_items:[];const u=Array.isArray(c.response.failed_items)?c.response.failed_items:[];const d=r.requests.map((f,g)=>({index:g,output_file_path:f.output_file_path,status:"missing"}));for(const f of l){const g=r$(f.output_file);if(g===null||g<0||g>=d.length)continue;const _=d[g];if(f.text_response)_.text_response=f.text_response;const b=f.output_url??"";if(!b||f.has_image_output===false){_.status="failed";_.error=f.text_response?`server returned text only (no image): ${f.text_response}`:"server reported success but no output_url";continue}try{const v=await it(b,_.output_file_path,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});_.status="downloaded";_.bytes=v.bytes;_.output_file_path=v.absolutePath;await $t({oss:{clean_oss_key:f.clean_oss_key,visible_oss_key:f.visible_oss_key},absolutePath:v.absolutePath,fileName:XV(v.absolutePath),sizeBytes:v.bytes,mime:kt(v.absolutePath),sessionId:t.sessionId,toolName:o,registerService:this.aigcRegisterServiceGetter?this.aigcRegisterServiceGetter():null})}catch(v){if(v instanceof E){if(v.kind==="path_escapes_workspace"){return ce(o,i,v)}_.status="failed";_.error=v.message;continue}throw v}}for(const f of u){const g=r$(f.output_file);if(g===null||g<0||g>=d.length)continue;const _=d[g];_.status="failed";const b=f.err_code?` [${f.err_code}]`:"";_.error=(f.error_msg??"unknown server error")+b}const h=d.filter(f=>f.status==="downloaded").length;const m=d.filter(f=>f.status!=="downloaded").length;const p=`${h}/${d.length} images saved (${m} failed/missing).`;return{tool_name:o,text:p,content:[{type:"text",text:p}],details:{ok:true,path:i,total_succeeded:h,total_failed:m,per_request:d}}}};wg=re(null);Ko=oe(wg,0,"MatrixImageSynthesizeTool",n$,Ko);ne(wg,1,Ko);import{extname as YV}from"node:path";var o$=".jpg";function QV(e){try{const t=YV(new URL(e).pathname).toLowerCase();if(!t||t.length>5)return o$;return t}catch{return o$}}var i$,Sg;i$=[X(Ri)];var Zo=class{constructor(t,r,n){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n}archonServer;ossMediaClient;workspaceScope;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Ri.name;const i=ee[o];const s={queries:r.queries.map(m=>({query:m.query,...m.prompt!==void 0?{prompt:m.prompt}:{}}))};if(r.providers!==void 0)s.providers=r.providers;const a=await Ze({toolName:o,path:i,input:s,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!a.ok)return a.result;const c=Array.isArray(a.response.results)?a.response.results:[];const l=[];for(let m=0;m<r.queries.length;m++){const p=r.queries[m];const f=c[m];const g={query:p.query,output_dir_path:p.output_dir_path,downloaded:[],failed:[]};if(f?.error)g.server_error=f.error;const _=Array.isArray(f?.images)?f.images:[];for(let b=0;b<_.length;b++){const v=_[b]?.image_url;if(!v){g.failed.push({index:b,image_url:"",reason:"missing image_url in response"});continue}const A=`${p.output_dir_path.replace(/\/+$/,"")}/${b}${QV(v)}`;try{const $=await it(v,A,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});g.downloaded.push({index:b,image_url:v,local_path:$.absolutePath,bytes:$.bytes})}catch($){if($ instanceof E){if($.kind==="path_escapes_workspace"){return ce(o,i,$)}g.failed.push({index:b,image_url:v,reason:$.message});continue}throw $}}l.push(g)}const u=l.reduce((m,p)=>m+p.downloaded.length,0);const d=l.reduce((m,p)=>m+p.failed.length,0);const h=`${u} image(s) saved across ${l.length} query(ies); ${d} failure(s).`;return{tool_name:o,text:h,content:[{type:"text",text:h}],details:{ok:true,path:i,total_downloaded:u,total_failed:d,per_query:l}}}};Sg=re(null);Zo=oe(Sg,0,"MatrixImagesSearchAndDownloadTool",i$,Zo);ne(Sg,1,Zo);var s$,Tg;s$=[X(Mo)];var Bo=class{constructor(t,r,n){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n}archonServer;ossMediaClient;workspaceScope;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Mo.name;const i=ee[o];try{const s=await yn(r.image_info.map(c=>c.file_path),this.workspaceScope,this.ossMediaClient);const a={image_info:r.image_info.map((c,l)=>Sr(s[l],c.prompt))};return await wr({toolName:o,path:i,input:a,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}})}catch(s){if(s instanceof E){return ce(o,i,s)}throw s}}};Tg=re(null);Bo=oe(Tg,0,"MatrixImagesUnderstandTool",s$,Bo);ne(Tg,1,Bo);var a$,Pg;a$=[X(Ei)];var Go=class{constructor(t,r,n){this.archonServer=t;this.mediaClient=r;this.workspaceScope=n}archonServer;mediaClient;workspaceScope;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Ei.name;const i=ee[o];if(!ar(r.model)&&r.model!==xt){const c=`Invalid video query: model must be ${Dr} or ${xt}.`;return{tool_name:o,text:c,content:[{type:"text",text:c}],isError:true,details:{ok:false,path:i,reason:"invalid_video_request"}}}const s=await Ze({toolName:o,path:i,input:{task_id:r.task_id,model:r.model},ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!s.ok)return s.result;if(s.response.status==="succeeded"){const c=typeof s.response.video_url==="string"?s.response.video_url:"";if(!c){const l="Video task succeeded but the server response did not include video_url, so no local file was written.";return{tool_name:o,text:l,content:[{type:"text",text:l}],isError:true,details:{ok:false,path:i,reason:"missing_video_url",response:s.response}}}try{const l=await it(c,r.output_file_path,this.workspaceScope,this.mediaClient,{...n?{signal:n}:{}});const u=`Video generation succeeded. Wrote ${l.bytes} bytes to ${l.absolutePath}.`;return{tool_name:o,text:u,content:[{type:"text",text:u}],details:{ok:true,path:i,response:s.response,output_file_path:l.absolutePath,bytes:l.bytes}}}catch(l){if(l instanceof E){return ce(o,i,l)}throw l}}const a=JSON.stringify(s.response,null,2);return{tool_name:o,text:a,content:[{type:"text",text:a}],details:{ok:true,path:i,response:s.response}}}};Pg=re(null);Go=oe(Pg,0,"MatrixQueryVideoGenerationTool",a$,Go);ne(Pg,1,Go);import{stat as r9}from"node:fs/promises";import{isIP as n9}from"node:net";import{extname as o9}from"node:path";import{fileURLToPath as i9}from"node:url";import{open as e9}from"node:fs/promises";async function l$(e){const t=await e9(e,"r");try{const r=(await t.stat()).size;for await(const n of c$(t,0,r)){if(n.type!=="moov")continue;const o=n.start+n.headerSize;const i=n.start+n.size;for await(const s of c$(t,o,i)){if(s.type==="mvhd")return t9(t,s)}}return void 0}finally{await t.close()}}async function*c$(e,t,r){let n=t;while(n+8<=r){const o=await Og(e,n,8);const i=o.readUInt32BE(0);const s=o.toString("ascii",4,8);let a=8;let c;if(i===1){const l=await Og(e,n+8,8);const u=l.readBigUInt64BE(0);if(u>BigInt(Number.MAX_SAFE_INTEGER))return;c=Number(u);a=16}else{c=i===0?r-n:i}if(c<a||n+c>r)return;yield{type:s,start:n,size:c,headerSize:a};n+=c}}async function t9(e,t){const r=t.size-t.headerSize;if(r<20)return void 0;const n=await Og(e,t.start+t.headerSize,Math.min(r,32));const o=n.readUInt8(0);if(o===0&&n.length>=20){return u$(n.readUInt32BE(12),BigInt(n.readUInt32BE(16)))}if(o===1&&n.length>=32){return u$(n.readUInt32BE(20),n.readBigUInt64BE(24))}return void 0}function u$(e,t){if(e<=0)return void 0;const r=Number(t)/e;return Number.isFinite(r)&&r>0?r:void 0}async function Og(e,t,r){const n=Buffer.allocUnsafe(r);const{bytesRead:o}=await e.read(n,0,r,t);if(o!==r)throw new Error("Unexpected end of ISO BMFF file");return n}var s9="16:9";var a9=new Set(["21:9","16:9","4:3","1:1","3:4","9:16"]);var c9=new Set([...a9,"adaptive"]);var y$={forceRemoteUrl:true,category:"user_file_upload_tmp"};var vg=new Set([".jpg",".jpeg",".png",".webp",".heic",".heif"]);var u9=new Set([".jpg",".png",".webp"]);var l9=new Set([".mp4",".mov"]);var d9=new Set([".wav",".mp3"]);var $g=30*1024*1024;var d$=50*1024*1024;var p9=15*1024*1024;var kg=new Set;var g$,Mg;g$=[X(Ai)];var Vo=class{constructor(t,r,n){this.archonServer=t;this.videoMediaClient=r;this.workspaceScope=n}archonServer;videoMediaClient;workspaceScope;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Ai.name;const i=ee[o];const s=g9(r);if(s)return x9(o,i,s);const a=r.input_image_path!==void 0||r.last_frame_image_path!==void 0;const c=y9(r);const l=ar(r.model)?a?"adaptive":c?r.ratio??"adaptive":r.ratio??s9:r.ratio;const u=ar(r.model)?r.resolution??"2K":r.resolution;const d={...r,ratio:l,resolution:u};const h=`${t.sessionId}:${t.turnId}:${zg(d)}`;if(kg.has(h)){return m$(o,i)}let m;let p;let f;let g;let _;try{if(r.input_image_path){m=await wd(r.input_image_path,this.workspaceScope,this.videoMediaClient,$g,"input_image_path")}if(r.last_frame_image_path){p=await wd(r.last_frame_image_path,this.workspaceScope,this.videoMediaClient,$g,"last_frame_image_path")}f=await p$(r.reference_image_paths,this.workspaceScope,this.videoMediaClient,$g,"reference_image_paths");g=await f9(r.reference_video_paths,r.reference_video_duration_seconds,this.workspaceScope,this.videoMediaClient);_=await p$(r.reference_audio_paths,this.workspaceScope,this.videoMediaClient,p9,"reference_audio_paths")}catch(A){if(A instanceof E){return ce(o,i,A)}throw A}const b={model:r.model,prompt:r.prompt};if(m)b.input_image=m;if(m){b.reference_type=r.reference_type??"first_frame"}if(p)b.last_frame_image=p;if(f!==void 0)b.reference_images=f;if(g!==void 0)b.reference_videos=g;if(_!==void 0)b.reference_audios=_;b.duration=r.duration;if(u!==void 0)b.resolution=u;if(l!==void 0){b.ratio=l}if(r.aigc_watermark!==void 0)b.aigc_watermark=r.aigc_watermark;if(kg.has(h)){return m$(o,i)}kg.add(h);let v;try{v=await Ze({toolName:o,path:i,input:b,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}})}catch(A){return h$(o,i,A)}if(!v.ok)return h$(o,i,v.result.text,v.result);return b9(o,i,v.response)}};Mg=re(null);Vo=oe(Mg,0,"MatrixSubmitVideoGenerationTool",g$,Vo);ne(Mg,1,Vo);async function p$(e,t,r,n,o){if(e===void 0)return void 0;const i=[];for(const[s,a]of e.entries()){i.push(await wd(a,t,r,n,`${o}[${s}]`))}return i}async function f9(e,t,r,n){if(e===void 0)return void 0;const o=[];for(const[s,a]of e.entries()){const c=t?.[s];if(Sd(a)&&c===void 0){throw new E("input_upload_failed",`reference_video_duration_seconds[${s}] is required for public reference video URL '${a}'.`)}let l;let u=c;if(Sd(a)){l=await wd(a,r,n,d$,`reference_video_paths[${s}]`)}else{const d=await _$(a,r,d$,`reference_video_paths[${s}]`);let h;try{h=await l$(d.absolutePath)}catch(p){throw new E("input_upload_failed",`Could not read duration_seconds for reference_video_paths[${s}] '${a}'. Provide a valid MP4/MOV workspace file or use a public URL with reference_video_duration_seconds[${s}].`,p)}if(h===void 0){throw new E("input_upload_failed",`Could not read duration_seconds for reference_video_paths[${s}] '${a}'. Provide a valid MP4/MOV workspace file or use a public URL with reference_video_duration_seconds[${s}].`)}u=h;const m=await gn(a,r,n,y$);l=x$(m);if(l.url&&!Ag(l.url)){throw new E("input_upload_failed",`Failed to prepare video media '${a}': temporary URL host is not publicly reachable.`)}}if(u===void 0){throw new E("input_upload_failed",`Could not read duration_seconds for reference_video_paths[${s}] '${a}'. Provide reference_video_duration_seconds[${s}] explicitly.`)}if(u<2||u>15){throw new E("input_upload_failed",`reference video duration_seconds must be between 2 and 15; reference_video_paths[${s}] is ${u}.`)}o.push({...l,duration_seconds:u})}const i=o.reduce((s,a)=>s+a.duration_seconds,0);if(i>15){throw new E("input_upload_failed",`reference video duration_seconds total must be at most 15; received ${i}.`)}return o}async function wd(e,t,r,n,o){if(Sd(e)){if(!Ag(e)){throw new E("input_upload_failed",`Failed to prepare video media '${e}': URL host is not publicly reachable.`)}return{url:e}}await _$(e,t,n,o);const i=x$(await gn(e,t,r,y$));if(i.url&&!Ag(i.url)){throw new E("input_upload_failed",`Failed to prepare video media '${e}': temporary URL host is not publicly reachable.`)}return i}async function _$(e,t,r,n){let o;try{o=e.startsWith("file://")?i9(e):e}catch(a){throw new E("input_not_found",`Input file URL is invalid: '${e}'. Provide a workspace-relative path or valid file:// URL.`,a)}let i;try{i=await xd(o,t)}catch(a){throw new E("path_escapes_workspace",`Input file path '${e}' is outside the workspace. Provide a path under one of: '${vc(t).join("', '")}'.`,a)}let s;try{s=await r9(i)}catch(a){throw new E("input_not_found",`Input file does not exist at '${i}'. Make sure the file was written before calling this tool.`,a)}if(!s.isFile()){throw new E("input_not_found",`Input path is not a file: ${i}`)}if(s.size>r){throw new E("input_upload_failed",`${n} is ${f$(s.size)}, above the Video Generation V2 limit of ${f$(r)}.`)}return{absolutePath:i,bytes:s.size}}function f$(e){return`${(e/(1024*1024)).toFixed(1)} MiB`}function x$(e){return{url:qi(e),...e.mimeType?{mime_type:e.mimeType}:{}}}function Sd(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return false}}function Ag(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return false;const r=t.hostname.toLowerCase().replace(/^\[|\]$/gu,"");const n=n9(r);if(n===4)return m9(r);if(n===6)return h9(r);if(r==="localhost"||!r.includes(".")||[".localhost",".local",".internal",".home.arpa",".invalid"].some(o=>r.endsWith(o))||r.endsWith("-internal.aliyuncs.com")){return false}return true}catch{return false}}function m9(e){const t=e.split(".").map(Number);if(t.length!==4||t.some(i=>!Number.isInteger(i)||i<0||i>255)){return false}const[r=0,n=0,o=0]=t;if(r===0||r===10||r===127||r>=224)return false;if(r===100&&n>=64&&n<=127)return false;if(r===169&&n===254)return false;if(r===172&&n>=16&&n<=31)return false;if(r===192&&n===168)return false;if(r===192&&n===0&&[0,2].includes(o))return false;if(r===198&&[18,19,51].includes(n))return false;if(r===203&&n===0&&o===113)return false;return true}function h9(e){const t=e.toLowerCase();return!(t==="::"||t==="::1"||t.startsWith("fc")||t.startsWith("fd")||/^fe[89ab]/u.test(t)||t.startsWith("ff")||t.startsWith("2001:db8:")||t.startsWith("::ffff:"))}function g9(e){if(!ar(e.model)&&e.model!==xt){return`model must be ${Dr} or ${xt}`}if(!e.prompt?.trim())return"prompt is required";if(Array.from(e.prompt).length>yd){return`prompt may contain at most ${yd} characters`}if(!Number.isInteger(e.duration)){return"duration is required after model selection and must be an integer number of seconds"}if(ar(e.model)&&(e.duration<4||e.duration>15)){return`${Dr} duration must be between 4 and 15 seconds`}const t=Id(e.reference_image_paths,"reference_image_paths",9)??Id(e.reference_video_paths,"reference_video_paths",3)??Id(e.reference_video_duration_seconds,"reference_video_duration_seconds",3)??Id(e.reference_audio_paths,"reference_audio_paths",sg);if(t)return t;if(e.reference_video_duration_seconds!==void 0&&e.reference_video_paths===void 0){return"reference_video_duration_seconds requires reference_video_paths"}if(e.reference_video_duration_seconds!==void 0&&e.reference_video_duration_seconds.length!==e.reference_video_paths?.length){return"reference_video_duration_seconds must contain the same number of items as reference_video_paths"}if(e.reference_video_duration_seconds!==void 0){for(const[a,c]of e.reference_video_duration_seconds.entries()){if(!Number.isFinite(c)||c<2||c>15){return`reference_video_duration_seconds[${a}] must be between 2 and 15`}}const s=e.reference_video_duration_seconds.reduce((a,c)=>a+c,0);if(s>15){return`reference_video_duration_seconds total must be at most 15; received ${s}`}}const r=(e.reference_image_paths?.length??0)+(e.reference_video_paths?.length??0)+(e.reference_audio_paths?.length??0);if(ar(e.model)&&r>ag){return`reference collections may contain at most ${ag} files in total`}const n=e.reference_image_paths!==void 0||e.reference_video_paths!==void 0||e.reference_audio_paths!==void 0;if(e.model===xt&&n){return`${xt} accepts exactly one input_image_path; reference collections are supported only by ${Dr}`}if(e.model===xt&&!e.input_image_path?.trim()){return`${xt} requires exactly one input_image_path`}if(n&&(e.input_image_path!==void 0||e.last_frame_image_path!==void 0||e.reference_type!==void 0)){return"reference collections cannot be combined with keyframe image paths or reference_type"}if((e.reference_audio_paths?.length??0)>0&&(e.reference_image_paths?.length??0)===0&&(e.reference_video_paths?.length??0)===0){return"reference_audio_paths cannot be used alone; add at least one reference image or video"}if(e.reference_type!==void 0&&e.input_image_path===void 0){return"reference_type requires input_image_path"}if(e.last_frame_image_path!==void 0){if(!ar(e.model)){return"last_frame_image_path is supported only by Alran-H3"}if(e.input_image_path===void 0){return"last_frame_image_path requires input_image_path as the first frame"}if(e.reference_type!==void 0&&e.reference_type!=="first_frame"){return"first+last-frame mode requires reference_type first_frame or omitted"}}if(ar(e.model)&&e.reference_type!==void 0&&e.reference_type!=="first_frame"&&e.reference_type!=="last_frame"){return`${Dr} supports first_frame or last_frame keyframe mode`}if(e.model===xt&&e.reference_type!==void 0&&e.reference_type!=="first_frame"&&e.reference_type!=="subject"){return`${xt} supports first_frame or legacy subject mode`}if(ar(e.model)&&e.resolution!==void 0&&e.resolution!=="768P"&&e.resolution!=="2K"){return`${Dr} supports 768P or 2K`}if(e.model===xt&&e.resolution!==void 0&&e.resolution!=="768P"&&e.resolution!=="1080P"){return`${xt} supports 768P or 1080P`}if(e.model===xt){if(e.duration!==6&&e.duration!==10){return`${xt} supports 6s or 10s`}if(e.duration===10&&e.resolution==="1080P"){return`${xt} 10s generation requires 768P`}}if(ar(e.model)&&e.ratio!==void 0&&!c9.has(e.ratio)){return`${Dr} ratio must be adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16`}const o=e.input_image_path!==void 0||e.last_frame_image_path!==void 0;if(ar(e.model)&&!o&&!n&&e.ratio==="adaptive"){return`${Dr} text-only ratio cannot be adaptive`}const i=Eg(e.input_image_path,"input_image_path",ar(e.model)?vg:u9)??Eg(e.last_frame_image_path,"last_frame_image_path",vg)??Rg(e.reference_image_paths,"reference_image_paths",vg)??Rg(e.reference_video_paths,"reference_video_paths",l9)??Rg(e.reference_audio_paths,"reference_audio_paths",d9);return i}function y9(e){return e.reference_image_paths!==void 0||e.reference_video_paths!==void 0||e.reference_audio_paths!==void 0}function Id(e,t,r){if(e===void 0)return void 0;if(e.length===0)return`${t} must be a non-empty array when provided`;if(r!==void 0&&e.length>r){return`${t} may contain at most ${r} items`}return void 0}function Rg(e,t,r){if(e===void 0)return void 0;for(let n=0;n<e.length;n+=1){const o=Eg(e[n],`${t}[${n}]`,r);if(o)return o}return void 0}function Eg(e,t,r){if(e===void 0)return void 0;const n=o9(_9(e)).toLowerCase();if(!r.has(n)){return`${t} must use ${[...r].join(", ")} media`}return void 0}function _9(e){if(Sd(e))return new URL(e).pathname;return e.split(/[?#]/u,1)[0]??""}function x9(e,t,r){const n=`Invalid video request: ${r}. No file was read and no paid task was submitted.`;return{tool_name:e,text:n,content:[{type:"text",text:n}],isError:true,details:{ok:false,path:t,reason:"invalid_video_request"}}}function m$(e,t){const r="Duplicate paid submission blocked: this exact video request was already attempted in this turn. Do not wait and do not call submit_video_generation again. If the original attempt returned a task_id, call query_video_generation with that task_id and the same model. If it returned an error, report that original failure; never infer that a task was created. Retry only after a new explicit user request in a later turn.";return{tool_name:e,text:r,content:[{type:"text",text:r}],isError:true,details:{ok:false,path:t,reason:"duplicate_paid_submission"}}}function h$(e,t,r,n){const o=r instanceof Error?r.message:String(r);const i=`Video submit failed: ${o}. No task_id was returned. Do not infer that a task was created, do not wait for a duplicate lock to expire, and do not retry submit_video_generation automatically. Report this failure to the user. Retry only after a new explicit user request in a later turn.`;return{tool_name:e,text:i,content:[{type:"text",text:i}],isError:true,details:{...n?.details??{},ok:false,path:t,reason:"video_submit_failed",...n?.details?{upstream:n.details}:{}}}}function b9(e,t,r){const n=JSON.stringify(r,null,2);return{tool_name:e,text:n,content:[{type:"text",text:n}],details:{ok:true,path:t,response:r}}}function zg(e){if(Array.isArray(e))return`[${e.map(t=>zg(t)).join(",")}]`;if(e&&typeof e==="object"){const t=Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r.localeCompare(n));return`{${t.map(([r,n])=>`${JSON.stringify(r)}:${zg(n)}`).join(",")}}`}return JSON.stringify(e)??"null"}var b$,Cg;b$=[X(eo)];var Ho=class{constructor(t,r,n){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n}archonServer;ossMediaClient;workspaceScope;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=ee[eo.name];try{const i=await gn(r.audio_info.file_path,this.workspaceScope,this.ossMediaClient);const s={audio_info:Sr(i,r.audio_info.prompt)};return await wr({toolName:eo.name,path:o,input:s,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}})}catch(i){if(i instanceof E){return ce(eo.name,o,i)}throw i}}};Cg=re(null);Ho=oe(Cg,0,"MatrixTranscribeAudioTool",b$,Ho);ne(Cg,1,Ho);import{basename as I9}from"node:path";var I$,Ng;I$=[X(Di)];var Wo=class{constructor(t,r,n,o=null){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n;this.aigcRegisterServiceGetter=o}archonServer;ossMediaClient;workspaceScope;aigcRegisterServiceGetter;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Di.name;const i=ee[o];const{output_file_path:s,...a}=r;const c=await Ze({toolName:o,path:i,input:a,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}});if(!c.ok)return c.result;const l=typeof c.response.output_url==="string"?c.response.output_url:"";if(!l){const u=typeof c.response.error==="string"?c.response.error:"";const d=`server response missing output_url${u?` (server error: ${u})`:". Cannot download generated audio."}`;return{tool_name:o,text:d,content:[{type:"text",text:d}],details:{ok:false,path:i,reason:"missing_output_url",response:c.response}}}try{const u=await it(l,r.output_file_path,this.workspaceScope,this.ossMediaClient,{...n?{signal:n}:{}});const d=typeof c.response.clean_oss_key==="string"?c.response.clean_oss_key:void 0;const h=typeof c.response.visible_oss_key==="string"?c.response.visible_oss_key:void 0;await $t({oss:{clean_oss_key:d,visible_oss_key:h},absolutePath:u.absolutePath,fileName:I9(u.absolutePath),sizeBytes:u.bytes,mime:kt(u.absolutePath),sessionId:t.sessionId,toolName:o,registerService:this.aigcRegisterServiceGetter?this.aigcRegisterServiceGetter():null});const m=`wrote ${u.bytes} bytes to ${u.absolutePath}.`;return{tool_name:o,text:m,content:[{type:"text",text:m}],details:{ok:true,path:i,output_file_path:u.absolutePath,bytes:u.bytes}}}catch(u){if(u instanceof E){return ce(o,i,u)}throw u}}};Ng=re(null);Wo=oe(Ng,0,"MatrixSynthesizeSpeechTool",I$,Wo);ne(Ng,1,Wo);var w$,Fg;w$=[X(Eo)];var Jo=class{constructor(t,r,n){this.archonServer=t;this.ossMediaClient=r;this.workspaceScope=n}archonServer;ossMediaClient;workspaceScope;async execute(t,r,n){if(n?.aborted)throw new Error("Operation aborted");const o=Eo.name;const i=ee[o];try{const s=await yn(r.video_info.map(c=>c.file_path),this.workspaceScope,this.ossMediaClient);const a={video_info:r.video_info.map((c,l)=>Sr(s[l],c.prompt))};return await wr({toolName:o,path:i,input:a,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}})}catch(s){if(s instanceof E){return ce(o,i,s)}throw s}}};Fg=re(null);Jo=oe(Fg,0,"MatrixVideosUnderstandTool",w$,Jo);ne(Fg,1,Jo);var S$,jg;S$=[X(Xs)];var Xo=class{constructor(t,r,n){this.archonServer=t;this._ossMediaClient=r;this._workspaceScope=n}archonServer;_ossMediaClient;_workspaceScope;execute(t,r,n){return wr({toolName:Xs.name,path:ee[Xs.name],input:r,ctx:t,archonServer:this.archonServer,...n?{signal:n}:{}})}};jg=re(null);Xo=oe(jg,0,"MatrixWebSearchTool",S$,Xo);ne(jg,1,Xo);var Ppe=[Mo.name,ki.name,Ri.name,Mi.name,Ai.name,Ei.name,zi.name,Ci.name,Ni.name,Ao.name,Fi.name,ji.name,Di.name,Ui.name,Li.name,Eo.name,eo.name];function T$(e,t,r,n=null,o={}){const i=[at(new Xo(e,t,r)),at(new Bo(e,t,r)),at(new Ko(e,t,r,n)),at(new Zo(e,t,r)),at(new qo(e,t,r)),at(new Vo(e,o.videoMediaClient??t,r)),at(new Go(e,t,r)),at(new Uo(e,t,r,n)),at(new Do(e,t,r,n)),at(new Co(e,t,r,n)),at(new Lo(e,t,r)),at(new Fo(e,t,r,n)),at(new jo(e,t,r,n)),at(new Wo(e,t,r,n)),at(new No(e,t,r,n)),at(new zo(e,t,r)),at(new Jo(e,t,r)),at(new Ho(e,t,r))];const{matrixLogger:s}=o;if(!s)return i;return i.map(a=>w9(a,s))}function w9(e,t){return{def:e.def,impl:{execute(r,n,o,i){return e.impl.execute({...r,matrixLogger:r.matrixLogger??t},n,o,i)}}}}var Ope={supportImage:[Mo.name],supportVideo:[Eo.name]};var R9=600*1024;var $$=500*1024*1024;var M9="/alran/api/v1/mcp/get_upload_url";var k$=15e5;var Ys=class{constructor(t){this.client=t}client;async uploadFile(t,r={}){let n;try{n=await P$(t)}catch(l){throw new Gt("file_not_found",`Input file does not exist: ${t}`,l)}if(!n.isFile()){throw new Gt("file_not_found",`Input path is not a file: ${t}`)}if(n.size>$$){throw new Gt("file_too_large",`${O$(t)} is ${R$(n.size)}, above the Matrix upload limit of ${R$($$)}.`)}const o=E9(r.filename??O$(t));const i=r.mimeType??A9(o);if(!r.forceRemoteUrl&&n.size<=R9){const l=(await O9(t)).toString("base64");return{ossKey:"",inlineData:l,mimeType:i,bytes:n.size}}const s=await this.client.postGatewayJson(M9,{filename:o,mime_type:i,...r.ttlSeconds!==void 0?{ttl_seconds:r.ttlSeconds}:{},...r.category!==void 0?{category:r.category}:{},size_bytes:n.size},void 0,k$);if((s.code??0)!==0||!s.put_url||!s.cdn_url){const l=s.error||s.message||"no put_url returned";throw new Gt("upload_failed",`Matrix get_upload_url failed: code=${s.code??"unknown"} ${l}`)}const a=s.content_type||i;const c=v$.toWeb(S9(t));try{await this.client.putBytes(s.put_url,c,{"Content-Type":a,"Content-Length":String(n.size)},void 0,k$)}catch(l){throw new Gt("upload_failed",Ug(l),l)}return{ossKey:s.oss_key??"",signedUrl:s.cdn_url,mimeType:a,bytes:n.size}}async downloadToFile(t,r,n){let o;try{o=await this.client.getStream(t,n?.signal,n?.timeoutMs)}catch(i){throw z9(i)}try{await P9(v9(r),{recursive:true});await k9(v$.fromWeb(o.body),T9(r));const i=await P$(r);return{bytes:i.size}}catch(i){if(n?.signal?.aborted){throw new Gt("aborted","Matrix download aborted",i)}throw new Gt("write_failed",Ug(i),i)}finally{o.dispose()}}};function A9(e){const t=$9(e).toLowerCase();return C9[t]??"application/octet-stream"}function E9(e){if(!e)return"file";const t=e.lastIndexOf(".");let r;let n;if(t<=0||t===e.length-1){r=Dg(e);n=""}else{r=Dg(e.slice(0,t));n=Dg(e.slice(t+1))}if(!r)r="file";if(t>0&&t<e.length-1){if(!n)n="bin";return`${r}.${n}`}return r}function Dg(e){return e.replace(/[^A-Za-z0-9_-]/gu,"_")}function R$(e){return`${(e/(1024*1024)).toFixed(1)} MiB`}function z9(e){if(e instanceof Gt)return e;if(e instanceof Error&&e.name==="AbortError"){return new Gt("aborted","Matrix download aborted",e)}return new Gt("download_failed",Ug(e),e)}function Ug(e){if(e instanceof Error)return e.message||e.name;if(typeof e==="string")return e;return String(e)}var C9={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp",".svg":"image/svg+xml",".heic":"image/heic",".mp3":"audio/mpeg",".wav":"audio/wav",".ogg":"audio/ogg",".flac":"audio/flac",".m4a":"audio/mp4",".aac":"audio/aac",".mp4":"video/mp4",".mov":"video/quicktime",".webm":"video/webm",".mkv":"video/x-matroska",".avi":"video/x-msvideo",".pdf":"application/pdf",".txt":"text/plain",".json":"application/json",".zip":"application/zip"};function M$(e){const t=e.executor??new Tn({...e.baseUrl?{baseUrl:e.baseUrl}:{},...e.accessToken?{accessToken:e.accessToken}:{},...e.authContext?{authContext:e.authContext}:{},...e.fetchImpl?{fetchImpl:e.fetchImpl}:{}});const r=e.mediaClient??new Ys(t instanceof Tn?t:new Tn({...e.baseUrl?{baseUrl:e.baseUrl}:{},...e.accessToken?{accessToken:e.accessToken}:{},...e.authContext?{authContext:e.authContext}:{},...e.fetchImpl?{fetchImpl:e.fetchImpl}:{}}));const n=e.extraInputRoots?.length?{workspaceRoot:e.workspaceRoot,extraInputRoots:e.extraInputRoots}:e.workspaceRoot;return T$(t,r,n,null,{...e.matrixLogger?{matrixLogger:e.matrixLogger}:{}})}var N9=/^[A-Za-z0-9._-]+$/u;function A$(e,t){if(t!=="dev"&&t!=="test"&&t!=="staging")return{};const r=e?.bedrockLane?.trim();return r&&N9.test(r)?{"bedrock-lane":r,bedrock_lane:r}:{}}function j9(e){const t=e.executor??new Tn({...e.baseUrl?{baseUrl:e.baseUrl}:{},...e.accessToken?{accessToken:e.accessToken}:{},...e.authContext?{authContext:e.authContext}:{},...e.fetchImpl?{fetchImpl:e.fetchImpl}:{},...e.routingHeadersGetter?{routingHeadersGetter:e.routingHeadersGetter}:{}});const r=e.mediaClient??new Ys(t instanceof Tn?t:new Tn({...e.baseUrl?{baseUrl:e.baseUrl}:{},...e.accessToken?{accessToken:e.accessToken}:{},...e.authContext?{authContext:e.authContext}:{},...e.fetchImpl?{fetchImpl:e.fetchImpl}:{},...e.routingHeadersGetter?{routingHeadersGetter:e.routingHeadersGetter}:{}}));const n=M$({workspaceRoot:e.workspaceRoot,...e.extraInputRoots?.length?{extraInputRoots:e.extraInputRoots}:{},executor:t,mediaClient:r});return{tools:n,workspaceRoot:e.workspaceRoot,createContext:e.createContext??(()=>({sessionId:"matrix-mcp-stdio",turnId:`matrix-mcp-${Date.now()}`,workspaceRoot:e.workspaceRoot}))}}function D9(e=process.env,t={}){const r=e.ALRAN_MATRIX_WORKSPACE_ROOT||e.WORKSPACE_ROOT||process.cwd();const n=(e.ALRAN_MATRIX_EXTRA_INPUT_ROOTS??"").split(F9).map(s=>s.trim()).filter(s=>s.length>0);const o=bl(e);const i=o.managed&&(e.ALRAN_MATRIX_ACCESS_TOKEN||e.MATRIX_ACCESS_TOKEN);return j9({workspaceRoot:r,...n.length>0?{extraInputRoots:n}:{},baseUrl:o.baseUrl,...o.explicitToken?{accessToken:o.explicitToken}:{},...i?{authContext:{accessToken:i}}:{},...t.fetchImpl?{fetchImpl:t.fetchImpl}:{},routingHeadersGetter:()=>A$({bedrockLane:e.ALRAN_MATRIX_BEDROCK_LANE},e.ALRAN_BUILD_ENV)})}function U9(e){return e.tools.map(t=>({name:t.def.name,description:t.def.description,inputSchema:E$(t.def.schema)?t.def.schema:{type:"object"}}))}async function L9(e,t,r={},n){const o=e.tools.find(i=>i.def.name===t);if(!o){return{isError:true,content:[{type:"text",text:`Unknown Matrix MCP tool: ${t}`}],_meta:{matrix:{server:"matrix",tool:t}}}}try{const i=o.def.prepareArguments?o.def.prepareArguments(r):r;const s=await o.impl.execute(e.createContext(),i,n);return K9(t,s)}catch(i){return{isError:true,content:[{type:"text",text:`Matrix MCP tool failed: ${B9(i)}`}],_meta:{matrix:{server:"matrix",tool:t}}}}}function q9(e){const t=new yl({name:"alran-matrix-mcp-server",version:"0.2.1"},{capabilities:{tools:{}}});t.setRequestHandler(Hp,async()=>({tools:U9(e)}));t.setRequestHandler(Ta,async r=>{const n=r.params.name;const o=E$(r.params.arguments)?r.params.arguments:{};return L9(e,n,o)});return t}async function xfe(e=D9()){const t=q9(e);const r=new xl;await t.connect(r);process.stderr.write("[alran-matrix-mcp-server] ready\n")}function K9(e,t){const r=t.content.flatMap(n=>Z9(n));if(r.length===0&&t.text){r.push({type:"text",text:t.text})}return{content:r,isError:t.isError===true,_meta:{matrix:{server:"matrix",tool:e},...t.details?{details:t.details}:{},...t.output?{output:t.output}:{}}}}function Z9(e){if(e.type==="text"){return[{type:"text",text:e.text}]}if(e.type==="image"){return[{type:"image",data:e.data,mimeType:e.mimeType}]}return[{type:"text",text:`[matrix] non-text block omitted from MCP preview: type=video`}]}function E$(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function B9(e){return e instanceof Error?e.message:String(e)}export{Zm as a,gj as b,yj as c,_j as d,xj as e,bj as f,Ij as g,wj as h,rh as i,nh as j,Sj as k,Tj as l,Pj as m,Oj as n,$j as o,s0 as p,Rj as q,Mj as r,X as s,at as t,Ue as u,y as v,Pi as w,bG as x,rg as y,XG as z,_ce as A,Ice as B,wv as C,dV as D,yV as E,Tv as F,bl as G,Ym as H,eh as I,Tn as J,A$ as K,ee as L,$v as M,wr as N,hk as O,so as P,uu as Q,lu as R,S,lH as T,Te as U,ft as V,dH as W,ue as X,M as Y,Ut as Z,z as _,pH as $,OI as aa,Np as ba,vI as ca,jp as da,ya as ea,ie as fa,CI as ga,bu as ha,bM as ia,jH as ja,ss as ka,$M as la,RM as ma,EM as na,zM as oa,ZM as pa,XM as qa,YM as ra,tA as sa,Mu as ta,nA as ua,LH as va,mA as wa,Oa as xa,Jp as ya,RA as za,cs as Aa,FA as Ba,DA as Ca,K as Da,Au as Ea,ZI as Fa,hl as Ga,GT as Ha,VT as Ia,_l as Ja,HT as Ka,j9 as La,U9 as Ma,xfe as Na};
|