@go-hare/claude-agent-sdk 0.3.177

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/browser-sdk.js ADDED
@@ -0,0 +1,97 @@
1
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
+
3
+ // Version: 0.3.177
4
+ var kT=Object.create;var{getPrototypeOf:wT,defineProperty:Bd,getOwnPropertyNames:$T}=Object;var IT=Object.prototype.hasOwnProperty;function TT(e){return this[e]}var PT,ET,Dy=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?PT??=new WeakMap:ET??=new WeakMap,i=n.get(e);if(i)return i}r=e!=null?kT(wT(e)):{};let s=t||!e||!e.__esModule?Bd(r,"default",{value:e,enumerable:!0}):r;for(let a of $T(e))if(!IT.call(s,a))Bd(s,a,{get:TT.bind(e,a),enumerable:!0});if(o)n.set(e,s);return s};var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var RT=(e)=>e;function CT(e,t){this[e]=RT.bind(null,t)}var fr=(e,t)=>{for(var r in t)Bd(e,r,{get:t[r],enumerable:!0,configurable:!0,set:CT.bind(t,r)})};var OT=(e,t)=>()=>(e&&(t=e(e=0)),t);var Br=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),AT=Symbol.dispose||Symbol.for("Symbol.dispose"),MT=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),be=(e,t,r)=>{if(t!=null){if(typeof t!=="object"&&typeof t!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var o;if(r)o=t[MT];if(o===void 0)o=t[AT];if(typeof o!=="function")throw TypeError("Object not disposable");e.push([r,o,t])}else if(r)e.push([r]);return t},Se=(e,t,r)=>{var o=typeof SuppressedError==="function"?SuppressedError:function(s,a,c,u){return u=Error(c),u.name="SuppressedError",u.error=s,u.suppressed=a,u},n=(s)=>t=r?new o(s,t,"An error was suppressed during disposal"):(r=!0,s),i=(s)=>{while(s=e.pop())try{var a=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(a).then(i,(c)=>(n(c),i()))}catch(c){n(c)}if(r)throw t};return i()};var Wr={};fr(Wr,{sep:()=>Qd,resolve:()=>_r,relative:()=>S_,posix:()=>T_,parse:()=>$_,normalize:()=>Jd,join:()=>qt,isAbsolute:()=>Xd,format:()=>w_,extname:()=>k_,dirname:()=>Vr,delimiter:()=>I_,default:()=>nP,basename:()=>Yd,_makeLong:()=>x_});function Lt(e){if(typeof e!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function b_(e,t){var r="",o=0,n=-1,i=0,s;for(var a=0;a<=e.length;++a){if(a<e.length)s=e.charCodeAt(a);else if(s===47)break;else s=47;if(s===47){if(n===a-1||i===1);else if(n!==a-1&&i===2){if(r.length<2||o!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var c=r.lastIndexOf("/");if(c!==r.length-1){if(c===-1)r="",o=0;else r=r.slice(0,c),o=r.length-1-r.lastIndexOf("/");n=a,i=0;continue}}else if(r.length===2||r.length===1){r="",o=0,n=a,i=0;continue}}if(t){if(r.length>0)r+="/..";else r="..";o=2}}else{if(r.length>0)r+="/"+e.slice(n+1,a);else r=e.slice(n+1,a);o=a-n-1}n=a,i=0}else if(s===46&&i!==-1)++i;else i=-1}return r}function rP(e,t){var r=t.dir||t.root,o=t.base||(t.name||"")+(t.ext||"");if(!r)return o;if(r===t.root)return r+o;return r+e+o}function _r(){var e="",t=!1,r;for(var o=arguments.length-1;o>=-1&&!t;o--){var n;if(o>=0)n=arguments[o];else{if(r===void 0)r=process.cwd();n=r}if(Lt(n),n.length===0)continue;e=n+"/"+e,t=n.charCodeAt(0)===47}if(e=b_(e,!t),t)if(e.length>0)return"/"+e;else return"/";else if(e.length>0)return e;else return"."}function Jd(e){if(Lt(e),e.length===0)return".";var t=e.charCodeAt(0)===47,r=e.charCodeAt(e.length-1)===47;if(e=b_(e,!t),e.length===0&&!t)e=".";if(e.length>0&&r)e+="/";if(t)return"/"+e;return e}function Xd(e){return Lt(e),e.length>0&&e.charCodeAt(0)===47}function qt(){if(arguments.length===0)return".";var e;for(var t=0;t<arguments.length;++t){var r=arguments[t];if(Lt(r),r.length>0)if(e===void 0)e=r;else e+="/"+r}if(e===void 0)return".";return Jd(e)}function S_(e,t){if(Lt(e),Lt(t),e===t)return"";if(e=_r(e),t=_r(t),e===t)return"";var r=1;for(;r<e.length;++r)if(e.charCodeAt(r)!==47)break;var o=e.length,n=o-r,i=1;for(;i<t.length;++i)if(t.charCodeAt(i)!==47)break;var s=t.length,a=s-i,c=n<a?n:a,u=-1,l=0;for(;l<=c;++l){if(l===c){if(a>c){if(t.charCodeAt(i+l)===47)return t.slice(i+l+1);else if(l===0)return t.slice(i+l)}else if(n>c){if(e.charCodeAt(r+l)===47)u=l;else if(l===0)u=0}break}var d=e.charCodeAt(r+l),m=t.charCodeAt(i+l);if(d!==m)break;else if(d===47)u=l}var p="";for(l=r+u+1;l<=o;++l)if(l===o||e.charCodeAt(l)===47)if(p.length===0)p+="..";else p+="/..";if(p.length>0)return p+t.slice(i+u);else{if(i+=u,t.charCodeAt(i)===47)++i;return t.slice(i)}}function x_(e){return e}function Vr(e){if(Lt(e),e.length===0)return".";var t=e.charCodeAt(0),r=t===47,o=-1,n=!0;for(var i=e.length-1;i>=1;--i)if(t=e.charCodeAt(i),t===47){if(!n){o=i;break}}else n=!1;if(o===-1)return r?"/":".";if(r&&o===1)return"//";return e.slice(0,o)}function Yd(e,t){if(t!==void 0&&typeof t!=="string")throw TypeError('"ext" argument must be a string');Lt(e);var r=0,o=-1,n=!0,i;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,a=-1;for(i=e.length-1;i>=0;--i){var c=e.charCodeAt(i);if(c===47){if(!n){r=i+1;break}}else{if(a===-1)n=!1,a=i+1;if(s>=0)if(c===t.charCodeAt(s)){if(--s===-1)o=i}else s=-1,o=a}}if(r===o)o=a;else if(o===-1)o=e.length;return e.slice(r,o)}else{for(i=e.length-1;i>=0;--i)if(e.charCodeAt(i)===47){if(!n){r=i+1;break}}else if(o===-1)n=!1,o=i+1;if(o===-1)return"";return e.slice(r,o)}}function k_(e){Lt(e);var t=-1,r=0,o=-1,n=!0,i=0;for(var s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(a===47){if(!n){r=s+1;break}continue}if(o===-1)n=!1,o=s+1;if(a===46){if(t===-1)t=s;else if(i!==1)i=1}else if(t!==-1)i=-1}if(t===-1||o===-1||i===0||i===1&&t===o-1&&t===r+1)return"";return e.slice(t,o)}function w_(e){if(e===null||typeof e!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return rP("/",e)}function $_(e){Lt(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var r=e.charCodeAt(0),o=r===47,n;if(o)t.root="/",n=1;else n=0;var i=-1,s=0,a=-1,c=!0,u=e.length-1,l=0;for(;u>=n;--u){if(r=e.charCodeAt(u),r===47){if(!c){s=u+1;break}continue}if(a===-1)c=!1,a=u+1;if(r===46){if(i===-1)i=u;else if(l!==1)l=1}else if(i!==-1)l=-1}if(i===-1||a===-1||l===0||l===1&&i===a-1&&i===s+1){if(a!==-1)if(s===0&&o)t.base=t.name=e.slice(1,a);else t.base=t.name=e.slice(s,a)}else{if(s===0&&o)t.name=e.slice(1,i),t.base=e.slice(1,a);else t.name=e.slice(s,i),t.base=e.slice(s,a);t.ext=e.slice(i,a)}if(s>0)t.dir=e.slice(0,s-1);else if(o)t.dir="/";return t}var Qd="/",I_=":",T_,nP;var It=OT(()=>{T_=((e)=>(e.posix=e,e))({resolve:_r,normalize:Jd,isAbsolute:Xd,join:qt,relative:S_,_makeLong:x_,dirname:Vr,basename:Yd,extname:k_,format:w_,parse:$_,sep:Qd,delimiter:I_,win32:null,posix:null}),nP=T_});var fa=M((Ox)=>{Object.defineProperty(Ox,"__esModule",{value:!0});Ox.regexpCode=Ox.getEsmExportName=Ox.getProperty=Ox.safeStringify=Ox.stringify=Ox.strConcat=Ox.addCodeArg=Ox.str=Ox._=Ox.nil=Ox._Code=Ox.Name=Ox.IDENTIFIER=Ox._CodeOrName=void 0;class ad{}Ox._CodeOrName=ad;Ox.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Po extends ad{constructor(e){super();if(!Ox.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Ox.Name=Po;class Mt extends ad{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof Po)t[r.str]=(t[r.str]||0)+1;return t},{})}}Ox._Code=Mt;Ox.nil=new Mt("");function Rx(e,...t){let r=[e[0]],o=0;while(o<t.length)wg(r,t[o]),r.push(e[++o]);return new Mt(r)}Ox._=Rx;var kg=new Mt("+");function Cx(e,...t){let r=[ma(e[0])],o=0;while(o<t.length)r.push(kg),wg(r,t[o]),r.push(kg,ma(e[++o]));return nz(r),new Mt(r)}Ox.str=Cx;function wg(e,t){if(t instanceof Mt)e.push(...t._items);else if(t instanceof Po)e.push(t);else e.push(sz(t))}Ox.addCodeArg=wg;function nz(e){let t=1;while(t<e.length-1){if(e[t]===kg){let r=oz(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function oz(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Po||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 Po))return`"${e}${t.slice(1)}`;return}function iz(e,t){return t.emptyStr()?e:e.emptyStr()?t:Cx`${e}${t}`}Ox.strConcat=iz;function sz(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ma(Array.isArray(e)?e.join(","):e)}function az(e){return new Mt(ma(e))}Ox.stringify=az;function ma(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ox.safeStringify=ma;function cz(e){return typeof e=="string"&&Ox.IDENTIFIER.test(e)?new Mt(`.${e}`):Rx`[${e}]`}Ox.getProperty=cz;function uz(e){if(typeof e=="string"&&Ox.IDENTIFIER.test(e))return new Mt(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Ox.getEsmExportName=uz;function lz(e){return new Mt(e.toString())}Ox.regexpCode=lz});var Pg=M((Nx)=>{Object.defineProperty(Nx,"__esModule",{value:!0});Nx.ValueScope=Nx.ValueScopeName=Nx.Scope=Nx.varKinds=Nx.UsedValueState=void 0;var rt=fa();class Mx extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var ud;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ud||(Nx.UsedValueState=ud={}));Nx.varKinds={const:new rt.Name("const"),let:new rt.Name("let"),var:new rt.Name("var")};class Ig{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof rt.Name?e:this.name(e)}name(e){return new rt.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}Nx.Scope=Ig;class Tg extends rt.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=rt._`.${new rt.Name(t)}[${r}]`}}Nx.ValueScopeName=Tg;var kz=rt._`\n`;class zx extends Ig{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?kz:rt.nil}}get(){return this._scope}name(e){return new Tg(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:n}=o,i=(r=t.key)!==null&&r!==void 0?r:t.ref,s=this._values[n];if(s){let u=s.get(i);if(u)return u}else s=this._values[n]=new Map;s.set(i,o);let a=this._scope[n]||(this._scope[n]=[]),c=a.length;return a[c]=t.ref,o.setValue(t,{property:n,itemIndex:c}),o}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return rt._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},t,r)}_reduceValues(e,t,r={},o){let n=rt.nil;for(let i in e){let s=e[i];if(!s)continue;let a=r[i]=r[i]||new Map;s.forEach((c)=>{if(a.has(c))return;a.set(c,ud.Started);let u=t(c);if(u){let l=this.opts.es5?Nx.varKinds.var:Nx.varKinds.const;n=rt._`${n}${l} ${c} = ${u};${this.opts._n}`}else if(u=o===null||o===void 0?void 0:o(c))n=rt._`${n}${u}${this.opts._n}`;else throw new Mx(c);a.set(c,ud.Completed)})}return n}}Nx.ValueScope=zx});var Y=M((nt)=>{Object.defineProperty(nt,"__esModule",{value:!0});nt.or=nt.and=nt.not=nt.CodeGen=nt.operators=nt.varKinds=nt.ValueScopeName=nt.ValueScope=nt.Scope=nt.Name=nt.regexpCode=nt.stringify=nt.getProperty=nt.nil=nt.strConcat=nt.str=nt._=void 0;var oe=fa(),zt=Pg(),Dr=fa();Object.defineProperty(nt,"_",{enumerable:!0,get:function(){return Dr._}});Object.defineProperty(nt,"str",{enumerable:!0,get:function(){return Dr.str}});Object.defineProperty(nt,"strConcat",{enumerable:!0,get:function(){return Dr.strConcat}});Object.defineProperty(nt,"nil",{enumerable:!0,get:function(){return Dr.nil}});Object.defineProperty(nt,"getProperty",{enumerable:!0,get:function(){return Dr.getProperty}});Object.defineProperty(nt,"stringify",{enumerable:!0,get:function(){return Dr.stringify}});Object.defineProperty(nt,"regexpCode",{enumerable:!0,get:function(){return Dr.regexpCode}});Object.defineProperty(nt,"Name",{enumerable:!0,get:function(){return Dr.Name}});var hd=Pg();Object.defineProperty(nt,"Scope",{enumerable:!0,get:function(){return hd.Scope}});Object.defineProperty(nt,"ValueScope",{enumerable:!0,get:function(){return hd.ValueScope}});Object.defineProperty(nt,"ValueScopeName",{enumerable:!0,get:function(){return hd.ValueScopeName}});Object.defineProperty(nt,"varKinds",{enumerable:!0,get:function(){return hd.varKinds}});nt.operators={GT:new oe._Code(">"),GTE:new oe._Code(">="),LT:new oe._Code("<"),LTE:new oe._Code("<="),EQ:new oe._Code("==="),NEQ:new oe._Code("!=="),NOT:new oe._Code("!"),OR:new oe._Code("||"),AND:new oe._Code("&&"),ADD:new oe._Code("+")};class jr{optimizeNodes(){return this}optimizeNames(e,t){return this}}class jx extends jr{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?zt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Ro(this.rhs,e,t);return this}get names(){return this.rhs instanceof oe._CodeOrName?this.rhs.names:{}}}class Cg extends jr{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof oe.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Ro(this.rhs,e,t),this}get names(){let e=this.lhs instanceof oe.Name?{}:{...this.lhs.names};return fd(e,this.rhs)}}class Ux extends Cg{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Fx extends jr{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Lx extends jr{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class qx extends jr{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Zx extends jr{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Ro(this.code,e,t),this}get names(){return this.code instanceof oe._CodeOrName?this.code.names:{}}}class gd extends jr{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;while(o--){let n=r[o];if(n.optimizeNames(e,t))continue;Tz(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Sn(e,t.names),{})}}class Ur extends gd{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Hx extends gd{}class ha extends Ur{}ha.kind="else";class lr extends Ur{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new ha(r):r}if(t){if(e===!1)return t instanceof lr?t:t.nodes;if(this.nodes.length)return this;return new lr(Gx(e),t instanceof lr?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Ro(this.condition,e,t),this}get names(){let e=super.names;if(fd(e,this.condition),this.else)Sn(e,this.else.names);return e}}lr.kind="if";class Eo extends Ur{}Eo.kind="for";class Bx extends Eo{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Ro(this.iteration,e,t),this}get names(){return Sn(super.names,this.iteration.names)}}class Kx extends Eo{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?zt.varKinds.var:this.varKind,{name:r,from:o,to:n}=this;return`for(${t} ${r}=${o}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=fd(super.names,this.from);return fd(e,this.to)}}class Eg extends Eo{constructor(e,t,r,o){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Ro(this.iterable,e,t),this}get names(){return Sn(super.names,this.iterable.names)}}class ld extends Ur{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}ld.kind="func";class dd extends gd{render(e){return"return "+super.render(e)}}dd.kind="return";class Vx extends Ur{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(o=this.finally)===null||o===void 0||o.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Sn(e,this.catch.names);if(this.finally)Sn(e,this.finally.names);return e}}class pd extends Ur{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}pd.kind="catch";class md extends Ur{render(e){return"finally"+super.render(e)}}md.kind="finally";class Wx{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
5
+ `:""},this._extScope=e,this._scope=new zt.Scope({parent:e}),this._nodes=[new Hx]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){let n=this._scope.toName(t);if(r!==void 0&&o)this._constants[n.str]=r;return this._leafNode(new jx(e,n,r)),n}const(e,t,r){return this._def(zt.varKinds.const,e,t,r)}let(e,t,r){return this._def(zt.varKinds.let,e,t,r)}var(e,t,r){return this._def(zt.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Cg(e,t,r))}add(e,t){return this._leafNode(new Ux(e,nt.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==oe.nil)this._leafNode(new Zx(e));return this}object(...e){let t=["{"];for(let[r,o]of e){if(t.length>1)t.push(",");if(t.push(r),r!==o||this.opts.es5)t.push(":"),(0,oe.addCodeArg)(t,o)}return t.push("}"),new oe._Code(t)}if(e,t,r){if(this._blockNode(new lr(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new lr(e))}else(){return this._elseNode(new ha)}endIf(){return this._endBlockNode(lr,ha)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new Bx(e),t)}forRange(e,t,r,o,n=this.opts.es5?zt.varKinds.var:zt.varKinds.let){let i=this._scope.toName(e);return this._for(new Kx(n,i,t,r),()=>o(i))}forOf(e,t,r,o=zt.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let i=t instanceof oe.Name?t:this.var("_arr",t);return this.forRange("_i",0,oe._`${i}.length`,(s)=>{this.var(n,oe._`${i}[${s}]`),r(n)})}return this._for(new Eg("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?zt.varKinds.var:zt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,oe._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new Eg("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(Eo)}label(e){return this._leafNode(new Fx(e))}break(e){return this._leafNode(new Lx(e))}return(e){let t=new dd;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(dd)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new Vx;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new pd(n),t(n)}if(r)this._currNode=o.finally=new md,this.code(r);return this._endBlockNode(pd,md)}throw(e){return this._leafNode(new qx(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=oe.nil,r,o){if(this._blockNode(new ld(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(ld)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof lr))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}nt.CodeGen=Wx;function Sn(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function fd(e,t){return t instanceof oe._CodeOrName?Sn(e,t.names):e}function Ro(e,t,r){if(e instanceof oe.Name)return o(e);if(!n(e))return e;return new oe._Code(e._items.reduce((i,s)=>{if(s instanceof oe.Name)s=o(s);if(s instanceof oe._Code)i.push(...s._items);else i.push(s);return i},[]));function o(i){let s=r[i.str];if(s===void 0||t[i.str]!==1)return i;return delete t[i.str],s}function n(i){return i instanceof oe._Code&&i._items.some((s)=>s instanceof oe.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function Tz(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Gx(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:oe._`!${Rg(e)}`}nt.not=Gx;var Pz=Jx(nt.operators.AND);function Ez(...e){return e.reduce(Pz)}nt.and=Ez;var Rz=Jx(nt.operators.OR);function Cz(...e){return e.reduce(Rz)}nt.or=Cz;function Jx(e){return(t,r)=>t===oe.nil?r:r===oe.nil?t:oe._`${Rg(t)} ${e} ${Rg(r)}`}function Rg(e){return e instanceof oe.Name?e:oe._`(${e})`}});var ie=M((ik)=>{Object.defineProperty(ik,"__esModule",{value:!0});ik.checkStrictMode=ik.getErrorPath=ik.Type=ik.useFunc=ik.setEvaluated=ik.evaluatedPropsToName=ik.mergeEvaluated=ik.eachItem=ik.unescapeJsonPointer=ik.escapeJsonPointer=ik.escapeFragment=ik.unescapeFragment=ik.schemaRefOrVal=ik.schemaHasRulesButRef=ik.schemaHasRules=ik.checkUnknownRules=ik.alwaysValidSchema=ik.toHash=void 0;var he=Y(),zz=fa();function Nz(e){let t={};for(let r of e)t[r]=!0;return t}ik.toHash=Nz;function Dz(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return ek(e,t),!tk(t,e.self.RULES.all)}ik.alwaysValidSchema=Dz;function ek(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=o.RULES.keywords;for(let i in t)if(!n[i])ok(e,`unknown keyword: "${i}"`)}ik.checkUnknownRules=ek;function tk(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}ik.schemaHasRules=tk;function jz(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}ik.schemaHasRulesButRef=jz;function Uz({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return he._`${r}`}return he._`${e}${t}${(0,he.getProperty)(o)}`}ik.schemaRefOrVal=Uz;function Fz(e){return rk(decodeURIComponent(e))}ik.unescapeFragment=Fz;function Lz(e){return encodeURIComponent(Ag(e))}ik.escapeFragment=Lz;function Ag(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}ik.escapeJsonPointer=Ag;function rk(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}ik.unescapeJsonPointer=rk;function qz(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}ik.eachItem=qz;function Yx({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,i,s,a)=>{let c=s===void 0?i:s instanceof he.Name?(i instanceof he.Name?e(n,i,s):t(n,i,s),s):i instanceof he.Name?(t(n,s,i),i):r(i,s);return a===he.Name&&!(c instanceof he.Name)?o(n,c):c}}ik.mergeEvaluated={props:Yx({mergeNames:(e,t,r)=>e.if(he._`${r} !== true && ${t} !== undefined`,()=>{e.if(he._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,he._`${r} || {}`).code(he._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(he._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,he._`${r} || {}`),Mg(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:nk}),items:Yx({mergeNames:(e,t,r)=>e.if(he._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,he._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(he._`${r} !== true`,()=>e.assign(r,t===!0?!0:he._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function nk(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",he._`{}`);if(t!==void 0)Mg(e,r,t);return r}ik.evaluatedPropsToName=nk;function Mg(e,t,r){Object.keys(r).forEach((o)=>e.assign(he._`${t}${(0,he.getProperty)(o)}`,!0))}ik.setEvaluated=Mg;var Qx={};function Zz(e,t){return e.scopeValue("func",{ref:t,code:Qx[t.code]||(Qx[t.code]=new zz._Code(t.code))})}ik.useFunc=Zz;var Og;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Og||(ik.Type=Og={}));function Hz(e,t,r){if(e instanceof he.Name){let o=t===Og.Num;return r?o?he._`"[" + ${e} + "]"`:he._`"['" + ${e} + "']"`:o?he._`"/" + ${e}`:he._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,he.getProperty)(e).toString():"/"+Ag(e)}ik.getErrorPath=Hz;function ok(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}ik.checkStrictMode=ok});var dr=M((ak)=>{Object.defineProperty(ak,"__esModule",{value:!0});var Be=Y(),cN={data:new Be.Name("data"),valCxt:new Be.Name("valCxt"),instancePath:new Be.Name("instancePath"),parentData:new Be.Name("parentData"),parentDataProperty:new Be.Name("parentDataProperty"),rootData:new Be.Name("rootData"),dynamicAnchors:new Be.Name("dynamicAnchors"),vErrors:new Be.Name("vErrors"),errors:new Be.Name("errors"),this:new Be.Name("this"),self:new Be.Name("self"),scope:new Be.Name("scope"),json:new Be.Name("json"),jsonPos:new Be.Name("jsonPos"),jsonLen:new Be.Name("jsonLen"),jsonPart:new Be.Name("jsonPart")};ak.default=cN});var ga=M((dk)=>{Object.defineProperty(dk,"__esModule",{value:!0});dk.extendErrors=dk.resetErrorsCount=dk.reportExtraError=dk.reportError=dk.keyword$DataError=dk.keywordError=void 0;var se=Y(),_d=ie(),Ge=dr();dk.keywordError={message:({keyword:e})=>se.str`must pass "${e}" keyword validation`};dk.keyword$DataError={message:({keyword:e,schemaType:t})=>t?se.str`"${e}" keyword must be ${t} ($data)`:se.str`"${e}" keyword is invalid ($data)`};function lN(e,t=dk.keywordError,r,o){let{it:n}=e,{gen:i,compositeRule:s,allErrors:a}=n,c=lk(e,t,r);if(o!==null&&o!==void 0?o:s||a)ck(i,c);else uk(n,se._`[${c}]`)}dk.reportError=lN;function dN(e,t=dk.keywordError,r){let{it:o}=e,{gen:n,compositeRule:i,allErrors:s}=o,a=lk(e,t,r);if(ck(n,a),!(i||s))uk(o,Ge.default.vErrors)}dk.reportExtraError=dN;function pN(e,t){e.assign(Ge.default.errors,t),e.if(se._`${Ge.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(se._`${Ge.default.vErrors}.length`,t),()=>e.assign(Ge.default.vErrors,null)))}dk.resetErrorsCount=pN;function mN({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:i}){if(n===void 0)throw Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,Ge.default.errors,(a)=>{if(e.const(s,se._`${Ge.default.vErrors}[${a}]`),e.if(se._`${s}.instancePath === undefined`,()=>e.assign(se._`${s}.instancePath`,(0,se.strConcat)(Ge.default.instancePath,i.errorPath))),e.assign(se._`${s}.schemaPath`,se.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(se._`${s}.schema`,r),e.assign(se._`${s}.data`,o)})}dk.extendErrors=mN;function ck(e,t){let r=e.const("err",t);e.if(se._`${Ge.default.vErrors} === null`,()=>e.assign(Ge.default.vErrors,se._`[${r}]`),se._`${Ge.default.vErrors}.push(${r})`),e.code(se._`${Ge.default.errors}++`)}function uk(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(se._`new ${e.ValidationError}(${t})`);else r.assign(se._`${o}.errors`,t),r.return(!1)}var xn={keyword:new se.Name("keyword"),schemaPath:new se.Name("schemaPath"),params:new se.Name("params"),propertyName:new se.Name("propertyName"),message:new se.Name("message"),schema:new se.Name("schema"),parentSchema:new se.Name("parentSchema")};function lk(e,t,r){let{createErrors:o}=e.it;if(o===!1)return se._`{}`;return fN(e,t,r)}function fN(e,t,r={}){let{gen:o,it:n}=e,i=[hN(n,r),gN(e,r)];return yN(e,t,i),o.object(...i)}function hN({errorPath:e},{instancePath:t}){let r=t?se.str`${e}${(0,_d.getErrorPath)(t,_d.Type.Str)}`:e;return[Ge.default.instancePath,(0,se.strConcat)(Ge.default.instancePath,r)]}function gN({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:se.str`${t}/${e}`;if(r)n=se.str`${n}${(0,_d.getErrorPath)(r,_d.Type.Str)}`;return[xn.schemaPath,n]}function yN(e,{params:t,message:r},o){let{keyword:n,data:i,schemaValue:s,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;if(o.push([xn.keyword,n],[xn.params,typeof t=="function"?t(e):t||se._`{}`]),c.messages)o.push([xn.message,typeof r=="function"?r(e):r]);if(c.verbose)o.push([xn.schema,s],[xn.parentSchema,se._`${l}${d}`],[Ge.default.data,i]);if(u)o.push([xn.propertyName,u])}});var gk=M((fk)=>{Object.defineProperty(fk,"__esModule",{value:!0});fk.boolOrEmptySchema=fk.topBoolOrEmptySchema=void 0;var xN=ga(),kN=Y(),wN=dr(),$N={message:"boolean schema is false"};function IN(e){let{gen:t,schema:r,validateName:o}=e;if(r===!1)mk(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(wN.default.data);else t.assign(kN._`${o}.errors`,null),t.return(!0)}fk.topBoolOrEmptySchema=IN;function TN(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),mk(e);else r.var(t,!0)}fk.boolOrEmptySchema=TN;function mk(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,xN.reportError)(n,$N,void 0,t)}});var Ng=M((yk)=>{Object.defineProperty(yk,"__esModule",{value:!0});yk.getRules=yk.isJSONType=void 0;var EN=["string","number","integer","boolean","null","object","array"],RN=new Set(EN);function CN(e){return typeof e=="string"&&RN.has(e)}yk.isJSONType=CN;function ON(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}yk.getRules=ON});var Dg=M((Sk)=>{Object.defineProperty(Sk,"__esModule",{value:!0});Sk.shouldUseRule=Sk.shouldUseGroup=Sk.schemaHasRulesForType=void 0;function MN({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&vk(e,o)}Sk.schemaHasRulesForType=MN;function vk(e,t){return t.rules.some((r)=>bk(e,r))}Sk.shouldUseGroup=vk;function bk(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((o)=>e[o]!==void 0))}Sk.shouldUseRule=bk});var ya=M((Ik)=>{Object.defineProperty(Ik,"__esModule",{value:!0});Ik.reportTypeError=Ik.checkDataTypes=Ik.checkDataType=Ik.coerceAndCheckDataType=Ik.getJSONTypes=Ik.getSchemaTypes=Ik.DataType=void 0;var DN=Ng(),jN=Dg(),UN=ga(),X=Y(),kk=ie(),Co;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Co||(Ik.DataType=Co={}));function FN(e){let t=wk(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}Ik.getSchemaTypes=FN;function wk(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(DN.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Ik.getJSONTypes=wk;function LN(e,t){let{gen:r,data:o,opts:n}=e,i=qN(t,n.coerceTypes),s=t.length>0&&!(i.length===0&&t.length===1&&(0,jN.schemaHasRulesForType)(e,t[0]));if(s){let a=Ug(t,o,n.strictNumbers,Co.Wrong);r.if(a,()=>{if(i.length)ZN(e,t,i);else Fg(e)})}return s}Ik.coerceAndCheckDataType=LN;var $k=new Set(["string","number","integer","boolean","null"]);function qN(e,t){return t?e.filter((r)=>$k.has(r)||t==="array"&&r==="array"):[]}function ZN(e,t,r){let{gen:o,data:n,opts:i}=e,s=o.let("dataType",X._`typeof ${n}`),a=o.let("coerced",X._`undefined`);if(i.coerceTypes==="array")o.if(X._`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,X._`${n}[0]`).assign(s,X._`typeof ${n}`).if(Ug(t,n,i.strictNumbers),()=>o.assign(a,n)));o.if(X._`${a} !== undefined`);for(let u of r)if($k.has(u)||u==="array"&&i.coerceTypes==="array")c(u);o.else(),Fg(e),o.endIf(),o.if(X._`${a} !== undefined`,()=>{o.assign(n,a),HN(e,a)});function c(u){switch(u){case"string":o.elseIf(X._`${s} == "number" || ${s} == "boolean"`).assign(a,X._`"" + ${n}`).elseIf(X._`${n} === null`).assign(a,X._`""`);return;case"number":o.elseIf(X._`${s} == "boolean" || ${n} === null
6
+ || (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,X._`+${n}`);return;case"integer":o.elseIf(X._`${s} === "boolean" || ${n} === null
7
+ || (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,X._`+${n}`);return;case"boolean":o.elseIf(X._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf(X._`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf(X._`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf(X._`${s} === "string" || ${s} === "number"
8
+ || ${s} === "boolean" || ${n} === null`).assign(a,X._`[${n}]`)}}}function HN({gen:e,parentData:t,parentDataProperty:r},o){e.if(X._`${t} !== undefined`,()=>e.assign(X._`${t}[${r}]`,o))}function jg(e,t,r,o=Co.Correct){let n=o===Co.Correct?X.operators.EQ:X.operators.NEQ,i;switch(e){case"null":return X._`${t} ${n} null`;case"array":i=X._`Array.isArray(${t})`;break;case"object":i=X._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s(X._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return X._`typeof ${t} ${n} ${e}`}return o===Co.Correct?i:(0,X.not)(i);function s(a=X.nil){return(0,X.and)(X._`typeof ${t} == "number"`,a,r?X._`isFinite(${t})`:X.nil)}}Ik.checkDataType=jg;function Ug(e,t,r,o){if(e.length===1)return jg(e[0],t,r,o);let n,i=(0,kk.toHash)(e);if(i.array&&i.object){let s=X._`typeof ${t} != "object"`;n=i.null?s:X._`!${t} || ${s}`,delete i.null,delete i.array,delete i.object}else n=X.nil;if(i.number)delete i.integer;for(let s in i)n=(0,X.and)(n,jg(s,t,r,o));return n}Ik.checkDataTypes=Ug;var BN={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?X._`{type: ${e}}`:X._`{type: ${t}}`};function Fg(e){let t=KN(e);(0,UN.reportError)(t,BN)}Ik.reportTypeError=Fg;function KN(e){let{gen:t,data:r,schema:o}=e,n=(0,kk.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var Ck=M((Ek)=>{Object.defineProperty(Ek,"__esModule",{value:!0});Ek.assignDefaults=void 0;var Oo=Y(),QN=ie();function eD(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)Pk(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,i)=>Pk(e,i,n.default))}Ek.assignDefaults=eD;function Pk(e,t,r){let{gen:o,compositeRule:n,data:i,opts:s}=e;if(r===void 0)return;let a=Oo._`${i}${(0,Oo.getProperty)(t)}`;if(n){(0,QN.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=Oo._`${a} === undefined`;if(s.useDefaults==="empty")c=Oo._`${c} || ${a} === null || ${a} === ""`;o.if(c,Oo._`${a} = ${(0,Oo.stringify)(r)}`)}});var wt=M((Mk)=>{Object.defineProperty(Mk,"__esModule",{value:!0});Mk.validateUnion=Mk.validateArray=Mk.usePattern=Mk.callValidateCode=Mk.schemaProperties=Mk.allSchemaProperties=Mk.noPropertyInData=Mk.propertyInData=Mk.isOwnProperty=Mk.hasPropFunc=Mk.reportMissingProp=Mk.checkMissingProp=Mk.checkReportMissingProp=void 0;var ve=Y(),Lg=ie(),Fr=dr(),tD=ie();function rD(e,t){let{gen:r,data:o,it:n}=e;r.if(Zg(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:ve._`${t}`},!0),e.error()})}Mk.checkReportMissingProp=rD;function nD({gen:e,data:t,it:{opts:r}},o,n){return(0,ve.or)(...o.map((i)=>(0,ve.and)(Zg(e,t,i,r.ownProperties),ve._`${n} = ${i}`)))}Mk.checkMissingProp=nD;function oD(e,t){e.setParams({missingProperty:t},!0),e.error()}Mk.reportMissingProp=oD;function Ok(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:ve._`Object.prototype.hasOwnProperty`})}Mk.hasPropFunc=Ok;function qg(e,t,r){return ve._`${Ok(e)}.call(${t}, ${r})`}Mk.isOwnProperty=qg;function iD(e,t,r,o){let n=ve._`${t}${(0,ve.getProperty)(r)} !== undefined`;return o?ve._`${n} && ${qg(e,t,r)}`:n}Mk.propertyInData=iD;function Zg(e,t,r,o){let n=ve._`${t}${(0,ve.getProperty)(r)} === undefined`;return o?(0,ve.or)(n,(0,ve.not)(qg(e,t,r))):n}Mk.noPropertyInData=Zg;function Ak(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Mk.allSchemaProperties=Ak;function sD(e,t){return Ak(t).filter((r)=>!(0,Lg.alwaysValidSchema)(e,t[r]))}Mk.schemaProperties=sD;function aD({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:i},it:s},a,c,u){let l=u?ve._`${e}, ${t}, ${o}${n}`:t,d=[[Fr.default.instancePath,(0,ve.strConcat)(Fr.default.instancePath,i)],[Fr.default.parentData,s.parentData],[Fr.default.parentDataProperty,s.parentDataProperty],[Fr.default.rootData,Fr.default.rootData]];if(s.opts.dynamicRef)d.push([Fr.default.dynamicAnchors,Fr.default.dynamicAnchors]);let m=ve._`${l}, ${r.object(...d)}`;return c!==ve.nil?ve._`${a}.call(${c}, ${m})`:ve._`${a}(${m})`}Mk.callValidateCode=aD;var cD=ve._`new RegExp`;function uD({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,i=n(r,o);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:ve._`${n.code==="new RegExp"?cD:(0,tD.useFunc)(e,n)}(${r}, ${o})`})}Mk.usePattern=uD;function lD(e){let{gen:t,data:r,keyword:o,it:n}=e,i=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(i,!0),s(()=>t.break()),i;function s(a){let c=t.const("len",ve._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:o,dataProp:u,dataPropType:Lg.Type.Num},i),t.if((0,ve.not)(i),a)})}}Mk.validateArray=lD;function dD(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>(0,Lg.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);if(t.assign(s,ve._`${s} || ${a}`),!e.mergeValidEvaluated(l,a))t.if((0,ve.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}Mk.validateUnion=dD});var Fk=M((jk)=>{Object.defineProperty(jk,"__esModule",{value:!0});jk.validateKeywordUsage=jk.validSchemaType=jk.funcKeywordCode=jk.macroKeywordCode=void 0;var Je=Y(),kn=dr(),wD=wt(),$D=ga();function ID(e,t){let{gen:r,keyword:o,schema:n,parentSchema:i,it:s}=e,a=t.macro.call(s.self,n,i,s),c=Dk(r,o,a);if(s.opts.validateSchema!==!1)s.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:Je.nil,errSchemaPath:`${s.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}jk.macroKeywordCode=ID;function TD(e,t){var r;let{gen:o,keyword:n,schema:i,parentSchema:s,$data:a,it:c}=e;ED(c,t);let u=!a&&t.compile?t.compile.call(c.self,i,s,c):t.validate,l=Dk(o,n,u),d=o.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1){if(h(),t.modifying)Nk(e);v(()=>e.error())}else{let b=t.async?p():f();if(t.modifying)Nk(e);v(()=>PD(e,b))}}function p(){let b=o.let("ruleErrs",null);return o.try(()=>h(Je._`await `),(I)=>o.assign(d,!1).if(Je._`${I} instanceof ${c.ValidationError}`,()=>o.assign(b,Je._`${I}.errors`),()=>o.throw(I))),b}function f(){let b=Je._`${l}.errors`;return o.assign(b,null),h(Je.nil),b}function h(b=t.async?Je._`await `:Je.nil){let I=c.opts.passContext?kn.default.this:kn.default.self,C=!(("compile"in t)&&!a||t.schema===!1);o.assign(d,Je._`${b}${(0,wD.callValidateCode)(e,l,I,C)}`,t.modifying)}function v(b){var I;o.if((0,Je.not)((I=t.valid)!==null&&I!==void 0?I:d),b)}}jk.funcKeywordCode=TD;function Nk(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,Je._`${o.parentData}[${o.parentDataProperty}]`))}function PD(e,t){let{gen:r}=e;r.if(Je._`Array.isArray(${t})`,()=>{r.assign(kn.default.vErrors,Je._`${kn.default.vErrors} === null ? ${t} : ${kn.default.vErrors}.concat(${t})`).assign(kn.default.errors,Je._`${kn.default.vErrors}.length`),(0,$D.extendErrors)(e)},()=>e.error())}function ED({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Dk(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Je.stringify)(r)})}function RD(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}jk.validSchemaType=RD;function CD({schema:e,opts:t,self:r,errSchemaPath:o},n,i){if(Array.isArray(n.keyword)?!n.keyword.includes(i):n.keyword!==i)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}jk.validateKeywordUsage=CD});var Hk=M((qk)=>{Object.defineProperty(qk,"__esModule",{value:!0});qk.extendSubschemaMode=qk.extendSubschemaData=qk.getSubschema=void 0;var Bt=Y(),Lk=ie();function zD(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:i,topSchemaRef:s}){if(t!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Bt._`${e.schemaPath}${(0,Bt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Bt._`${e.schemaPath}${(0,Bt.getProperty)(t)}${(0,Bt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Lk.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||i===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:s,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}qk.getSubschema=zD;function ND(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:i,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=a.let("data",Bt._`${t.data}${(0,Bt.getProperty)(r)}`,!0);c(m),e.errorPath=Bt.str`${u}${(0,Lk.getErrorPath)(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=Bt._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof Bt.Name?n:a.let("data",n,!0);if(c(u),s!==void 0)e.propertyName=s}if(i)e.dataTypes=i;function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}qk.extendSubschemaData=ND;function DD(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:i}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}qk.extendSubschemaMode=DD});var Hg=M((H7,Bk)=>{Bk.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}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();if(i=Object.keys(t),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!==0;){var s=i[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var Vk=M((B7,Kk)=>{var Lr=Kk.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};vd(t,o,n,e,"",e)};Lr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Lr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Lr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Lr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function vd(e,t,r,o,n,i,s,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,i,s,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Lr.arrayKeywords)for(var m=0;m<d.length;m++)vd(e,t,r,d[m],n+"/"+l+"/"+m,i,n,l,o,m)}else if(l in Lr.propsKeywords){if(d&&typeof d=="object")for(var p in d)vd(e,t,r,d[p],n+"/"+l+"/"+FD(p),i,n,l,o,p)}else if(l in Lr.keywords||e.allKeys&&!(l in Lr.skipKeywords))vd(e,t,r,d,n+"/"+l,i,n,l,o)}r(o,n,i,s,a,c,u)}}function FD(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var _a=M((Xk)=>{Object.defineProperty(Xk,"__esModule",{value:!0});Xk.getSchemaRefs=Xk.resolveUrl=Xk.normalizeId=Xk._getFullPath=Xk.getFullPath=Xk.inlineRef=void 0;var LD=ie(),qD=Hg(),ZD=Vk(),HD=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function BD(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Bg(e);if(!t)return!1;return Wk(e)<=t}Xk.inlineRef=BD;var KD=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Bg(e){for(let t in e){if(KD.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Bg))return!0;if(typeof r=="object"&&Bg(r))return!0}return!1}function Wk(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,HD.has(r))continue;if(typeof e[r]=="object")(0,LD.eachItem)(e[r],(o)=>t+=Wk(o));if(t===1/0)return 1/0}return t}function Gk(e,t="",r){if(r!==!1)t=Ao(t);let o=e.parse(t);return Jk(e,o)}Xk.getFullPath=Gk;function Jk(e,t){return e.serialize(t).split("#")[0]+"#"}Xk._getFullPath=Jk;var VD=/#\/?$/;function Ao(e){return e?e.replace(VD,""):""}Xk.normalizeId=Ao;function WD(e,t,r){return r=Ao(r),e.resolve(t,r)}Xk.resolveUrl=WD;var GD=/^[a-z_][-a-z0-9._]*$/i;function JD(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Ao(e[r]||t),i={"":n},s=Gk(o,n,!1),a={},c=new Set;return ZD(e,{allKeys:!0},(d,m,p,f)=>{if(f===void 0)return;let h=s+m,v=i[f];if(typeof d[r]=="string")v=b.call(this,d[r]);I.call(this,d.$anchor),I.call(this,d.$dynamicAnchor),i[m]=v;function b(C){let q=this.opts.uriResolver.resolve;if(C=Ao(v?q(v,C):C),c.has(C))throw l(C);c.add(C);let Z=this.refs[C];if(typeof Z=="string")Z=this.refs[Z];if(typeof Z=="object")u(d,Z.schema,C);else if(C!==Ao(h))if(C[0]==="#")u(d,a[C],C),a[C]=d;else this.refs[C]=h;return C}function I(C){if(typeof C=="string"){if(!GD.test(C))throw Error(`invalid anchor "${C}"`);b.call(this,`#${C}`)}}}),a;function u(d,m,p){if(m!==void 0&&!qD(d,m))throw l(p)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}Xk.getSchemaRefs=JD});var Sa=M((mw)=>{Object.defineProperty(mw,"__esModule",{value:!0});mw.getData=mw.KeywordCxt=mw.validateFunctionCode=void 0;var nw=gk(),Qk=ya(),Vg=Dg(),bd=ya(),rj=Ck(),ba=Fk(),Kg=Hk(),F=Y(),W=dr(),nj=_a(),pr=ie(),va=ga();function oj(e){if(sw(e)){if(aw(e),iw(e)){aj(e);return}}ow(e,()=>(0,nw.topBoolOrEmptySchema)(e))}mw.validateFunctionCode=oj;function ow({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},i){if(n.code.es5)e.func(t,F._`${W.default.data}, ${W.default.valCxt}`,o.$async,()=>{e.code(F._`"use strict"; ${ew(r,n)}`),sj(e,n),e.code(i)});else e.func(t,F._`${W.default.data}, ${ij(n)}`,o.$async,()=>e.code(ew(r,n)).code(i))}function ij(e){return F._`{${W.default.instancePath}="", ${W.default.parentData}, ${W.default.parentDataProperty}, ${W.default.rootData}=${W.default.data}${e.dynamicRef?F._`, ${W.default.dynamicAnchors}={}`:F.nil}}={}`}function sj(e,t){e.if(W.default.valCxt,()=>{if(e.var(W.default.instancePath,F._`${W.default.valCxt}.${W.default.instancePath}`),e.var(W.default.parentData,F._`${W.default.valCxt}.${W.default.parentData}`),e.var(W.default.parentDataProperty,F._`${W.default.valCxt}.${W.default.parentDataProperty}`),e.var(W.default.rootData,F._`${W.default.valCxt}.${W.default.rootData}`),t.dynamicRef)e.var(W.default.dynamicAnchors,F._`${W.default.valCxt}.${W.default.dynamicAnchors}`)},()=>{if(e.var(W.default.instancePath,F._`""`),e.var(W.default.parentData,F._`undefined`),e.var(W.default.parentDataProperty,F._`undefined`),e.var(W.default.rootData,W.default.data),t.dynamicRef)e.var(W.default.dynamicAnchors,F._`{}`)})}function aj(e){let{schema:t,opts:r,gen:o}=e;ow(e,()=>{if(r.$comment&&t.$comment)uw(e);if(pj(e),o.let(W.default.vErrors,null),o.let(W.default.errors,0),r.unevaluated)cj(e);cw(e),hj(e)});return}function cj(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",F._`${r}.evaluated`),t.if(F._`${e.evaluated}.dynamicProps`,()=>t.assign(F._`${e.evaluated}.props`,F._`undefined`)),t.if(F._`${e.evaluated}.dynamicItems`,()=>t.assign(F._`${e.evaluated}.items`,F._`undefined`))}function ew(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?F._`/*# sourceURL=${r} */`:F.nil}function uj(e,t){if(sw(e)){if(aw(e),iw(e)){lj(e,t);return}}(0,nw.boolOrEmptySchema)(e,t)}function iw({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function sw(e){return typeof e.schema!="boolean"}function lj(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)uw(e);mj(e),fj(e);let i=o.const("_errs",W.default.errors);cw(e,i),o.var(t,F._`${i} === ${W.default.errors}`)}function aw(e){(0,pr.checkUnknownRules)(e),dj(e)}function cw(e,t){if(e.opts.jtd)return tw(e,[],!1,t);let r=(0,Qk.getSchemaTypes)(e.schema),o=(0,Qk.coerceAndCheckDataType)(e,r);tw(e,r,!o,t)}function dj(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&(0,pr.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function pj(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,pr.checkStrictMode)(e,"default is ignored in the schema root")}function mj(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,nj.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function fj(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function uw({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let i=r.$comment;if(n.$comment===!0)e.code(F._`${W.default.self}.logger.log(${i})`);else if(typeof n.$comment=="function"){let s=F.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(F._`${W.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function hj(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:i}=e;if(r.$async)t.if(F._`${W.default.errors} === 0`,()=>t.return(W.default.data),()=>t.throw(F._`new ${n}(${W.default.vErrors})`));else{if(t.assign(F._`${o}.errors`,W.default.vErrors),i.unevaluated)gj(e);t.return(F._`${W.default.errors} === 0`)}}function gj({gen:e,evaluated:t,props:r,items:o}){if(r instanceof F.Name)e.assign(F._`${t}.props`,r);if(o instanceof F.Name)e.assign(F._`${t}.items`,o)}function tw(e,t,r,o){let{gen:n,schema:i,data:s,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,pr.schemaHasRulesButRef)(i,l))){n.block(()=>dw(e,"$ref",l.all.$ref.definition));return}if(!c.jtd)yj(e,t);n.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){if(!(0,Vg.shouldUseGroup)(i,m))return;if(m.type){if(n.if((0,bd.checkDataType)(m.type,s,c.strictNumbers)),rw(e,m),t.length===1&&t[0]===m.type&&r)n.else(),(0,bd.reportTypeError)(e);n.endIf()}else rw(e,m);if(!a)n.if(F._`${W.default.errors} === ${o||0}`)}}function rw(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)(0,rj.assignDefaults)(e,t.type);r.block(()=>{for(let i of t.rules)if((0,Vg.shouldUseRule)(o,i))dw(e,i.keyword,i.definition,t.type)})}function yj(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(_j(e,t),!e.opts.allowUnionTypes)vj(e,t);bj(e,e.dataTypes)}function _j(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!lw(e.dataTypes,r))Wg(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),xj(e,t)}function vj(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Wg(e,"use allowUnionTypes to allow union type keyword")}function bj(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Vg.shouldUseRule)(e.schema,n)){let{type:i}=n.definition;if(i.length&&!i.some((s)=>Sj(t,s)))Wg(e,`missing type "${i.join(",")}" for keyword "${o}"`)}}}function Sj(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function lw(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function xj(e,t){let r=[];for(let o of e.dataTypes)if(lw(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function Wg(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,pr.checkStrictMode)(e,t,e.opts.strictTypes)}class Gg{constructor(e,t,r){if((0,ba.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,pr.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",pw(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,ba.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",W.default.errors)}result(e,t,r){this.failResult((0,F.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,F.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(F._`${t} !== undefined && (${(0,F.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?va.reportExtraError:va.reportError)(this,this.def.error,t)}$dataError(){(0,va.reportError)(this,this.def.$dataError||va.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,va.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=F.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=F.nil,t=F.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:i}=this;if(r.if((0,F.or)(F._`${o} === undefined`,t)),e!==F.nil)r.assign(e,!0);if(n.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==F.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return(0,F.or)(i(),s());function i(){if(r.length){if(!(t instanceof F.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return F._`${(0,bd.checkDataTypes)(a,t,n.opts.strictNumbers,bd.DataType.Wrong)}`}return F.nil}function s(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return F._`!${a}(${t})`}return F.nil}}subschema(e,t){let r=(0,Kg.getSubschema)(this.it,e);(0,Kg.extendSubschemaData)(r,this.it,e),(0,Kg.extendSubschemaMode)(r,e);let o={...this.it,...r,items:void 0,props:void 0};return uj(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=pr.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=pr.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,F.Name)),!0}}mw.KeywordCxt=Gg;function dw(e,t,r,o){let n=new Gg(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)(0,ba.funcKeywordCode)(n,r);else if("macro"in r)(0,ba.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,ba.funcKeywordCode)(n,r)}var kj=/^\/(?:[^~]|~0|~1)*$/,wj=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function pw(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,i;if(e==="")return W.default.rootData;if(e[0]==="/"){if(!kj.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,i=W.default.rootData}else{let u=wj.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=t)throw Error(c("property/index",l));return o[t-l]}if(l>t)throw Error(c("data",l));if(i=r[t-l],!n)return i}let s=i,a=n.split("/");for(let u of a)if(u)i=F._`${i}${(0,F.getProperty)((0,pr.unescapeJsonPointer)(u))}`,s=F._`${s} && ${i}`;return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}mw.getData=pw});var Sd=M((gw)=>{Object.defineProperty(gw,"__esModule",{value:!0});class hw extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}gw.default=hw});var xa=M((_w)=>{Object.defineProperty(_w,"__esModule",{value:!0});var Jg=_a();class yw extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,Jg.resolveUrl)(e,t,r),this.missingSchema=(0,Jg.normalizeId)((0,Jg.getFullPath)(e,this.missingRef))}}_w.default=yw});var kd=M((Sw)=>{Object.defineProperty(Sw,"__esModule",{value:!0});Sw.resolveSchema=Sw.getCompilingSchema=Sw.resolveRef=Sw.compileSchema=Sw.SchemaEnv=void 0;var Nt=Y(),Ej=Sd(),wn=dr(),Dt=_a(),vw=ie(),Rj=Sa();class ka{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Dt.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}Sw.SchemaEnv=ka;function Yg(e){let t=bw.call(this,e);if(t)return t;let r=(0,Dt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:i}=this.opts,s=new Nt.CodeGen(this.scope,{es5:o,lines:n,ownProperties:i}),a;if(e.$async)a=s.scopeValue("Error",{ref:Ej.default,code:Nt._`require("ajv/dist/runtime/validation_error").default`});let c=s.scopeName("validate");e.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:wn.default.data,parentData:wn.default.parentData,parentDataProperty:wn.default.parentDataProperty,dataNames:[wn.default.data],dataPathArr:[Nt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Nt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Nt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Nt._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Rj.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();if(l=`${s.scopeRefs(wn.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let p=Function(`${wn.default.self}`,`${wn.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async)p.$async=!0;if(this.opts.code.source===!0)p.source={validateName:c,validateCode:d,scopeValues:s._values};if(this.opts.unevaluated){let{props:f,items:h}=u;if(p.evaluated={props:f instanceof Nt.Name?void 0:f,items:h instanceof Nt.Name?void 0:h,dynamicProps:f instanceof Nt.Name,dynamicItems:h instanceof Nt.Name},p.source)p.source.evaluated=(0,Nt.stringify)(p.evaluated)}return e.validate=p,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}Sw.compileSchema=Yg;function Cj(e,t,r){var o;r=(0,Dt.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let i=Mj.call(this,e,r);if(i===void 0){let s=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;if(s)i=new ka({schema:s,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=Oj.call(this,i)}Sw.resolveRef=Cj;function Oj(e){if((0,Dt.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Yg.call(this,e)}function bw(e){for(let t of this._compilations)if(Aj(t,e))return t}Sw.getCompilingSchema=bw;function Aj(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Mj(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||xd.call(this,e,t)}function xd(e,t){let r=this.opts.uriResolver.parse(t),o=(0,Dt._getFullPath)(this.opts.uriResolver,r),n=(0,Dt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return Xg.call(this,r,e);let i=(0,Dt.normalizeId)(o),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=xd.call(this,e,s);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Xg.call(this,r,a)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)Yg.call(this,s);if(i===(0,Dt.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];if(u)n=(0,Dt.resolveUrl)(this.opts.uriResolver,n,u);return new ka({schema:a,schemaId:c,root:e,baseId:n})}return Xg.call(this,r,s)}Sw.resolveSchema=xd;var zj=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xg(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[(0,vw.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!zj.has(a)&&u)t=(0,Dt.resolveUrl)(this.opts.uriResolver,t,u)}let i;if(typeof r!="boolean"&&r.$ref&&!(0,vw.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Dt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=xd.call(this,o,a)}let{schemaId:s}=this.opts;if(i=i||new ka({schema:r,schemaId:s,root:o,baseId:t}),i.schema!==i.root.schema)return i;return}});var kw=M((X7,Fj)=>{Fj.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:!1}});var ty=M((Y7,Ew)=>{var Lj=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),$w=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),Qg=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Iw=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),qj=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function ey(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Zj=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function ww(e){return e.length=0,!0}function Hj(e,t,r){if(e.length){let o=ey(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function Bj(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],i=!1,s=!1,a=Hj;for(let c=0;c<e.length;c++){let u=e[c];if(u==="["||u==="]")continue;if(u===":"){if(i===!0)s=!0;if(!a(n,o,r))break;if(++t>7){r.error=!0;break}if(c>0&&e[c-1]===":")i=!0;o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=ww}else{n.push(u);continue}}if(n.length)if(a===ww)r.zone=n.join("");else if(s)o.push(n.join(""));else o.push(ey(n));return r.address=o.join(""),r}function Tw(e){if(Kj(e,":")<2)return{host:e,isIPV6:!1};let t=Bj(e);if(!t.error){let{address:r,address:o}=t;if(t.zone)r+="%"+t.zone,o+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:e,isIPV6:!1}}function Kj(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function Vj(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===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(n===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]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var Wj={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Gj=/[@/?#:]/g,Jj=/[@/?#]/g;function Pw(e,t){let r=t?Jj:Gj;return r.lastIndex=0,e.replace(r,(o)=>Wj[o])}function Xj(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(Qg(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));if(t&&Iw(s))r+=s;else r+="%"+i;o+=2;continue}}r+=e[o]}return r}function Yj(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Qg(o)){let n=o.toUpperCase(),i=String.fromCharCode(parseInt(n,16));if(i!=="."&&Iw(i))t+=i;else t+="%"+n;r+=2;continue}}if(qj(e[r]))t+=e[r];else t+=escape(e[r])}return t}function Qj(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Qg(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function e1(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!$w(r)){let o=Tw(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=Pw(r,!1)}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}Ew.exports={nonSimpleDomain:Zj,recomposeAuthority:e1,reescapeHostDelimiters:Pw,normalizePercentEncoding:Xj,normalizePathEncoding:Yj,escapePreservingEscapes:Qj,removeDotSegments:Vj,isIPv4:$w,isUUID:Lj,normalizeIPv6:Tw,stringArrayToHexStripped:ey}});var Mw=M((Q7,Aw)=>{var{isUUID:t1}=ty(),r1=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n1=["http","https","ws","wss","urn","urn:uuid"];function o1(e){return n1.indexOf(e)!==-1}function ry(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;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!1}function Rw(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function Cw(e){let 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 i1(e){return e.secure=ry(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function s1(e){if(e.port===(ry(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){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function a1(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(r1);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,i=ny(n);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function c1(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,i=ny(n);if(i)e=i.serialize(e,t);let s=e,a=e.nss;return s.path=`${o||t.nid}:${a}`,t.skipEscape=!0,s}function u1(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!t1(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function l1(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Ow={scheme:"http",domainHost:!0,parse:Rw,serialize:Cw},d1={scheme:"https",domainHost:Ow.domainHost,parse:Rw,serialize:Cw},wd={scheme:"ws",domainHost:!0,parse:i1,serialize:s1},p1={scheme:"wss",domainHost:wd.domainHost,parse:wd.parse,serialize:wd.serialize},m1={scheme:"urn",parse:a1,serialize:c1,skipNormalize:!0},f1={scheme:"urn:uuid",parse:u1,serialize:l1,skipNormalize:!0},$d={http:Ow,https:d1,ws:wd,wss:p1,urn:m1,"urn:uuid":f1};Object.setPrototypeOf($d,null);function ny(e){return e&&($d[e]||$d[e.toLowerCase()])||void 0}Aw.exports={wsIsSecure:ry,SCHEMES:$d,isValidSchemeName:o1,getSchemeHandler:ny}});var Fw=M((eY,Id)=>{var{normalizeIPv6:h1,removeDotSegments:wa,recomposeAuthority:g1,normalizePercentEncoding:y1,normalizePathEncoding:_1,escapePreservingEscapes:v1,reescapeHostDelimiters:b1,isIPv4:S1,nonSimpleDomain:x1}=ty(),{SCHEMES:k1,getSchemeHandler:Nw}=Mw();function w1(e,t){if(typeof e==="string")e=E1(e,t);else if(typeof e==="object")e=Mo($n(e,t),t);return e}function $1(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=Dw(Mo(e,o),Mo(t,o),o,!0);return o.skipEscape=!0,$n(n,o)}function Dw(e,t,r,o){let n={};if(!o)e=Mo($n(e,r),r),t=Mo($n(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=wa(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=wa(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=wa(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=wa(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function I1(e,t,r){let o=zw(e,r),n=zw(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function $n(e,t){let 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:""},o=Object.assign({},t),n=[],i=Nw(o.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=v1(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=y1(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=g1(r);if(s!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let a=r.path;if(!o.absolutePath&&(!i||!i.absolutePath))a=wa(a);if(s===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);n.push(a)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var T1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function P1(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}function jw(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,i=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(T1);if(s){if(o.scheme=s[1],o.userinfo=s[3],o.host=s[4],o.port=parseInt(s[5],10),o.path=s[6]||"",o.query=s[7],o.fragment=s[8],isNaN(o.port))o.port=s[5];let a=P1(o,s);if(a!==void 0)o.error=o.error||a,n=!0;if(o.host)if(S1(o.host)===!1){let l=h1(o.host);o.host=l.host.toLowerCase(),i=l.isIPV6}else i=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let c=Nw(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)){if(o.host&&(r.domainHost||c&&c.domainHost)&&i===!1&&x1(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}}if(!c||c&&!c.skipNormalize){if(e.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=b1(unescape(o.host),i)}if(o.path)o.path=_1(o.path);if(o.fragment)try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}}if(c&&c.parse)c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function Mo(e,t){return jw(e,t).parsed}function E1(e,t){return Uw(e,t).normalized}function Uw(e,t){let{parsed:r,malformedAuthorityOrPort:o}=jw(e,t);return{normalized:o?e:$n(r,t),malformedAuthorityOrPort:o}}function zw(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:o}=Uw(e,t);return o?void 0:r}if(typeof e==="object")return $n(e,t)}var oy={SCHEMES:k1,normalize:w1,resolve:$1,resolveComponent:Dw,equal:I1,serialize:$n,parse:Mo};Id.exports=oy;Id.exports.default=oy;Id.exports.fastUri=oy});var Zw=M((qw)=>{Object.defineProperty(qw,"__esModule",{value:!0});var Lw=Fw();Lw.code='require("ajv/dist/runtime/uri").default';qw.default=Lw});var Xw=M((mr)=>{Object.defineProperty(mr,"__esModule",{value:!0});mr.CodeGen=mr.Name=mr.nil=mr.stringify=mr.str=mr._=mr.KeywordCxt=void 0;var C1=Sa();Object.defineProperty(mr,"KeywordCxt",{enumerable:!0,get:function(){return C1.KeywordCxt}});var zo=Y();Object.defineProperty(mr,"_",{enumerable:!0,get:function(){return zo._}});Object.defineProperty(mr,"str",{enumerable:!0,get:function(){return zo.str}});Object.defineProperty(mr,"stringify",{enumerable:!0,get:function(){return zo.stringify}});Object.defineProperty(mr,"nil",{enumerable:!0,get:function(){return zo.nil}});Object.defineProperty(mr,"Name",{enumerable:!0,get:function(){return zo.Name}});Object.defineProperty(mr,"CodeGen",{enumerable:!0,get:function(){return zo.CodeGen}});var O1=Sd(),Ww=xa(),A1=Ng(),$a=kd(),M1=Y(),Ia=_a(),Td=ya(),sy=ie(),Hw=kw(),z1=Zw(),Gw=(e,t)=>new RegExp(e,t);Gw.code="new RegExp";var N1=["removeAdditional","useDefaults","coerceTypes"],D1=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),j1={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."},U1={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Bw=200;function F1(e){var t,r,o,n,i,s,a,c,u,l,d,m,p,f,h,v,b,I,C,q,Z,Re,ft,Pn,Zd;let Lo=e.strict,Hd=(t=e.code)===null||t===void 0?void 0:t.optimize,zy=Hd===!0||Hd===void 0?1:Hd||0,Ny=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Gw,xT=(n=e.uriResolver)!==null&&n!==void 0?n:z1.default;return{strictSchema:(s=(i=e.strictSchema)!==null&&i!==void 0?i:Lo)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Lo)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Lo)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:Lo)!==null&&m!==void 0?m:"log",strictRequired:(f=(p=e.strictRequired)!==null&&p!==void 0?p:Lo)!==null&&f!==void 0?f:!1,code:e.code?{...e.code,optimize:zy,regExp:Ny}:{optimize:zy,regExp:Ny},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:Bw,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:Bw,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(I=e.messages)!==null&&I!==void 0?I:!0,inlineRefs:(C=e.inlineRefs)!==null&&C!==void 0?C:!0,schemaId:(q=e.schemaId)!==null&&q!==void 0?q:"$id",addUsedSchema:(Z=e.addUsedSchema)!==null&&Z!==void 0?Z:!0,validateSchema:(Re=e.validateSchema)!==null&&Re!==void 0?Re:!0,validateFormats:(ft=e.validateFormats)!==null&&ft!==void 0?ft:!0,unicodeRegExp:(Pn=e.unicodeRegExp)!==null&&Pn!==void 0?Pn:!0,int32range:(Zd=e.int32range)!==null&&Zd!==void 0?Zd:!0,uriResolver:xT}}class Pd{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...F1(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new M1.ValueScope({scope:{},prefixes:D1,es5:t,lines:r}),this.logger=K1(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,A1.getRules)(),Kw.call(this,j1,e,"NOT SUPPORTED"),Kw.call(this,U1,e,"DEPRECATED","warn"),this._metaOpts=H1.call(this),e.formats)q1.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)Z1.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);L1.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=Hw;if(r==="id")o={...Hw},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);if(!("$async"in r))this.errors=r.errors;return o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(u,l){await n.call(this,u.$schema);let d=this._addSchema(u,l);return d.validate||i.call(this,d)}async function n(u){if(u&&!this.getSchema(u))await o.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(l){if(!(l instanceof Ww.default))throw l;return s.call(this,l),await a.call(this,l.missingSchema),i.call(this,u)}}function s({missingSchema:u,missingRef:l}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${l} cannot be resolved`)}async function a(u){let l=await c.call(this,u);if(!this.refs[u])await n.call(this,l.$schema);if(!this.refs[u])this.addSchema(l,u,t)}async function c(u){let l=this._loading[u];if(l)return l;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:i}=this.opts;if(n=e[i],n!==void 0&&typeof n!="string")throw Error(`schema ${i} must be string`)}return t=(0,Ia.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=Vw.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new $a.SchemaEnv({schema:{},schemaId:r});if(t=$a.resolveSchema.call(this,o,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=Vw.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=(0,Ia.normalizeId)(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(W1.call(this,r,t),!t)return(0,sy.eachItem)(r,(n)=>iy.call(this,n)),this;J1.call(this,t);let o={...t,type:(0,Td.getJSONTypes)(t.type),schemaType:(0,Td.getJSONTypes)(t.schemaType)};return(0,sy.eachItem)(r,o.type.length===0?(n)=>iy.call(this,n,o):(n)=>o.type.forEach((i)=>iy.call(this,n,o,i))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),i=e;for(let s of n)i=i[s];for(let s in r){let a=r[s];if(typeof a!="object")continue;let{$data:c}=a.definition,u=i[s];if(c&&u)i[s]=Jw(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let i,{schemaId:s}=this.opts;if(typeof e=="object")i=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=(0,Ia.normalizeId)(i||r);let c=Ia.getSchemaRefs.call(this,e,r);if(a=new $a.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(o)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else $a.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{$a.compileSchema.call(this,e)}finally{this.opts=t}}}Pd.ValidationError=O1.default;Pd.MissingRefError=Ww.default;mr.default=Pd;function Kw(e,t,r,o="error"){for(let n in e){let i=n;if(i in t)this.logger[o](`${r}: option ${n}. ${e[i]}`)}}function Vw(e){return e=(0,Ia.normalizeId)(e),this.schemas[e]||this.refs[e]}function L1(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function q1(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function Z1(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function H1(){let e={...this.opts};for(let t of N1)delete e[t];return e}var B1={log(){},warn(){},error(){}};function K1(e){if(e===!1)return B1;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var V1=/^[a-z_$][a-z0-9_$:-]*$/i;function W1(e,t){let{RULES:r}=this;if((0,sy.eachItem)(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!V1.test(o))throw Error(`Keyword ${o} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function iy(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=n?i.post:i.rules.find(({type:c})=>c===r);if(!s)s={type:r,rules:[]},i.rules.push(s);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Td.getJSONTypes)(t.type),schemaType:(0,Td.getJSONTypes)(t.schemaType)}};if(t.before)G1.call(this,s,a,t.before);else s.rules.push(a);i.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach((c)=>this.addKeyword(c))}function G1(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function J1(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=Jw(t);e.validateSchema=this.compile(t,!0)}var X1={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Jw(e){return{anyOf:[e,X1]}}});var Qw=M((Yw)=>{Object.defineProperty(Yw,"__esModule",{value:!0});var eU={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Yw.default=eU});var i$=M((n$)=>{Object.defineProperty(n$,"__esModule",{value:!0});n$.callRef=n$.getValidate=void 0;var rU=xa(),e$=wt(),ot=Y(),No=dr(),t$=kd(),Ed=ie(),nU={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:i,validateName:s,opts:a,self:c}=o,{root:u}=i;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=t$.resolveRef.call(c,u,n,r);if(l===void 0)throw new rU.default(o.opts.uriResolver,n,r);if(l instanceof t$.SchemaEnv)return m(l);return p(l);function d(){if(i===u)return Rd(e,s,i,i.$async);let f=t.scopeValue("root",{ref:u});return Rd(e,ot._`${f}.validate`,u,u.$async)}function m(f){let h=r$(e,f);Rd(e,h,f,f.$async)}function p(f){let h=t.scopeValue("schema",a.code.source===!0?{ref:f,code:(0,ot.stringify)(f)}:{ref:f}),v=t.name("valid"),b=e.subschema({schema:f,dataTypes:[],schemaPath:ot.nil,topSchemaRef:h,errSchemaPath:r},v);e.mergeEvaluated(b),e.ok(v)}}};function r$(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):ot._`${r.scopeValue("wrapper",{ref:t})}.validate`}n$.getValidate=r$;function Rd(e,t,r,o){let{gen:n,it:i}=e,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?No.default.this:ot.nil;if(o)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let f=n.let("valid");n.try(()=>{if(n.code(ot._`await ${(0,e$.callValidateCode)(e,t,u)}`),p(t),!s)n.assign(f,!0)},(h)=>{if(n.if(ot._`!(${h} instanceof ${i.ValidationError})`,()=>n.throw(h)),m(h),!s)n.assign(f,!1)}),e.ok(f)}function d(){e.result((0,e$.callValidateCode)(e,t,u),()=>p(t),()=>m(t))}function m(f){let h=ot._`${f}.errors`;n.assign(No.default.vErrors,ot._`${No.default.vErrors} === null ? ${h} : ${No.default.vErrors}.concat(${h})`),n.assign(No.default.errors,ot._`${No.default.vErrors}.length`)}function p(f){var h;if(!i.opts.unevaluated)return;let v=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(v&&!v.dynamicProps){if(v.props!==void 0)i.props=Ed.mergeEvaluated.props(n,v.props,i.props)}else{let b=n.var("props",ot._`${f}.evaluated.props`);i.props=Ed.mergeEvaluated.props(n,b,i.props,ot.Name)}if(i.items!==!0)if(v&&!v.dynamicItems){if(v.items!==void 0)i.items=Ed.mergeEvaluated.items(n,v.items,i.items)}else{let b=n.var("items",ot._`${f}.evaluated.items`);i.items=Ed.mergeEvaluated.items(n,b,i.items,ot.Name)}}}n$.callRef=Rd;n$.default=nU});var a$=M((s$)=>{Object.defineProperty(s$,"__esModule",{value:!0});var sU=Qw(),aU=i$(),cU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",sU.default,aU.default];s$.default=cU});var u$=M((c$)=>{Object.defineProperty(c$,"__esModule",{value:!0});var Cd=Y(),qr=Cd.operators,Od={maximum:{okStr:"<=",ok:qr.LTE,fail:qr.GT},minimum:{okStr:">=",ok:qr.GTE,fail:qr.LT},exclusiveMaximum:{okStr:"<",ok:qr.LT,fail:qr.GTE},exclusiveMinimum:{okStr:">",ok:qr.GT,fail:qr.LTE}},lU={message:({keyword:e,schemaCode:t})=>Cd.str`must be ${Od[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Cd._`{comparison: ${Od[e].okStr}, limit: ${t}}`},dU={keyword:Object.keys(Od),type:"number",schemaType:"number",$data:!0,error:lU,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(Cd._`${r} ${Od[t].fail} ${o} || isNaN(${r})`)}};c$.default=dU});var d$=M((l$)=>{Object.defineProperty(l$,"__esModule",{value:!0});var Ta=Y(),mU={message:({schemaCode:e})=>Ta.str`must be multiple of ${e}`,params:({schemaCode:e})=>Ta._`{multipleOf: ${e}}`},fU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:mU,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,i=n.opts.multipleOfPrecision,s=t.let("res"),a=i?Ta._`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:Ta._`${s} !== parseInt(${s})`;e.fail$data(Ta._`(${o} === 0 || (${s} = ${r}/${o}, ${a}))`)}};l$.default=fU});var f$=M((m$)=>{Object.defineProperty(m$,"__esModule",{value:!0});function p$(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}m$.default=p$;p$.code='require("ajv/dist/runtime/ucs2length").default'});var g$=M((h$)=>{Object.defineProperty(h$,"__esModule",{value:!0});var In=Y(),yU=ie(),_U=f$(),vU={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return In.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>In._`{limit: ${e}}`},bU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:vU,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,i=t==="maxLength"?In.operators.GT:In.operators.LT,s=n.opts.unicode===!1?In._`${r}.length`:In._`${(0,yU.useFunc)(e.gen,_U.default)}(${r})`;e.fail$data(In._`${s} ${i} ${o}`)}};h$.default=bU});var _$=M((y$)=>{Object.defineProperty(y$,"__esModule",{value:!0});var xU=wt(),kU=ie(),Do=Y(),wU={message:({schemaCode:e})=>Do.str`must match pattern "${e}"`,params:({schemaCode:e})=>Do._`{pattern: ${e}}`},$U={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:wU,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:i,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?Do._`new RegExp`:(0,kU.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,Do._`${u}(${i}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(Do._`!${l}`)}else{let c=(0,xU.usePattern)(e,n);e.fail$data(Do._`!${c}.test(${r})`)}}};y$.default=$U});var b$=M((v$)=>{Object.defineProperty(v$,"__esModule",{value:!0});var Pa=Y(),TU={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return Pa.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>Pa._`{limit: ${e}}`},PU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:TU,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?Pa.operators.GT:Pa.operators.LT;e.fail$data(Pa._`Object.keys(${r}).length ${n} ${o}`)}};v$.default=PU});var x$=M((S$)=>{Object.defineProperty(S$,"__esModule",{value:!0});var Ea=wt(),Ra=Y(),RU=ie(),CU={message:({params:{missingProperty:e}})=>Ra.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Ra._`{missingProperty: ${e}}`},OU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:CU,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:i,it:s}=e,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors)u();else l();if(a.strictRequired){let p=e.parentSchema.properties,{definedProperties:f}=e.it;for(let h of r)if((p===null||p===void 0?void 0:p[h])===void 0&&!f.has(h)){let v=s.schemaEnv.baseId+s.errSchemaPath,b=`required property "${h}" is not defined at "${v}" (strictRequired)`;(0,RU.checkStrictMode)(s,b,s.opts.strictRequired)}}function u(){if(c||i)e.block$data(Ra.nil,d);else for(let p of r)(0,Ea.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||i){let f=t.let("valid",!0);e.block$data(f,()=>m(p,f)),e.ok(f)}else t.if((0,Ea.checkMissingProp)(e,r,p)),(0,Ea.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",o,(p)=>{e.setParams({missingProperty:p}),t.if((0,Ea.noPropertyInData)(t,n,p,a.ownProperties),()=>e.error())})}function m(p,f){e.setParams({missingProperty:p}),t.forOf(p,o,()=>{t.assign(f,(0,Ea.propertyInData)(t,n,p,a.ownProperties)),t.if((0,Ra.not)(f),()=>{e.error(),t.break()})},Ra.nil)}}};S$.default=OU});var w$=M((k$)=>{Object.defineProperty(k$,"__esModule",{value:!0});var Ca=Y(),MU={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return Ca.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>Ca._`{limit: ${e}}`},zU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:MU,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Ca.operators.GT:Ca.operators.LT;e.fail$data(Ca._`${r}.length ${n} ${o}`)}};k$.default=zU});var Ad=M((I$)=>{Object.defineProperty(I$,"__esModule",{value:!0});var $$=Hg();$$.code='require("ajv/dist/runtime/equal").default';I$.default=$$});var P$=M((T$)=>{Object.defineProperty(T$,"__esModule",{value:!0});var ay=ya(),Ue=Y(),jU=ie(),UU=Ad(),FU={message:({params:{i:e,j:t}})=>Ue.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ue._`{i: ${e}, j: ${t}}`},LU={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:FU,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:i,schemaCode:s,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=i.items?(0,ay.getSchemaTypes)(i.items):[];e.block$data(c,l,Ue._`${s} === false`),e.ok(c);function l(){let f=t.let("i",Ue._`${r}.length`),h=t.let("j");e.setParams({i:f,j:h}),t.assign(c,!0),t.if(Ue._`${f} > 1`,()=>(d()?m:p)(f,h))}function d(){return u.length>0&&!u.some((f)=>f==="object"||f==="array")}function m(f,h){let v=t.name("item"),b=(0,ay.checkDataTypes)(u,v,a.opts.strictNumbers,ay.DataType.Wrong),I=t.const("indices",Ue._`{}`);t.for(Ue._`;${f}--;`,()=>{if(t.let(v,Ue._`${r}[${f}]`),t.if(b,Ue._`continue`),u.length>1)t.if(Ue._`typeof ${v} == "string"`,Ue._`${v} += "_"`);t.if(Ue._`typeof ${I}[${v}] == "number"`,()=>{t.assign(h,Ue._`${I}[${v}]`),e.error(),t.assign(c,!1).break()}).code(Ue._`${I}[${v}] = ${f}`)})}function p(f,h){let v=(0,jU.useFunc)(t,UU.default),b=t.name("outer");t.label(b).for(Ue._`;${f}--;`,()=>t.for(Ue._`${h} = ${f}; ${h}--;`,()=>t.if(Ue._`${v}(${r}[${f}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(b)})))}}};T$.default=LU});var R$=M((E$)=>{Object.defineProperty(E$,"__esModule",{value:!0});var cy=Y(),ZU=ie(),HU=Ad(),BU={message:"must be equal to constant",params:({schemaCode:e})=>cy._`{allowedValue: ${e}}`},KU={keyword:"const",$data:!0,error:BU,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:i}=e;if(o||i&&typeof i=="object")e.fail$data(cy._`!${(0,ZU.useFunc)(t,HU.default)}(${r}, ${n})`);else e.fail(cy._`${i} !== ${r}`)}};E$.default=KU});var O$=M((C$)=>{Object.defineProperty(C$,"__esModule",{value:!0});var Oa=Y(),WU=ie(),GU=Ad(),JU={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Oa._`{allowedValues: ${e}}`},XU={keyword:"enum",schemaType:"array",$data:!0,error:JU,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:i,it:s}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=(0,WU.useFunc)(t,GU.default),l;if(a||o)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw Error("ajv implementation error");let p=t.const("vSchema",i);l=(0,Oa.or)(...n.map((f,h)=>m(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,(p)=>t.if(Oa._`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function m(p,f){let h=n[f];return typeof h==="object"&&h!==null?Oa._`${u()}(${r}, ${p}[${f}])`:Oa._`${r} === ${h}`}}};C$.default=XU});var M$=M((A$)=>{Object.defineProperty(A$,"__esModule",{value:!0});var QU=u$(),e4=d$(),t4=g$(),r4=_$(),n4=b$(),o4=x$(),i4=w$(),s4=P$(),a4=R$(),c4=O$(),u4=[QU.default,e4.default,t4.default,r4.default,n4.default,o4.default,i4.default,s4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},a4.default,c4.default];A$.default=u4});var ly=M((N$)=>{Object.defineProperty(N$,"__esModule",{value:!0});N$.validateAdditionalItems=void 0;var Tn=Y(),uy=ie(),d4={message:({params:{len:e}})=>Tn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Tn._`{limit: ${e}}`},p4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:d4,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,uy.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}z$(e,o)}};function z$(e,t){let{gen:r,schema:o,data:n,keyword:i,it:s}=e;s.items=!0;let a=r.const("len",Tn._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(Tn._`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,uy.alwaysValidSchema)(s,o)){let u=r.var("valid",Tn._`${a} <= ${t.length}`);r.if((0,Tn.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:i,dataProp:l,dataPropType:uy.Type.Num},u),!s.allErrors)r.if((0,Tn.not)(u),()=>r.break())})}}N$.validateAdditionalItems=z$;N$.default=p4});var dy=M((F$)=>{Object.defineProperty(F$,"__esModule",{value:!0});F$.validateTuple=void 0;var j$=Y(),Md=ie(),f4=wt(),h4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return U$(e,"additionalItems",t);if(r.items=!0,(0,Md.alwaysValidSchema)(r,t))return;e.ok((0,f4.validateArray)(e))}};function U$(e,t,r=e.schema){let{gen:o,parentSchema:n,data:i,keyword:s,it:a}=e;if(l(n),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=Md.mergeEvaluated.items(o,r.length,a.items);let c=o.name("valid"),u=o.const("len",j$._`${i}.length`);r.forEach((d,m)=>{if((0,Md.alwaysValidSchema)(a,d))return;o.if(j$._`${u} > ${m}`,()=>e.subschema({keyword:s,schemaProp:m,dataProp:m},c)),e.ok(c)});function l(d){let{opts:m,errSchemaPath:p}=a,f=r.length,h=f===d.minItems&&(f===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let v=`"${s}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,Md.checkStrictMode)(a,v,m.strictTuples)}}}F$.validateTuple=U$;F$.default=h4});var Z$=M((q$)=>{Object.defineProperty(q$,"__esModule",{value:!0});var y4=dy(),_4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,y4.validateTuple)(e,"items")};q$.default=_4});var K$=M((B$)=>{Object.defineProperty(B$,"__esModule",{value:!0});var H$=Y(),b4=ie(),S4=wt(),x4=ly(),k4={message:({params:{len:e}})=>H$.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>H$._`{limit: ${e}}`},w4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:k4,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,(0,b4.alwaysValidSchema)(o,t))return;if(n)(0,x4.validateAdditionalItems)(e,n);else e.ok((0,S4.validateArray)(e))}};B$.default=w4});var W$=M((V$)=>{Object.defineProperty(V$,"__esModule",{value:!0});var $t=Y(),zd=ie(),I4={message:({params:{min:e,max:t}})=>t===void 0?$t.str`must contain at least ${e} valid item(s)`:$t.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?$t._`{minContains: ${e}}`:$t._`{minContains: ${e}, maxContains: ${t}}`},T4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:I4,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e,s,a,{minContains:c,maxContains:u}=o;if(i.opts.next)s=c===void 0?1:c,a=u;else s=1;let l=t.const("len",$t._`${n}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,zd.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,zd.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,zd.alwaysValidSchema)(i,r)){let h=$t._`${l} >= ${s}`;if(a!==void 0)h=$t._`${h} && ${l} <= ${a}`;e.pass(h);return}i.items=!0;let d=t.name("valid");if(a===void 0&&s===1)p(d,()=>t.if(d,()=>t.break()));else if(s===0){if(t.let(d,!0),a!==void 0)t.if($t._`${n}.length > 0`,m)}else t.let(d,!1),m();e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),v=t.let("count",0);p(h,()=>t.if(h,()=>f(v)))}function p(h,v){t.forRange("i",0,l,(b)=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:zd.Type.Num,compositeRule:!0},h),v()})}function f(h){if(t.code($t._`${h}++`),a===void 0)t.if($t._`${h} >= ${s}`,()=>t.assign(d,!0).break());else if(t.if($t._`${h} > ${a}`,()=>t.assign(d,!1).break()),s===1)t.assign(d,!0);else t.if($t._`${h} >= ${s}`,()=>t.assign(d,!0))}}};V$.default=T4});var eI=M((X$)=>{Object.defineProperty(X$,"__esModule",{value:!0});X$.validateSchemaDeps=X$.validatePropertyDeps=X$.error=void 0;var py=Y(),E4=ie(),Aa=wt();X$.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return py.str`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>py._`{property: ${e},
9
+ missingProperty: ${o},
10
+ depsCount: ${t},
11
+ deps: ${r}}`};var R4={keyword:"dependencies",type:"object",schemaType:"object",error:X$.error,code(e){let[t,r]=C4(e);G$(e,t),J$(e,r)}};function C4({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function G$(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,Aa.propertyInData)(r,o,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors)r.if(c,()=>{for(let u of a)(0,Aa.checkReportMissingProp)(e,u)});else r.if(py._`${c} && (${(0,Aa.checkMissingProp)(e,a,i)})`),(0,Aa.reportMissingProp)(e,i),r.else()}}X$.validatePropertyDeps=G$;function J$(e,t=e.schema){let{gen:r,data:o,keyword:n,it:i}=e,s=r.name("valid");for(let a in t){if((0,E4.alwaysValidSchema)(i,t[a]))continue;r.if((0,Aa.propertyInData)(r,o,a,i.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s)}}X$.validateSchemaDeps=J$;X$.default=R4});var nI=M((rI)=>{Object.defineProperty(rI,"__esModule",{value:!0});var tI=Y(),M4=ie(),z4={message:"property name must be valid",params:({params:e})=>tI._`{propertyName: ${e.propertyName}}`},N4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:z4,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,M4.alwaysValidSchema)(n,r))return;let i=t.name("valid");t.forIn("key",o,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),t.if((0,tI.not)(i),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(i)}};rI.default=N4});var my=M((oI)=>{Object.defineProperty(oI,"__esModule",{value:!0});var Nd=wt(),jt=Y(),j4=dr(),Dd=ie(),U4={message:"must NOT have additional properties",params:({params:e})=>jt._`{additionalProperty: ${e.additionalProperty}}`},F4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:U4,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:i,it:s}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,Dd.alwaysValidSchema)(s,r))return;let u=(0,Nd.allSchemaProperties)(o.properties),l=(0,Nd.allSchemaProperties)(o.patternProperties);d(),e.ok(jt._`${i} === ${j4.default.errors}`);function d(){t.forIn("key",n,(v)=>{if(!u.length&&!l.length)f(v);else t.if(m(v),()=>f(v))})}function m(v){let b;if(u.length>8){let I=(0,Dd.schemaRefOrVal)(s,o.properties,"properties");b=(0,Nd.isOwnProperty)(t,I,v)}else if(u.length)b=(0,jt.or)(...u.map((I)=>jt._`${v} === ${I}`));else b=jt.nil;if(l.length)b=(0,jt.or)(b,...l.map((I)=>jt._`${(0,Nd.usePattern)(e,I)}.test(${v})`));return(0,jt.not)(b)}function p(v){t.code(jt._`delete ${n}[${v}]`)}function f(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(v);return}if(r===!1){if(e.setParams({additionalProperty:v}),e.error(),!a)t.break();return}if(typeof r=="object"&&!(0,Dd.alwaysValidSchema)(s,r)){let b=t.name("valid");if(c.removeAdditional==="failing")h(v,b,!1),t.if((0,jt.not)(b),()=>{e.reset(),p(v)});else if(h(v,b),!a)t.if((0,jt.not)(b),()=>t.break())}}function h(v,b,I){let C={keyword:"additionalProperties",dataProp:v,dataPropType:Dd.Type.Str};if(I===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(C,b)}}};oI.default=F4});var cI=M((aI)=>{Object.defineProperty(aI,"__esModule",{value:!0});var q4=Sa(),iI=wt(),fy=ie(),sI=my(),Z4={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e;if(i.opts.removeAdditional==="all"&&o.additionalProperties===void 0)sI.default.code(new q4.KeywordCxt(i,sI.default,"additionalProperties"));let s=(0,iI.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);if(i.opts.unevaluated&&s.length&&i.props!==!0)i.props=fy.mergeEvaluated.props(t,(0,fy.toHash)(s),i.props);let a=s.filter((d)=>!(0,fy.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(u(d))l(d);else{if(t.if((0,iI.propertyInData)(t,n,d,i.opts.ownProperties)),l(d),!i.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};aI.default=Z4});var mI=M((pI)=>{Object.defineProperty(pI,"__esModule",{value:!0});var uI=wt(),jd=Y(),lI=ie(),dI=ie(),B4={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:i}=e,{opts:s}=i,a=(0,uI.allSchemaProperties)(r),c=a.filter((h)=>(0,lI.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=t.name("valid");if(i.props!==!0&&!(i.props instanceof jd.Name))i.props=(0,dI.evaluatedPropsToName)(t,i.props);let{props:d}=i;m();function m(){for(let h of a){if(u)p(h);if(i.allErrors)f(h);else t.var(l,!0),f(h),t.if(l)}}function p(h){for(let v in u)if(new RegExp(h).test(v))(0,lI.checkStrictMode)(i,`property ${v} matches pattern ${h} (use allowMatchingProperties)`)}function f(h){t.forIn("key",o,(v)=>{t.if(jd._`${(0,uI.usePattern)(e,h)}.test(${v})`,()=>{let b=c.includes(h);if(!b)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:v,dataPropType:dI.Type.Str},l);if(i.opts.unevaluated&&d!==!0)t.assign(jd._`${d}[${v}]`,!0);else if(!b&&!i.allErrors)t.if((0,jd.not)(l),()=>t.break())})})}}};pI.default=B4});var hI=M((fI)=>{Object.defineProperty(fI,"__esModule",{value:!0});var V4=ie(),W4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,V4.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};fI.default=W4});var yI=M((gI)=>{Object.defineProperty(gI,"__esModule",{value:!0});var J4=wt(),X4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:J4.validateUnion,error:{message:"must match a schema in anyOf"}};gI.default=X4});var vI=M((_I)=>{Object.defineProperty(_I,"__esModule",{value:!0});var Ud=Y(),Q4=ie(),eF={message:"must match exactly one schema in oneOf",params:({params:e})=>Ud._`{passingSchemas: ${e.passing}}`},tF={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:eF,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let i=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let m;if((0,Q4.alwaysValidSchema)(n,l))t.var(c,!0);else m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(Ud._`${c} && ${s}`).assign(s,!1).assign(a,Ud._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(s,!0),t.assign(a,d),m)e.mergeEvaluated(m,Ud.Name)})})}}};_I.default=tF});var SI=M((bI)=>{Object.defineProperty(bI,"__esModule",{value:!0});var nF=ie(),oF={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((i,s)=>{if((0,nF.alwaysValidSchema)(o,i))return;let a=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(a)})}};bI.default=oF});var $I=M((wI)=>{Object.defineProperty(wI,"__esModule",{value:!0});var Fd=Y(),kI=ie(),sF={message:({params:e})=>Fd.str`must match "${e.ifClause}" schema`,params:({params:e})=>Fd._`{failingKeyword: ${e.ifClause}}`},aF={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:sF,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)(0,kI.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=xI(o,"then"),i=xI(o,"else");if(!n&&!i)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else if(n)t.if(a,u("then"));else t.if((0,Fd.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},a);if(t.assign(s,a),e.mergeValidEvaluated(m,s),d)t.assign(d,Fd._`${l}`);else e.setParams({ifClause:l})}}}};function xI(e,t){let r=e.schema[t];return r!==void 0&&!(0,kI.alwaysValidSchema)(e,r)}wI.default=aF});var TI=M((II)=>{Object.defineProperty(II,"__esModule",{value:!0});var uF=ie(),lF={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,uF.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};II.default=lF});var EI=M((PI)=>{Object.defineProperty(PI,"__esModule",{value:!0});var pF=ly(),mF=Z$(),fF=dy(),hF=K$(),gF=W$(),yF=eI(),_F=nI(),vF=my(),bF=cI(),SF=mI(),xF=hI(),kF=yI(),wF=vI(),$F=SI(),IF=$I(),TF=TI();function PF(e=!1){let t=[xF.default,kF.default,wF.default,$F.default,IF.default,TF.default,_F.default,vF.default,yF.default,bF.default,SF.default];if(e)t.push(mF.default,hF.default);else t.push(pF.default,fF.default);return t.push(gF.default),t}PI.default=PF});var CI=M((RI)=>{Object.defineProperty(RI,"__esModule",{value:!0});var Ee=Y(),RF={message:({schemaCode:e})=>Ee.str`must match format "${e}"`,params:({schemaCode:e})=>Ee._`{format: ${e}}`},CF={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:RF,code(e,t){let{gen:r,data:o,$data:n,schema:i,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;if(n)m();else p();function m(){let f=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",Ee._`${f}[${s}]`),v=r.let("fType"),b=r.let("format");r.if(Ee._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(v,Ee._`${h}.type || "string"`).assign(b,Ee._`${h}.validate`),()=>r.assign(v,Ee._`"string"`).assign(b,h)),e.fail$data((0,Ee.or)(I(),C()));function I(){if(c.strictSchema===!1)return Ee.nil;return Ee._`${s} && !${b}`}function C(){let q=l.$async?Ee._`(${h}.async ? await ${b}(${o}) : ${b}(${o}))`:Ee._`${b}(${o})`,Z=Ee._`(typeof ${b} == "function" ? ${q} : ${b}.test(${o}))`;return Ee._`${b} && ${b} !== true && ${v} === ${t} && !${Z}`}}function p(){let f=d.formats[i];if(!f){I();return}if(f===!0)return;let[h,v,b]=C(f);if(h===t)e.pass(q());function I(){if(c.strictSchema===!1){d.logger.warn(Z());return}throw Error(Z());function Z(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function C(Z){let Re=Z instanceof RegExp?(0,Ee.regexpCode)(Z):c.code.formats?Ee._`${c.code.formats}${(0,Ee.getProperty)(i)}`:void 0,ft=r.scopeValue("formats",{key:i,ref:Z,code:Re});if(typeof Z=="object"&&!(Z instanceof RegExp))return[Z.type||"string",Z.validate,Ee._`${ft}.validate`];return["string",Z,ft]}function q(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!l.$async)throw Error("async format in sync schema");return Ee._`await ${b}(${o})`}return typeof v=="function"?Ee._`${b}(${o})`:Ee._`${b}.test(${o})`}}}};RI.default=CF});var AI=M((OI)=>{Object.defineProperty(OI,"__esModule",{value:!0});var AF=CI(),MF=[AF.default];OI.default=MF});var NI=M((MI)=>{Object.defineProperty(MI,"__esModule",{value:!0});MI.contentVocabulary=MI.metadataVocabulary=void 0;MI.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];MI.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var UI=M((jI)=>{Object.defineProperty(jI,"__esModule",{value:!0});var DF=a$(),jF=M$(),UF=EI(),FF=AI(),DI=NI(),LF=[DF.default,jF.default,(0,UF.default)(),FF.default,DI.metadataVocabulary,DI.contentVocabulary];jI.default=LF});var ZI=M((LI)=>{Object.defineProperty(LI,"__esModule",{value:!0});LI.DiscrError=void 0;var FI;(function(e){e.Tag="tag",e.Mapping="mapping"})(FI||(LI.DiscrError=FI={}))});var KI=M((BI)=>{Object.defineProperty(BI,"__esModule",{value:!0});var jo=Y(),hy=ZI(),HI=kd(),ZF=xa(),HF=ie(),BF={message:({params:{discrError:e,tagName:t}})=>e===hy.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>jo._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},KF={keyword:"discriminator",type:"object",schemaType:"object",error:BF,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:i}=e,{oneOf:s}=n;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",jo._`${r}${(0,jo.getProperty)(a)}`);t.if(jo._`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:hy.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let p=m();t.if(!1);for(let f in p)t.elseIf(jo._`${u} === ${f}`),t.assign(c,d(p[f]));t.else(),e.error(!1,{discrError:hy.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(p){let f=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},f);return e.mergeEvaluated(h,jo.Name),f}function m(){var p;let f={},h=b(n),v=!0;for(let q=0;q<s.length;q++){let Z=s[q];if((Z===null||Z===void 0?void 0:Z.$ref)&&!(0,HF.schemaHasRulesButRef)(Z,i.self.RULES)){let ft=Z.$ref;if(Z=HI.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,ft),Z instanceof HI.SchemaEnv)Z=Z.schema;if(Z===void 0)throw new ZF.default(i.opts.uriResolver,i.baseId,ft)}let Re=(p=Z===null||Z===void 0?void 0:Z.properties)===null||p===void 0?void 0:p[a];if(typeof Re!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(h||b(Z)),I(Re,q)}if(!v)throw Error(`discriminator: "${a}" must be required`);return f;function b({required:q}){return Array.isArray(q)&&q.includes(a)}function I(q,Z){if(q.const)C(q.const,Z);else if(q.enum)for(let Re of q.enum)C(Re,Z);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function C(q,Z){if(typeof q!="string"||q in f)throw Error(`discriminator: "${a}" values must be unique strings`);f[q]=Z}}}};BI.default=KF});var VI=M((WY,WF)=>{WF.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var yy=M((it,gy)=>{Object.defineProperty(it,"__esModule",{value:!0});it.MissingRefError=it.ValidationError=it.CodeGen=it.Name=it.nil=it.stringify=it.str=it._=it.KeywordCxt=it.Ajv=void 0;var GF=Xw(),JF=UI(),XF=KI(),WI=VI(),YF=["/properties"],Ld="http://json-schema.org/draft-07/schema";class Ma extends GF.default{_addVocabularies(){if(super._addVocabularies(),JF.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(XF.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(WI,YF):WI;this.addMetaSchema(e,Ld,!1),this.refs["http://json-schema.org/schema"]=Ld}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ld)?Ld:void 0)}}it.Ajv=Ma;gy.exports=it=Ma;gy.exports.Ajv=Ma;Object.defineProperty(it,"__esModule",{value:!0});it.default=Ma;var QF=Sa();Object.defineProperty(it,"KeywordCxt",{enumerable:!0,get:function(){return QF.KeywordCxt}});var Uo=Y();Object.defineProperty(it,"_",{enumerable:!0,get:function(){return Uo._}});Object.defineProperty(it,"str",{enumerable:!0,get:function(){return Uo.str}});Object.defineProperty(it,"stringify",{enumerable:!0,get:function(){return Uo.stringify}});Object.defineProperty(it,"nil",{enumerable:!0,get:function(){return Uo.nil}});Object.defineProperty(it,"Name",{enumerable:!0,get:function(){return Uo.Name}});Object.defineProperty(it,"CodeGen",{enumerable:!0,get:function(){return Uo.CodeGen}});var eL=Sd();Object.defineProperty(it,"ValidationError",{enumerable:!0,get:function(){return eL.default}});var tL=xa();Object.defineProperty(it,"MissingRefError",{enumerable:!0,get:function(){return tL.default}})});var oT=M((rT)=>{Object.defineProperty(rT,"__esModule",{value:!0});rT.formatNames=rT.fastFormats=rT.fullFormats=void 0;function Kt(e,t){return{validate:e,compare:t}}rT.fullFormats={date:Kt(YI,Sy),time:Kt(vy(!0),xy),"date-time":Kt(GI(!0),eT),"iso-time":Kt(vy(),QI),"iso-date-time":Kt(GI(),tT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:uL,"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:gL,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:lL,int32:{type:"number",validate:mL},int64:{type:"number",validate:fL},float:{type:"number",validate:XI},double:{type:"number",validate:XI},password:!0,binary:!0};rT.fastFormats={...rT.fullFormats,date:Kt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Sy),time:Kt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,xy),"date-time":Kt(/^\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,eT),"iso-time":Kt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,QI),"iso-date-time":Kt(/^\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,tT),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};rT.formatNames=Object.keys(rT.fullFormats);function oL(e){return e%4===0&&(e%100!==0||e%400===0)}var iL=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,sL=[0,31,28,31,30,31,30,31,31,30,31,30,31];function YI(e){let t=iL.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&oL(r)?29:sL[o])}function Sy(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var _y=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function vy(e){return function(r){let o=_y.exec(r);if(!o)return!1;let n=+o[1],i=+o[2],s=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&i<=59&&s<60)return!0;let d=i-l*c,m=n-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&s<61}}function xy(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function QI(e,t){if(!(e&&t))return;let r=_y.exec(e),o=_y.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var by=/t|\s/i;function GI(e){let t=vy(e);return function(o){let n=o.split(by);return n.length===2&&YI(n[0])&&t(n[1])}}function eT(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function tT(e,t){if(!(e&&t))return;let[r,o]=e.split(by),[n,i]=t.split(by),s=Sy(r,n);if(s===void 0)return;return s||xy(o,i)}var aL=/\/|:/,cL=/^(?:[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 uL(e){return aL.test(e)&&cL.test(e)}var JI=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function lL(e){return JI.lastIndex=0,JI.test(e)}var dL=-2147483648,pL=2147483647;function mL(e){return Number.isInteger(e)&&e<=pL&&e>=dL}function fL(e){return Number.isInteger(e)}function XI(){return!0}var hL=/[^\\]\\Z/;function gL(e){if(hL.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var sT=M((iT)=>{Object.defineProperty(iT,"__esModule",{value:!0});iT.formatLimitDefinition=void 0;var _L=yy(),Ut=Y(),Zr=Ut.operators,qd={formatMaximum:{okStr:"<=",ok:Zr.LTE,fail:Zr.GT},formatMinimum:{okStr:">=",ok:Zr.GTE,fail:Zr.LT},formatExclusiveMaximum:{okStr:"<",ok:Zr.LT,fail:Zr.GTE},formatExclusiveMinimum:{okStr:">",ok:Zr.GT,fail:Zr.LTE}},vL={message:({keyword:e,schemaCode:t})=>Ut.str`should be ${qd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ut._`{comparison: ${qd[e].okStr}, limit: ${t}}`};iT.formatLimitDefinition={keyword:Object.keys(qd),type:"string",schemaType:"string",$data:!0,error:vL,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:i}=e,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new _L.KeywordCxt(i,a.RULES.all.format.definition,"format");if(c.$data)u();else l();function u(){let m=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=t.const("fmt",Ut._`${m}[${c.schemaCode}]`);e.fail$data((0,Ut.or)(Ut._`typeof ${p} != "object"`,Ut._`${p} instanceof RegExp`,Ut._`typeof ${p}.compare != "function"`,d(p)))}function l(){let m=c.schema,p=a.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw Error(`"${n}": format "${m}" does not define "compare" function`);let f=t.scopeValue("formats",{key:m,ref:p,code:s.code.formats?Ut._`${s.code.formats}${(0,Ut.getProperty)(m)}`:void 0});e.fail$data(d(f))}function d(m){return Ut._`${m}.compare(${r}, ${o}) ${qd[n].fail} 0`}},dependencies:["format"]};var bL=(e)=>(e.addKeyword(iT.formatLimitDefinition),e);iT.default=bL});var lT=M((za,uT)=>{Object.defineProperty(za,"__esModule",{value:!0});var Fo=oT(),xL=sT(),$y=Y(),aT=new $y.Name("fullFormats"),kL=new $y.Name("fastFormats"),Iy=(e,t={keywords:!0})=>{if(Array.isArray(t))return cT(e,t,Fo.fullFormats,aT),e;let[r,o]=t.mode==="fast"?[Fo.fastFormats,kL]:[Fo.fullFormats,aT],n=t.formats||Fo.formatNames;if(cT(e,n,r,o),t.keywords)(0,xL.default)(e);return e};Iy.get=(e,t="full")=>{let o=(t==="fast"?Fo.fastFormats:Fo.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function cT(e,t,r,o){var n,i;(n=(i=e.opts.code).formats)!==null&&n!==void 0||(i.formats=$y._`require("ajv-formats/dist/formats").${o}`);for(let s of t)e.addFormat(s,r[s])}uT.exports=za=Iy;Object.defineProperty(za,"__esModule",{value:!0});za.default=Iy});class Ft extends Error{}var{closeSync:HV,writeFileSync:BV,fsyncSync:KV,openSync:VV}=(()=>({}));function NT(){this.__data__=[],this.size=0}var jy=NT;function DT(e,t){return e===t||e!==e&&t!==t}var Uy=DT;function jT(e,t){var r=e.length;while(r--)if(Uy(e[r][0],t))return r;return-1}var hr=jT;var UT=Array.prototype,FT=UT.splice;function LT(e){var t=this.__data__,r=hr(t,e);if(r<0)return!1;var o=t.length-1;if(r==o)t.pop();else FT.call(t,r,1);return--this.size,!0}var Fy=LT;function qT(e){var t=this.__data__,r=hr(t,e);return r<0?void 0:t[r][1]}var Ly=qT;function ZT(e){return hr(this.__data__,e)>-1}var qy=ZT;function HT(e,t){var r=this.__data__,o=hr(r,e);if(o<0)++this.size,r.push([e,t]);else r[o][1]=t;return this}var Zy=HT;function En(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}En.prototype.clear=jy;En.prototype.delete=Fy;En.prototype.get=Ly;En.prototype.has=qy;En.prototype.set=Zy;var Hy=En;var BT=typeof global=="object"&&global&&global.Object===Object&&global,By=BT;var KT=typeof self=="object"&&self&&self.Object===Object&&self,VT=By||KT||Function("return this")(),Rn=VT;var WT=Rn.Symbol,Cn=WT;var Ky=Object.prototype,GT=Ky.hasOwnProperty,JT=Ky.toString,qo=Cn?Cn.toStringTag:void 0;function XT(e){var t=GT.call(e,qo),r=e[qo];try{e[qo]=void 0;var o=!0}catch(i){}var n=JT.call(e);if(o)if(t)e[qo]=r;else delete e[qo];return n}var Vy=XT;var YT=Object.prototype,QT=YT.toString;function e0(e){return QT.call(e)}var Wy=e0;var t0="[object Null]",r0="[object Undefined]",Gy=Cn?Cn.toStringTag:void 0;function n0(e){if(e==null)return e===void 0?r0:t0;return Gy&&Gy in Object(e)?Vy(e):Wy(e)}var Jy=n0;function o0(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Da=o0;var i0="[object AsyncFunction]",s0="[object Function]",a0="[object GeneratorFunction]",c0="[object Proxy]";function u0(e){if(!Da(e))return!1;var t=Jy(e);return t==s0||t==a0||t==i0||t==c0}var Xy=u0;var l0=Rn["__core-js_shared__"],ja=l0;var Yy=function(){var e=/[^.]+$/.exec(ja&&ja.keys&&ja.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function d0(e){return!!Yy&&Yy in e}var Qy=d0;var p0=Function.prototype,m0=p0.toString;function f0(e){if(e!=null){try{return m0.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var e_=f0;var h0=/[\\^$.*+?()[\]{}|]/g,g0=/^\[object .+?Constructor\]$/,y0=Function.prototype,_0=Object.prototype,v0=y0.toString,b0=_0.hasOwnProperty,S0=RegExp("^"+v0.call(b0).replace(h0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function x0(e){if(!Da(e)||Qy(e))return!1;var t=Xy(e)?S0:g0;return t.test(e_(e))}var t_=x0;function k0(e,t){return e==null?void 0:e[t]}var r_=k0;function w0(e,t){var r=r_(e,t);return t_(r)?r:void 0}var Ua=w0;var $0=Ua(Rn,"Map"),n_=$0;var I0=Ua(Object,"create"),Vt=I0;function T0(){this.__data__=Vt?Vt(null):{},this.size=0}var o_=T0;function P0(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var i_=P0;var E0="__lodash_hash_undefined__",R0=Object.prototype,C0=R0.hasOwnProperty;function O0(e){var t=this.__data__;if(Vt){var r=t[e];return r===E0?void 0:r}return C0.call(t,e)?t[e]:void 0}var s_=O0;var A0=Object.prototype,M0=A0.hasOwnProperty;function z0(e){var t=this.__data__;return Vt?t[e]!==void 0:M0.call(t,e)}var a_=z0;var N0="__lodash_hash_undefined__";function D0(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Vt&&t===void 0?N0:t,this}var c_=D0;function On(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}On.prototype.clear=o_;On.prototype.delete=i_;On.prototype.get=s_;On.prototype.has=a_;On.prototype.set=c_;var Kd=On;function j0(){this.size=0,this.__data__={hash:new Kd,map:new(n_||Hy),string:new Kd}}var u_=j0;function U0(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var l_=U0;function F0(e,t){var r=e.__data__;return l_(t)?r[typeof t=="string"?"string":"hash"]:r.map}var gr=F0;function L0(e){var t=gr(this,e).delete(e);return this.size-=t?1:0,t}var d_=L0;function q0(e){return gr(this,e).get(e)}var p_=q0;function Z0(e){return gr(this,e).has(e)}var m_=Z0;function H0(e,t){var r=gr(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}var f_=H0;function An(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}An.prototype.clear=u_;An.prototype.delete=d_;An.prototype.get=p_;An.prototype.has=m_;An.prototype.set=f_;var Vd=An;var{realpathSync:__}=(()=>({}));var B0="Expected a function";function Wd(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(B0);var r=function(){var o=arguments,n=t?t.apply(this,o):o[0],i=r.cache;if(i.has(n))return i.get(n);var s=e.apply(this,o);return r.cache=i.set(n,s)||i,s};return r.cache=new(Wd.Cache||Vd),r}Wd.Cache=Vd;var ht=Wd;var h_=function(){return"/"};var Zo=()=>globalThis.crypto.randomUUID();function Kr(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function yr(){let e=new Set;return{subscribe(t){return e.add(t),()=>{e.delete(t)}},emit(...t){let r;for(let o of e)try{o(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}function g_(){return{sent:new Set,rejected:new Set}}var y_="[\\w-]{1,63}",Jq=new RegExp(`^${y_}$`),Xq=new RegExp(`^a(?:${y_}-)?[0-9a-f]{16}$`);var V0={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function W0(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof __==="function"){let r=h_();try{e=v_(__(r))}catch{e=v_(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackOccurred:!1,refusalFallbackModelLatch:void 0,sdkDialogHostActive:!1,sdkSupportedDialogKinds:void 0,sdkSupportedDialogKindsSource:void 0,replConfigArgv:[],initialMainLoopModel:void 0,modelStrings:null,isInteractive:!1,attacherCaps:null,hasStreamingInput:!1,modelOverrideOptOutForSession:!1,kairosActive:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,teamMemoryServerStatus:void 0,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,searchToolsOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:Zo(),mainAgentId:null,parentSessionId:void 0,loggerProvider:null,eventLogger:null,pendingOTelEvents:[],meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,cachedOtlpHttpAgentFactory:null,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginsNoMcp:[],inlinePluginUrls:[],syncedPluginDirs:[],chromeFlagOverride:void 0,onboardingShownThisSession:!1,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionPrResolved:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),loopTickInFlightPrompt:null,loopConsecutiveKeepalives:0,sessionCreatedTeams:new Set,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,longContext1mCreditsBlocked:!1,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:V0,replBridgeActive:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,strictMcpConfig:!1,activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],activeInputs:new Map,hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:g_(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var G0=W0(),J0=()=>{return};function Gd(){return J0()?.sessionId??G0.sessionId}var X0=yr(),c6=X0.subscribe;function v_(e){return process.platform==="darwin"?e.normalize("NFC"):e}var Y0=yr(),u6=Y0.subscribe;var Q0=yr(),l6=Q0.subscribe;var eP=yr();var d6=eP.subscribe;var tP=yr();var p6=tP.subscribe;var{appendFile:Qv,mkdir:RE,rename:eb,stat:CE,symlink:OE,unlink:Fp}=(()=>({}));It();function P_({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:o=1/0,immediateMode:n=!1}){let i=[],s=0,a=null,c=null;function u(){if(a)clearTimeout(a),a=null}function l(f){try{e(f)}catch{}}function d(){if(c)l(c.join("")),c=null;if(i.length===0)return;l(i.join("")),i=[],s=0,u()}function m(){if(!a)a=setTimeout(d,t)}function p(){if(c){c.push(...i),i=[],s=0,u();return}let f=i;i=[],s=0,u(),c=f,setImmediate(()=>{let h=c;if(c=null,h)l(h.join(""))})}return{write(f){if(n){l(f);return}if(i.push(f),s+=f.length,m(),i.length>=r||s>=o)p()},flush:d,dispose(){d()}}}It();var{realpathSync:g6}=(()=>({}));function R_(e){return process.platform==="darwin"?e.normalize("NFC"):e}function C_(e){return/^[\\/]{2}/.test(e)}function O_(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function oP(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function A_(e){if(/^\\\\\?\\volume\{/i.test(e))return E_(e);let t=oP(e);if(t!==e&&E_(t))return!0;return C_(t)&&!O_(t)}function E_(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)||e.includes("/")}function iP(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class M_{#e=new Set;register(e){let t=iP(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#e);this.#e.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}var sP=new M_;function z_(e){return sP.register(e)}var N_=ht((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((i)=>i.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((i)=>i.startsWith("!")),o=t.some((i)=>!i.startsWith("!"));if(r&&o)return null;let n=t.map((i)=>i.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function aP(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let i=e.match(/^([^:[]+):/);if(i&&i[1])t.push(i[1].trim().toLowerCase())}let o=e.match(/^\[([^\]]+)]/);if(o&&o[1])t.push(o[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let i=n[1].trim().toLowerCase();if(i.length<30&&!i.includes(" "))t.push(i)}return Array.from(new Set(t))}function cP(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function D_(e,t){if(!t)return!0;let r=aP(e);return cP(r,t)}var ep=function(){return"/"};It();var j_=ht(()=>(process.env.CLAUDE_CONFIG_DIR??qt(ep(),".claude")).normalize("NFC"),()=>process.env.CLAUDE_CONFIG_DIR);var T6=ht(()=>Kr(process.env.CLAUDE_CODE_SUPERVISED));function O(e,t,r,o,n){if(o==="m")throw TypeError("Private method is not writable");if(o==="a"&&!n)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r}function y(e,t,r,o){if(r==="a"&&!o)throw TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!o:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(e):o?o.value:t.get(e)}var tp=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return tp=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(o)=>(+o^r()&15>>+o/4).toString(16))};function Wt(e){return typeof e==="object"&&e!==null&&(("name"in e)&&e.name==="AbortError"||("message"in e)&&String(e.message).includes("FetchRequestCanceledException"))}var Ho=(e)=>{if(e instanceof Error)return e;if(typeof e==="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){let t=Error(e.message,e.cause?{cause:e.cause}:{});if(e.stack)t.stack=e.stack;if(e.cause&&!t.cause)t.cause=e.cause;if(e.name)t.name=e.name;return t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};class z extends Error{}class Oe extends z{constructor(e,t,r,o,n){super(`${Oe.makeMessage(e,t,r)}`);this.status=e,this.headers=o,this.requestID=o?.get("request-id"),this.error=t,this.type=n??null}static makeMessage(e,t,r){let o=t?.message?typeof t.message==="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;if(e&&o)return`${e} ${o}`;if(e)return`${e} status code (no body)`;if(o)return o;return"(no status code or body)"}static generate(e,t,r,o){if(!e||!o)return new Gr({message:r,cause:Ho(t)});let n=t,i=n?.error?.type;if(e===400)return new Ko(e,n,r,o,i);if(e===401)return new Vo(e,n,r,o,i);if(e===403)return new Wo(e,n,r,o,i);if(e===404)return new Go(e,n,r,o,i);if(e===409)return new Jo(e,n,r,o,i);if(e===422)return new Xo(e,n,r,o,i);if(e===429)return new Yo(e,n,r,o,i);if(e>=500)return new Qo(e,n,r,o,i);return new Oe(e,n,r,o,i)}}class Ne extends Oe{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class Gr extends Oe{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);if(t)this.cause=t}}class Bo extends Gr{constructor({message:e}={}){super({message:e??"Request timed out."})}}class Ko extends Oe{}class Vo extends Oe{}class Wo extends Oe{}class Go extends Oe{}class Jo extends Oe{}class Xo extends Oe{}class Yo extends Oe{}class Qo extends Oe{}var lP=/^[a-z][a-z0-9+.-]*:/i,U_=(e)=>lP.test(e),rp=(e)=>(rp=Array.isArray,rp(e)),np=rp;function Fa(e){if(typeof e!=="object")return{};return e??{}}function op(e){if(!e)return!0;for(let t in e)return!1;return!0}function F_(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var L_=(e,t)=>{if(typeof t!=="number"||!Number.isInteger(t))throw new z(`${e} must be an integer`);if(t<0)throw new z(`${e} must be a positive integer`);return t};var La=(e)=>{try{return JSON.parse(e)}catch(t){return}};var q_=(e)=>new Promise((t)=>setTimeout(t,e));var gt="0.94.0";var K_=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function dP(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var pP=()=>{let e=dP();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gt,"X-Stainless-OS":H_(Deno.build.os),"X-Stainless-Arch":Z_(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gt,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gt,"X-Stainless-OS":H_(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Z_(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=mP();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gt,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gt,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function mP(){if(typeof navigator>"u"||!navigator)return null;let e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:t,pattern:r}of e){let o=r.exec(navigator.userAgent);if(o){let n=o[1]||0,i=o[2]||0,s=o[3]||0;return{browser:t,version:`${n}.${i}.${s}`}}}return null}var Z_=(e)=>{if(e==="x32")return"x32";if(e==="x86_64"||e==="x64")return"x64";if(e==="arm")return"arm";if(e==="aarch64"||e==="arm64")return"arm64";if(e)return`other:${e}`;return"unknown"},H_=(e)=>{if(e=e.toLowerCase(),e.includes("ios"))return"iOS";if(e==="android")return"Android";if(e==="darwin")return"MacOS";if(e==="win32")return"Windows";if(e==="freebsd")return"FreeBSD";if(e==="openbsd")return"OpenBSD";if(e==="linux")return"Linux";if(e)return`Other:${e}`;return"Unknown"},B_,ei=()=>B_??(B_=pP());function V_(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function ip(...e){let t=globalThis.ReadableStream;if(typeof t>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function qa(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return ip({start(){},async pull(r){let{done:o,value:n}=await t.next();if(o)r.close();else r.enqueue(n)},async cancel(){await t.return?.()}})}function ti(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();if(r?.done)t.releaseLock();return r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function W_(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),r=t.cancel();t.releaseLock(),await r}var G_=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});function J_(e){return Object.entries(e).filter(([t,r])=>typeof r<"u").map(([t,r])=>{if(typeof r==="string"||typeof r==="number"||typeof r==="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(r===null)return`${encodeURIComponent(t)}=`;throw new z(`Cannot stringify type ${typeof r}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var Y_="urn:ietf:params:oauth:grant-type:jwt-bearer",Q_="refresh_token",Za="/v1/oauth/token",Jr="oauth-2025-04-20",ev="oidc-federation-2026-04-01",tv=120,Mn=30,rv=5,X_=1048576;function Ha(e){if(!e)return;let t;try{t=new URL(e)}catch(o){throw new le(`Invalid token endpoint base URL "${e}": ${o}`)}if(t.protocol==="https:")return;let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(r==="localhost"||r==="127.0.0.1"||r==="::1"))return;throw new le(`Refusing to send credential over non-https token endpoint "${e}"`)}async function Ba(e,t){let r=await yP(e),o;try{o=JSON.parse(r)}catch{throw new le(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,Xe(r),t)}if(!o.access_token)throw new le(`Token endpoint response missing access_token: ${JSON.stringify(Xe(o))}`,e.status,Xe(o),t);if(o.token_type&&o.token_type.toLowerCase()!=="bearer")throw new le(`Token endpoint response: unsupported token_type "${o.token_type}" (want Bearer)`,e.status,Xe(o),t);return o}var sp=2000,gP=new Set(["error","error_description","error_uri"]);function Xe(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=sp)return e;return e.slice(0,sp)+`... <${e.length-sp} more chars>`}return JSON.stringify(Xe(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[r,o]of Object.entries(e))if(gP.has(r))t[r]=o;return t}return null}async function Ka(e,t=(r)=>console.warn(`anthropic-sdk: ${r}`)){if(typeof process>"u"||process.platform==="win32")return;let r=await import("node:fs"),o=e,n;try{o=await r.promises.realpath(e),n=await r.promises.stat(o)}catch{return}let i=n.mode&511;if(i&18)throw new le(`Credentials file at ${o} is group/world-writable (mode 0o${i.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${o}\`.`);if(i&36)throw new le(`Credentials file at ${o} is group/world-readable (mode 0o${i.toString(8)}); run \`chmod 600 ${o}\` before retrying.`);if(typeof process.getuid==="function"&&n.uid!==process.getuid())t(`credentials file at ${o} is owned by uid ${n.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function Va(e,t){let r=await import("node:fs"),n=(await Promise.resolve().then(() => (It(),Wr))).dirname(e);await r.promises.mkdir(n,{recursive:!0,mode:448});let i=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let s=await r.promises.open(i,"w",384);try{await s.writeFile(JSON.stringify(t,null,2)),await s.sync()}finally{await s.close()}await r.promises.rename(i,e)}catch(s){throw await r.promises.unlink(i).catch(()=>{}),s}try{let s=await r.promises.open(n,"r");try{await s.sync()}finally{await s.close()}}catch{}}async function yP(e){if(!e.body)return"";let t=e.body.getReader(),r=[],o=0;for(;;){let{done:i,value:s}=await t.read();if(i)break;if(o+s.length>X_){let a=X_-o;if(a>0)r.push(s.subarray(0,a));await t.cancel();break}r.push(s),o+=s.length}let n;if(r.length===1)n=r[0];else{n=new Uint8Array(r.reduce((s,a)=>s+a.length,0));let i=0;for(let s of r)n.set(s,i),i+=s.length}return new TextDecoder("utf-8").decode(n)}class le extends z{constructor(e,t=null,r=null,o=null){super(e);this.statusCode=t,this.body=r,this.requestId=o}}function Tt(){return Math.floor(Date.now()/1000)}class ap{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let r=t.expiresAt-Tt();if(r>tv)return t.token;if(r>Mn)return this.backgroundRefresh(),t.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){if(this.pendingRefresh&&!e)return this.pendingRefresh;return this.doRefresh(e)}backgroundRefresh(){if(this.pendingRefresh)return;if(Tt()-this.lastAdvisoryError<rv)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=Tt(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>(this.cached=t,this.pendingRefresh=null,t),(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var ue=(e)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0;return};function iv(e){let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),o=0;for(let n of e)r.set(n,o),o+=n.length;return r}var nv;function zn(e){let t;return(nv??(t=new globalThis.TextEncoder,nv=t.encode.bind(t)))(e)}var ov;function cp(e){let t;return(ov??(t=new globalThis.TextDecoder,ov=t.decode.bind(t)))(e)}var Ga={off:0,error:200,warn:300,info:400,debug:500},up=(e,t,r)=>{if(!e)return;if(F_(Ga,e))return e;Te(r).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ga))}`);return};function ri(){}function Wa(e,t,r){if(!t||Ga[e]>Ga[r])return ri;else return t[e].bind(t)}var _P={error:ri,warn:ri,info:ri,debug:ri},sv=new WeakMap;function Te(e){let t=e.logger,r=e.logLevel??"off";if(!t)return _P;let o=sv.get(t);if(o&&o[0]===r)return o[1];let n={error:Wa("error",t,r),warn:Wa("warn",t,r),info:Wa("info",t,r),debug:Wa("debug",t,r)};return sv.set(t,[r,n]),n}var Gt=(e)=>{if(e.options)e.options={...e.options},delete e.options.headers;if(e.headers)e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,r])=>[t,t.toLowerCase()==="x-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var Ja="1.0",vP=/^[A-Za-z0-9_.-]+$/;function av(e){if(!e)throw Error("profile name is empty");if(e==="."||e==="..")throw Error(`profile name "${e}" is not allowed`);if(e.includes("/")||e.includes("\\"))throw Error(`profile name "${e}" must not contain path separators`);if(!vP.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var cv=async(e)=>{var t,r;let o=await lp();if(o===null)return null;let n=e??await lv();if(n===null)return null;av(n);let i=await import("node:fs"),a=(await Promise.resolve().then(() => (It(),Wr))).join(o,"configs",`${n}.json`),c;try{c=await i.promises.readFile(a,"utf-8")}catch(d){if(d?.code!=="ENOENT")throw Error(`failed to read config file ${a}: ${d}`);c=null}if(c===null){let d=ue("ANTHROPIC_ORGANIZATION_ID"),m=ue("ANTHROPIC_IDENTITY_TOKEN_FILE"),p=ue("ANTHROPIC_FEDERATION_RULE_ID");if(p&&d)return{fromFile:!1,config:{organization_id:d,workspace_id:ue("ANTHROPIC_WORKSPACE_ID"),base_url:ue("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:p,service_account_id:ue("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:m?{source:"file",path:m}:void 0,scope:ue("ANTHROPIC_SCOPE")}}};return null}let u;try{u=JSON.parse(c)}catch(d){throw Error(`failed to parse config file ${a}: ${d}`)}if(!u.authentication)throw Error(`config file ${a} is missing "authentication"`);let l=u.authentication.type;if(l!=="oidc_federation"&&l!=="user_oauth")throw Error(`authentication.type "${l}" is not a known authentication type`);if(u.organization_id??(u.organization_id=ue("ANTHROPIC_ORGANIZATION_ID")),u.workspace_id??(u.workspace_id=ue("ANTHROPIC_WORKSPACE_ID")),u.base_url??(u.base_url=ue("ANTHROPIC_BASE_URL")),(t=u.authentication).scope??(t.scope=ue("ANTHROPIC_SCOPE")),u.authentication.type==="oidc_federation"){if(!u.authentication.identity_token){let d=ue("ANTHROPIC_IDENTITY_TOKEN_FILE");if(d)u.authentication.identity_token={source:"file",path:d}}if(!u.authentication.federation_rule_id)u.authentication.federation_rule_id=ue("ANTHROPIC_FEDERATION_RULE_ID")??"";(r=u.authentication).service_account_id??(r.service_account_id=ue("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:u,fromFile:!0}};var uv=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let r=await lp();if(!r)return null;let o=t??await lv();if(!o)return null;return av(o),(await Promise.resolve().then(() => (It(),Wr))).join(r,"credentials",`${o}.json`)},lp=async()=>{if(!bP())return null;let e=await Promise.resolve().then(() => (It(),Wr)),t=ue("ANTHROPIC_CONFIG_DIR");if(t)return t;if(ei()["X-Stainless-OS"]==="Windows"){let i=ue("APPDATA");if(i)return e.join(i,"Anthropic");let s=ue("USERPROFILE");if(s)return e.join(s,"AppData","Roaming","Anthropic");return null}let o=ue("XDG_CONFIG_HOME");if(o)return e.join(o,"anthropic");let n=ue("HOME");if(n)return e.join(n,".config","anthropic");return null},bP=()=>{let e=ei()["X-Stainless-Runtime"];return e==="node"||e==="deno"},lv=async()=>{let e=await lp();if(!e)return null;let t=ue("ANTHROPIC_PROFILE");if(t)return t;let r=await import("node:fs"),n=(await Promise.resolve().then(() => (It(),Wr))).join(e,"active_config");try{return(await r.promises.readFile(n,"utf-8")).trim()||"default"}catch(i){if(i?.code!=="ENOENT")throw Error(`failed to read ${n}: ${i}`);return"default"}};function dp(e){if(!e)throw new z("Identity token file path is empty");return async()=>{let t=await import("node:fs"),r;try{r=await t.promises.readFile(e,"utf-8")}catch(n){throw new z(`Failed to read identity token file at ${e}: ${n}`)}let o=r.trim();if(!o)throw new z(`Identity token file at ${e} is empty`);return o}}function dv(e){if(!e)throw new z("Identity token value is empty");return()=>e}function pv(e){return async()=>{Ha(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new le(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let r={grant_type:Y_,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)r.service_account_id=e.serviceAccountId;if(e.workspaceId)r.workspace_id=e.workspaceId;let o=`${e.baseURL}${Za}`,n;try{n=await e.fetch(o,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${Jr},${ev}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${gt} oidcFederationProvider`},body:JSON.stringify(r)})}catch(c){throw new le(`Failed to reach token endpoint ${o}: ${c}`)}let i=n.headers.get("Request-Id");if(!n.ok){let c=await n.text().catch(()=>""),u=Xe(c),l="";if(n.status===401)l=` Ensure your federation rule matches your identity token. ${e.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the ANTHROPIC_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Claude Console for more details.`;throw new le(`Token exchange failed with status ${n.status}${i?` (request-id ${i})`:""}: ${u}${l}`,n.status,u,i)}let s=await Ba(n,i),a=Number(s.expires_in);if(!Number.isFinite(a))throw new le(`Token endpoint response missing required fields: ${JSON.stringify(Xe(s))}`,n.status,Xe(s),i);return{token:s.access_token,expiresAt:Tt()+a}}}function mv(e){return async(t)=>{let r=await import("node:fs");await Ka(e.credentialsPath,e.onSafetyWarning);let o;try{o=await r.promises.readFile(e.credentialsPath,"utf-8")}catch(v){throw new le(`Credentials file not found at ${e.credentialsPath}: ${v}`)}let n;try{n=JSON.parse(o)}catch(v){throw new le(`Credentials file at ${e.credentialsPath} is not valid JSON: ${v}`)}let i=n.access_token;if(!i)throw new le(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let s=n.expires_at;if(!t?.forceRefresh&&(s==null||Tt()<s-Mn))return{token:i,expiresAt:s??null};let a=n.refresh_token;if(!e.clientId||!a)throw new le(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${a?"set":"empty"})`);Ha(e.baseURL);let c={grant_type:Q_,refresh_token:a,client_id:e.clientId},u=`${e.baseURL}${Za}`,l;try{l=await e.fetch(u,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":Jr,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${gt} userOAuthProvider`},body:JSON.stringify(c)})}catch(v){throw new le(`User OAuth refresh failed to reach token endpoint: ${v}`)}let d=l.headers.get("Request-Id");if(!l.ok){let v=await l.text().catch(()=>"");throw new le(`User OAuth refresh failed (HTTP ${l.status}): ${Xe(v)}`,l.status,Xe(v),d)}let m=await Ba(l,d),p=Number(m.expires_in);if(!Number.isFinite(p))throw new le(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(Xe(m))}`,l.status,Xe(m),d);let f=Tt()+p,h=m.refresh_token||a;return await Va(e.credentialsPath,{...n,version:Ja,type:"oauth_token",access_token:m.access_token,expires_at:f,refresh_token:h}),{token:m.access_token,expiresAt:f}}}function pp(e,t){let r=e.authentication.credentials_path??null,o=(e.base_url||t.baseURL).replace(/\/+$/,""),n=SP(e,r,o,t),i={};if(e.workspace_id&&e.authentication.type==="user_oauth")i["anthropic-workspace-id"]=e.workspace_id;return{provider:n,extraHeaders:i,baseURL:e.base_url||void 0}}async function fv(e,t){let r=await cv(t);if(!r)return null;let{config:o,fromFile:n}=r,i=o.authentication.credentials_path||!n?o:{...o,authentication:{...o.authentication,credentials_path:await uv(o,t)??void 0}};return pp(i,e)}function SP(e,t,r,o){switch(e.authentication.type){case"oidc_federation":{let n=e.authentication,i=xP(n);if(!i)throw new le("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!n.federation_rule_id)throw new le("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).");if(!e.organization_id)throw new le("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let s=pv({identityTokenProvider:i,federationRuleId:n.federation_rule_id,organizationId:e.organization_id,serviceAccountId:n.service_account_id,workspaceId:e.workspace_id,baseURL:r,fetch:o.fetch,userAgent:o.userAgent});if(t)return kP(s,t,o.onCacheWriteError,o.onSafetyWarning);return s}case"user_oauth":{if(!t)throw new le("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return mv({credentialsPath:t,clientId:e.authentication.client_id,baseURL:r,fetch:o.fetch,userAgent:o.userAgent,onSafetyWarning:o.onSafetyWarning})}default:{let n=e.authentication.type;throw new le(`authentication.type "${n}" is not a known authentication type`)}}}function xP(e){if(e.identity_token){let o=e.identity_token.source;if(o!=="file")throw new le(`identity_token.source "${o}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new le('identity_token.source "file" requires a non-empty path');return dp(e.identity_token.path)}let t=ue("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return dp(t);let r=ue("ANTHROPIC_IDENTITY_TOKEN");if(r)return dv(r);return null}function kP(e,t,r,o){return async(n)=>{let i=await import("node:fs");await Ka(t,o);let s;try{let c=await i.promises.readFile(t,"utf-8");s=JSON.parse(c);let u=s?.access_token;if(u&&!n?.forceRefresh){let l=s?.expires_at;if(l==null||Tt()<l-Mn)return{token:u,expiresAt:l??null}}}catch(c){if(c?.code!=="ENOENT"&&!(c instanceof SyntaxError))r?.(c)}let a=await e(n);try{await Va(t,{...s??{},version:Ja,type:"oauth_token",access_token:a.token,expires_at:a.expiresAt})}catch(c){r?.(c)}return a}}var st,at;class vr{constructor(){st.set(this,void 0),at.set(this,void 0),O(this,st,new Uint8Array,"f"),O(this,at,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?zn(e):e;O(this,st,iv([y(this,st,"f"),t]),"f");let r=[],o;while((o=wP(y(this,st,"f"),y(this,at,"f")))!=null){if(o.carriage&&y(this,at,"f")==null){O(this,at,o.index,"f");continue}if(y(this,at,"f")!=null&&(o.index!==y(this,at,"f")+1||o.carriage)){r.push(cp(y(this,st,"f").subarray(0,y(this,at,"f")-1))),O(this,st,y(this,st,"f").subarray(y(this,at,"f")),"f"),O(this,at,null,"f");continue}let n=y(this,at,"f")!==null?o.preceding-1:o.preceding,i=cp(y(this,st,"f").subarray(0,n));r.push(i),O(this,st,y(this,st,"f").subarray(o.index),"f"),O(this,at,null,"f")}return r}flush(){if(!y(this,st,"f").length)return[];return this.decode(`
12
+ `)}}st=new WeakMap,at=new WeakMap;vr.NEWLINE_CHARS=new Set([`
13
+ `,"\r"]);vr.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function wP(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function hv(e){for(let o=0;o<e.length-1;o++){if(e[o]===10&&e[o+1]===10)return o+2;if(e[o]===13&&e[o+1]===13)return o+2;if(e[o]===13&&e[o+1]===10&&o+3<e.length&&e[o+2]===13&&e[o+3]===10)return o+4}return-1}var ni;class ct{constructor(e,t,r){this.iterator=e,ni.set(this,void 0),this.controller=t,O(this,ni,r,"f")}static fromSSEResponse(e,t,r){let o=!1,n=r?Te(r):console;async function*i(){if(o)throw new z("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let a of $P(e,t)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(c){throw n.error("Could not parse message into JSON:",a.data),n.error("From chunk:",a.raw),c}if(a.event==="message_start"||a.event==="message_delta"||a.event==="message_stop"||a.event==="content_block_start"||a.event==="content_block_delta"||a.event==="content_block_stop"||a.event==="message"||a.event==="user.message"||a.event==="user.interrupt"||a.event==="user.tool_confirmation"||a.event==="user.custom_tool_result"||a.event==="agent.message"||a.event==="agent.thinking"||a.event==="agent.tool_use"||a.event==="agent.tool_result"||a.event==="agent.mcp_tool_use"||a.event==="agent.mcp_tool_result"||a.event==="agent.custom_tool_use"||a.event==="agent.thread_context_compacted"||a.event==="session.status_running"||a.event==="session.status_idle"||a.event==="session.status_rescheduled"||a.event==="session.status_terminated"||a.event==="session.error"||a.event==="session.deleted"||a.event==="span.model_request_start"||a.event==="span.model_request_end")try{yield JSON.parse(a.data)}catch(c){throw n.error("Could not parse message into JSON:",a.data),n.error("From chunk:",a.raw),c}if(a.event==="ping")continue;if(a.event==="error"){let c=La(a.data)??a.data,u=c?.error?.type;throw new Oe(void 0,c,void 0,e.headers,u)}}s=!0}catch(a){if(Wt(a))return;throw a}finally{if(!s)t.abort()}}return new ct(i,t,r)}static fromReadableStream(e,t,r){let o=!1;async function*n(){let s=new vr,a=ti(e);for await(let c of a)for(let u of s.decode(c))yield u;for(let c of s.flush())yield c}async function*i(){if(o)throw new z("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let a of n()){if(s)continue;if(a)yield JSON.parse(a)}s=!0}catch(a){if(Wt(a))return;throw a}finally{if(!s)t.abort()}}return new ct(i,t,r)}[(ni=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],r=this.iterator(),o=(n)=>({next:()=>{if(n.length===0){let i=r.next();e.push(i),t.push(i)}return n.shift()}});return[new ct(()=>o(e),this.controller,y(this,ni,"f")),new ct(()=>o(t),this.controller,y(this,ni,"f"))]}toReadableStream(){let e=this,t;return ip({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{let{value:o,done:n}=await t.next();if(n)return r.close();let i=zn(JSON.stringify(o)+`
14
+ `);r.enqueue(i)}catch(o){r.error(o)}},async cancel(){await t.return?.()}})}}async function*$P(e,t){if(!e.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new z("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new z("Attempted to iterate over a response with no body")}let r=new gv,o=new vr,n=ti(e.body);for await(let i of IP(n))for(let s of o.decode(i)){let a=r.decode(s);if(a)yield a}for(let i of o.flush()){let s=r.decode(i);if(s)yield s}}async function*IP(e){let t=new Uint8Array;for await(let r of e){if(r==null)continue;let o=r instanceof ArrayBuffer?new Uint8Array(r):typeof r==="string"?zn(r):r,n=new Uint8Array(t.length+o.length);n.set(t),n.set(o,t.length),t=n;let i;while((i=hv(t))!==-1)yield t.slice(0,i),t=t.slice(i)}if(t.length>0)yield t}class gv{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r"))e=e.substring(0,e.length-1);if(!e){if(!this.event&&!this.data.length)return null;let n={event:this.event,data:this.data.join(`
15
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],n}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,r,o]=TP(e,":");if(o.startsWith(" "))o=o.substring(1);if(t==="event")this.event=o;else if(t==="data")this.data.push(o);return null}}function TP(e,t){let r=e.indexOf(t);if(r!==-1)return[e.substring(0,r),t,e.substring(r+t.length)];return[e,"",""]}async function Xa(e,t){let{response:r,requestLogID:o,retryOfRequestLogID:n,startTime:i}=t,s=await(async()=>{if(t.options.stream){if(Te(e).debug("response",r.status,r.url,r.headers,r.body),t.options.__streamClass)return t.options.__streamClass.fromSSEResponse(r,t.controller);return ct.fromSSEResponse(r,t.controller)}if(r.status===204)return null;if(t.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(r.headers.get("content-length")==="0")return;let m=await r.json();return mp(m,r)}return await r.text()})();return Te(e).debug(`[${o}] response parsed`,Gt({retryOfRequestLogID:n,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function mp(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return e;return Object.defineProperty(e,"_request_id",{value:t.headers.get("request-id"),enumerable:!1})}var oi;class Xr extends Promise{constructor(e,t,r=Xa){super((o)=>{o(null)});this.responsePromise=t,this.parseResponse=r,oi.set(this,void 0),O(this,oi,e,"f")}_thenUnwrap(e){return new Xr(y(this,oi,"f"),this.responsePromise,async(t,r)=>mp(e(await this.parseResponse(t,r),r),r.response))}asResponse(){return this.responsePromise.then((e)=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((e)=>this.parseResponse(y(this,oi,"f"),e));return this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}oi=new WeakMap;var Ya;class fp{constructor(e,t,r,o){Ya.set(this,void 0),O(this,Ya,e,"f"),this.options=o,this.response=t,this.body=r}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new z("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await y(this,Ya,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;yield e;while(e.hasNextPage())e=await e.getNextPage(),yield e}async*[(Ya=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}}class Qa extends Xr{constructor(e,t,r){super(e,t,async(o,n)=>new r(o,n.response,await Xa(o,n),n.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}}class Pt extends fp{constructor(e,t,r,o){super(e,t,r,o);this.data=r.data||[],this.has_more=r.has_more||!1,this.first_id=r.first_id||null,this.last_id=r.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let t=this.first_id;if(!t)return null;return{...this.options,query:{...Fa(this.options.query),before_id:t}}}let e=this.last_id;if(!e)return null;return{...this.options,query:{...Fa(this.options.query),after_id:e}}}}class de extends fp{constructor(e,t,r,o){super(e,t,r,o);this.data=r.data||[],this.next_page=r.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;if(!e)return null;return{...this.options,query:{...Fa(this.options.query),page:e}}}}var gp=()=>{if(typeof File>"u"){let{process:e}=globalThis,t=typeof e?.versions?.node==="string"&&parseInt(e.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Yr(e,t,r){return gp(),new File(e,t??"unknown_file",r)}function ii(e,t){let r=typeof e==="object"&&e!==null&&(("name"in e)&&e.name&&String(e.name)||("url"in e)&&e.url&&String(e.url)||("filename"in e)&&e.filename&&String(e.filename)||("path"in e)&&e.path&&String(e.path))||"";return t?r.split(/[\\/]/).pop()||void 0:r}var yp=(e)=>e!=null&&typeof e==="object"&&typeof e[Symbol.asyncIterator]==="function";var Nn=async(e,t,r=!0)=>({...e,body:await RP(e.body,t,r)}),yv=new WeakMap;function EP(e){let t=typeof e==="function"?e:e.fetch,r=yv.get(t);if(r)return r;let o=(async()=>{try{let n="Response"in t?t.Response:(await t("data:,")).constructor,i=new FormData;if(i.toString()===await new n(i).text())return!1;return!0}catch{return!0}})();return yv.set(t,o),o}var RP=async(e,t,r=!0)=>{if(!await EP(t))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let o=new FormData;return await Promise.all(Object.entries(e||{}).map(([n,i])=>hp(o,n,i,r))),o},CP=(e)=>e instanceof Blob&&("name"in e);var hp=async(e,t,r,o)=>{if(r===void 0)return;if(r==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof r==="string"||typeof r==="number"||typeof r==="boolean")e.append(t,String(r));else if(r instanceof Response){let n={},i=r.headers.get("Content-Type");if(i)n={type:i};e.append(t,Yr([await r.blob()],ii(r,o),n))}else if(yp(r))e.append(t,Yr([await new Response(qa(r)).blob()],ii(r,o)));else if(CP(r))e.append(t,Yr([r],ii(r,o),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map((n)=>hp(e,t+"[]",n,o)));else if(typeof r==="object")await Promise.all(Object.entries(r).map(([n,i])=>hp(e,`${t}[${n}]`,i,o)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)};var _v=(e)=>e!=null&&typeof e==="object"&&typeof e.size==="number"&&typeof e.type==="string"&&typeof e.text==="function"&&typeof e.slice==="function"&&typeof e.arrayBuffer==="function",OP=(e)=>e!=null&&typeof e==="object"&&typeof e.name==="string"&&typeof e.lastModified==="number"&&_v(e),AP=(e)=>e!=null&&typeof e==="object"&&typeof e.url==="string"&&typeof e.blob==="function";async function ec(e,t,r){if(gp(),e=await e,t||(t=ii(e,!0)),OP(e)){if(e instanceof File&&t==null&&r==null)return e;return Yr([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...r})}if(AP(e)){let n=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),Yr(await _p(n),t,r)}let o=await _p(e);if(!r?.type){let n=o.find((i)=>typeof i==="object"&&("type"in i)&&i.type);if(typeof n==="string")r={...r,type:n}}return Yr(o,t,r)}async function _p(e){let t=[];if(typeof e==="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(_v(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(yp(e))for await(let r of e)t.push(...await _p(r));else{let r=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${r?`; constructor: ${r}`:""}${MP(e)}`)}return t}function MP(e){if(typeof e!=="object"||e===null)return"";return`; props: [${Object.getOwnPropertyNames(e).map((r)=>`"${r}"`).join(", ")}]`}class V{constructor(e){this._client=e}}var vv=Symbol.for("brand.privateNullableHeaders");function*NP(e){if(!e)return;if(vv in e){let{values:o,nulls:n}=e;yield*o.entries();for(let i of n)yield[i,null];return}let t=!1,r;if(e instanceof Headers)r=e.entries();else if(np(e))r=e;else t=!0,r=Object.entries(e??{});for(let o of r){let n=o[0];if(typeof n!=="string")throw TypeError("expected header name to be a string");let i=np(o[1])?o[1]:[o[1]],s=!1;for(let a of i){if(a===void 0)continue;if(t&&!s)s=!0,yield[n,null];yield[n,a]}}}var S=(e)=>{let t=new Headers,r=new Set;for(let o of e){let n=new Set;for(let[i,s]of NP(o)){let a=i.toLowerCase();if(!n.has(a))t.delete(i),n.add(a);if(s===null)t.delete(i),r.add(a);else t.append(i,s),r.delete(a)}}return{[vv]:!0,values:t,nulls:r}};function Sv(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var bv=Object.freeze(Object.create(null)),DP=(e=Sv)=>function(r,...o){if(r.length===1)return r[0];let n=!1,i=[],s=r.reduce((l,d,m)=>{if(/[?#]/.test(d))n=!0;let p=o[m],f=(n?encodeURIComponent:e)(""+p);if(m!==o.length&&(p==null||typeof p==="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??bv)??bv)?.toString))f=p+"",i.push({start:l.length+d.length,length:f.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`});return l+d+(m===o.length?"":f)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;while((u=c.exec(a))!==null)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((l,d)=>l.start-d.start),i.length>0){let l=0,d=i.reduce((m,p)=>{let f=" ".repeat(p.start-l),h="^".repeat(p.length);return l=p.start+p.length,m+f+h},"");throw new z(`Path parameters result in path with invalid segments:
16
+ ${i.map((m)=>m.error).join(`
17
+ `)}
18
+ ${s}
19
+ ${d}`)}return s},E=DP(Sv);class si extends V{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/environments?beta=true",{body:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/environments/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/environments/${e}?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/environments?beta=true",de,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(E`/v1/environments/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(E`/v1/environments/${e}/archive?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}var ai=Symbol("anthropic.sdk.stainlessHelper");function tc(e){return typeof e==="object"&&e!==null&&ai in e}function vp(e,t){let r=new Set;if(e){for(let o of e)if(tc(o))r.add(o[ai])}if(t)for(let o of t){if(tc(o))r.add(o[ai]);if(Array.isArray(o.content)){for(let n of o.content)if(tc(n))r.add(n[ai])}}return Array.from(r)}function rc(e,t){let r=vp(e,t);if(r.length===0)return{};return{"x-stainless-helper":r.join(", ")}}function xv(e){if(tc(e))return{"x-stainless-helper":e[ai]};return{}}class ci extends V{list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/files?beta=true",Pt,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(E`/v1/files/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},r?.headers])})}download(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/files/${e}/content?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/files/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},r?.headers])})}upload(e,t){let{betas:r,...o}=e;return this._client.post("/v1/files?beta=true",Nn({body:o,...t,headers:S([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},xv(o.file),t?.headers])},this._client))}}class ui extends V{retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/models/${e}?beta=true`,{...r,headers:S([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/models?beta=true",Pt,{query:o,...t,headers:S([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers])})}}class li extends V{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/user_profiles?beta=true",{body:o,...t,headers:S([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/user_profiles/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/user_profiles/${e}?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/user_profiles?beta=true",de,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}createEnrollmentURL(e,t={},r){let{betas:o}=t??{};return this._client.post(E`/v1/user_profiles/${e}/enrollment_url?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}}class di extends V{list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(E`/v1/agents/${e}/versions?beta=true`,de,{query:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class Dn extends V{constructor(){super(...arguments);this.versions=new di(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/agents?beta=true",{body:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o,...n}=t??{};return this._client.get(E`/v1/agents/${e}?beta=true`,{query:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/agents/${e}?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/agents?beta=true",de,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(E`/v1/agents/${e}/archive?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}Dn.Versions=di;class pi extends V{create(e,t,r){let{view:o,betas:n,...i}=t;return this._client.post(E`/v1/memory_stores/${e}/memories?beta=true`,{query:{view:o},body:i,...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}retrieve(e,t,r){let{memory_store_id:o,betas:n,...i}=t;return this._client.get(E`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:i,...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{memory_store_id:o,view:n,betas:i,...s}=t;return this._client.post(E`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:{view:n},body:s,...r,headers:S([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(E`/v1/memory_stores/${e}/memories?beta=true`,de,{query:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{memory_store_id:o,expected_content_sha256:n,betas:i}=t;return this._client.delete(E`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:{expected_content_sha256:n},...r,headers:S([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class mi extends V{retrieve(e,t,r){let{memory_store_id:o,betas:n,...i}=t;return this._client.get(E`/v1/memory_stores/${o}/memory_versions/${e}?beta=true`,{query:i,...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(E`/v1/memory_stores/${e}/memory_versions?beta=true`,de,{query:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}redact(e,t,r){let{memory_store_id:o,betas:n}=t;return this._client.post(E`/v1/memory_stores/${o}/memory_versions/${e}/redact?beta=true`,{...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class Qr extends V{constructor(){super(...arguments);this.memories=new pi(this._client),this.memoryVersions=new mi(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/memory_stores?beta=true",{body:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/memory_stores/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/memory_stores/${e}?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/memory_stores?beta=true",de,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(E`/v1/memory_stores/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(E`/v1/memory_stores/${e}/archive?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}Qr.Memories=pi;Qr.MemoryVersions=mi;class jn{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new vr;for await(let t of this.iterator)for(let r of e.decode(t))yield JSON.parse(r);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,t){if(!e.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new z("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new z("Attempted to iterate over a response with no body")}return new jn(ti(e.body),t)}}class fi extends V{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...t,headers:S([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/messages/batches/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",Pt,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(E`/v1/messages/batches/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}cancel(e,t={},r){let{betas:o}=t??{};return this._client.post(E`/v1/messages/batches/${e}/cancel?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}async results(e,t={},r){let o=await this.retrieve(e);if(!o.results_url)throw new z(`No batch \`results_url\`; Has it finished processing? ${o.processing_status} - ${o.id}`);let{betas:n}=t??{};return this._client.get(o.results_url,{...r,headers:S([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((i,s)=>jn.fromResponse(s.response,s.controller))}}var nc={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function kv(e){return e?.output_format??e?.output_config?.format}function bp(e,t,r){let o=kv(t);if(!t||!("parse"in(o??{})))return{...e,content:e.content.map((n)=>{if(n.type==="text"){let i=Object.defineProperty({...n},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(i,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return n}),parsed_output:null};return Sp(e,t,r)}function Sp(e,t,r){let o=null,n=e.content.map((i)=>{if(i.type==="text"){let s=WP(t,i.text);if(o===null)o=s;let a=Object.defineProperty({...i},"parsed_output",{value:s,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),s},enumerable:!1})}return i});return{...e,content:n,parsed_output:o}}function WP(e,t){let r=kv(e);if(r?.type!=="json_schema")return null;try{if("parse"in r)return r.parse(t);return JSON.parse(t)}catch(o){throw new z(`Failed to parse structured output: ${o}`)}}var GP=(e)=>{let t=0,r=[];while(t<e.length){let o=e[t];if(o==="\\"){t++;continue}if(o==="{"){r.push({type:"brace",value:"{"}),t++;continue}if(o==="}"){r.push({type:"brace",value:"}"}),t++;continue}if(o==="["){r.push({type:"paren",value:"["}),t++;continue}if(o==="]"){r.push({type:"paren",value:"]"}),t++;continue}if(o===":"){r.push({type:"separator",value:":"}),t++;continue}if(o===","){r.push({type:"delimiter",value:","}),t++;continue}if(o==='"'){let a="",c=!1;o=e[++t];while(o!=='"'){if(t===e.length){c=!0;break}if(o==="\\"){if(t++,t===e.length){c=!0;break}a+=o+e[t],o=e[++t]}else a+=o,o=e[++t]}if(o=e[++t],!c)r.push({type:"string",value:a});continue}if(o&&/\s/.test(o)){t++;continue}let i=/[0-9]/;if(o&&i.test(o)||o==="-"||o==="."){let a="";if(o==="-")a+=o,o=e[++t];while(o&&i.test(o)||o===".")a+=o,o=e[++t];r.push({type:"number",value:a});continue}let s=/[a-z]/i;if(o&&s.test(o)){let a="";while(o&&s.test(o)){if(t===e.length)break;a+=o,o=e[++t]}if(a=="true"||a=="false"||a==="null")r.push({type:"name",value:a});else{t++;continue}continue}t++}return r},Un=(e)=>{if(e.length===0)return e;let t=e[e.length-1];switch(t.type){case"separator":return e=e.slice(0,e.length-1),Un(e);break;case"number":let r=t.value[t.value.length-1];if(r==="."||r==="-")return e=e.slice(0,e.length-1),Un(e);case"string":let o=e[e.length-2];if(o?.type==="delimiter")return e=e.slice(0,e.length-1),Un(e);else if(o?.type==="brace"&&o.value==="{")return e=e.slice(0,e.length-1),Un(e);break;case"delimiter":return e=e.slice(0,e.length-1),Un(e);break}return e},JP=(e)=>{let t=[];if(e.map((r)=>{if(r.type==="brace")if(r.value==="{")t.push("}");else t.splice(t.lastIndexOf("}"),1);if(r.type==="paren")if(r.value==="[")t.push("]");else t.splice(t.lastIndexOf("]"),1)}),t.length>0)t.reverse().map((r)=>{if(r==="}")e.push({type:"brace",value:"}"});else if(r==="]")e.push({type:"paren",value:"]"})});return e},XP=(e)=>{let t="";return e.map((r)=>{switch(r.type){case"string":t+='"'+r.value+'"';break;default:t+=r.value;break}}),t},oc=(e)=>JSON.parse(XP(JP(Un(GP(e)))));var yt,br,Fn,hi,ic,gi,yi,sc,_i,Jt,vi,ac,cc,en,uc,lc,bi,xp,wv,dc,kp,wp,$p,$v,Iv="__json_buf";function Tv(e){return e.type==="tool_use"||e.type==="server_tool_use"||e.type==="mcp_tool_use"}class Si{constructor(e,t){yt.add(this),this.messages=[],this.receivedMessages=[],br.set(this,void 0),Fn.set(this,null),this.controller=new AbortController,hi.set(this,void 0),ic.set(this,()=>{}),gi.set(this,()=>{}),yi.set(this,void 0),sc.set(this,()=>{}),_i.set(this,()=>{}),Jt.set(this,{}),vi.set(this,!1),ac.set(this,!1),cc.set(this,!1),en.set(this,!1),uc.set(this,void 0),lc.set(this,void 0),bi.set(this,void 0),dc.set(this,(r)=>{if(O(this,ac,!0,"f"),Wt(r))r=new Ne;if(r instanceof Ne)return O(this,cc,!0,"f"),this._emit("abort",r);if(r instanceof z)return this._emit("error",r);if(r instanceof Error){let o=new z(r.message);return o.cause=r,this._emit("error",o)}return this._emit("error",new z(String(r)))}),O(this,hi,new Promise((r,o)=>{O(this,ic,r,"f"),O(this,gi,o,"f")}),"f"),O(this,yi,new Promise((r,o)=>{O(this,sc,r,"f"),O(this,_i,o,"f")}),"f"),y(this,hi,"f").catch(()=>{}),y(this,yi,"f").catch(()=>{}),O(this,Fn,e,"f"),O(this,bi,t?.logger??console,"f")}get response(){return y(this,uc,"f")}get request_id(){return y(this,lc,"f")}async withResponse(){O(this,en,!0,"f");let e=await y(this,hi,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new Si(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,r,{logger:o}={}){let n=new Si(t,{logger:o});for(let i of t.messages)n._addMessageParam(i);return O(n,Fn,{...t,stream:!0},"f"),n._run(()=>n._createMessage(e,{...t,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},y(this,dc,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){if(this.receivedMessages.push(e),t)this._emit("message",e)}async _createMessage(e,t,r){let o=r?.signal,n;if(o){if(o.aborted)this.controller.abort();n=this.controller.abort.bind(this.controller),o.addEventListener("abort",n)}try{y(this,yt,"m",kp).call(this);let{response:i,data:s}=await e.create({...t,stream:!0},{...r,signal:this.controller.signal}).withResponse();this._connected(i);for await(let a of s)y(this,yt,"m",wp).call(this,a);if(s.controller.signal?.aborted)throw new Ne;y(this,yt,"m",$p).call(this)}finally{if(o&&n)o.removeEventListener("abort",n)}}_connected(e){if(this.ended)return;O(this,uc,e,"f"),O(this,lc,e?.headers.get("request-id"),"f"),y(this,ic,"f").call(this,e),this._emit("connect")}get ended(){return y(this,vi,"f")}get errored(){return y(this,ac,"f")}get aborted(){return y(this,cc,"f")}abort(){this.controller.abort()}on(e,t){return(y(this,Jt,"f")[e]||(y(this,Jt,"f")[e]=[])).push({listener:t}),this}off(e,t){let r=y(this,Jt,"f")[e];if(!r)return this;let o=r.findIndex((n)=>n.listener===t);if(o>=0)r.splice(o,1);return this}once(e,t){return(y(this,Jt,"f")[e]||(y(this,Jt,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,r)=>{if(O(this,en,!0,"f"),e!=="error")this.once("error",r);this.once(e,t)})}async done(){O(this,en,!0,"f"),await y(this,yi,"f")}get currentMessage(){return y(this,br,"f")}async finalMessage(){return await this.done(),y(this,yt,"m",xp).call(this)}async finalText(){return await this.done(),y(this,yt,"m",wv).call(this)}_emit(e,...t){if(y(this,vi,"f"))return;if(e==="end")O(this,vi,!0,"f"),y(this,sc,"f").call(this);let r=y(this,Jt,"f")[e];if(r)y(this,Jt,"f")[e]=r.filter((o)=>!o.once),r.forEach(({listener:o})=>o(...t));if(e==="abort"){let o=t[0];if(!y(this,en,"f")&&!r?.length)Promise.reject(o);y(this,gi,"f").call(this,o),y(this,_i,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=t[0];if(!y(this,en,"f")&&!r?.length)Promise.reject(o);y(this,gi,"f").call(this,o),y(this,_i,"f").call(this,o),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",y(this,yt,"m",xp).call(this))}async _fromReadableStream(e,t){let r=t?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{y(this,yt,"m",kp).call(this),this._connected(null);let n=ct.fromReadableStream(e,this.controller);for await(let i of n)y(this,yt,"m",wp).call(this,i);if(n.controller.signal?.aborted)throw new Ne;y(this,yt,"m",$p).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}[(br=new WeakMap,Fn=new WeakMap,hi=new WeakMap,ic=new WeakMap,gi=new WeakMap,yi=new WeakMap,sc=new WeakMap,_i=new WeakMap,Jt=new WeakMap,vi=new WeakMap,ac=new WeakMap,cc=new WeakMap,en=new WeakMap,uc=new WeakMap,lc=new WeakMap,bi=new WeakMap,dc=new WeakMap,yt=new WeakSet,xp=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},wv=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((r)=>r.type==="text").map((r)=>r.text);if(t.length===0)throw new z("stream ended without producing a content block with type=text");return t.join(" ")},kp=function(){if(this.ended)return;O(this,br,void 0,"f")},wp=function(t){if(this.ended)return;let r=y(this,yt,"m",$v).call(this,t);switch(this._emit("streamEvent",t,r),t.type){case"content_block_delta":{let o=r.content.at(-1);switch(t.delta.type){case"text_delta":{if(o.type==="text")this._emit("text",t.delta.text,o.text||"");break}case"citations_delta":{if(o.type==="text")this._emit("citation",t.delta.citation,o.citations??[]);break}case"input_json_delta":{if(Tv(o)&&o.input)this._emit("inputJson",t.delta.partial_json,o.input);break}case"thinking_delta":{if(o.type==="thinking")this._emit("thinking",t.delta.thinking,o.thinking);break}case"signature_delta":{if(o.type==="thinking")this._emit("signature",o.signature);break}case"compaction_delta":{if(o.type==="compaction"&&o.content)this._emit("compaction",o.content);break}default:Pv(t.delta)}break}case"message_stop":{this._addMessageParam(r),this._addMessage(bp(r,y(this,Fn,"f"),{logger:y(this,bi,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",r.content.at(-1));break}case"message_start":{O(this,br,r,"f");break}case"content_block_start":case"message_delta":break}},$p=function(){if(this.ended)throw new z("stream has ended, this shouldn't happen");let t=y(this,br,"f");if(!t)throw new z("request ended without sending any chunks");return O(this,br,void 0,"f"),bp(t,y(this,Fn,"f"),{logger:y(this,bi,"f")})},$v=function(t){let r=y(this,br,"f");if(t.type==="message_start"){if(r)throw new z(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!r)throw new z(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return r;case"message_delta":if(r.container=t.delta.container,r.stop_reason=t.delta.stop_reason,r.stop_sequence=t.delta.stop_sequence,r.usage.output_tokens=t.usage.output_tokens,r.context_management=t.context_management,t.usage.input_tokens!=null)r.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)r.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)r.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)r.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.iterations!=null)r.usage.iterations=t.usage.iterations;return r;case"content_block_start":return r.content.push(t.content_block),r;case"content_block_delta":{let o=r.content.at(t.index);switch(t.delta.type){case"text_delta":{if(o?.type==="text")r.content[t.index]={...o,text:(o.text||"")+t.delta.text};break}case"citations_delta":{if(o?.type==="text")r.content[t.index]={...o,citations:[...o.citations??[],t.delta.citation]};break}case"input_json_delta":{if(o&&Tv(o)){let n=o[Iv]||"";n+=t.delta.partial_json;let i={...o};if(Object.defineProperty(i,Iv,{value:n,enumerable:!1,writable:!0}),n)try{i.input=oc(n)}catch(s){let a=new z(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${n}`);y(this,dc,"f").call(this,a)}r.content[t.index]=i}break}case"thinking_delta":{if(o?.type==="thinking")r.content[t.index]={...o,thinking:o.thinking+t.delta.thinking};break}case"signature_delta":{if(o?.type==="thinking")r.content[t.index]={...o,signature:t.delta.signature};break}case"compaction_delta":{if(o?.type==="compaction")r.content[t.index]={...o,content:(o.content||"")+t.delta.content};break}default:Pv(t.delta)}return r}case"content_block_stop":return r}},Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("streamEvent",(o)=>{let n=t.shift();if(n)n.resolve(o);else e.push(o)}),this.on("end",()=>{r=!0;for(let o of t)o.resolve(void 0);t.length=0}),this.on("abort",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),this.on("error",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),{next:async()=>{if(!e.length){if(r)return{value:void 0,done:!0};return new Promise((n,i)=>t.push({resolve:n,reject:i})).then((n)=>n?{value:n,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ct(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Pv(e){}class Ln extends Error{constructor(e){let t=typeof e==="string"?e:e.map((r)=>{if(r.type==="text")return r.text;return`[${r.type}]`}).join(" ");super(t);this.name="ToolError",this.content=e}}var Ev=1e5,Rv=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
20
+ 1. Task Overview
21
+ The user's core request and success criteria
22
+ Any clarifications or constraints they specified
23
+ 2. Current State
24
+ What has been completed so far
25
+ Files created, modified, or analyzed (with paths if relevant)
26
+ Key outputs or artifacts produced
27
+ 3. Important Discoveries
28
+ Technical constraints or requirements uncovered
29
+ Decisions made and their rationale
30
+ Errors encountered and how they were resolved
31
+ What approaches were tried that didn't work (and why)
32
+ 4. Next Steps
33
+ Specific actions needed to complete the task
34
+ Any blockers or open questions to resolve
35
+ Priority order if multiple steps remain
36
+ 5. Context to Preserve
37
+ User preferences or style requirements
38
+ Domain-specific details that aren't obvious
39
+ Any promises made to the user
40
+ Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
41
+ Wrap your summary in <summary></summary> tags.`;var xi,qn,tn,Ae,Ye,ut,Xt,Sr,ki,Cv,Ip;function Ov(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}class wi{constructor(e,t,r){xi.add(this),this.client=e,qn.set(this,!1),tn.set(this,!1),Ae.set(this,void 0),Ye.set(this,void 0),ut.set(this,void 0),Xt.set(this,void 0),Sr.set(this,void 0),ki.set(this,0),O(this,Ae,{params:{...t,messages:structuredClone(t.messages)}},"f");let n=["BetaToolRunner",...vp(t.tools,t.messages)].join(", ");if(O(this,Ye,{...r,headers:S([{"x-stainless-helper":n},r?.headers])},"f"),O(this,Sr,Ov(),"f"),t.compactionControl?.enabled)console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(qn=new WeakMap,tn=new WeakMap,Ae=new WeakMap,Ye=new WeakMap,ut=new WeakMap,Xt=new WeakMap,Sr=new WeakMap,ki=new WeakMap,xi=new WeakSet,Cv=async function(){let t=y(this,Ae,"f").params.compactionControl;if(!t||!t.enabled)return!1;let r=0;if(y(this,ut,"f")!==void 0)try{let c=await y(this,ut,"f");r=c.usage.input_tokens+(c.usage.cache_creation_input_tokens??0)+(c.usage.cache_read_input_tokens??0)+c.usage.output_tokens}catch{return!1}let o=t.contextTokenThreshold??Ev;if(r<o)return!1;let n=t.model??y(this,Ae,"f").params.model,i=t.summaryPrompt??Rv,s=y(this,Ae,"f").params.messages;if(s[s.length-1].role==="assistant"){let c=s[s.length-1];if(Array.isArray(c.content)){let u=c.content.filter((l)=>l.type!=="tool_use");if(u.length===0)s.pop();else c.content=u}}let a=await this.client.beta.messages.create({model:n,messages:[...s,{role:"user",content:[{type:"text",text:i}]}],max_tokens:y(this,Ae,"f").params.max_tokens},{signal:y(this,Ye,"f").signal,headers:S([y(this,Ye,"f").headers,{"x-stainless-helper":"compaction"}])});if(a.content[0]?.type!=="text")throw new z("Expected text response for compaction");return y(this,Ae,"f").params.messages=[{role:"user",content:a.content}],!0},Symbol.asyncIterator)](){var e;if(y(this,qn,"f"))throw new z("Cannot iterate over a consumed stream");O(this,qn,!0,"f"),O(this,tn,!0,"f"),O(this,Xt,void 0,"f");try{while(!0){let t;try{if(y(this,Ae,"f").params.max_iterations&&y(this,ki,"f")>=y(this,Ae,"f").params.max_iterations)break;O(this,tn,!1,"f"),O(this,Xt,void 0,"f"),O(this,ki,(e=y(this,ki,"f"),e++,e),"f"),O(this,ut,void 0,"f");let{max_iterations:r,compactionControl:o,...n}=y(this,Ae,"f").params;if(n.stream)t=this.client.beta.messages.stream({...n},y(this,Ye,"f")),O(this,ut,t.finalMessage(),"f"),y(this,ut,"f").catch(()=>{}),yield t;else O(this,ut,this.client.beta.messages.create({...n,stream:!1},y(this,Ye,"f")),"f"),yield y(this,ut,"f");if(!await y(this,xi,"m",Cv).call(this)){if(!y(this,tn,"f")){let{role:a,content:c}=await y(this,ut,"f");y(this,Ae,"f").params.messages.push({role:a,content:c})}let s=await y(this,xi,"m",Ip).call(this,y(this,Ae,"f").params.messages.at(-1));if(s)y(this,Ae,"f").params.messages.push(s);else if(!y(this,tn,"f"))break}}finally{if(t)t.abort()}}if(!y(this,ut,"f"))throw new z("ToolRunner concluded without a message from the server");y(this,Sr,"f").resolve(await y(this,ut,"f"))}catch(t){throw O(this,qn,!1,"f"),y(this,Sr,"f").promise.catch(()=>{}),y(this,Sr,"f").reject(t),O(this,Sr,Ov(),"f"),t}}setMessagesParams(e){if(typeof e==="function")y(this,Ae,"f").params=e(y(this,Ae,"f").params);else y(this,Ae,"f").params=e;O(this,tn,!0,"f"),O(this,Xt,void 0,"f")}setRequestOptions(e){if(typeof e==="function")O(this,Ye,e(y(this,Ye,"f")),"f");else O(this,Ye,{...y(this,Ye,"f"),...e},"f")}async generateToolResponse(e=y(this,Ye,"f").signal){let t=await y(this,ut,"f")??this.params.messages.at(-1);if(!t)return null;return y(this,xi,"m",Ip).call(this,t,e)}done(){return y(this,Sr,"f").promise}async runUntilDone(){if(!y(this,qn,"f"))for await(let e of this);return this.done()}get params(){return y(this,Ae,"f").params}pushMessages(...e){this.setMessagesParams((t)=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}}Ip=async function(t,r=y(this,Ye,"f").signal){if(y(this,Xt,"f")!==void 0)return y(this,Xt,"f");return O(this,Xt,YP(y(this,Ae,"f").params,t,{...y(this,Ye,"f"),signal:r}),"f"),y(this,Xt,"f")};async function YP(e,t=e.messages.at(-1),r){if(!t||t.role!=="assistant"||!t.content||typeof t.content==="string")return null;let o=t.content.filter((i)=>i.type==="tool_use");if(o.length===0)return null;return{role:"user",content:await Promise.all(o.map(async(i)=>{let s=e.tools.find((a)=>("name"in a?a.name:a.mcp_server_name)===i.name);if(!s||!("run"in s))return{type:"tool_result",tool_use_id:i.id,content:`Error: Tool '${i.name}' not found`,is_error:!0};try{let a=i.input;if("parse"in s&&s.parse)a=s.parse(a);let c=await s.run(a,{toolUseBlock:i,signal:r?.signal});return{type:"tool_result",tool_use_id:i.id,content:c}}catch(a){return{type:"tool_result",tool_use_id:i.id,content:a instanceof Ln?a.content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}var Av={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},QP=["claude-mythos-preview","claude-opus-4-6"];class xr extends V{constructor(){super(...arguments);this.batches=new fi(this._client)}create(e,t){let r=Mv(e),{betas:o,...n}=r;if(n.model in Av)console.warn(`The model '${n.model}' is deprecated and will reach end-of-life on ${Av[n.model]}
42
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(QP.includes(n.model)&&n.thinking&&n.thinking.type==="enabled")console.warn(`Using Claude with ${n.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let i=this._client._options.timeout;if(!n.stream&&i==null){let a=nc[n.model]??void 0;i=this._client.calculateNonstreamingTimeout(n.max_tokens,a)}let s=rc(n.tools,n.messages);return this._client.post("/v1/messages?beta=true",{body:n,timeout:i??600000,...t,headers:S([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},s,t?.headers]),stream:r.stream??!1})}parse(e,t){return t={...t,headers:S([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(e,t).then((r)=>Sp(r,e,{logger:this._client.logger??console}))}stream(e,t){return Si.createMessage(this,e,t)}countTokens(e,t){let r=Mv(e),{betas:o,...n}=r;return this._client.post("/v1/messages/count_tokens?beta=true",{body:n,...t,headers:S([{"anthropic-beta":[...o??[],"token-counting-2024-11-01"].toString()},t?.headers])})}toolRunner(e,t){return new wi(this._client,e,t)}}function Mv(e){if(!e.output_format)return e;if(e.output_config?.format)throw new z("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:t,...r}=e;return{...r,output_config:{...e.output_config,format:t}}}xr.Batches=fi;xr.BetaToolRunner=wi;xr.ToolError=Ln;class $i extends V{list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(E`/v1/sessions/${e}/events?beta=true`,de,{query:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}send(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/sessions/${e}/events?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}stream(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/sessions/${e}/events/stream?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers]),stream:!0})}}class Ii extends V{retrieve(e,t,r){let{session_id:o,betas:n}=t;return this._client.get(E`/v1/sessions/${o}/resources/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{session_id:o,betas:n,...i}=t;return this._client.post(E`/v1/sessions/${o}/resources/${e}?beta=true`,{body:i,...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(E`/v1/sessions/${e}/resources?beta=true`,de,{query:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{session_id:o,betas:n}=t;return this._client.delete(E`/v1/sessions/${o}/resources/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}add(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/sessions/${e}/resources?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class rn extends V{constructor(){super(...arguments);this.events=new $i(this._client),this.resources=new Ii(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/sessions?beta=true",{body:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/sessions/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/sessions/${e}?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/sessions?beta=true",de,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(E`/v1/sessions/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(E`/v1/sessions/${e}/archive?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}rn.Events=$i;rn.Resources=Ii;class Ti extends V{create(e,t={},r){let{betas:o,...n}=t??{};return this._client.post(E`/v1/skills/${e}/versions?beta=true`,Nn({body:n,...r,headers:S([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])},this._client))}retrieve(e,t,r){let{skill_id:o,betas:n}=t;return this._client.get(E`/v1/skills/${o}/versions/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(E`/v1/skills/${e}/versions?beta=true`,de,{query:n,...r,headers:S([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}delete(e,t,r){let{skill_id:o,betas:n}=t;return this._client.delete(E`/v1/skills/${o}/versions/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])})}}class Zn extends V{constructor(){super(...arguments);this.versions=new Ti(this._client)}create(e={},t){let{betas:r,...o}=e??{};return this._client.post("/v1/skills?beta=true",Nn({body:o,...t,headers:S([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},t?.headers])},this._client,!1))}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/skills/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/skills?beta=true",de,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(E`/v1/skills/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}}Zn.Versions=Ti;class Pi extends V{create(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/vaults/${e}/credentials?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}retrieve(e,t,r){let{vault_id:o,betas:n}=t;return this._client.get(E`/v1/vaults/${o}/credentials/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{vault_id:o,betas:n,...i}=t;return this._client.post(E`/v1/vaults/${o}/credentials/${e}?beta=true`,{body:i,...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(E`/v1/vaults/${e}/credentials?beta=true`,de,{query:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{vault_id:o,betas:n}=t;return this._client.delete(E`/v1/vaults/${o}/credentials/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t,r){let{vault_id:o,betas:n}=t;return this._client.post(E`/v1/vaults/${o}/credentials/${e}/archive?beta=true`,{...r,headers:S([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class Hn extends V{constructor(){super(...arguments);this.credentials=new Pi(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/vaults?beta=true",{body:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/vaults/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(E`/v1/vaults/${e}?beta=true`,{body:n,...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/vaults?beta=true",de,{query:o,...t,headers:S([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(E`/v1/vaults/${e}?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(E`/v1/vaults/${e}/archive?beta=true`,{...r,headers:S([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}Hn.Credentials=Pi;class Fe extends V{constructor(){super(...arguments);this.models=new ui(this._client),this.messages=new xr(this._client),this.agents=new Dn(this._client),this.environments=new si(this._client),this.sessions=new rn(this._client),this.vaults=new Hn(this._client),this.memoryStores=new Qr(this._client),this.files=new ci(this._client),this.skills=new Zn(this._client),this.userProfiles=new li(this._client)}}Fe.Models=ui;Fe.Messages=xr;Fe.Agents=Dn;Fe.Environments=si;Fe.Sessions=rn;Fe.Vaults=Hn;Fe.MemoryStores=Qr;Fe.Files=ci;Fe.Skills=Zn;Fe.UserProfiles=li;class Bn extends V{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/complete",{body:o,timeout:this._client._options.timeout??600000,...t,headers:S([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}}function zv(e){return e?.output_config?.format}function Tp(e,t,r){let o=zv(t);if(!t||!("parse"in(o??{})))return{...e,content:e.content.map((n)=>{if(n.type==="text")return Object.defineProperty({...n},"parsed_output",{value:null,enumerable:!1});return n}),parsed_output:null};return Pp(e,t,r)}function Pp(e,t,r){let o=null,n=e.content.map((i)=>{if(i.type==="text"){let s=cE(t,i.text);if(o===null)o=s;return Object.defineProperty({...i},"parsed_output",{value:s,enumerable:!1})}return i});return{...e,content:n,parsed_output:o}}function cE(e,t){let r=zv(e);if(r?.type!=="json_schema")return null;try{if("parse"in r)return r.parse(t);return JSON.parse(t)}catch(o){throw new z(`Failed to parse structured output: ${o}`)}}var _t,kr,Kn,Ei,pc,Ri,Ci,mc,Oi,Yt,Ai,fc,hc,nn,gc,yc,Mi,Ep,Nv,Rp,Cp,Op,Ap,Dv,jv="__json_buf";function Uv(e){return e.type==="tool_use"||e.type==="server_tool_use"}class zi{constructor(e,t){_t.add(this),this.messages=[],this.receivedMessages=[],kr.set(this,void 0),Kn.set(this,null),this.controller=new AbortController,Ei.set(this,void 0),pc.set(this,()=>{}),Ri.set(this,()=>{}),Ci.set(this,void 0),mc.set(this,()=>{}),Oi.set(this,()=>{}),Yt.set(this,{}),Ai.set(this,!1),fc.set(this,!1),hc.set(this,!1),nn.set(this,!1),gc.set(this,void 0),yc.set(this,void 0),Mi.set(this,void 0),Rp.set(this,(r)=>{if(O(this,fc,!0,"f"),Wt(r))r=new Ne;if(r instanceof Ne)return O(this,hc,!0,"f"),this._emit("abort",r);if(r instanceof z)return this._emit("error",r);if(r instanceof Error){let o=new z(r.message);return o.cause=r,this._emit("error",o)}return this._emit("error",new z(String(r)))}),O(this,Ei,new Promise((r,o)=>{O(this,pc,r,"f"),O(this,Ri,o,"f")}),"f"),O(this,Ci,new Promise((r,o)=>{O(this,mc,r,"f"),O(this,Oi,o,"f")}),"f"),y(this,Ei,"f").catch(()=>{}),y(this,Ci,"f").catch(()=>{}),O(this,Kn,e,"f"),O(this,Mi,t?.logger??console,"f")}get response(){return y(this,gc,"f")}get request_id(){return y(this,yc,"f")}async withResponse(){O(this,nn,!0,"f");let e=await y(this,Ei,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new zi(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,r,{logger:o}={}){let n=new zi(t,{logger:o});for(let i of t.messages)n._addMessageParam(i);return O(n,Kn,{...t,stream:!0},"f"),n._run(()=>n._createMessage(e,{...t,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},y(this,Rp,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){if(this.receivedMessages.push(e),t)this._emit("message",e)}async _createMessage(e,t,r){let o=r?.signal,n;if(o){if(o.aborted)this.controller.abort();n=this.controller.abort.bind(this.controller),o.addEventListener("abort",n)}try{y(this,_t,"m",Cp).call(this);let{response:i,data:s}=await e.create({...t,stream:!0},{...r,signal:this.controller.signal}).withResponse();this._connected(i);for await(let a of s)y(this,_t,"m",Op).call(this,a);if(s.controller.signal?.aborted)throw new Ne;y(this,_t,"m",Ap).call(this)}finally{if(o&&n)o.removeEventListener("abort",n)}}_connected(e){if(this.ended)return;O(this,gc,e,"f"),O(this,yc,e?.headers.get("request-id"),"f"),y(this,pc,"f").call(this,e),this._emit("connect")}get ended(){return y(this,Ai,"f")}get errored(){return y(this,fc,"f")}get aborted(){return y(this,hc,"f")}abort(){this.controller.abort()}on(e,t){return(y(this,Yt,"f")[e]||(y(this,Yt,"f")[e]=[])).push({listener:t}),this}off(e,t){let r=y(this,Yt,"f")[e];if(!r)return this;let o=r.findIndex((n)=>n.listener===t);if(o>=0)r.splice(o,1);return this}once(e,t){return(y(this,Yt,"f")[e]||(y(this,Yt,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,r)=>{if(O(this,nn,!0,"f"),e!=="error")this.once("error",r);this.once(e,t)})}async done(){O(this,nn,!0,"f"),await y(this,Ci,"f")}get currentMessage(){return y(this,kr,"f")}async finalMessage(){return await this.done(),y(this,_t,"m",Ep).call(this)}async finalText(){return await this.done(),y(this,_t,"m",Nv).call(this)}_emit(e,...t){if(y(this,Ai,"f"))return;if(e==="end")O(this,Ai,!0,"f"),y(this,mc,"f").call(this);let r=y(this,Yt,"f")[e];if(r)y(this,Yt,"f")[e]=r.filter((o)=>!o.once),r.forEach(({listener:o})=>o(...t));if(e==="abort"){let o=t[0];if(!y(this,nn,"f")&&!r?.length)Promise.reject(o);y(this,Ri,"f").call(this,o),y(this,Oi,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=t[0];if(!y(this,nn,"f")&&!r?.length)Promise.reject(o);y(this,Ri,"f").call(this,o),y(this,Oi,"f").call(this,o),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",y(this,_t,"m",Ep).call(this))}async _fromReadableStream(e,t){let r=t?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{y(this,_t,"m",Cp).call(this),this._connected(null);let n=ct.fromReadableStream(e,this.controller);for await(let i of n)y(this,_t,"m",Op).call(this,i);if(n.controller.signal?.aborted)throw new Ne;y(this,_t,"m",Ap).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}[(kr=new WeakMap,Kn=new WeakMap,Ei=new WeakMap,pc=new WeakMap,Ri=new WeakMap,Ci=new WeakMap,mc=new WeakMap,Oi=new WeakMap,Yt=new WeakMap,Ai=new WeakMap,fc=new WeakMap,hc=new WeakMap,nn=new WeakMap,gc=new WeakMap,yc=new WeakMap,Mi=new WeakMap,Rp=new WeakMap,_t=new WeakSet,Ep=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Nv=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((r)=>r.type==="text").map((r)=>r.text);if(t.length===0)throw new z("stream ended without producing a content block with type=text");return t.join(" ")},Cp=function(){if(this.ended)return;O(this,kr,void 0,"f")},Op=function(t){if(this.ended)return;let r=y(this,_t,"m",Dv).call(this,t);switch(this._emit("streamEvent",t,r),t.type){case"content_block_delta":{let o=r.content.at(-1);switch(t.delta.type){case"text_delta":{if(o.type==="text")this._emit("text",t.delta.text,o.text||"");break}case"citations_delta":{if(o.type==="text")this._emit("citation",t.delta.citation,o.citations??[]);break}case"input_json_delta":{if(Uv(o)&&o.input)this._emit("inputJson",t.delta.partial_json,o.input);break}case"thinking_delta":{if(o.type==="thinking")this._emit("thinking",t.delta.thinking,o.thinking);break}case"signature_delta":{if(o.type==="thinking")this._emit("signature",o.signature);break}default:Fv(t.delta)}break}case"message_stop":{this._addMessageParam(r),this._addMessage(Tp(r,y(this,Kn,"f"),{logger:y(this,Mi,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",r.content.at(-1));break}case"message_start":{O(this,kr,r,"f");break}case"content_block_start":case"message_delta":break}},Ap=function(){if(this.ended)throw new z("stream has ended, this shouldn't happen");let t=y(this,kr,"f");if(!t)throw new z("request ended without sending any chunks");return O(this,kr,void 0,"f"),Tp(t,y(this,Kn,"f"),{logger:y(this,Mi,"f")})},Dv=function(t){let r=y(this,kr,"f");if(t.type==="message_start"){if(r)throw new z(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!r)throw new z(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return r;case"message_delta":if(r.stop_reason=t.delta.stop_reason,r.stop_sequence=t.delta.stop_sequence,r.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null)r.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)r.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)r.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)r.usage.server_tool_use=t.usage.server_tool_use;return r;case"content_block_start":return r.content.push({...t.content_block}),r;case"content_block_delta":{let o=r.content.at(t.index);switch(t.delta.type){case"text_delta":{if(o?.type==="text")r.content[t.index]={...o,text:(o.text||"")+t.delta.text};break}case"citations_delta":{if(o?.type==="text")r.content[t.index]={...o,citations:[...o.citations??[],t.delta.citation]};break}case"input_json_delta":{if(o&&Uv(o)){let n=o[jv]||"";n+=t.delta.partial_json;let i={...o};if(Object.defineProperty(i,jv,{value:n,enumerable:!1,writable:!0}),n)i.input=oc(n);r.content[t.index]=i}break}case"thinking_delta":{if(o?.type==="thinking")r.content[t.index]={...o,thinking:o.thinking+t.delta.thinking};break}case"signature_delta":{if(o?.type==="thinking")r.content[t.index]={...o,signature:t.delta.signature};break}default:Fv(t.delta)}return r}case"content_block_stop":return r}},Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("streamEvent",(o)=>{let n=t.shift();if(n)n.resolve(o);else e.push(o)}),this.on("end",()=>{r=!0;for(let o of t)o.resolve(void 0);t.length=0}),this.on("abort",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),this.on("error",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),{next:async()=>{if(!e.length){if(r)return{value:void 0,done:!0};return new Promise((n,i)=>t.push({resolve:n,reject:i})).then((n)=>n?{value:n,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ct(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Fv(e){}class Ni extends V{create(e,t){return this._client.post("/v1/messages/batches",{body:e,...t})}retrieve(e,t){return this._client.get(E`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",Pt,{query:e,...t})}delete(e,t){return this._client.delete(E`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(E`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let r=await this.retrieve(e);if(!r.results_url)throw new z(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);return this._client.get(r.results_url,{...t,headers:S([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,n)=>jn.fromResponse(n.response,n.controller))}}class on extends V{constructor(){super(...arguments);this.batches=new Ni(this._client)}create(e,t){if(e.model in Lv)console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${Lv[e.model]}
43
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(lE.includes(e.model)&&e.thinking&&e.thinking.type==="enabled")console.warn(`Using Claude with ${e.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let r=this._client._options.timeout;if(!e.stream&&r==null){let n=nc[e.model]??void 0;r=this._client.calculateNonstreamingTimeout(e.max_tokens,n)}let o=rc(e.tools,e.messages);return this._client.post("/v1/messages",{body:e,timeout:r??600000,...t,headers:S([o,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then((r)=>Pp(r,e,{logger:this._client.logger??console}))}stream(e,t){return zi.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){return this._client.post("/v1/messages/count_tokens",{body:e,...t})}}var Lv={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026"},lE=["claude-mythos-preview","claude-opus-4-6"];on.Batches=Ni;class Vn extends V{retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(E`/v1/models/${e}`,{...r,headers:S([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/models",Pt,{query:o,...t,headers:S([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers])})}}var Mp,zp,_c,qv,Zv="\\n\\nHuman:",Hv="\\n\\nAssistant:";class $e{get credentials(){return this._authState.provider}constructor({baseURL:e=ue("ANTHROPIC_BASE_URL"),apiKey:t,authToken:r,...o}={}){if(Mp.add(this),this._requestAuthFlags=new WeakMap,_c.set(this,void 0),t===void 0)t=o.profile!=null?null:ue("ANTHROPIC_API_KEY")??null;if(r===void 0)r=o.profile!=null?null:ue("ANTHROPIC_AUTH_TOKEN")??null;if(o.profile!=null&&(o.credentials!=null||o.config!=null))throw TypeError("Pass at most one of `profile`, `credentials`, or `config`.");let n={apiKey:t,authToken:r,...o,baseURL:e||"https://api.anthropic.com"};if(!n.dangerouslyAllowBrowser&&K_())throw new z(`It looks like you're running in a browser-like environment.
44
+
45
+ This is disabled by default, as it risks exposing your secret API credentials to attackers.
46
+ If you understand the risks and have appropriate mitigations in place,
47
+ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
48
+
49
+ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
50
+ `);this.baseURL=n.baseURL,this._baseURLIsExplicit=o.__baseURLIsExplicit??!!e,this.timeout=n.timeout??zp.DEFAULT_TIMEOUT,this.logger=n.logger??console;let i="warn";this.logLevel=i,this.logLevel=up(n.logLevel,"ClientOptions.logLevel",this)??up(ue("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??i,this.fetchOptions=n.fetchOptions,this.maxRetries=n.maxRetries??2,this.fetch=n.fetch??V_(),O(this,_c,G_,"f");let s=ue("ANTHROPIC_CUSTOM_HEADERS");if(s){let c={};for(let u of s.split(`
51
+ `)){let l=u.indexOf(":");if(l>=0)c[u.substring(0,l).trim()]=u.substring(l+1).trim()}n.defaultHeaders={...c,...n.defaultHeaders}}let a=o.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=r,a){if(this._authState=a,!this._baseURLIsExplicit&&a.baseURL)this.baseURL=a.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let c=n.credentials??null;if(c)this._authState.provider=c,this._authState.tokenCache=this._makeTokenCache(c);else if(n.config!=null){let u=pp(n.config,this._credentialResolverOptions());this._authState.provider=u.provider,this._authState.tokenCache=this._makeTokenCache(u.provider),this._authState.extraHeaders=u.extraHeaders,this._applyCredentialBaseURL(u.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{Te(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{Te(this).warn(e)}}}_makeTokenCache(e){return new ap(e,(t)=>{Te(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,o={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(o)}async _resolveDefaultCredentials(e){try{let t=await fv(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new z(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,S([{Authorization:`Bearer ${t}`}])}return S([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return S([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return S([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return J_(e)}getUserAgent(){return`${this.constructor.name}/JS ${gt}`}defaultIdempotencyKey(){return`stainless-node-retry-${tp()}`}makeStatusError(e,t,r,o){return Oe.generate(e,t,r,o)}buildURL(e,t,r){let o=!y(this,Mp,"m",qv).call(this)&&r||this.baseURL,n=U_(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),i=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!op(i)||!op(s))t={...s,...i,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new z("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let o=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[i,s]of Object.entries(this._authState.extraHeaders))if(!o.has(i))o.set(i,s);if(!o.get("anthropic-beta")?.split(",").map((i)=>i.trim())?.includes(Jr))o.append("anthropic-beta",Jr);e.headers=o}}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((o)=>({method:e,path:t,...o})))}request(e,t=null){return new Xr(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let o=await e,n=o.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(o);await this.prepareOptions(o);let{req:i,url:s,timeout:a}=await this.buildRequest(o,{retryCount:n-t});await this.prepareRequest(i,{url:s,options:o});let c="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),u=r===void 0?"":`, retryOf: ${r}`,l=Date.now();if(Te(this).debug(`[${c}] sending request`,Gt({retryOfRequestLogID:r,method:o.method,url:s,options:o,headers:i.headers})),o.signal?.aborted)throw new Ne;let d=new AbortController,m=await this.fetchWithTimeout(s,i,a,d).catch(Ho),p=Date.now();if(m instanceof globalThis.Error){let v=`retrying, ${t} attempts remaining`;if(o.signal?.aborted)throw new Ne;let b=Wt(m)||/timed? ?out/i.test(String(m)+("cause"in m?String(m.cause):""));if(t)return Te(this).info(`[${c}] connection ${b?"timed out":"failed"} - ${v}`),Te(this).debug(`[${c}] connection ${b?"timed out":"failed"} (${v})`,Gt({retryOfRequestLogID:r,url:s,durationMs:p-l,message:m.message})),this.retryRequest(o,t,r??c);if(Te(this).info(`[${c}] connection ${b?"timed out":"failed"} - error; no more retries left`),Te(this).debug(`[${c}] connection ${b?"timed out":"failed"} (error; no more retries left)`,Gt({retryOfRequestLogID:r,url:s,durationMs:p-l,message:m.message})),b)throw new Bo;throw new Gr({cause:m})}let f=[...m.headers.entries()].filter(([v])=>v==="request-id").map(([v,b])=>", "+v+": "+JSON.stringify(b)).join(""),h=`[${c}${u}${f}] ${i.method} ${s} ${m.ok?"succeeded":"failed"} with status ${m.status} in ${p-l}ms`;if(!m.ok){let v=await this.shouldRetry(m,o);if(t&&v){let Re=`retrying, ${t} attempts remaining`;return await W_(m.body),Te(this).info(`${h} - ${Re}`),Te(this).debug(`[${c}] response error (${Re})`,Gt({retryOfRequestLogID:r,url:m.url,status:m.status,headers:m.headers,durationMs:p-l})),this.retryRequest(o,t,r??c,m.headers)}let b=v?"error; no more retries left":"error; not retryable";Te(this).info(`${h} - ${b}`);let I=await m.text().catch((Re)=>Ho(Re).message),C=La(I),q=C?void 0:I;throw Te(this).debug(`[${c}] response error (${b})`,Gt({retryOfRequestLogID:r,url:m.url,status:m.status,headers:m.headers,message:q,durationMs:Date.now()-l})),this.makeStatusError(m.status,C,q,m.headers)}return Te(this).info(h),Te(this).debug(`[${c}] response start`,Gt({retryOfRequestLogID:r,url:m.url,status:m.status,headers:m.headers,durationMs:p-l})),{response:m,options:o,controller:d,requestLogID:c,retryOfRequestLogID:r,startTime:l}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((o)=>({method:"get",path:e,...o})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new Qa(this,r,e)}async fetchWithTimeout(e,t,r,o){let{signal:n,method:i,...s}=t||{},a=this._makeAbort(o);if(n)n.addEventListener("abort",a,{once:!0});let c=setTimeout(a,r),u=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,l={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...s};if(i)l.method=i.toUpperCase();try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(c)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let o=e.headers.get("x-should-retry");if(o==="true")return!0;if(o==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,o){let n,i=o?.get("retry-after-ms");if(i){let a=parseFloat(i);if(!Number.isNaN(a))n=a}let s=o?.get("retry-after");if(s&&!n){let a=parseFloat(s);if(!Number.isNaN(a))n=a*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let a=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,a)}return await q_(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,i=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return i*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new z("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(e,{retryCount:t=0}={}){let r={...e},{method:o,path:n,query:i,defaultBaseURL:s}=r;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let a=this.buildURL(n,i,s);if("timeout"in r)L_("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:c,body:u}=this.buildBody({options:r}),l=await this.buildHeaders({options:e,method:o,bodyHeaders:c,retryCount:t});return{req:{method:o,headers:l,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...r.fetchOptions??{}},url:a,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:o}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let i=S([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...ei(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(i),i.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=S([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:qa(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return y(this,_c,"f").call(this,{body:e,headers:r})}}zp=$e,_c=new WeakMap,Mp=new WeakSet,qv=function(){return this.baseURL!=="https://api.anthropic.com"};$e.Anthropic=zp;$e.HUMAN_PROMPT=Zv;$e.AI_PROMPT=Hv;$e.DEFAULT_TIMEOUT=600000;$e.AnthropicError=z;$e.APIError=Oe;$e.APIConnectionError=Gr;$e.APIConnectionTimeoutError=Bo;$e.APIUserAbortError=Ne;$e.NotFoundError=Go;$e.ConflictError=Jo;$e.RateLimitError=Yo;$e.BadRequestError=Ko;$e.AuthenticationError=Vo;$e.InternalServerError=Qo;$e.PermissionDeniedError=Wo;$e.UnprocessableEntityError=Xo;$e.toFile=ec;class sn extends $e{constructor(){super(...arguments);this.completions=new Bn(this),this.messages=new on(this),this.models=new Vn(this),this.beta=new Fe(this)}}sn.Completions=Bn;sn.Messages=on;sn.Models=Vn;sn.Beta=Fe;function pE(e){return e}function Di(e){return pE(e)}function Np(e){return e instanceof Error?e:Error(String(e))}function vc(e){return e instanceof Error?e.message:String(e)}function Wn(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function Bv(e){return Wn(e)==="ENOENT"}function Dp(e){return Wn(e)==="EISDIR"}var G=(()=>({}));var{lstat:mE,mkdir:fE,open:hE,readdir:gE,readFile:Kv,rename:yE,rmdir:_E,rm:vE,stat:bE,unlink:SE}=(()=>({}));It();var xE={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=be(r,we`fs.existsSync(${e})`,0);return G.existsSync(e)}catch(o){var n=o,i=1}finally{Se(r,n,i)}},async stat(e){return bE(e)},async lstat(e){return mE(e)},async readdir(e){return gE(e,{withFileTypes:!0})},async unlink(e){return SE(e)},async rmdir(e){return _E(e)},async rm(e,t){return vE(e,t)},async mkdir(e,t){try{await fE(e,{recursive:!0,...t})}catch(r){if(Wn(r)!=="EEXIST")throw r}},async readFile(e,t){return Kv(e,{encoding:t.encoding})},async rename(e,t){return yE(e,t)},statSync(e){let r=[];try{const t=be(r,we`fs.statSync(${e})`,0);return G.statSync(e)}catch(o){var n=o,i=1}finally{Se(r,n,i)}},lstatSync(e){let r=[];try{const t=be(r,we`fs.lstatSync(${e})`,0);return G.lstatSync(e)}catch(o){var n=o,i=1}finally{Se(r,n,i)}},readFileSync(e,t){let o=[];try{const r=be(o,we`fs.readFileSync(${e})`,0);return G.readFileSync(e,{encoding:t.encoding})}catch(n){var i=n,s=1}finally{Se(o,i,s)}},readFileBytesSync(e){let r=[];try{const t=be(r,we`fs.readFileBytesSync(${e})`,0);return G.readFileSync(e)}catch(o){var n=o,i=1}finally{Se(r,n,i)}},readSync(e,t){let n=[];try{const r=be(n,we`fs.readSync(${e}, ${t.length} bytes)`,0);let o=void 0;try{o=G.openSync(e,"r");let c=Buffer.alloc(t.length),u=G.readSync(o,c,0,t.length,0);return{buffer:c,bytesRead:u}}finally{if(o)G.closeSync(o)}}catch(i){var s=i,a=1}finally{Se(n,s,a)}},appendFileSync(e,t,r){let n=[];try{const o=be(n,we`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let c=G.openSync(e,"ax",r.mode);try{G.appendFileSync(c,t)}finally{G.closeSync(c)}return}catch(c){if(Wn(c)!=="EEXIST")throw c}G.appendFileSync(e,t)}catch(i){var s=i,a=1}finally{Se(n,s,a)}},copyFileSync(e,t){let o=[];try{const r=be(o,we`fs.copyFileSync(${e} → ${t})`,0);G.copyFileSync(e,t)}catch(n){var i=n,s=1}finally{Se(o,i,s)}},unlinkSync(e){let r=[];try{const t=be(r,we`fs.unlinkSync(${e})`,0);G.unlinkSync(e)}catch(o){var n=o,i=1}finally{Se(r,n,i)}},renameSync(e,t){let o=[];try{const r=be(o,we`fs.renameSync(${e} → ${t})`,0);G.renameSync(e,t)}catch(n){var i=n,s=1}finally{Se(o,i,s)}},linkSync(e,t){let o=[];try{const r=be(o,we`fs.linkSync(${e} → ${t})`,0);G.linkSync(e,t)}catch(n){var i=n,s=1}finally{Se(o,i,s)}},symlinkSync(e,t,r){let n=[];try{const o=be(n,we`fs.symlinkSync(${e} → ${t})`,0);G.symlinkSync(e,t,r)}catch(i){var s=i,a=1}finally{Se(n,s,a)}},readlinkSync(e){let r=[];try{const t=be(r,we`fs.readlinkSync(${e})`,0);return G.readlinkSync(e)}catch(o){var n=o,i=1}finally{Se(r,n,i)}},realpathSync(e){let r=[];try{const t=be(r,we`fs.realpathSync(${e})`,0);return R_(G.realpathSync(e))}catch(o){var n=o,i=1}finally{Se(r,n,i)}},mkdirSync(e,t){let n=[];try{const r=be(n,we`fs.mkdirSync(${e})`,0);let o={recursive:!0};if(t?.mode!==void 0)o.mode=t.mode;try{G.mkdirSync(e,o)}catch(c){if(Wn(c)!=="EEXIST")throw c}}catch(i){var s=i,a=1}finally{Se(n,s,a)}},readdirSync(e){let r=[];try{const t=be(r,we`fs.readdirSync(${e})`,0);return G.readdirSync(e,{withFileTypes:!0})}catch(o){var n=o,i=1}finally{Se(r,n,i)}},readdirStringSync(e){let r=[];try{const t=be(r,we`fs.readdirStringSync(${e})`,0);return G.readdirSync(e)}catch(o){var n=o,i=1}finally{Se(r,n,i)}},isDirEmptySync(e){let o=[];try{const t=be(o,we`fs.isDirEmptySync(${e})`,0);let r=this.readdirSync(e);return r.length===0}catch(n){var i=n,s=1}finally{Se(o,i,s)}},rmdirSync(e){let r=[];try{const t=be(r,we`fs.rmdirSync(${e})`,0);G.rmdirSync(e)}catch(o){var n=o,i=1}finally{Se(r,n,i)}},rmSync(e,t){let o=[];try{const r=be(o,we`fs.rmSync(${e})`,0);G.rmSync(e,t)}catch(n){var i=n,s=1}finally{Se(o,i,s)}},createWriteStream(e){return G.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return Kv(e);let r=await hE(e,"r");try{let{size:o}=await r.stat(),n=Math.min(o,t),i=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:a}=await r.read(i,s,n-s,s);if(a===0)break;s+=a}return s<n?i.subarray(0,s):i}finally{await r.close()}}},kE=xE;function bc(){return kE}It();var{lstatSync:uV,readFileSync:lV,rmSync:dV,unlinkSync:pV,writeFileSync:mV}=(()=>({}));function wE(e,t){if(e.destroyed)return;e.write(t)}function Vv(e){wE(process.stderr,e)}var vV=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,bV=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;var $E=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,Wv="[^\\s,;&}\\])]+",Xv="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",IE=`[^\\s-]{0,4}${Xv}['"\`]?`,Gv=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${Wv})|${IE}|${Wv}`,TE=["sk","ant","api"].join("-"),PE=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${$E.source})[\\w.-]*["']?\\s*[=:]\\s*(${Gv})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${Gv})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:`\\b(AIza[\\w-]{35})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${TE}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:`\\b(sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})\\b|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:Xv,flags:"i",confidence:"high"}];var Jv=null;function EE(e){return PE.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function Yv(e){Jv??=EE(!0);for(let t of Jv)e=e.replace(t.re,(r,o)=>{if(typeof o!=="string")return"[REDACTED]";let n=o.length>=2&&(o[0]==='"'||o[0]==="'")&&o.at(-1)===o[0]?o[0]:"",i=r.lastIndexOf(o);return`${r.slice(0,i)}${n}[REDACTED]${n}${r.slice(i+o.length)}`});return e}var Lp={verbose:0,debug:1,info:2,warn:3,error:4},AE=ht(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(Lp,e))return e;return"debug"}),ME=!1;function xc(){if(typeof process>"u"||!Array.isArray(process.argv))return[];let e=process.argv.indexOf("--");return e===-1?process.argv:process.argv.slice(0,e)}var qp=ht(()=>{let e=xc();return ME||Kr(process.env.DEBUG)||Kr(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||rb()||e.some((t)=>t.startsWith("--debug="))||nb()!==null});var zE=ht(()=>{let e=xc().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return N_(t)}),rb=ht(()=>{let e=xc();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),nb=ht(()=>{let e=xc();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return tb(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return tb(e[t+1])}return null});function tb(e){return A_(e)?null:_r(e)}function NE(e){if(!qp())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=zE();return D_(e,t)}var DE=!1;var jE=10485760,Sc=null,jp=Promise.resolve(),ji=-1,Up=!1,Zp=null;async function ob(e,t,r=jE){if(ji<0)ji=await CE(e).then((o)=>o.size).catch(()=>0);else ji+=t;if(ji<=r||Up)return;Up=!0;try{let o=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await eb(e,o)}catch(n){if(!Bv(n))await Fp(o).catch(()=>{}),await eb(e,o).catch(()=>Fp(e).catch(()=>{}))}ji=0}finally{Up=!1}}function ib(e){return Zp=qt(e,`${Gd()}.txt`),Zp}async function UE(e,t,r,o){if(e)await RE(t,{recursive:!0}).catch(()=>{});let n=r;try{await Qv(r,o)}catch(i){if(!Dp(i))throw i;n=ib(r),await Qv(n,o)}await ob(n,Buffer.byteLength(o)).catch(Hp),ab()}function Hp(){}function FE(){if(!Sc){let e=null;Sc=P_({writeFn:(t)=>{let r=sb(),o=Vr(r),n=e!==o;if(e=o,qp()){if(n)try{bc().mkdirSync(o)}catch{}let i=r;try{bc().appendFileSync(r,t)}catch(s){if(!Dp(s))throw s;i=ib(r),bc().appendFileSync(i,t)}ob(i,Buffer.byteLength(t)).catch(Hp),ab();return}jp=jp.then(UE.bind(null,n,o,r,t)).catch(Hp)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:qp()}),z_(async()=>{Sc?.dispose(),await jp})}return Sc}function Le(e,{level:t}={level:"debug"}){if(Lp[t]<Lp[AE()])return;if(!NE(e))return;if(DE&&e.includes(`
52
+ `))e=lt(e);let o=`${new Date().toISOString()} [${t.toUpperCase()}] ${Yv(e.trim())}
53
+ `;if(rb()){Vv(o);return}FE().write(o)}function sb(){return nb()??Zp??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??qt(j_(),"debug",`${Gd()}.txt`)}var ab=ht(async()=>{try{let e=sb(),t=Vr(e),r=qt(t,"latest");await Fp(r).catch(()=>{}),await OE(e,r)}catch{}});var JV=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})();var LE={[Symbol.dispose](){}};function qE(){return LE}var we=qE;function lt(e,t,r){let n=[];try{const o=be(n,we`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(i){var s=i,a=1}finally{Se(n,s,a)}}var Gn=(e,t)=>{let o=[];try{const r=be(o,we`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(n){var i=n,s=1}finally{Se(o,i,s)}};class an{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((e,t)=>{this.readResolve=e,this.readReject=t})}enqueue(e){if(this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let t=this.readReject;this.readResolve=void 0,this.readReject=void 0,t(e)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}function ZE(){return{eventQueue:[],sink:null}}var HE=ZE();function Ui(e,t){let r=HE;if(r.sink===null){r.eventQueue.push({eventName:e,metadata:t,async:!1});return}r.sink.logEvent(e,t)}function BE(e,t){Ui("tengu_feature_ok",{feature_name:Di(e),...t})}function KE(e,t,r){Ui("tengu_feature_bad",{...r,feature_name:Di(e),error_code:t})}async function Et(e,t,r){try{let o=await t();return BE(e),o}catch(o){throw KE(e,r?.(o)??"error"),o}}class Bp{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}var cb=Symbol("suppressControlResponse");class Kp{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new an;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let r={type:"system",subtype:"mirror_error",error:t,key:e,uuid:Zo(),session_id:e.sessionId};this.inputStream.enqueue(r)}addCleanupCallback(e){if(this.cleanupPerformed)e();else this.cleanupCallbacks.push(e)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor(e,t,r,o,n,i=new Map,s,a,c,u,l,d){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=r;this.hooks=o;this.abortController=n;this.jsonSchema=s;this.initConfig=a;this.onElicitation=c;this.getOAuthToken=u;this.getHostAuthToken=l;this.onUserDialog=d;for(let[m,p]of i)this.connectSdkMcpServer(m,p);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}async backgroundTasks(e){return(await this.request({subtype:"background_tasks",tool_use_id:e})).response.backgrounded??!0}close(){this.cleanup()}cleanup(e){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise}async performCleanup(e){for(let t of this.cleanupCallbacks)try{t()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let r of this.cancelControllers.values())r.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:r}of this.pendingControlResponses.values())r(t);this.pendingControlResponses.clear();for(let{reject:r}of this.pendingMcpResponses.values())r(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())r.close().catch(()=>{});if(this.sdkMcpTransports.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}}next(...[e]){return this.sdkMessages.next(...[e])}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let t=this.pendingControlResponses.get(e.response.request_id);if(t)t.handler(e.response);continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;else if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.lastErrorResultText=e.is_error?e.subtype==="success"?e.result:e.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)Le("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(e.type==="system"&&e.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(e)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(e instanceof Ft)){let t=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);Le(`[Query.readMessages] Replacing exit error with result text. Original: ${vc(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){if(this.cancelControllers.has(e.request_id)){Le(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${e.request_id} (${e.request.subtype}) — skipping`);return}let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let r=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;if(r===cb)return;let o={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:r}};await Promise.resolve(this.transport.write(lt(o)+`
54
+ `))}catch(r){if(this.cleanupPerformed)return;let o={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:vc(r)}};try{await Promise.resolve(this.transport.write(lt(o)+`
55
+ `))}catch(n){Le(`[Query.handleControlRequest] Error-response write failed: ${vc(n)}`,{level:"error"})}}finally{this.cancelControllers.delete(e.request_id)}}handleControlCancelRequest(e){let t=this.cancelControllers.get(e.request_id);if(t)t.abort(),this.cancelControllers.delete(e.request_id)}async processControlRequest(e,t){if(e.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");return{...await this.canUseTool(e.request.tool_name,e.request.input,{signal:t,suggestions:e.request.permission_suggestions,blockedPath:e.request.blocked_path,decisionReason:e.request.decision_reason,title:e.request.title,displayName:e.request.display_name,description:e.request.description,toolUseID:e.request.tool_use_id,agentID:e.request.agent_id}),toolUseID:e.request.tool_use_id}}else if(e.request.subtype==="hook_callback")return await this.handleHookCallbacks(e.request.callback_id,e.request.input,e.request.tool_use_id,t);else if(e.request.subtype==="mcp_message"){let r=e.request,o=this.sdkMcpTransports.get(r.server_name);if(!o)throw Error(`SDK MCP server not found: ${r.server_name}`);if("method"in r.message&&"id"in r.message&&r.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(r.server_name,r,o)};else{if(o.onmessage)o.onmessage(r.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}else if(e.request.subtype==="elicitation"){let r=e.request;if(this.onElicitation)return await this.onElicitation({serverName:r.mcp_server_name,message:r.message,mode:r.mode,url:r.url,elicitationId:r.elicitation_id,requestedSchema:r.requested_schema,title:r.title,displayName:r.display_name,description:r.description},{signal:t});return{action:"decline"}}else if(e.request.subtype==="request_user_dialog"){if(this.onUserDialog)return await this.onUserDialog({dialogKind:e.request.dialog_kind,payload:e.request.payload,toolUseID:e.request.tool_use_id},{signal:t});return Le(`[Query] No onUserDialog handler for request_user_dialog (kind=${e.request.dialog_kind}) — staying silent so a capable client (or the worker's park deadline) settles it`),Ui("tengu_request_user_dialog_response_ignored",{shape:Di("auto_cancel")}),cb}else if(e.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");return{accessToken:await this.getOAuthToken({signal:t})??null}}else if(e.request.subtype==="host_auth_token_refresh"){if(!this.getHostAuthToken)throw Error("getHostAuthToken callback is not provided.");return{authToken:await this.getHostAuthToken({signal:t})??null}}throw Error("Unsupported control request subtype: "+e.request.subtype)}async*readSdkMessages(){try{for await(let e of this.inputStream)yield e}finally{await this.cleanup()}}async initialize(){let e;if(this.hooks){e={};for(let[n,i]of Object.entries(this.hooks))if(i.length>0)e[n]=i.map((s)=>{let a=[];for(let c of s.hooks){let u=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(u,c),a.push(u)}return{matcher:s.matcher,hookCallbackIds:a,timeout:s.timeout}})}let t=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,r={subtype:"initialize",hooks:e,sdkMcpServers:t,jsonSchema:this.jsonSchema,systemPrompt:typeof this.initConfig?.systemPrompt==="string"?[this.initConfig.systemPrompt]:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,planModeInstructions:this.initConfig?.planModeInstructions,appendSubagentSystemPrompt:this.initConfig?.appendSubagentSystemPrompt,toolAliases:this.initConfig?.toolAliases,excludeDynamicSections:this.initConfig?.excludeDynamicSections,agents:this.initConfig?.agents,title:this.initConfig?.title,skills:Array.isArray(this.initConfig?.skills)?this.initConfig.skills:void 0,webSearchIsolationExemptMcpServers:this.initConfig?.webSearchIsolationExemptMcpServers,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries,forwardSubagentText:this.initConfig?.forwardSubagentText,supportedDialogKinds:this.initConfig?.supportedDialogKinds};return(await this.request(r)).response}async interrupt(){return Et("sdk_interrupt",async()=>{await this.request({subtype:"interrupt"})})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e})}async applyFlagSettings(e){return Et("sdk_apply_flag_settings",async()=>{await this.request({subtype:"apply_flag_settings",settings:e})})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async rewindFiles(e,t){return Et("sdk_rewind_files",async()=>(await this.request({subtype:"rewind_files",user_message_id:e,dry_run:t?.dryRun})).response)}async cancelAsyncMessage(e){return(await this.request({subtype:"cancel_async_message",message_uuid:e})).response.cancelled}async seedReadState(e,t){await this.request({subtype:"seed_read_state",path:e,mtime:t})}async enableRemoteControl(e,t){return(await this.request({subtype:"remote_control",enabled:e,...t!==void 0&&{name:t}})).response}async submitFeedback(e,t){return(await this.request({subtype:"submit_feedback",description:e,surface:t?.surface})).response}async generateSessionTitle(e,t){return Et("sdk_session_title_generate",async()=>(await this.request({subtype:"generate_session_title",description:e,persist:t?.persist})).response.title)}async askSideQuestion(e){return Et("sdk_side_question",async()=>{let r=(await this.request({subtype:"side_question",question:e})).response;return r.response===null?null:{response:r.response,synthetic:r.synthetic??!1}})}async launchUltrareview(e,t){return(await this.request({subtype:"ultrareview_launch",args:e,confirm:t?.confirm??!1})).response}async messageRated(e){await this.request({subtype:"message_rated",messageUuid:e.messageUuid,sentiment:e.sentiment,surface:e.surface,cleared:e.cleared??!1})}processPendingPermissionRequests(e){for(let t of e)if(t.request.subtype==="can_use_tool")this.handleControlRequest(t).catch(()=>{})}processPendingUserDialogRequests(e){for(let t of e)if(t.request.subtype==="request_user_dialog")this.handleControlRequest(t).catch(()=>{})}request(e){let t=Math.random().toString(36).substring(2,15),r={request_id:t,type:"control_request",request:e},o=e.subtype==="initialize";return new Promise((n,i)=>{this.pendingControlResponses.set(t,{handler:(s)=>{if(this.pendingControlResponses.delete(t),s.subtype==="success")n(s);else i(Error(s.error));if(!o&&(s.pending_permission_requests||s.pending_user_dialog_requests))Le(`[Query] Ignoring prompt-redelivery fields on non-initialize response (subtype=${e.subtype})`);else{if(s.pending_permission_requests)this.processPendingPermissionRequests(s.pending_permission_requests);if(s.pending_user_dialog_requests)this.processPendingUserDialogRequests(s.pending_user_dialog_requests)}},reject:i}),Promise.resolve(this.transport.write(lt(r)+`
56
+ `)).catch((s)=>{this.pendingControlResponses.delete(t),i(s)})})}initializationResult(){return this.initialization}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(e){await this.request({subtype:"mcp_reconnect",serverName:e})}async toggleMcpServer(e,t){return Et("sdk_mcp_toggle_server",async()=>{await this.request({subtype:"mcp_toggle",serverName:e,enabled:t})})}async enableChannel(e){return Et("sdk_mcp_enable_channel",async()=>{await this.request({subtype:"channel_enable",serverName:e})})}async mcpAuthenticate(e,t){return(await this.request({subtype:"mcp_authenticate",serverName:e,redirectUri:t})).response}async mcpClearAuth(e){return(await this.request({subtype:"mcp_clear_auth",serverName:e})).response}async mcpSubmitOAuthCallbackUrl(e,t){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:e,callbackUrl:t})).response}async claudeAuthenticate(e){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:e})).response}async claudeOAuthCallback(e,t){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:e,state:t})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(){return(await this.request({subtype:"get_context_usage"})).response}async usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET(){return(await this.request({subtype:"get_usage"})).response}async readFile(e,t){try{return(await this.request({subtype:"read_file",path:e,max_bytes:t?.maxBytes,encoding:t?.encoding})).response}catch{return null}}async reloadPlugins(){return Et("sdk_reload_plugins",async()=>(await this.request({subtype:"reload_plugins"})).response)}async reloadSkills(){return Et("sdk_reload_skills",async()=>(await this.request({subtype:"reload_skills"})).response)}async setMcpServers(e){return Et("sdk_mcp_set_servers",async()=>{let t={},r={};for(let[a,c]of Object.entries(e))if(c.type==="sdk"&&"instance"in c)t[a]=c.instance;else r[a]=c;let o=new Set(this.sdkMcpServerInstances.keys()),n=new Set(Object.keys(t));for(let a of o)if(!n.has(a))await this.disconnectSdkMcpServer(a);for(let[a,c]of Object.entries(t))if(!o.has(a))this.connectSdkMcpServer(a,c);let i={};for(let a of Object.keys(t))i[a]={type:"sdk",name:a};return(await this.request({subtype:"mcp_set_servers",servers:{...r,...i}})).response})}async accountInfo(){return(await this.initialization).account}async streamInput(e){Le("[Query.streamInput] Starting to process input stream");try{let t=0;for await(let r of e){if(t++,Le(`[Query.streamInput] Processing message ${t}: ${r.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(lt(r)+`
57
+ `))}if(Le(`[Query.streamInput] Finished processing ${t} messages from input stream`),t>0&&this.hasBidirectionalNeeds())Le("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult();Le("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(t){if(!(t instanceof Ft))throw t}}waitForFirstResult(){if(this.firstResultReceived)return Le("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve();return new Promise((e)=>{if(this.abortController?.signal.aborted){e();return}this.abortController?.signal.addEventListener("abort",()=>e(),{once:!0}),this.firstResultReceivedResolve=e})}handleHookCallbacks(e,t,r,o){let n=this.hookCallbacks.get(e);if(!n)throw Error(`No hook callback found for ID: ${e}`);return n(t,r,{signal:o})}connectSdkMcpServer(e,t){let r=new Bp((o)=>this.sendMcpServerMessageToCli(e,o));this.sdkMcpTransports.set(e,r),this.sdkMcpServerInstances.set(e,t),t.connect(r).catch((o)=>{if(this.sdkMcpTransports.get(e)===r)this.sdkMcpTransports.delete(e);if(this.sdkMcpServerInstances.get(e)===t)this.sdkMcpServerInstances.delete(e);Le(`[Query.connectSdkMcpServer] Failed to connect MCP server '${e}': ${o}`,{level:"error"})})}async disconnectSdkMcpServer(e){let t=this.sdkMcpTransports.get(e);if(t)await t.close(),this.sdkMcpTransports.delete(e);this.sdkMcpServerInstances.delete(e)}sendMcpServerMessageToCli(e,t){if("id"in t&&t.id!==null&&t.id!==void 0){let o=`${e}:${t.id}`,n=this.pendingMcpResponses.get(o);if(n){n.resolve(t),this.pendingMcpResponses.delete(o);return}}let r={type:"control_request",request_id:Zo(),request:{subtype:"mcp_message",server_name:e,message:t}};Promise.resolve(this.transport.write(lt(r)+`
58
+ `)).catch((o)=>{Le(`[Query.sendMcpServerMessageToCli] Transport write failed: ${o}`,{level:"error"})})}handleMcpControlRequest(e,t,r){let o="id"in t.message?t.message.id:null,n=`${e}:${o}`;return new Promise((i,s)=>{let a=()=>{this.pendingMcpResponses.delete(n)},c=(l)=>{a(),i(l)},u=(l)=>{a(),s(l)};if(this.pendingMcpResponses.set(n,{resolve:c,reject:u}),r.onmessage)r.onmessage(t.message);else{a(),s(Error("No message handler registered"));return}})}}class kc extends Error{retryAfterMs;constructor(e,t){super(e);this.retryAfterMs=t}}class Vp{pending=[];pendingAtClose=0;draining=!1;closed=!1;backpressureResolvers=[];sleepResolve=null;flushResolvers=[];droppedBatches=0;config;constructor(e){this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length===0)return;while(this.pending.length+t.length>this.config.maxQueueSize&&!this.closed)await new Promise((r)=>{this.backpressureResolvers.push(r)});if(this.closed)return;this.pending.push(...t),this.drain()}flush(){if(this.pending.length===0&&!this.draining)return Promise.resolve();return this.drain(),new Promise((e)=>{this.flushResolvers.push(e)})}close(){if(this.closed)return;this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{while(this.pending.length>0&&!this.closed){let t=this.takeBatch();if(t.length===0)continue;try{await this.config.send(t),e=0}catch(r){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let o=r instanceof kc?r.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,o));continue}this.releaseBackpressure()}}finally{if(this.draining=!1,this.pending.length===0){for(let t of this.flushResolvers)t();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let r=0,o=0;while(o<this.pending.length&&o<e){let n;try{n=Buffer.byteLength(lt(this.pending[o]))}catch{this.pending.splice(o,1);continue}if(o>0&&r+n>t)break;r+=n,o++}return this.pending.splice(0,o)}retryDelay(e,t){let r=Math.random()*this.config.jitterMs;if(t!==void 0)return Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+r;return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+r}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise((t)=>{this.sleepResolve=t,setTimeout((r,o)=>{r.sleepResolve=null,o()},e,this,t)})}}function ub(e){let t=[],r=0,o;while((o=e.indexOf(`
59
+
60
+ `,r))!==-1){let n=e.slice(r,o);if(r=o+2,!n.trim())continue;let i={},s=!1;for(let a of n.split(`
61
+ `)){if(a.startsWith(":")){s=!0;continue}let c=a.indexOf(":");if(c===-1)continue;let u=a.slice(0,c),l=a[c+1]===" "?a.slice(c+2):a.slice(c+1);switch(u){case"event":i.event=l;break;case"id":i.id=l;break;case"data":i.data=i.data?i.data+`
62
+ `+l:l;break}}if(i.data||s)t.push(i)}return{frames:t,remaining:e.slice(r)}}var VE=15000,lb=1000,db=30000,pb=5,WE=45000,GE=30000,JE=3,XE=1000,mb=new Set([401,403,404]),YE={stream:!0};class Wp{options;ready=!1;closed=!1;abortController;streamAbort=null;messages=new an;exitError;readyPromise;readyResolve;readyReject;abortHandler;livenessTimer;reconnectAttempts=0;lastEventId="";uploader;constructor(e){this.options=e;if(this.abortController=e.abortController||new AbortController,this.readyPromise=new Promise((t,r)=>{this.readyResolve=t,this.readyReject=r}),this.readyPromise.catch(()=>{}),this.uploader=new Vp({maxBatchSize:1,maxQueueSize:XE,baseDelayMs:lb,maxDelayMs:db,jitterMs:250,maxConsecutiveFailures:JE,send:(t)=>this.postOnce(t[0])}),this.abortHandler=()=>{this.exitError=new Ft("SSE connection aborted by user"),this.close()},this.abortController.signal.aborted)this.abortHandler();else this.abortController.signal.addEventListener("abort",this.abortHandler);this.connect()}buildHeaders(e){return{...this.options.headers??{},...e}}async connect(){if(this.closed)return;this.streamAbort=new AbortController;let e=this.streamAbort.signal,t=this.buildHeaders({Accept:"text/event-stream"});if(this.lastEventId)t["Last-Event-ID"]=this.lastEventId;let r=setTimeout(()=>{this.streamAbort?.abort(),this.handleStreamEnd(Error("SSE connect timeout"))},this.options.connectTimeoutMs??VE),o;try{o=await fetch(this.options.streamUrl,{method:"GET",headers:t,signal:e})}catch(n){if(clearTimeout(r),this.closed||e.aborted)return;return this.handleStreamEnd(Np(n))}if(clearTimeout(r),!o.ok||!o.body){if(o.body?.cancel(),mb.has(o.status))return this.fail(Error(`SSE connect failed: HTTP ${o.status}`));return this.handleStreamEnd(Error(`SSE connect failed: HTTP ${o.status}`))}this.ready=!0,this.reconnectAttempts=0,this.resetLivenessTimer(),this.readyResolve?.(),this.readStream(o.body,e)}async readStream(e,t){let r=e.getReader(),o=new TextDecoder,n="";try{while(!t.aborted){let{done:i,value:s}=await r.read();if(i)break;this.resetLivenessTimer(),n+=o.decode(s,YE);let{frames:a,remaining:c}=ub(n);n=c;for(let u of a){if(u.id)this.lastEventId=u.id;if(!u.data)continue;if(u.event!=="client_event"&&u.event!=="ephemeral_event")continue;try{let l=Gn(u.data),d=l.payload;if(!d||typeof d.type!=="string")continue;if(u.event==="ephemeral_event"&&(d.type==="control_request"||d.type==="control_response"||d.type==="control_cancel_request")){console.debug(`[BrowserSSETransport] Dropping ${d.type} on ephemeral_event`);continue}if(u.event==="client_event"&&l.source!=="worker"&&(d.type==="control_request"||d.type==="control_cancel_request"))continue;if(u.event==="client_event"&&d.type==="control_response"&&l.source!=="worker"&&d.response&&typeof d.response==="object"&&(("pending_user_dialog_requests"in d.response)||("pending_permission_requests"in d.response))){let{pending_user_dialog_requests:m,pending_permission_requests:p,...f}=d.response;this.messages.enqueue({...d,response:f});continue}this.messages.enqueue(d)}catch{}}}}catch(i){if(!this.closed&&!t.aborted)return this.handleStreamEnd(Np(i));return}finally{r.releaseLock()}if(!this.closed&&!t.aborted)this.handleStreamEnd()}handleStreamEnd(e){if(this.ready=!1,this.clearLivenessTimer(),this.closed)return;if(this.reconnectAttempts>=pb)return this.fail(e??Error(`SSE reconnect budget exhausted (${pb} attempts)`));this.reconnectAttempts++;let t=Math.min(lb*2**(this.reconnectAttempts-1),db);setTimeout(()=>void this.connect(),t)}fail(e){if(this.exitError=this.exitError??e,!this.ready)this.readyReject?.(e);this.close()}resetLivenessTimer(){this.clearLivenessTimer(),this.livenessTimer=setTimeout(()=>{this.streamAbort?.abort(),this.handleStreamEnd(Error("SSE liveness timeout"))},WE)}clearLivenessTimer(){if(this.livenessTimer)clearTimeout(this.livenessTimer),this.livenessTimer=void 0}async write(e){if(this.abortController.signal.aborted)throw new Ft("Operation aborted");if(!this.ready)await this.readyPromise;if(this.closed)throw this.exitError??Error("SSETransport is closed");let t=Gn(e),r=!t||typeof t!=="object"||Array.isArray(t)||typeof t.uuid==="string"&&t.uuid?e:JSON.stringify({...t,uuid:crypto.randomUUID()});await this.uploader.enqueue(r)}async postOnce(e){let t=this.buildHeaders({"Content-Type":"application/json"}),r=JSON.stringify({session_id:this.options.sessionId,events:[{payload:Gn(e)}]}),o=await fetch(this.options.sendUrl,{method:"POST",headers:t,body:r,signal:QE([this.abortController.signal,AbortSignal.timeout(GE)])});if(o.body?.cancel(),o.ok)return;if(mb.has(o.status))throw this.fail(Error(`POST ${this.options.sendUrl}: HTTP ${o.status}`)),Error(`permanent HTTP ${o.status}`);let n=o.headers.get("Retry-After");throw new kc(`POST ${this.options.sendUrl}: HTTP ${o.status}`,n?Number(n)*1000:void 0)}close(){if(this.closed)return;if(this.closed=!0,this.ready=!1,this.clearLivenessTimer(),this.streamAbort?.abort(),this.uploader.close(),this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;this.messages.done()}[Symbol.dispose](){this.close()}isReady(){return this.ready&&!this.closed}endInput(){}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function QE(e){let t=AbortSignal;if(typeof t.any==="function")return t.any(e);let r=new AbortController;for(let o of e){if(o.aborted){r.abort(o.reason);break}o.addEventListener("abort",()=>r.abort(o.reason),{once:!0})}return r.signal}var fb=15000,eR=50000;class Gp{options;ws;ready=!1;abortController;messages=new an;exitError;readyPromise;readyResolve;readyReject;abortHandler;keepAliveTimer;partialLine="";constructor(e){this.options=e;this.abortController=e.abortController||new AbortController,this.readyPromise=new Promise((t,r)=>{this.readyResolve=t,this.readyReject=r}),this.readyPromise.catch(()=>{}),this.initialize()}initialize(){try{let{url:e}=this.options,t=new URL(e);if(!t.protocol.startsWith("ws"))throw Error("WebSocket URL must use ws:// or wss:// protocol");this.ws=new globalThis.WebSocket(t.toString());let r=setTimeout(()=>{if(!this.ready){this.ws?.close();let o=Error(`WebSocket connection timeout after ${fb}ms`);if(this.exitError=o,this.readyReject)this.readyReject(o)}},fb);if(this.ws.onopen=()=>{if(clearTimeout(r),this.ready=!0,this.readyResolve)this.readyResolve();if(this.options.authMessage&&this.ws)try{this.ws.send(lt(this.options.authMessage)+`
63
+ `)}catch{}this.keepAliveTimer=setInterval(()=>{if(this.ws&&this.ws.readyState===globalThis.WebSocket.OPEN)try{this.ws.send(lt({type:"keep_alive"})+`
64
+ `)}catch{}},eR)},this.ws.onerror=(o)=>{clearTimeout(r),this.ready=!1;let n=Error("WebSocket connection error");if(this.exitError=n,this.readyReject)this.readyReject(n);this.messages.done()},this.ws.onclose=(o)=>{if(this.ready=!1,this.keepAliveTimer)clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0;if(o.code!==1000&&o.code!==1001)this.exitError=Error(`WebSocket closed abnormally with code ${o.code}: ${o.reason}`);this.messages.done()},this.ws.onmessage=(o)=>{if(typeof o.data!=="string")return;let i=(this.partialLine+o.data).split(`
65
+ `);this.partialLine=i.pop()??"";for(let s of i){if(!s)continue;try{this.messages.enqueue(Gn(s))}catch(a){}}},this.abortController)if(this.abortHandler=()=>{this.close(),this.exitError=new Ft("WebSocket connection aborted by user")},this.abortController.signal.aborted)this.abortHandler();else this.abortController.signal.addEventListener("abort",this.abortHandler)}catch(e){if(this.ready=!1,this.exitError=e,this.readyReject)this.readyReject(e);throw e}}async write(e){if(this.abortController.signal.aborted)throw new Ft("Operation aborted");if(!this.ready)await this.readyPromise;if(!this.ready||!this.ws||this.ws.readyState!==globalThis.WebSocket.OPEN)throw Error("WebSocketTransport is not ready for writing");this.ws.send(e)}close(){if(this.abortHandler&&this.abortController)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;if(this.keepAliveTimer)clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0;if(this.ws&&this.ws.readyState===globalThis.WebSocket.OPEN)this.ws.close(1000,"Normal closure");this.ready=!1,this.messages.done()}[Symbol.dispose](){this.close()}isReady(){return this.ready&&this.ws?.readyState===globalThis.WebSocket.OPEN}endInput(){}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function hb(e){return new AbortController}var Hh={};fr(Hh,{xid:()=>eO,void:()=>SO,uuidv7:()=>VC,uuidv6:()=>KC,uuidv4:()=>BC,uuid:()=>HC,url:()=>WC,uppercase:()=>Is,unknown:()=>_e,union:()=>me,undefined:()=>vO,ulid:()=>QC,uint64:()=>yO,uint32:()=>fO,tuple:()=>$O,trim:()=>Os,treeifyError:()=>Tc,transform:()=>jh,toUpperCase:()=>Ms,toLowerCase:()=>As,toJSONSchema:()=>po,templateLiteral:()=>MO,symbol:()=>_O,superRefine:()=>kS,success:()=>OO,stringbool:()=>DO,stringFormat:()=>lO,string:()=>_,strictObject:()=>wO,startsWith:()=>Ps,size:()=>ks,setErrorMap:()=>FO,set:()=>PO,safeParseAsync:()=>fh,safeParse:()=>mh,registry:()=>ts,regexes:()=>Tr,regex:()=>ws,refine:()=>xS,record:()=>fe,readonly:()=>gS,property:()=>oh,promise:()=>zO,prettifyError:()=>Pc,preprocess:()=>kl,prefault:()=>uS,positive:()=>eh,pipe:()=>gl,partialRecord:()=>IO,parseAsync:()=>ph,parse:()=>dh,overwrite:()=>nr,optional:()=>ye,object:()=>N,number:()=>ae,nullish:()=>CO,nullable:()=>hl,null:()=>yl,normalize:()=>Cs,nonpositive:()=>rh,nonoptional:()=>lS,nonnegative:()=>nh,never:()=>_l,negative:()=>th,nativeEnum:()=>EO,nanoid:()=>JC,nan:()=>AO,multipleOf:()=>hn,minSize:()=>gn,minLength:()=>Rr,mime:()=>Rs,maxSize:()=>co,maxLength:()=>uo,map:()=>TO,lte:()=>vt,lt:()=>tr,lowercase:()=>$s,looseObject:()=>Ze,locales:()=>so,literal:()=>j,length:()=>lo,lazy:()=>vS,ksuid:()=>tO,keyof:()=>kO,jwt:()=>uO,json:()=>jO,iso:()=>mo,ipv6:()=>nO,ipv4:()=>rO,intersection:()=>Ls,int64:()=>gO,int32:()=>mO,int:()=>hh,instanceof:()=>NO,includes:()=>Ts,guid:()=>ZC,gte:()=>tt,gt:()=>rr,globalRegistry:()=>et,getErrorMap:()=>LO,function:()=>cl,formatError:()=>eo,float64:()=>pO,float32:()=>dO,flattenError:()=>Qn,file:()=>RO,enum:()=>Ke,endsWith:()=>Es,emoji:()=>GC,email:()=>qC,e164:()=>cO,discriminatedUnion:()=>Sl,date:()=>xO,custom:()=>qh,cuid2:()=>YC,cuid:()=>XC,core:()=>Rt,config:()=>Pe,coerce:()=>Zh,clone:()=>qe,cidrv6:()=>iO,cidrv4:()=>oO,check:()=>SS,catch:()=>mS,boolean:()=>Ce,bigint:()=>hO,base64url:()=>aO,base64:()=>sO,array:()=>te,any:()=>bO,_default:()=>aS,_ZodString:()=>gh,ZodXID:()=>wh,ZodVoid:()=>Jb,ZodUnknown:()=>Wb,ZodUnion:()=>zh,ZodUndefined:()=>Bb,ZodUUID:()=>or,ZodURL:()=>_h,ZodULID:()=>kh,ZodType:()=>Q,ZodTuple:()=>eS,ZodTransform:()=>Dh,ZodTemplateLiteral:()=>yS,ZodSymbol:()=>Hb,ZodSuccess:()=>dS,ZodStringFormat:()=>ge,ZodString:()=>Ds,ZodSet:()=>rS,ZodRecord:()=>Nh,ZodRealError:()=>fo,ZodReadonly:()=>hS,ZodPromise:()=>bS,ZodPrefault:()=>cS,ZodPipe:()=>Lh,ZodOptional:()=>Uh,ZodObject:()=>bl,ZodNumberFormat:()=>ho,ZodNumber:()=>js,ZodNullable:()=>iS,ZodNull:()=>Kb,ZodNonOptional:()=>Fh,ZodNever:()=>Gb,ZodNanoID:()=>bh,ZodNaN:()=>fS,ZodMap:()=>tS,ZodLiteral:()=>nS,ZodLazy:()=>_S,ZodKSUID:()=>$h,ZodJWT:()=>Ah,ZodIssueCode:()=>UO,ZodIntersection:()=>Qb,ZodISOTime:()=>pl,ZodISODuration:()=>ml,ZodISODateTime:()=>ll,ZodISODate:()=>dl,ZodIPv6:()=>Th,ZodIPv4:()=>Ih,ZodGUID:()=>fl,ZodFile:()=>oS,ZodError:()=>FC,ZodEnum:()=>Ns,ZodEmoji:()=>vh,ZodEmail:()=>yh,ZodE164:()=>Oh,ZodDiscriminatedUnion:()=>Yb,ZodDefault:()=>sS,ZodDate:()=>vl,ZodCustomStringFormat:()=>Zb,ZodCustom:()=>xl,ZodCatch:()=>pS,ZodCUID2:()=>xh,ZodCUID:()=>Sh,ZodCIDRv6:()=>Eh,ZodCIDRv4:()=>Ph,ZodBoolean:()=>Us,ZodBigIntFormat:()=>Mh,ZodBigInt:()=>Fs,ZodBase64URL:()=>Ch,ZodBase64:()=>Rh,ZodArray:()=>Xb,ZodAny:()=>Vb,TimePrecision:()=>ju,NEVER:()=>wc,$output:()=>zu,$input:()=>Nu,$brand:()=>$c});var Rt={};fr(Rt,{version:()=>Qm,util:()=>T,treeifyError:()=>Tc,toJSONSchema:()=>po,toDotPath:()=>_b,safeParseAsync:()=>Ir,safeParse:()=>$r,registry:()=>ts,regexes:()=>Tr,prettifyError:()=>Pc,parseAsync:()=>dn,parse:()=>ln,locales:()=>so,isValidJWT:()=>Nb,isValidBase64URL:()=>zb,isValidBase64:()=>sf,globalRegistry:()=>et,globalConfig:()=>Fi,function:()=>cl,formatError:()=>eo,flattenError:()=>Qn,config:()=>Pe,clone:()=>qe,_xid:()=>ms,_void:()=>el,_uuidv7:()=>ss,_uuidv6:()=>is,_uuidv4:()=>os,_uuid:()=>ns,_url:()=>as,_uppercase:()=>Is,_unknown:()=>fn,_union:()=>_C,_undefined:()=>Ju,_ulid:()=>ps,_uint64:()=>Wu,_uint32:()=>Hu,_tuple:()=>ih,_trim:()=>Os,_transform:()=>TC,_toUpperCase:()=>Ms,_toLowerCase:()=>As,_templateLiteral:()=>NC,_symbol:()=>Gu,_success:()=>OC,_stringbool:()=>sl,_stringFormat:()=>al,_string:()=>Du,_startsWith:()=>Ps,_size:()=>ks,_set:()=>kC,_safeParseAsync:()=>Oc,_safeParse:()=>Cc,_regex:()=>ws,_refine:()=>il,_record:()=>SC,_readonly:()=>zC,_property:()=>oh,_promise:()=>jC,_positive:()=>eh,_pipe:()=>MC,_parseAsync:()=>Rc,_parse:()=>Ec,_overwrite:()=>nr,_optional:()=>PC,_number:()=>Uu,_nullable:()=>EC,_null:()=>Xu,_normalize:()=>Cs,_nonpositive:()=>rh,_nonoptional:()=>CC,_nonnegative:()=>nh,_never:()=>Qu,_negative:()=>th,_nativeEnum:()=>$C,_nanoid:()=>us,_nan:()=>rl,_multipleOf:()=>hn,_minSize:()=>gn,_minLength:()=>Rr,_min:()=>tt,_mime:()=>Rs,_maxSize:()=>co,_maxLength:()=>uo,_max:()=>vt,_map:()=>xC,_lte:()=>vt,_lt:()=>tr,_lowercase:()=>$s,_literal:()=>IC,_length:()=>lo,_lazy:()=>DC,_ksuid:()=>fs,_jwt:()=>xs,_isoTime:()=>Wf,_isoDuration:()=>Gf,_isoDateTime:()=>Kf,_isoDate:()=>Vf,_ipv6:()=>gs,_ipv4:()=>hs,_intersection:()=>bC,_int64:()=>Vu,_int32:()=>Zu,_int:()=>Fu,_includes:()=>Ts,_guid:()=>ao,_gte:()=>tt,_gt:()=>rr,_float64:()=>qu,_float32:()=>Lu,_file:()=>nl,_enum:()=>wC,_endsWith:()=>Es,_emoji:()=>cs,_email:()=>rs,_e164:()=>Ss,_discriminatedUnion:()=>vC,_default:()=>RC,_date:()=>tl,_custom:()=>ol,_cuid2:()=>ds,_cuid:()=>ls,_coercedString:()=>Bf,_coercedNumber:()=>Jf,_coercedDate:()=>Qf,_coercedBoolean:()=>Xf,_coercedBigint:()=>Yf,_cidrv6:()=>_s,_cidrv4:()=>ys,_catch:()=>AC,_boolean:()=>Bu,_bigint:()=>Ku,_base64url:()=>bs,_base64:()=>vs,_array:()=>zs,_any:()=>Yu,TimePrecision:()=>ju,NEVER:()=>wc,JSONSchemaGenerator:()=>ul,JSONSchema:()=>Fb,Doc:()=>Nc,$output:()=>zu,$input:()=>Nu,$constructor:()=>g,$brand:()=>$c,$ZodXID:()=>Wc,$ZodVoid:()=>pu,$ZodUnknown:()=>mn,$ZodUnion:()=>Yi,$ZodUndefined:()=>cu,$ZodUUID:()=>Fc,$ZodURL:()=>qc,$ZodULID:()=>Vc,$ZodType:()=>K,$ZodTuple:()=>Er,$ZodTransform:()=>oo,$ZodTemplateLiteral:()=>Cu,$ZodSymbol:()=>au,$ZodSuccess:()=>Tu,$ZodStringFormat:()=>pe,$ZodString:()=>Pr,$ZodSet:()=>_u,$ZodRegistry:()=>es,$ZodRecord:()=>gu,$ZodRealError:()=>Yn,$ZodReadonly:()=>Ru,$ZodPromise:()=>Ou,$ZodPrefault:()=>$u,$ZodPipe:()=>io,$ZodOptional:()=>xu,$ZodObject:()=>Xi,$ZodNumberFormat:()=>iu,$ZodNumber:()=>Gi,$ZodNullable:()=>ku,$ZodNull:()=>uu,$ZodNonOptional:()=>Iu,$ZodNever:()=>du,$ZodNanoID:()=>Hc,$ZodNaN:()=>Eu,$ZodMap:()=>yu,$ZodLiteral:()=>bu,$ZodLazy:()=>Au,$ZodKSUID:()=>Gc,$ZodJWT:()=>nu,$ZodIntersection:()=>hu,$ZodISOTime:()=>nf,$ZodISODuration:()=>of,$ZodISODateTime:()=>tf,$ZodISODate:()=>rf,$ZodIPv6:()=>Xc,$ZodIPv4:()=>Jc,$ZodGUID:()=>Uc,$ZodFunction:()=>sh,$ZodFile:()=>Su,$ZodError:()=>Wi,$ZodEnum:()=>vu,$ZodEmoji:()=>Zc,$ZodEmail:()=>Lc,$ZodE164:()=>ru,$ZodDiscriminatedUnion:()=>fu,$ZodDefault:()=>wu,$ZodDate:()=>mu,$ZodCustomStringFormat:()=>ou,$ZodCustom:()=>Mu,$ZodCheckUpperCase:()=>Km,$ZodCheckStringFormat:()=>to,$ZodCheckStartsWith:()=>Wm,$ZodCheckSizeEquals:()=>Fm,$ZodCheckRegex:()=>Hm,$ZodCheckProperty:()=>Jm,$ZodCheckOverwrite:()=>Ym,$ZodCheckNumberFormat:()=>Nm,$ZodCheckMultipleOf:()=>zm,$ZodCheckMinSize:()=>Um,$ZodCheckMinLength:()=>qm,$ZodCheckMimeType:()=>Xm,$ZodCheckMaxSize:()=>jm,$ZodCheckMaxLength:()=>Lm,$ZodCheckLowerCase:()=>Bm,$ZodCheckLessThan:()=>Mc,$ZodCheckLengthEquals:()=>Zm,$ZodCheckIncludes:()=>Vm,$ZodCheckGreaterThan:()=>zc,$ZodCheckEndsWith:()=>Gm,$ZodCheckBigIntFormat:()=>Dm,$ZodCheck:()=>xe,$ZodCatch:()=>Pu,$ZodCUID2:()=>Kc,$ZodCUID:()=>Bc,$ZodCIDRv6:()=>Qc,$ZodCIDRv4:()=>Yc,$ZodBoolean:()=>ro,$ZodBigIntFormat:()=>su,$ZodBigInt:()=>Ji,$ZodBase64URL:()=>tu,$ZodBase64:()=>eu,$ZodAsyncError:()=>Qt,$ZodArray:()=>no,$ZodAny:()=>lu});var wc=Object.freeze({status:"aborted"});function g(e,t,r){function o(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(let l in s.prototype)if(!(l in a))Object.defineProperty(a,l,{value:s.prototype[l].bind(a)});a._zod.constr=s,a._zod.def=c}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let u=r?.Parent?new i:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var $c=Symbol("zod_brand");class Qt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var Fi={};function Pe(e){if(e)Object.assign(Fi,e);return Fi}var T={};fr(T,{unwrapMessage:()=>Li,stringifyPrimitive:()=>R,required:()=>yR,randomString:()=>cR,propertyKeyTypes:()=>Bi,promiseAllObject:()=>aR,primitiveTypes:()=>tm,prefixIssues:()=>Qe,pick:()=>pR,partial:()=>gR,optionalKeys:()=>rm,omit:()=>mR,numKeys:()=>uR,nullish:()=>wr,normalizeParams:()=>$,merge:()=>hR,jsonStringifyReplacer:()=>Xp,joinValues:()=>x,issue:()=>im,isPlainObject:()=>Xn,isObject:()=>Jn,getSizableOrigin:()=>Ki,getParsedType:()=>lR,getLengthableOrigin:()=>Vi,getEnumValues:()=>qi,getElementAtPath:()=>sR,floatSafeRemainder:()=>Yp,finalizeIssue:()=>dt,extend:()=>fR,escapeRegex:()=>er,esc:()=>cn,defineLazy:()=>ce,createTransparentProxy:()=>dR,clone:()=>qe,cleanRegex:()=>Hi,cleanEnum:()=>_R,captureStackTrace:()=>Ic,cached:()=>Zi,assignProp:()=>Qp,assertNotEqual:()=>rR,assertNever:()=>oR,assertIs:()=>nR,assertEqual:()=>tR,assert:()=>iR,allowsEval:()=>em,aborted:()=>un,NUMBER_FORMAT_RANGES:()=>nm,Class:()=>gb,BIGINT_FORMAT_RANGES:()=>om});function tR(e){return e}function rR(e){return e}function nR(e){}function oR(e){throw Error()}function iR(e){}function qi(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function x(e,t="|"){return e.map((r)=>R(r)).join(t)}function Xp(e,t){if(typeof t==="bigint")return t.toString();return t}function Zi(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function wr(e){return e===null||e===void 0}function Hi(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Yp(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return i%s/10**n}function ce(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Qp(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function sR(e,t){if(!t)return e;return t.reduce((r,o)=>r?.[o],e)}function aR(e){let t=Object.keys(e),r=t.map((o)=>e[o]);return Promise.all(r).then((o)=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function cR(e=10){let r="";for(let o=0;o<e;o++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function cn(e){return JSON.stringify(e)}var Ic=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Jn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var em=Zi(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Xn(e){if(Jn(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(Jn(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function uR(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var lR=(e)=>{let 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<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},Bi=new Set(["string","number","symbol"]),tm=new Set(["string","number","bigint","boolean","symbol","undefined"]);function er(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qe(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function $(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function dR(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function R(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function rm(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var nm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},om={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pR(e,t){let r={},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=o.shape[n]}return qe(e,{...e._zod.def,shape:r,checks:[]})}function mR(e,t){let r={...e._zod.def.shape},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return qe(e,{...e._zod.def,shape:r,checks:[]})}function fR(e,t){if(!Xn(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return Qp(this,"shape",o),o},checks:[]};return qe(e,r)}function hR(e,t){return qe(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Qp(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function gR(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in o))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;n[i]=e?new e({type:"optional",innerType:o[i]}):o[i]}else for(let i in o)n[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return qe(t,{...t._zod.def,shape:n,checks:[]})}function yR(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in n))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;n[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)n[i]=new e({type:"nonoptional",innerType:o[i]});return qe(t,{...t._zod.def,shape:n,checks:[]})}function un(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Qe(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Li(e){return typeof e==="string"?e:e?.message}function dt(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=Li(e.inst?._zod.def?.error?.(e))??Li(t?.error?.(e))??Li(r.customError?.(e))??Li(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function Ki(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Vi(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function im(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function _R(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}class gb{constructor(...e){}}var yb=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Xp,2)},enumerable:!0})},Wi=g("$ZodError",yb),Yn=g("$ZodError",yb,{Parent:Error});function Qn(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function eo(e,t){let r=t||function(i){return i.message},o={_errors:[]},n=(i)=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)o._errors.push(r(s));else{let a=o,c=0;while(c<s.path.length){let u=s.path[c];if(c!==s.path.length-1)a[u]=a[u]||{_errors:[]};else a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s));a=a[u],c++}}};return n(e),o}function Tc(e,t){let r=t||function(i){return i.message},o={errors:[]},n=(i,s=[])=>{var a,c;for(let u of i.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map((l)=>n({issues:l},u.path));else if(u.code==="invalid_key")n({issues:u.issues},u.path);else if(u.code==="invalid_element")n({issues:u.issues},u.path);else{let l=[...s,...u.path];if(l.length===0){o.errors.push(r(u));continue}let d=o,m=0;while(m<l.length){let p=l[m],f=m===l.length-1;if(typeof p==="string")d.properties??(d.properties={}),(a=d.properties)[p]??(a[p]={errors:[]}),d=d.properties[p];else d.items??(d.items=[]),(c=d.items)[p]??(c[p]={errors:[]}),d=d.items[p];if(f)d.errors.push(r(u));m++}}};return n(e),o}function _b(e){let t=[];for(let r of e)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function Pc(e){let t=[],r=[...e.issues].sort((o,n)=>o.path.length-n.path.length);for(let o of r)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${_b(o.path)}`);return t.join(`
66
+ `)}var Ec=(e)=>(t,r,o,n)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Qt;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>dt(c,i,Pe())));throw Ic(a,n?.callee),a}return s.value},ln=Ec(Yn),Rc=(e)=>async(t,r,o,n)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>dt(c,i,Pe())));throw Ic(a,n?.callee),a}return s.value},dn=Rc(Yn),Cc=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Qt;return i.issues.length?{success:!1,error:new(e??Wi)(i.issues.map((s)=>dt(s,n,Pe())))}:{success:!0,data:i.value}},$r=Cc(Yn),Oc=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>dt(s,n,Pe())))}:{success:!0,data:i.value}},Ir=Oc(Yn);var Tr={};fr(Tr,{xid:()=>um,uuid7:()=>kR,uuid6:()=>xR,uuid4:()=>SR,uuid:()=>pn,uppercase:()=>Mm,unicodeEmail:()=>IR,undefined:()=>Om,ulid:()=>cm,time:()=>wm,string:()=>Im,rfc5322Email:()=>$R,number:()=>Em,null:()=>Cm,nanoid:()=>dm,lowercase:()=>Am,ksuid:()=>lm,ipv6:()=>ym,ipv4:()=>gm,integer:()=>Pm,html5Email:()=>wR,hostname:()=>Sm,guid:()=>mm,extendedDuration:()=>bR,emoji:()=>hm,email:()=>fm,e164:()=>xm,duration:()=>pm,domain:()=>ER,datetime:()=>$m,date:()=>km,cuid2:()=>am,cuid:()=>sm,cidrv6:()=>vm,cidrv4:()=>_m,browserEmail:()=>TR,boolean:()=>Rm,bigint:()=>Tm,base64url:()=>Ac,base64:()=>bm,_emoji:()=>PR});var sm=/^[cC][^\s-]{8,}$/,am=/^[0-9a-z]+$/,cm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,um=/^[0-9a-vA-V]{20}$/,lm=/^[A-Za-z0-9]{27}$/,dm=/^[a-zA-Z0-9_-]{21}$/,pm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,bR=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,mm=/^([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})$/,pn=(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)$/;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})$`)},SR=pn(4),xR=pn(6),kR=pn(7),fm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wR=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$R=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,IR=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,TR=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,PR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function hm(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var gm=/^(?:(?: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])$/,ym=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,_m=/^((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])$/,vm=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ac=/^[A-Za-z0-9_-]*$/,Sm=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,ER=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,xm=/^\+(?:[0-9]){6,14}[0-9]$/,vb="(?:(?:\\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])))",km=new RegExp(`^${vb}$`);function bb(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function wm(e){return new RegExp(`^${bb(e)}$`)}function $m(e){let t=bb({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-]\\d{2}:\\d{2})");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${vb}T(?:${o})$`)}var Im=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Tm=/^\d+n?$/,Pm=/^\d+$/,Em=/^-?\d+(?:\.\d+)?/i,Rm=/true|false/i,Cm=/null/i;var Om=/undefined/i;var Am=/^[^A-Z]*$/,Mm=/^[^a-z]*$/;var xe=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),xb={number:"number",bigint:"bigint",object:"date"},Mc=g("$ZodCheckLessThan",(e,t)=>{xe.init(e,t);let r=xb[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zc=g("$ZodCheckGreaterThan",(e,t)=>{xe.init(e,t);let r=xb[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zm=g("$ZodCheckMultipleOf",(e,t)=>{xe.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Yp(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Nm=g("$ZodCheckNumberFormat",(e,t)=>{xe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=nm[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=i,r)a.pattern=Pm}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",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:o,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:o,continue:!t.abort});return}}if(a<n)s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}}),Dm=g("$ZodCheckBigIntFormat",(e,t)=>{xe.init(e,t);let[r,o]=om[t.format];e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=(n)=>{let i=n.value;if(i<r)n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(i>o)n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:e})}}),jm=g("$ZodCheckMaxSize",(e,t)=>{xe.init(e,t),e._zod.when=(r)=>{let o=r.value;return!wr(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let o=r.value;if(o.size<=t.maximum)return;r.issues.push({origin:Ki(o),code:"too_big",maximum:t.maximum,input:o,inst:e,continue:!t.abort})}}),Um=g("$ZodCheckMinSize",(e,t)=>{xe.init(e,t),e._zod.when=(r)=>{let o=r.value;return!wr(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let o=r.value;if(o.size>=t.minimum)return;r.issues.push({origin:Ki(o),code:"too_small",minimum:t.minimum,input:o,inst:e,continue:!t.abort})}}),Fm=g("$ZodCheckSizeEquals",(e,t)=>{xe.init(e,t),e._zod.when=(r)=>{let o=r.value;return!wr(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=(r)=>{let o=r.value,n=o.size;if(n===t.size)return;let i=n>t.size;r.issues.push({origin:Ki(o),...i?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Lm=g("$ZodCheckMaxLength",(e,t)=>{xe.init(e,t),e._zod.when=(r)=>{let o=r.value;return!wr(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let o=r.value;if(o.length<=t.maximum)return;let i=Vi(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),qm=g("$ZodCheckMinLength",(e,t)=>{xe.init(e,t),e._zod.when=(r)=>{let o=r.value;return!wr(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let o=r.value;if(o.length>=t.minimum)return;let i=Vi(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zm=g("$ZodCheckLengthEquals",(e,t)=>{xe.init(e,t),e._zod.when=(r)=>{let o=r.value;return!wr(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(r)=>{let o=r.value,n=o.length;if(n===t.length)return;let i=Vi(o),s=n>t.length;r.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),to=g("$ZodCheckStringFormat",(e,t)=>{var r,o;if(xe.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),Hm=g("$ZodCheckRegex",(e,t)=>{to.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,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})}}),Bm=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Am),to.init(e,t)}),Km=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mm),to.init(e,t)}),Vm=g("$ZodCheckIncludes",(e,t)=>{xe.init(e,t);let r=er(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Wm=g("$ZodCheckStartsWith",(e,t)=>{xe.init(e,t);let r=new RegExp(`^${er(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Gm=g("$ZodCheckEndsWith",(e,t)=>{xe.init(e,t);let r=new RegExp(`.*${er(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function Sb(e,t,r){if(e.issues.length)t.issues.push(...Qe(r,e.issues))}var Jm=g("$ZodCheckProperty",(e,t)=>{xe.init(e,t),e._zod.check=(r)=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((n)=>Sb(n,r,t.property));Sb(o,r,t.property);return}}),Xm=g("$ZodCheckMimeType",(e,t)=>{xe.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(r.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e})}}),Ym=g("$ZodCheckOverwrite",(e,t)=>{xe.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Nc{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
67
+ `).filter((i)=>i),o=Math.min(...r.map((i)=>i.length-i.trimStart().length)),n=r.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
68
+ `))}}var Qm={major:4,minor:0,patch:0};var K=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qm;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,s,a)=>{let c=un(i),u;for(let l of s){if(l._zod.when){if(!l._zod.when(i))continue}else if(c)continue;let d=i.issues.length,m=l._zod.check(i);if(m instanceof Promise&&a?.async===!1)throw new Qt;if(u||m instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await m,i.issues.length===d)return;if(!c)c=un(i,d)});else{if(i.issues.length===d)continue;if(!c)c=un(i,d)}}if(u)return u.then(()=>i);return i};e._zod.run=(i,s)=>{let a=e._zod.parse(i,s);if(a instanceof Promise){if(s.async===!1)throw new Qt;return a.then((c)=>n(c,o,s))}return n(a,o,s)}}e["~standard"]={validate:(n)=>{try{let i=$r(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return Ir(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Pr=g("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Im(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),pe=g("$ZodStringFormat",(e,t)=>{to.init(e,t),Pr.init(e,t)}),Uc=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=mm),pe.init(e,t)}),Fc=g("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=pn(o))}else t.pattern??(t.pattern=pn());pe.init(e,t)}),Lc=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=fm),pe.init(e,t)}),qc=g("$ZodURL",(e,t)=>{pe.init(e,t),e._zod.check=(r)=>{try{let o=r.value,n=new URL(o),i=n.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Sm.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(!o.endsWith("/")&&i.endsWith("/"))r.value=i.slice(0,-1);else r.value=i;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Zc=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=hm()),pe.init(e,t)}),Hc=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=dm),pe.init(e,t)}),Bc=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=sm),pe.init(e,t)}),Kc=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=am),pe.init(e,t)}),Vc=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=cm),pe.init(e,t)}),Wc=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=um),pe.init(e,t)}),Gc=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=lm),pe.init(e,t)}),tf=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$m(t)),pe.init(e,t)}),rf=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=km),pe.init(e,t)}),nf=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=wm(t)),pe.init(e,t)}),of=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pm),pe.init(e,t)}),Jc=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=gm),pe.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv4"})}),Xc=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ym),pe.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv6"}),e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Yc=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=_m),pe.init(e,t)}),Qc=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=vm),pe.init(e,t),e._zod.check=(r)=>{let[o,n]=r.value.split("/");try{if(!n)throw Error();let i=Number(n);if(`${i}`!==n)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function sf(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var eu=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=bm),pe.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=(r)=>{if(sf(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function zb(e){if(!Ac.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return sf(r)}var tu=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ac),pe.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=(r)=>{if(zb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ru=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xm),pe.init(e,t)});function Nb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var nu=g("$ZodJWT",(e,t)=>{pe.init(e,t),e._zod.check=(r)=>{if(Nb(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ou=g("$ZodCustomStringFormat",(e,t)=>{pe.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Gi=g("$ZodNumber",(e,t)=>{K.init(e,t),e._zod.pattern=e._zod.bag.pattern??Em,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),iu=g("$ZodNumber",(e,t)=>{Nm.init(e,t),Gi.init(e,t)}),ro=g("$ZodBoolean",(e,t)=>{K.init(e,t),e._zod.pattern=Rm,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Ji=g("$ZodBigInt",(e,t)=>{K.init(e,t),e._zod.pattern=Tm,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(n){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),su=g("$ZodBigInt",(e,t)=>{Dm.init(e,t),Ji.init(e,t)}),au=g("$ZodSymbol",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),cu=g("$ZodUndefined",(e,t)=>{K.init(e,t),e._zod.pattern=Om,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),uu=g("$ZodNull",(e,t)=>{K.init(e,t),e._zod.pattern=Cm,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),lu=g("$ZodAny",(e,t)=>{K.init(e,t),e._zod.parse=(r)=>r}),mn=g("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=(r)=>r}),du=g("$ZodNever",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),pu=g("$ZodVoid",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),mu=g("$ZodDate",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(a){}let n=r.value,i=n instanceof Date;if(i&&!Number.isNaN(n.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function wb(e,t,r){if(e.issues.length)t.issues.push(...Qe(r,e.issues));t.value[r]=e.value}var no=g("$ZodArray",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let a=n[s],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>wb(u,r,s)));else wb(c,r,s)}if(i.length)return Promise.all(i).then(()=>r);return r}});function Dc(e,t,r){if(e.issues.length)t.issues.push(...Qe(r,e.issues));t.value[r]=e.value}function $b(e,t,r,o){if(e.issues.length)if(o[r]===void 0)if(r in o)t.value[r]=void 0;else t.value[r]=e.value;else t.issues.push(...Qe(r,e.issues));else if(e.value===void 0){if(r in o)t.value[r]=void 0}else t.value[r]=e.value}var Xi=g("$ZodObject",(e,t)=>{K.init(e,t);let r=Zi(()=>{let d=Object.keys(t.shape);for(let p of d)if(!(t.shape[p]instanceof K))throw Error(`Invalid element at key "${p}": expected a Zod schema`);let m=rm(t.shape);return{shape:t.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(m)}});ce(e._zod,"propValues",()=>{let d=t.shape,m={};for(let p in d){let f=d[p]._zod;if(f.values){m[p]??(m[p]=new Set);for(let h of f.values)m[p].add(h)}}return m});let o=(d)=>{let m=new Nc(["shape","payload","ctx"]),p=r.value,f=(I)=>{let C=cn(I);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};m.write("const input = payload.value;");let h=Object.create(null),v=0;for(let I of p.keys)h[I]=`key_${v++}`;m.write("const newResult = {}");for(let I of p.keys)if(p.optionalKeys.has(I)){let C=h[I];m.write(`const ${C} = ${f(I)};`);let q=cn(I);m.write(`
69
+ if (${C}.issues.length) {
70
+ if (input[${q}] === undefined) {
71
+ if (${q} in input) {
72
+ newResult[${q}] = undefined;
73
+ }
74
+ } else {
75
+ payload.issues = payload.issues.concat(
76
+ ${C}.issues.map((iss) => ({
77
+ ...iss,
78
+ path: iss.path ? [${q}, ...iss.path] : [${q}],
79
+ }))
80
+ );
81
+ }
82
+ } else if (${C}.value === undefined) {
83
+ if (${q} in input) newResult[${q}] = undefined;
84
+ } else {
85
+ newResult[${q}] = ${C}.value;
86
+ }
87
+ `)}else{let C=h[I];m.write(`const ${C} = ${f(I)};`),m.write(`
88
+ if (${C}.issues.length) payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
89
+ ...iss,
90
+ path: iss.path ? [${cn(I)}, ...iss.path] : [${cn(I)}]
91
+ })));`),m.write(`newResult[${cn(I)}] = ${C}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");let b=m.compile();return(I,C)=>b(d,I,C)},n,i=Jn,s=!Fi.jitless,c=s&&em.value,u=t.catchall,l;e._zod.parse=(d,m)=>{l??(l=r.value);let p=d.value;if(!i(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;let f=[];if(s&&c&&m?.async===!1&&m.jitless!==!0){if(!n)n=o(t.shape);d=n(d,m)}else{d.value={};let C=l.shape;for(let q of l.keys){let Z=C[q],Re=Z._zod.run({value:p[q],issues:[]},m),ft=Z._zod.optin==="optional"&&Z._zod.optout==="optional";if(Re instanceof Promise)f.push(Re.then((Pn)=>ft?$b(Pn,d,q,p):Dc(Pn,d,q)));else if(ft)$b(Re,d,q,p);else Dc(Re,d,q)}}if(!u)return f.length?Promise.all(f).then(()=>d):d;let h=[],v=l.keySet,b=u._zod,I=b.def.type;for(let C of Object.keys(p)){if(v.has(C))continue;if(I==="never"){h.push(C);continue}let q=b.run({value:p[C],issues:[]},m);if(q instanceof Promise)f.push(q.then((Z)=>Dc(Z,d,C)));else Dc(q,d,C)}if(h.length)d.issues.push({code:"unrecognized_keys",keys:h,input:p,inst:e});if(!f.length)return d;return Promise.all(f).then(()=>d)}});function Ib(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((i)=>dt(i,o,Pe())))}),t}var Yi=g("$ZodUnion",(e,t)=>{K.init(e,t),ce(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),ce(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),ce(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),ce(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${r.map((o)=>Hi(o.source)).join("|")})$`)}return}),e._zod.parse=(r,o)=>{let n=!1,i=[];for(let s of t.options){let a=s._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)i.push(a),n=!0;else{if(a.issues.length===0)return a;i.push(a)}}if(!n)return Ib(i,r,e,o);return Promise.all(i).then((s)=>Ib(s,r,e,o))}}),fu=g("$ZodDiscriminatedUnion",(e,t)=>{Yi.init(e,t);let r=e._zod.parse;ce(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){if(!n[a])n[a]=new Set;for(let u of c)n[a].add(u)}}return n});let o=Zi(()=>{let n=t.options,i=new Map;for(let s of n){let a=s._zod.propValues[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!Jn(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(n,i);if(t.unionFallback)return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),n}}),hu=g("$ZodIntersection",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,u])=>Tb(r,c,u));return Tb(r,i,s)}});function ef(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Xn(e)&&Xn(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let s=ef(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=ef(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Tb(e,t,r){if(t.issues.length)e.issues.push(...t.issues);if(r.issues.length)e.issues.push(...r.issues);if(un(e))return e;let o=ef(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Er=g("$ZodTuple",(e,t)=>{K.init(e,t);let r=t.items,o=r.length-[...r].reverse().findIndex((n)=>n._zod.optin!=="optional");e._zod.parse=(n,i)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[];if(!t.rest){let u=s.length>r.length,l=s.length<o-1;if(u||l)return n.issues.push({input:s,inst:e,origin:"array",...u?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),n}let c=-1;for(let u of r){if(c++,c>=s.length){if(c>=o)continue}let l=u._zod.run({value:s[c],issues:[]},i);if(l instanceof Promise)a.push(l.then((d)=>jc(d,n,c)));else jc(l,n,c)}if(t.rest){let u=s.slice(r.length);for(let l of u){c++;let d=t.rest._zod.run({value:l,issues:[]},i);if(d instanceof Promise)a.push(d.then((m)=>jc(m,n,c)));else jc(d,n,c)}}if(a.length)return Promise.all(a).then(()=>n);return n}});function jc(e,t,r){if(e.issues.length)t.issues.push(...Qe(r,e.issues));t.value[r]=e.value}var gu=g("$ZodRecord",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Xn(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;r.value={};for(let c of s)if(typeof c==="string"||typeof c==="number"||typeof c==="symbol"){let u=t.valueType._zod.run({value:n[c],issues:[]},o);if(u instanceof Promise)i.push(u.then((l)=>{if(l.issues.length)r.issues.push(...Qe(c,l.issues));r.value[c]=l.value}));else{if(u.issues.length)r.issues.push(...Qe(c,u.issues));r.value[c]=u.value}}let a;for(let c in n)if(!s.has(c))a=a??[],a.push(c);if(a&&a.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(let s of Reflect.ownKeys(n)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map((u)=>dt(u,o,Pe())),input:s,path:[s],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:n[s],issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>{if(u.issues.length)r.issues.push(...Qe(s,u.issues));r.value[a.value]=u.value}));else{if(c.issues.length)r.issues.push(...Qe(s,c.issues));r.value[a.value]=c.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}}),yu=g("$ZodMap",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,a]of n){let c=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);if(c instanceof Promise||u instanceof Promise)i.push(Promise.all([c,u]).then(([l,d])=>{Pb(l,d,r,s,n,e,o)}));else Pb(c,u,r,s,n,e,o)}if(i.length)return Promise.all(i).then(()=>r);return r}});function Pb(e,t,r,o,n,i,s){if(e.issues.length)if(Bi.has(typeof o))r.issues.push(...Qe(o,e.issues));else r.issues.push({origin:"map",code:"invalid_key",input:n,inst:i,issues:e.issues.map((a)=>dt(a,s,Pe()))});if(t.issues.length)if(Bi.has(typeof o))r.issues.push(...Qe(o,t.issues));else r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map((a)=>dt(a,s,Pe()))});r.value.set(e.value,t.value)}var _u=g("$ZodSet",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((c)=>Eb(c,r)));else Eb(a,r)}if(i.length)return Promise.all(i).then(()=>r);return r}});function Eb(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var vu=g("$ZodEnum",(e,t)=>{K.init(e,t);let r=qi(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter((o)=>Bi.has(typeof o)).map((o)=>typeof o==="string"?er(o):o.toString()).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;if(e._zod.values.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),bu=g("$ZodLiteral",(e,t)=>{K.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?er(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let n=r.value;if(e._zod.values.has(n))return r;return r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}}),Su=g("$ZodFile",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(n instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),oo=g("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r));if(n instanceof Promise)throw new Qt;return r.value=n,r}}),xu=g("$ZodOptional",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ce(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ce(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Hi(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional")return t.innerType._zod.run(r,o);if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),ku=g("$ZodNullable",(e,t)=>{K.init(e,t),ce(e._zod,"optin",()=>t.innerType._zod.optin),ce(e._zod,"optout",()=>t.innerType._zod.optout),ce(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Hi(r.source)}|null)$`):void 0}),ce(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),wu=g("$ZodDefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Rb(i,t));return Rb(n,t)}});function Rb(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var $u=g("$ZodPrefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Iu=g("$ZodNonOptional",(e,t)=>{K.init(e,t),ce(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Cb(i,e));return Cb(n,e)}});function Cb(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}var Tu=g("$ZodSuccess",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>(r.value=i.issues.length===0,r));return r.value=n.issues.length===0,r}}),Pu=g("$ZodCatch",(e,t)=>{K.init(e,t),e._zod.optin="optional",ce(e._zod,"optout",()=>t.innerType._zod.optout),ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>dt(s,o,Pe()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>dt(i,o,Pe()))},input:r.value}),r.issues=[];return r}}),Eu=g("$ZodNaN",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),io=g("$ZodPipe",(e,t)=>{K.init(e,t),ce(e._zod,"values",()=>t.in._zod.values),ce(e._zod,"optin",()=>t.in._zod.optin),ce(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,o)=>{let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Ob(i,t,o));return Ob(n,t,o)}});function Ob(e,t,r){if(un(e))return e;return t.out._zod.run({value:e.value,issues:e.issues},r)}var Ru=g("$ZodReadonly",(e,t)=>{K.init(e,t),ce(e._zod,"propValues",()=>t.innerType._zod.propValues),ce(e._zod,"values",()=>t.innerType._zod.values),ce(e._zod,"optin",()=>t.innerType._zod.optin),ce(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Ab);return Ab(n)}});function Ab(e){return e.value=Object.freeze(e.value),e}var Cu=g("$ZodTemplateLiteral",(e,t)=>{K.init(e,t);let r=[];for(let o of t.parts)if(o instanceof K){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||tm.has(typeof o))r.push(er(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"template_literal",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:"template_literal",pattern:e._zod.pattern.source}),o;return o}}),Ou=g("$ZodPromise",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then((n)=>t.innerType._zod.run({value:n,issues:[]},o))}),Au=g("$ZodLazy",(e,t)=>{K.init(e,t),ce(e._zod,"innerType",()=>t.getter()),ce(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),ce(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),ce(e._zod,"optin",()=>e._zod.innerType._zod.optin),ce(e._zod,"optout",()=>e._zod.innerType._zod.optout),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Mu=g("$ZodCustom",(e,t)=>{xe.init(e,t),K.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>Mb(i,r,o,e));Mb(n,r,o,e);return}});function Mb(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(im(n))}}var so={};fr(so,{zhTW:()=>Hf,zhCN:()=>Zf,vi:()=>qf,ur:()=>Lf,ua:()=>Ff,tr:()=>Uf,th:()=>jf,ta:()=>Df,sv:()=>Nf,sl:()=>zf,ru:()=>Mf,pt:()=>Af,ps:()=>Cf,pl:()=>Of,ota:()=>Rf,no:()=>Ef,nl:()=>Pf,ms:()=>Tf,mk:()=>If,ko:()=>$f,kh:()=>wf,ja:()=>kf,it:()=>xf,id:()=>Sf,hu:()=>bf,he:()=>vf,frCA:()=>_f,fr:()=>yf,fi:()=>gf,fa:()=>hf,es:()=>ff,eo:()=>mf,en:()=>Qi,de:()=>pf,cs:()=>df,ca:()=>lf,be:()=>uf,az:()=>cf,ar:()=>af});var RR=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(n)=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${R(n.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()} ${s.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()} ${s.unit}`;return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`;if(i.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`;if(i.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`;if(i.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`;return`${o[i.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${x(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function af(){return{localeError:RR()}}var CR=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Yanlış dəyər: gözlənilən ${R(n.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`;if(i.format==="ends_with")return`Yanlış mətn: "${i.suffix}" ilə bitməlidir`;if(i.format==="includes")return`Yanlış mətn: "${i.includes}" daxil olmalıdır`;if(i.format==="regex")return`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${o[i.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${x(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function cf(){return{localeError:CR()}}function jb(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}var OR=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(n)=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Няправільны ўвод: чакалася ${R(n.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=jb(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${s.verb} ${i}${n.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=jb(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${s.verb} ${i}${n.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${i.prefix}"`;if(i.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${i.suffix}"`;if(i.format==="includes")return`Няправільны радок: павінен змяшчаць "${i.includes}"`;if(i.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`;return`Няправільны ${o[i.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${x(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function uf(){return{localeError:OR()}}var AR=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrada",email:"adreça electrònica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Valor invàlid: s'esperava ${R(n.values[0])}`;return`Opció invàlida: s'esperava una de ${x(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a màxim":"menys de",s=t(n.origin);if(s)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${i} ${n.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a mínim":"més de",s=t(n.origin);if(s)return`Massa petit: s'esperava que ${n.origin} contingués ${i} ${n.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Format invàlid: ha de començar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format invàlid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format invàlid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${i.pattern}`;return`Format invàlid per a ${o[i.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function lf(){return{localeError:AR()}}var MR=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"regulární výraz",email:"e-mailová adresa",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:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(n)=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Neplatný vstup: očekáváno ${R(n.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${i}${n.maximum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${i}${n.minimum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neplatný řetězec: musí začínat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatný řetězec: musí končit na "${i.suffix}"`;if(i.format==="includes")return`Neplatný řetězec: musí obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`;return`Neplatný formát ${o[i.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${x(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function df(){return{localeError:MR()}}var zR=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(n)=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ungültige Eingabe: erwartet ${R(n.values[0])}`;return`Ungültige Option: erwartet eine von ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ungültiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ungültiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ungültiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ungültig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${x(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function pf(){return{localeError:zR()}}var NR=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},DR=()=>{let 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"}};function t(o){return e[o]??null}let 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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${NR(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${R(o.values[0])}`;return`Invalid option: expected one of ${x(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${x(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Qi(){return{localeError:DR()}}var jR=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},UR=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(o){return e[o]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(o)=>{switch(o.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${o.expected}, riceviĝis ${jR(o.input)}`;case"invalid_value":if(o.values.length===1)return`Nevalida enigo: atendiĝis ${R(o.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${x(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()} ${i.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Tro malgranda: atendiĝis ke ${o.origin} havu ${n}${o.minimum.toString()} ${i.unit}`;return`Tro malgranda: atendiĝis ke ${o.origin} estu ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`;if(n.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`;if(n.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${n.includes}"`;if(n.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`;return`Nevalida ${r[n.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${x(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function mf(){return{localeError:UR()}}var FR=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return i},o={regex:"entrada",email:"dirección de correo electrónico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Entrada inválida: se esperaba ${n.expected}, recibido ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrada inválida: se esperaba ${R(n.values[0])}`;return`Opción inválida: se esperaba una de ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Demasiado pequeño: se esperaba que ${n.origin} tuviera ${i}${n.minimum.toString()} ${s.unit}`;return`Demasiado pequeño: se esperaba que ${n.origin} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cadena inválida: debe comenzar con "${i.prefix}"`;if(i.format==="ends_with")return`Cadena inválida: debe terminar en "${i.suffix}"`;if(i.format==="includes")return`Cadena inválida: debe incluir "${i.includes}"`;if(i.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${i.pattern}`;return`Inválido ${o[i.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n.origin}`;default:return"Entrada inválida"}}};function ff(){return{localeError:FR()}}var LR=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(n)=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${n.expected} می‌بود، ${r(n.input)} دریافت شد`;case"invalid_value":if(n.values.length===1)return`ورودی نامعتبر: می‌بایست ${R(n.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${x(n.values,"|")} می‌بود`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} ${s.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} باشد`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} ${s.unit} باشد`;return`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} باشد`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`رشته نامعتبر: باید با "${i.prefix}" شروع شود`;if(i.format==="ends_with")return`رشته نامعتبر: باید با "${i.suffix}" تمام شود`;if(i.format==="includes")return`رشته نامعتبر: باید شامل "${i.includes}" باشد`;if(i.format==="regex")return`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`;return`${o[i.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${x(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function hf(){return{localeError:LR()}}var qR=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(n)=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Virheellinen syöte: täytyy olla ${R(n.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Liian suuri: ${s.subject} täytyy olla ${i}${n.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon täytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Liian pieni: ${s.subject} täytyy olla ${i}${n.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon täytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen syöte: täytyy sisältää "${i.includes}"`;if(i.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`;return`Virheellinen ${o[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${x(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function gf(){return{localeError:qR()}}var ZR=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(n)=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":if(n.values.length===1)return`Entrée invalide : ${R(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${x(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Trop grand : ${n.origin??"valeur"} doit ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"élément(s)"}`;return`Trop grand : ${n.origin??"valeur"} doit être ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Trop petit : ${n.origin} doit ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : ${n.origin} doit être ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${i.pattern}`;return`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${x(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function yf(){return{localeError:ZR()}}var HR=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(n)=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrée invalide : attendu ${R(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"≤":"<",s=t(n.origin);if(s)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"≥":">",s=t(n.origin);if(s)return`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au motif ${i.pattern}`;return`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${x(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function _f(){return{localeError:HR()}}var BR=()=>{let e={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(n)=>{switch(n.code){case"invalid_type":return`קלט לא תקין: צריך ${n.expected}, התקבל ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`קלט לא תקין: צריך ${R(n.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`גדול מדי: ${n.origin??"value"} צריך להיות ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`גדול מדי: ${n.origin??"value"} צריך להיות ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`קטן מדי: ${n.origin} צריך להיות ${i}${n.minimum.toString()} ${s.unit}`;return`קטן מדי: ${n.origin} צריך להיות ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${i.prefix}"`;if(i.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${i.suffix}"`;if(i.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${i.includes}"`;if(i.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${i.pattern}`;return`${o[i.format]??n.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${n.divisor}`;case"unrecognized_keys":return`מפתח${n.keys.length>1?"ות":""} לא מזוה${n.keys.length>1?"ים":"ה"}: ${x(n.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${n.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n.origin}`;default:return"קלט לא תקין"}}};function vf(){return{localeError:BR()}}var KR=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"bemenet",email:"email cím",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 időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(n)=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Érvénytelen bemenet: a várt érték ${R(n.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${i}${n.maximum.toString()} ${s.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${i}${n.minimum.toString()} ${s.unit}`;return`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`;if(i.format==="ends_with")return`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`;if(i.format==="includes")return`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`;if(i.format==="regex")return`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`;return`Érvénytelen ${o[i.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function bf(){return{localeError:KR()}}var VR=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input tidak valid: diharapkan ${R(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${o[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function Sf(){return{localeError:VR()}}var WR=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input non valido: atteso ${R(n.values[0])}`;return`Opzione non valida: atteso uno tra ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${x(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function xf(){return{localeError:WR()}}var GR=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(n)=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":if(n.values.length===1)return`無効な入力: ${R(n.values[0])}が期待されました`;return`無効な選択: ${x(n.values,"、")}のいずれかである必要があります`;case"too_big":{let i=n.inclusive?"以下である":"より小さい",s=t(n.origin);if(s)return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${s.unit??"要素"}${i}必要があります`;return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${i}必要があります`}case"too_small":{let i=n.inclusive?"以上である":"より大きい",s=t(n.origin);if(s)return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${s.unit}${i}必要があります`;return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${i}必要があります`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`無効な文字列: "${i.prefix}"で始まる必要があります`;if(i.format==="ends_with")return`無効な文字列: "${i.suffix}"で終わる必要があります`;if(i.format==="includes")return`無効な文字列: "${i.includes}"を含む必要があります`;if(i.format==="regex")return`無効な文字列: パターン${i.pattern}に一致する必要があります`;return`無効な${o[i.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${x(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function kf(){return{localeError:GR()}}var JR=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(n)=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${R(n.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()} ${s.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()} ${s.unit}`;return`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`;if(i.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`;if(i.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`;if(i.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`;return`មិនត្រឹមត្រូវ៖ ${o[i.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${x(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function wf(){return{localeError:JR()}}var XR=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(n)=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":if(n.values.length===1)return`잘못된 입력: 값은 ${R(n.values[0])} 이어야 합니다`;return`잘못된 옵션: ${x(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let i=n.inclusive?"이하":"미만",s=i==="미만"?"이어야 합니다":"여야 합니다",a=t(n.origin),c=a?.unit??"요소";if(a)return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${c} ${i}${s}`;return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${i}${s}`}case"too_small":{let i=n.inclusive?"이상":"초과",s=i==="이상"?"이어야 합니다":"여야 합니다",a=t(n.origin),c=a?.unit??"요소";if(a)return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${c} ${i}${s}`;return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`;if(i.format==="ends_with")return`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`;if(i.format==="includes")return`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`;if(i.format==="regex")return`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${o[i.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${x(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function $f(){return{localeError:XR()}}var YR=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(n)=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${R(n.values[0])}`;return`Грешана опција: се очекува една ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${i}${n.maximum.toString()} ${s.unit??"елементи"}`;return`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Премногу мал: се очекува ${n.origin} да има ${i}${n.minimum.toString()} ${s.unit}`;return`Премногу мал: се очекува ${n.origin} да биде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неважечка низа: мора да започнува со "${i.prefix}"`;if(i.format==="ends_with")return`Неважечка низа: мора да завршува со "${i.suffix}"`;if(i.format==="includes")return`Неважечка низа: мора да вклучува "${i.includes}"`;if(i.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${x(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function If(){return{localeError:YR()}}var QR=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input tidak sah: dijangka ${R(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${o[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${x(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function Tf(){return{localeError:QR()}}var eC=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(n)=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ongeldige invoer: verwacht ${R(n.values[0])}`;return`Ongeldige optie: verwacht één van ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Te lang: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${s.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Te kort: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${s.unit} bevat`;return`Te kort: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function Pf(){return{localeError:eC()}}var tC=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ugyldig verdi: forventet ${R(n.values[0])}`;return`Ugyldig valg: forventet en av ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: må starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: må ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: må inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: må matche mønsteret ${i.pattern}`;return`Ugyldig ${o[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${x(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function Ef(){return{localeError:tC()}}var rC=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"giren",email:"epostagâh",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 hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(n)=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Fâsit giren: umulan ${R(n.values[0])}`;return`Fâsit tercih: mûteberler ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${s.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmalıydı.`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} ${s.unit} sahip olmalıydı.`;return`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Fâsit metin: "${i.prefix}" ile başlamalı.`;if(i.format==="ends_with")return`Fâsit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`Fâsit metin: "${i.includes}" ihtivâ etmeli.`;if(i.format==="regex")return`Fâsit metin: ${i.pattern} nakşına uymalı.`;return`Fâsit ${o[i.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${x(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Rf(){return{localeError:rC()}}var nC=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(n)=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":if(n.values.length===1)return`ناسم ورودي: باید ${R(n.values[0])} وای`;return`ناسم انتخاب: باید یو له ${x(n.values,"|")} څخه وای`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} ${s.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} وي`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} ${s.unit} ولري`;return`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} وي`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`ناسم متن: باید د "${i.prefix}" سره پیل شي`;if(i.format==="ends_with")return`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`;if(i.format==="includes")return`ناسم متن: باید "${i.includes}" ولري`;if(i.format==="regex")return`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`;return`${o[i.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${x(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function Cf(){return{localeError:nC()}}var oC=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"wyrażenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(n)=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${R(n.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.maximum.toString()} ${s.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.minimum.toString()} ${s.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`;if(i.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`;if(i.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`;return`Nieprawidłow(y/a/e) ${o[i.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Of(){return{localeError:oC()}}var iC=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"padrão",email:"endereço de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrada inválida: esperado ${R(n.values[0])}`;return`Opção inválida: esperada uma das ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Texto inválido: deve começar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inválido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inválido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inválido: deve corresponder ao padrão ${i.pattern}`;return`${o[i.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function Af(){return{localeError:iC()}}function Ub(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}var sC=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(n)=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Неверный ввод: ожидалось ${R(n.values[0])}`;return`Неверный вариант: ожидалось одно из ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=Ub(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${i}${n.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=Ub(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${i}${n.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неверная строка: должна начинаться с "${i.prefix}"`;if(i.format==="ends_with")return`Неверная строка: должна заканчиваться на "${i.suffix}"`;if(i.format==="includes")return`Неверная строка: должна содержать "${i.includes}"`;if(i.format==="regex")return`Неверная строка: должна соответствовать шаблону ${i.pattern}`;return`Неверный ${o[i.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function Mf(){return{localeError:sC()}}var aC=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"vnos",email:"e-poštni naslov",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 datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(n)=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Neveljaven vnos: pričakovano ${R(n.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Premajhno: pričakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${s.unit}`;return`Premajhno: pričakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neveljaven niz: mora se začeti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se končati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${o[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${x(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function zf(){return{localeError:aC()}}var cC=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"reguljärt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(n)=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ogiltig inmatning: förväntat ${R(n.values[0])}`;return`Ogiltigt val: förväntade en av ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`För stor(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`För stor(t): förväntat ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()} ${s.unit}`;return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ogiltig sträng: måste börja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig sträng: måste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig sträng: måste innehålla "${i.includes}"`;if(i.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`;return`Ogiltig(t) ${o[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${x(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function Nf(){return{localeError:cC()}}var uC=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",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 தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${R(n.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${x(n.values,"|")} இல் ஒன்று`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ${s.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`;if(i.format==="ends_with")return`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`;if(i.format==="includes")return`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`;if(i.format==="regex")return`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${o[i.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${x(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Df(){return{localeError:uC()}}var lC=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(n)=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${R(n.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"ไม่เกิน":"น้อยกว่า",s=t(n.origin);if(s)return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()} ${s.unit??"รายการ"}`;return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"อย่างน้อย":"มากกว่า",s=t(n.origin);if(s)return`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()} ${s.unit}`;return`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`;if(i.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`;if(i.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`;if(i.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`;return`รูปแบบไม่ถูกต้อง: ${o[i.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${x(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function jf(){return{localeError:lC()}}var dC=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},pC=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(o){return e[o]??null}let r={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(o)=>{switch(o.code){case"invalid_type":return`Geçersiz değer: beklenen ${o.expected}, alınan ${dC(o.input)}`;case"invalid_value":if(o.values.length===1)return`Geçersiz değer: beklenen ${R(o.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${x(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()} ${i.unit??"öğe"}`;return`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()} ${i.unit}`;return`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Geçersiz metin: "${n.prefix}" ile başlamalı`;if(n.format==="ends_with")return`Geçersiz metin: "${n.suffix}" ile bitmeli`;if(n.format==="includes")return`Geçersiz metin: "${n.includes}" içermeli`;if(n.format==="regex")return`Geçersiz metin: ${n.pattern} desenine uymalı`;return`Geçersiz ${r[n.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${x(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Uf(){return{localeError:pC()}}var mC=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(n)=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Неправильні вхідні дані: очікується ${R(n.values[0])}`;return`Неправильна опція: очікується одне з ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Занадто велике: очікується, що ${n.origin??"значення"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"елементів"}`;return`Занадто велике: очікується, що ${n.origin??"значення"} буде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Занадто мале: очікується, що ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Занадто мале: очікується, що ${n.origin} буде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неправильний рядок: повинен починатися з "${i.prefix}"`;if(i.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`;if(i.format==="includes")return`Неправильний рядок: повинен містити "${i.includes}"`;if(i.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`;return`Неправильний ${o[i.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${x(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function Ff(){return{localeError:mC()}}var fC=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(n)=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":if(n.values.length===1)return`غلط ان پٹ: ${R(n.values[0])} متوقع تھا`;return`غلط آپشن: ${x(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`بہت بڑا: ${n.origin??"ویلیو"} کے ${i}${n.maximum.toString()} ${s.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${n.origin??"ویلیو"} کا ${i}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`بہت چھوٹا: ${n.origin} کے ${i}${n.minimum.toString()} ${s.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${n.origin} کا ${i}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`;if(i.format==="ends_with")return`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`;if(i.format==="includes")return`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`;if(i.format==="regex")return`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`;return`غلط ${o[i.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${x(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Lf(){return{localeError:fC()}}var hC=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"đầu vào",email:"địa chỉ email",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:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(n)=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${R(n.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"phần tử"}`;return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Quá nhỏ: mong đợi ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Quá nhỏ: mong đợi ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`;if(i.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`;if(i.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`;if(i.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`;return`${o[i.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${x(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function qf(){return{localeError:hC()}}var gC=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(n)=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`无效输入:期望 ${R(n.values[0])}`;return`无效选项:期望以下之一 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()} ${s.unit??"个元素"}`;return`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`无效字符串:必须以 "${i.prefix}" 开头`;if(i.format==="ends_with")return`无效字符串:必须以 "${i.suffix}" 结尾`;if(i.format==="includes")return`无效字符串:必须包含 "${i.includes}"`;if(i.format==="regex")return`无效字符串:必须满足正则表达式 ${i.pattern}`;return`无效${o[i.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${x(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function Zf(){return{localeError:gC()}}var yC=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"輸入",email:"郵件地址",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 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(n)=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`無效的輸入值:預期為 ${R(n.values[0])}`;return`無效的選項:預期為以下其中之一 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()} ${s.unit??"個元素"}`;return`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()} ${s.unit}`;return`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`無效的字串:必須以 "${i.prefix}" 開頭`;if(i.format==="ends_with")return`無效的字串:必須以 "${i.suffix}" 結尾`;if(i.format==="includes")return`無效的字串:必須包含 "${i.includes}"`;if(i.format==="regex")return`無效的字串:必須符合格式 ${i.pattern}`;return`無效的 ${o[i.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${x(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function Hf(){return{localeError:yC()}}var zu=Symbol("ZodOutput"),Nu=Symbol("ZodInput");class es{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function ts(){return new es}var et=ts();function Du(e,t){return new e({type:"string",...$(t)})}function Bf(e,t){return new e({type:"string",coerce:!0,...$(t)})}function rs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function ao(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function ns(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function os(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function is(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function ss(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function as(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function cs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function us(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function ls(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function ds(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function ps(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function ms(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function fs(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function hs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function gs(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function ys(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function _s(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function vs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function bs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function Ss(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function xs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}var ju={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Kf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function Vf(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function Wf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function Gf(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function Uu(e,t){return new e({type:"number",checks:[],...$(t)})}function Jf(e,t){return new e({type:"number",coerce:!0,checks:[],...$(t)})}function Fu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function Lu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...$(t)})}function qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...$(t)})}function Zu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...$(t)})}function Hu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...$(t)})}function Bu(e,t){return new e({type:"boolean",...$(t)})}function Xf(e,t){return new e({type:"boolean",coerce:!0,...$(t)})}function Ku(e,t){return new e({type:"bigint",...$(t)})}function Yf(e,t){return new e({type:"bigint",coerce:!0,...$(t)})}function Vu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...$(t)})}function Wu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...$(t)})}function Gu(e,t){return new e({type:"symbol",...$(t)})}function Ju(e,t){return new e({type:"undefined",...$(t)})}function Xu(e,t){return new e({type:"null",...$(t)})}function Yu(e){return new e({type:"any"})}function fn(e){return new e({type:"unknown"})}function Qu(e,t){return new e({type:"never",...$(t)})}function el(e,t){return new e({type:"void",...$(t)})}function tl(e,t){return new e({type:"date",...$(t)})}function Qf(e,t){return new e({type:"date",coerce:!0,...$(t)})}function rl(e,t){return new e({type:"nan",...$(t)})}function tr(e,t){return new Mc({check:"less_than",...$(t),value:e,inclusive:!1})}function vt(e,t){return new Mc({check:"less_than",...$(t),value:e,inclusive:!0})}function rr(e,t){return new zc({check:"greater_than",...$(t),value:e,inclusive:!1})}function tt(e,t){return new zc({check:"greater_than",...$(t),value:e,inclusive:!0})}function eh(e){return rr(0,e)}function th(e){return tr(0,e)}function rh(e){return vt(0,e)}function nh(e){return tt(0,e)}function hn(e,t){return new zm({check:"multiple_of",...$(t),value:e})}function co(e,t){return new jm({check:"max_size",...$(t),maximum:e})}function gn(e,t){return new Um({check:"min_size",...$(t),minimum:e})}function ks(e,t){return new Fm({check:"size_equals",...$(t),size:e})}function uo(e,t){return new Lm({check:"max_length",...$(t),maximum:e})}function Rr(e,t){return new qm({check:"min_length",...$(t),minimum:e})}function lo(e,t){return new Zm({check:"length_equals",...$(t),length:e})}function ws(e,t){return new Hm({check:"string_format",format:"regex",...$(t),pattern:e})}function $s(e){return new Bm({check:"string_format",format:"lowercase",...$(e)})}function Is(e){return new Km({check:"string_format",format:"uppercase",...$(e)})}function Ts(e,t){return new Vm({check:"string_format",format:"includes",...$(t),includes:e})}function Ps(e,t){return new Wm({check:"string_format",format:"starts_with",...$(t),prefix:e})}function Es(e,t){return new Gm({check:"string_format",format:"ends_with",...$(t),suffix:e})}function oh(e,t,r){return new Jm({check:"property",property:e,schema:t,...$(r)})}function Rs(e,t){return new Xm({check:"mime_type",mime:e,...$(t)})}function nr(e){return new Ym({check:"overwrite",tx:e})}function Cs(e){return nr((t)=>t.normalize(e))}function Os(){return nr((e)=>e.trim())}function As(){return nr((e)=>e.toLowerCase())}function Ms(){return nr((e)=>e.toUpperCase())}function zs(e,t,r){return new e({type:"array",element:t,...$(r)})}function _C(e,t,r){return new e({type:"union",options:t,...$(r)})}function vC(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...$(o)})}function bC(e,t,r){return new e({type:"intersection",left:t,right:r})}function ih(e,t,r,o){let n=r instanceof K;return new e({type:"tuple",items:t,rest:n?r:null,...$(n?o:r)})}function SC(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...$(o)})}function xC(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...$(o)})}function kC(e,t,r){return new e({type:"set",valueType:t,...$(r)})}function wC(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map((n)=>[n,n])):t;return new e({type:"enum",entries:o,...$(r)})}function $C(e,t,r){return new e({type:"enum",entries:t,...$(r)})}function IC(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...$(r)})}function nl(e,t){return new e({type:"file",...$(t)})}function TC(e,t){return new e({type:"transform",transform:t})}function PC(e,t){return new e({type:"optional",innerType:t})}function EC(e,t){return new e({type:"nullable",innerType:t})}function RC(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r==="function"?r():r}})}function CC(e,t,r){return new e({type:"nonoptional",innerType:t,...$(r)})}function OC(e,t){return new e({type:"success",innerType:t})}function AC(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r==="function"?r:()=>r})}function MC(e,t,r){return new e({type:"pipe",in:t,out:r})}function zC(e,t){return new e({type:"readonly",innerType:t})}function NC(e,t,r){return new e({type:"template_literal",parts:t,...$(r)})}function DC(e,t){return new e({type:"lazy",getter:t})}function jC(e,t){return new e({type:"promise",innerType:t})}function ol(e,t,r){let o=$(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function il(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}function sl(e,t){let r=$(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((f)=>typeof f==="string"?f.toLowerCase():f),n=n.map((f)=>typeof f==="string"?f.toLowerCase():f);let i=new Set(o),s=new Set(n),a=e.Pipe??io,c=e.Boolean??ro,u=e.String??Pr,d=new(e.Transform??oo)({type:"transform",transform:(f,h)=>{let v=f;if(r.case!=="sensitive")v=v.toLowerCase();if(i.has(v))return!0;else if(s.has(v))return!1;else return h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:h.value,inst:d}),{}},error:r.error}),m=new a({type:"pipe",in:new u({type:"string",error:r.error}),out:d,error:r.error});return new a({type:"pipe",in:m,out:new c({type:"boolean",error:r.error}),error:r.error})}function al(e,t,r,o={}){let n=$(o),i={...$(o),check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(a)=>r.test(a),...n};if(r instanceof RegExp)i.pattern=r;return new e(i)}class sh{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!=="function")throw Error("implement() must be called with a function");let t=(...r)=>{let o=this._def.input?ln(this._def.input,r,void 0,{callee:t}):r;if(!Array.isArray(o))throw Error("Invalid arguments schema: not an array or tuple schema.");let n=e(...o);return this._def.output?ln(this._def.output,n,void 0,{callee:t}):n};return t}implementAsync(e){if(typeof e!=="function")throw Error("implement() must be called with a function");let t=async(...r)=>{let o=this._def.input?await dn(this._def.input,r,void 0,{callee:t}):r;if(!Array.isArray(o))throw Error("Invalid arguments schema: not an array or tuple schema.");let n=await e(...o);return this._def.output?dn(this._def.output,n,void 0,{callee:t}):n};return t}input(...e){let t=this.constructor;if(Array.isArray(e[0]))return new t({type:"function",input:new Er({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output});return new t({type:"function",input:e[0],output:this._def.output})}output(e){return new this.constructor({type:"function",input:this._def.input,output:e})}}function cl(e){return new sh({type:"function",input:Array.isArray(e?.input)?ih(Er,e?.input):e?.input??zs(no,fn(mn)),output:e?.output??fn(mn)})}class ul{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??et,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var r;let o=e._zod.def,n={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...t,schemaPath:[...t.schemaPath,e],path:t.path},d=e._zod.parent;if(d)s.ref=d,this.process(d,l),this.seen.get(d).isParent=!0;else{let m=s.schema;switch(o.type){case"string":{let p=m;p.type="string";let{minimum:f,maximum:h,format:v,patterns:b,contentEncoding:I}=e._zod.bag;if(typeof f==="number")p.minLength=f;if(typeof h==="number")p.maxLength=h;if(v){if(p.format=n[v]??v,p.format==="")delete p.format}if(I)p.contentEncoding=I;if(b&&b.size>0){let C=[...b];if(C.length===1)p.pattern=C[0].source;else if(C.length>1)s.schema.allOf=[...C.map((q)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:q.source}))]}break}case"number":{let p=m,{minimum:f,maximum:h,format:v,multipleOf:b,exclusiveMaximum:I,exclusiveMinimum:C}=e._zod.bag;if(typeof v==="string"&&v.includes("int"))p.type="integer";else p.type="number";if(typeof C==="number")p.exclusiveMinimum=C;if(typeof f==="number"){if(p.minimum=f,typeof C==="number")if(C>=f)delete p.minimum;else delete p.exclusiveMinimum}if(typeof I==="number")p.exclusiveMaximum=I;if(typeof h==="number"){if(p.maximum=h,typeof I==="number")if(I<=h)delete p.maximum;else delete p.exclusiveMaximum}if(typeof b==="number")p.multipleOf=b;break}case"boolean":{let p=m;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{m.type="null";break}case"any":break;case"unknown":break;case"undefined":case"never":{m.not={};break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let p=m,{minimum:f,maximum:h}=e._zod.bag;if(typeof f==="number")p.minItems=f;if(typeof h==="number")p.maxItems=h;p.type="array",p.items=this.process(o.element,{...l,path:[...l.path,"items"]});break}case"object":{let p=m;p.type="object",p.properties={};let f=o.shape;for(let b in f)p.properties[b]=this.process(f[b],{...l,path:[...l.path,"properties",b]});let h=new Set(Object.keys(f)),v=new Set([...h].filter((b)=>{let I=o.shape[b]._zod;if(this.io==="input")return I.optin===void 0;else return I.optout===void 0}));if(v.size>0)p.required=Array.from(v);if(o.catchall?._zod.def.type==="never")p.additionalProperties=!1;else if(!o.catchall){if(this.io==="output")p.additionalProperties=!1}else if(o.catchall)p.additionalProperties=this.process(o.catchall,{...l,path:[...l.path,"additionalProperties"]});break}case"union":{let p=m;p.anyOf=o.options.map((f,h)=>this.process(f,{...l,path:[...l.path,"anyOf",h]}));break}case"intersection":{let p=m,f=this.process(o.left,{...l,path:[...l.path,"allOf",0]}),h=this.process(o.right,{...l,path:[...l.path,"allOf",1]}),v=(I)=>("allOf"in I)&&Object.keys(I).length===1,b=[...v(f)?f.allOf:[f],...v(h)?h.allOf:[h]];p.allOf=b;break}case"tuple":{let p=m;p.type="array";let f=o.items.map((b,I)=>this.process(b,{...l,path:[...l.path,"prefixItems",I]}));if(this.target==="draft-2020-12")p.prefixItems=f;else p.items=f;if(o.rest){let b=this.process(o.rest,{...l,path:[...l.path,"items"]});if(this.target==="draft-2020-12")p.items=b;else p.additionalItems=b}if(o.rest)p.items=this.process(o.rest,{...l,path:[...l.path,"items"]});let{minimum:h,maximum:v}=e._zod.bag;if(typeof h==="number")p.minItems=h;if(typeof v==="number")p.maxItems=v;break}case"record":{let p=m;p.type="object",p.propertyNames=this.process(o.keyType,{...l,path:[...l.path,"propertyNames"]}),p.additionalProperties=this.process(o.valueType,{...l,path:[...l.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let p=m,f=qi(o.entries);if(f.every((h)=>typeof h==="number"))p.type="number";if(f.every((h)=>typeof h==="string"))p.type="string";p.enum=f;break}case"literal":{let p=m,f=[];for(let h of o.values)if(h===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof h==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else f.push(Number(h));else f.push(h);if(f.length===0);else if(f.length===1){let h=f[0];p.type=h===null?"null":typeof h,p.const=h}else{if(f.every((h)=>typeof h==="number"))p.type="number";if(f.every((h)=>typeof h==="string"))p.type="string";if(f.every((h)=>typeof h==="boolean"))p.type="string";if(f.every((h)=>h===null))p.type="null";p.enum=f}break}case"file":{let p=m,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:h,maximum:v,mime:b}=e._zod.bag;if(h!==void 0)f.minLength=h;if(v!==void 0)f.maxLength=v;if(b)if(b.length===1)f.contentMediaType=b[0],Object.assign(p,f);else p.anyOf=b.map((I)=>({...f,contentMediaType:I}));else Object.assign(p,f);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let p=this.process(o.innerType,l);m.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,l),s.ref=o.innerType;break}case"success":{let p=m;p.type="boolean";break}case"default":{this.process(o.innerType,l),s.ref=o.innerType,m.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{if(this.process(o.innerType,l),s.ref=o.innerType,this.io==="input")m._prefault=JSON.parse(JSON.stringify(o.defaultValue));break}case"catch":{this.process(o.innerType,l),s.ref=o.innerType;let p;try{p=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}m.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let p=m,f=e._zod.pattern;if(!f)throw Error("Pattern not found in template literal");p.type="string",p.pattern=f.source;break}case"pipe":{let p=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(p,l),s.ref=p;break}case"readonly":{this.process(o.innerType,l),s.ref=o.innerType,m.readOnly=!0;break}case"promise":{this.process(o.innerType,l),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,l),s.ref=o.innerType;break}case"lazy":{let p=e._zod.innerType;this.process(p,l),s.ref=p;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let c=this.metadataRegistry.get(e);if(c)Object.assign(s.schema,c);if(this.io==="input"&&Me(e))delete s.schema.examples,delete s.schema.default;if(this.io==="input"&&s.schema._prefault)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,this.seen.get(e).schema}emit(e,t){let r={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},o=this.seen.get(e);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(u)=>{let l=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let f=r.external.registry.get(u[0])?.id;if(f)return{ref:r.external.uri(f)};let h=u[1].defId??u[1].schema.id??`schema${this.counter++}`;return u[1].defId=h,{defId:h,ref:`${r.external.uri("__shared")}#/${l}/${h}`}}if(u[1]===o)return{ref:"#"};let m=`${"#"}/${l}/`,p=u[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:m+p}},i=(u)=>{if(u[1].schema.$ref)return;let l=u[1],{ref:d,defId:m}=n(u);if(l.def={...l.schema},m)l.defId=m;let p=l.schema;for(let f in p)delete p[f];p.$ref=d};for(let u of this.seen.entries()){let l=u[1];if(e===u[0]){i(u);continue}if(r.external){let m=r.external.registry.get(u[0])?.id;if(e!==u[0]&&m){i(u);continue}}if(this.metadataRegistry.get(u[0])?.id){i(u);continue}if(l.cycle){if(r.cycles==="throw")throw Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
92
+
93
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(r.cycles==="ref")i(u);continue}if(l.count>1){if(r.reused==="ref"){i(u);continue}}}let s=(u,l)=>{let d=this.seen.get(u),m=d.def??d.schema,p={...m};if(d.ref===null)return;let f=d.ref;if(d.ref=null,f){s(f,l);let h=this.seen.get(f).schema;if(h.$ref&&l.target==="draft-7")m.allOf=m.allOf??[],m.allOf.push(h);else Object.assign(m,h),Object.assign(m,p)}if(!d.isParent)this.override({zodSchema:u,jsonSchema:m,path:d.path??[]})};for(let u of[...this.seen.entries()].reverse())s(u[0],{target:this.target});let a={};if(this.target==="draft-2020-12")a.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")a.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);Object.assign(a,o.def);let c=r.external?.defs??{};for(let u of this.seen.entries()){let l=u[1];if(l.def&&l.defId)c[l.defId]=l.def}if(!r.external&&Object.keys(c).length>0)if(this.target==="draft-2020-12")a.$defs=c;else a.definitions=c;try{return JSON.parse(JSON.stringify(a))}catch(u){throw Error("Error converting schema to JSON.")}}}function po(e,t){if(e instanceof es){let o=new ul(t),n={};for(let a of e._idmap.entries()){let[c,u]=a;o.process(u)}let i={},s={registry:e,uri:t?.uri||((a)=>a),defs:n};for(let a of e._idmap.entries()){let[c,u]=a;i[c]=o.emit(u,{...t,external:s})}if(Object.keys(n).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:n}}return{schemas:i}}let r=new ul(t);return r.process(e),r.emit(e,t)}function Me(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;switch(n.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Me(n.element,r);case"object":{for(let i in n.shape)if(Me(n.shape[i],r))return!0;return!1}case"union":{for(let i of n.options)if(Me(i,r))return!0;return!1}case"intersection":return Me(n.left,r)||Me(n.right,r);case"tuple":{for(let i of n.items)if(Me(i,r))return!0;if(n.rest&&Me(n.rest,r))return!0;return!1}case"record":return Me(n.keyType,r)||Me(n.valueType,r);case"map":return Me(n.keyType,r)||Me(n.valueType,r);case"set":return Me(n.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Me(n.innerType,r);case"lazy":return Me(n.getter(),r);case"default":return Me(n.innerType,r);case"prefault":return Me(n.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Me(n.in,r)||Me(n.out,r);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${n.type}`)}var Fb={};var mo={};fr(mo,{time:()=>uh,duration:()=>lh,datetime:()=>ah,date:()=>ch,ZodISOTime:()=>pl,ZodISODuration:()=>ml,ZodISODateTime:()=>ll,ZodISODate:()=>dl});var ll=g("ZodISODateTime",(e,t)=>{tf.init(e,t),ge.init(e,t)});function ah(e){return Kf(ll,e)}var dl=g("ZodISODate",(e,t)=>{rf.init(e,t),ge.init(e,t)});function ch(e){return Vf(dl,e)}var pl=g("ZodISOTime",(e,t)=>{nf.init(e,t),ge.init(e,t)});function uh(e){return Wf(pl,e)}var ml=g("ZodISODuration",(e,t)=>{of.init(e,t),ge.init(e,t)});function lh(e){return Gf(ml,e)}var qb=(e,t)=>{Wi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>eo(e,r)},flatten:{value:(r)=>Qn(e,r)},addIssue:{value:(r)=>e.issues.push(r)},addIssues:{value:(r)=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},FC=g("ZodError",qb),fo=g("ZodError",qb,{Parent:Error});var dh=Ec(fo),ph=Rc(fo),mh=Cc(fo),fh=Oc(fo);var Q=g("ZodType",(e,t)=>(K.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(r,o)=>qe(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.parse=(r,o)=>dh(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>mh(e,r,o),e.parseAsync=async(r,o)=>ph(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>fh(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(xS(r,o)),e.superRefine=(r)=>e.check(kS(r)),e.overwrite=(r)=>e.check(nr(r)),e.optional=()=>ye(e),e.nullable=()=>hl(e),e.nullish=()=>ye(hl(e)),e.nonoptional=(r)=>lS(e,r),e.array=()=>te(e),e.or=(r)=>me([e,r]),e.and=(r)=>Ls(e,r),e.transform=(r)=>gl(e,jh(r)),e.default=(r)=>aS(e,r),e.prefault=(r)=>uS(e,r),e.catch=(r)=>mS(e,r),e.pipe=(r)=>gl(e,r),e.readonly=()=>gS(e),e.describe=(r)=>{let o=e.clone();return et.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return et.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return et.get(e);let o=e.clone();return et.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),gh=g("_ZodString",(e,t)=>{Pr.init(e,t),Q.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(ws(...o)),e.includes=(...o)=>e.check(Ts(...o)),e.startsWith=(...o)=>e.check(Ps(...o)),e.endsWith=(...o)=>e.check(Es(...o)),e.min=(...o)=>e.check(Rr(...o)),e.max=(...o)=>e.check(uo(...o)),e.length=(...o)=>e.check(lo(...o)),e.nonempty=(...o)=>e.check(Rr(1,...o)),e.lowercase=(o)=>e.check($s(o)),e.uppercase=(o)=>e.check(Is(o)),e.trim=()=>e.check(Os()),e.normalize=(...o)=>e.check(Cs(...o)),e.toLowerCase=()=>e.check(As()),e.toUpperCase=()=>e.check(Ms())}),Ds=g("ZodString",(e,t)=>{Pr.init(e,t),gh.init(e,t),e.email=(r)=>e.check(rs(yh,r)),e.url=(r)=>e.check(as(_h,r)),e.jwt=(r)=>e.check(xs(Ah,r)),e.emoji=(r)=>e.check(cs(vh,r)),e.guid=(r)=>e.check(ao(fl,r)),e.uuid=(r)=>e.check(ns(or,r)),e.uuidv4=(r)=>e.check(os(or,r)),e.uuidv6=(r)=>e.check(is(or,r)),e.uuidv7=(r)=>e.check(ss(or,r)),e.nanoid=(r)=>e.check(us(bh,r)),e.guid=(r)=>e.check(ao(fl,r)),e.cuid=(r)=>e.check(ls(Sh,r)),e.cuid2=(r)=>e.check(ds(xh,r)),e.ulid=(r)=>e.check(ps(kh,r)),e.base64=(r)=>e.check(vs(Rh,r)),e.base64url=(r)=>e.check(bs(Ch,r)),e.xid=(r)=>e.check(ms(wh,r)),e.ksuid=(r)=>e.check(fs($h,r)),e.ipv4=(r)=>e.check(hs(Ih,r)),e.ipv6=(r)=>e.check(gs(Th,r)),e.cidrv4=(r)=>e.check(ys(Ph,r)),e.cidrv6=(r)=>e.check(_s(Eh,r)),e.e164=(r)=>e.check(Ss(Oh,r)),e.datetime=(r)=>e.check(ah(r)),e.date=(r)=>e.check(ch(r)),e.time=(r)=>e.check(uh(r)),e.duration=(r)=>e.check(lh(r))});function _(e){return Du(Ds,e)}var ge=g("ZodStringFormat",(e,t)=>{pe.init(e,t),gh.init(e,t)}),yh=g("ZodEmail",(e,t)=>{Lc.init(e,t),ge.init(e,t)});function qC(e){return rs(yh,e)}var fl=g("ZodGUID",(e,t)=>{Uc.init(e,t),ge.init(e,t)});function ZC(e){return ao(fl,e)}var or=g("ZodUUID",(e,t)=>{Fc.init(e,t),ge.init(e,t)});function HC(e){return ns(or,e)}function BC(e){return os(or,e)}function KC(e){return is(or,e)}function VC(e){return ss(or,e)}var _h=g("ZodURL",(e,t)=>{qc.init(e,t),ge.init(e,t)});function WC(e){return as(_h,e)}var vh=g("ZodEmoji",(e,t)=>{Zc.init(e,t),ge.init(e,t)});function GC(e){return cs(vh,e)}var bh=g("ZodNanoID",(e,t)=>{Hc.init(e,t),ge.init(e,t)});function JC(e){return us(bh,e)}var Sh=g("ZodCUID",(e,t)=>{Bc.init(e,t),ge.init(e,t)});function XC(e){return ls(Sh,e)}var xh=g("ZodCUID2",(e,t)=>{Kc.init(e,t),ge.init(e,t)});function YC(e){return ds(xh,e)}var kh=g("ZodULID",(e,t)=>{Vc.init(e,t),ge.init(e,t)});function QC(e){return ps(kh,e)}var wh=g("ZodXID",(e,t)=>{Wc.init(e,t),ge.init(e,t)});function eO(e){return ms(wh,e)}var $h=g("ZodKSUID",(e,t)=>{Gc.init(e,t),ge.init(e,t)});function tO(e){return fs($h,e)}var Ih=g("ZodIPv4",(e,t)=>{Jc.init(e,t),ge.init(e,t)});function rO(e){return hs(Ih,e)}var Th=g("ZodIPv6",(e,t)=>{Xc.init(e,t),ge.init(e,t)});function nO(e){return gs(Th,e)}var Ph=g("ZodCIDRv4",(e,t)=>{Yc.init(e,t),ge.init(e,t)});function oO(e){return ys(Ph,e)}var Eh=g("ZodCIDRv6",(e,t)=>{Qc.init(e,t),ge.init(e,t)});function iO(e){return _s(Eh,e)}var Rh=g("ZodBase64",(e,t)=>{eu.init(e,t),ge.init(e,t)});function sO(e){return vs(Rh,e)}var Ch=g("ZodBase64URL",(e,t)=>{tu.init(e,t),ge.init(e,t)});function aO(e){return bs(Ch,e)}var Oh=g("ZodE164",(e,t)=>{ru.init(e,t),ge.init(e,t)});function cO(e){return Ss(Oh,e)}var Ah=g("ZodJWT",(e,t)=>{nu.init(e,t),ge.init(e,t)});function uO(e){return xs(Ah,e)}var Zb=g("ZodCustomStringFormat",(e,t)=>{ou.init(e,t),ge.init(e,t)});function lO(e,t,r={}){return al(Zb,e,t,r)}var js=g("ZodNumber",(e,t)=>{Gi.init(e,t),Q.init(e,t),e.gt=(o,n)=>e.check(rr(o,n)),e.gte=(o,n)=>e.check(tt(o,n)),e.min=(o,n)=>e.check(tt(o,n)),e.lt=(o,n)=>e.check(tr(o,n)),e.lte=(o,n)=>e.check(vt(o,n)),e.max=(o,n)=>e.check(vt(o,n)),e.int=(o)=>e.check(hh(o)),e.safe=(o)=>e.check(hh(o)),e.positive=(o)=>e.check(rr(0,o)),e.nonnegative=(o)=>e.check(tt(0,o)),e.negative=(o)=>e.check(tr(0,o)),e.nonpositive=(o)=>e.check(vt(0,o)),e.multipleOf=(o,n)=>e.check(hn(o,n)),e.step=(o,n)=>e.check(hn(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function ae(e){return Uu(js,e)}var ho=g("ZodNumberFormat",(e,t)=>{iu.init(e,t),js.init(e,t)});function hh(e){return Fu(ho,e)}function dO(e){return Lu(ho,e)}function pO(e){return qu(ho,e)}function mO(e){return Zu(ho,e)}function fO(e){return Hu(ho,e)}var Us=g("ZodBoolean",(e,t)=>{ro.init(e,t),Q.init(e,t)});function Ce(e){return Bu(Us,e)}var Fs=g("ZodBigInt",(e,t)=>{Ji.init(e,t),Q.init(e,t),e.gte=(o,n)=>e.check(tt(o,n)),e.min=(o,n)=>e.check(tt(o,n)),e.gt=(o,n)=>e.check(rr(o,n)),e.gte=(o,n)=>e.check(tt(o,n)),e.min=(o,n)=>e.check(tt(o,n)),e.lt=(o,n)=>e.check(tr(o,n)),e.lte=(o,n)=>e.check(vt(o,n)),e.max=(o,n)=>e.check(vt(o,n)),e.positive=(o)=>e.check(rr(BigInt(0),o)),e.negative=(o)=>e.check(tr(BigInt(0),o)),e.nonpositive=(o)=>e.check(vt(BigInt(0),o)),e.nonnegative=(o)=>e.check(tt(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(hn(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function hO(e){return Ku(Fs,e)}var Mh=g("ZodBigIntFormat",(e,t)=>{su.init(e,t),Fs.init(e,t)});function gO(e){return Vu(Mh,e)}function yO(e){return Wu(Mh,e)}var Hb=g("ZodSymbol",(e,t)=>{au.init(e,t),Q.init(e,t)});function _O(e){return Gu(Hb,e)}var Bb=g("ZodUndefined",(e,t)=>{cu.init(e,t),Q.init(e,t)});function vO(e){return Ju(Bb,e)}var Kb=g("ZodNull",(e,t)=>{uu.init(e,t),Q.init(e,t)});function yl(e){return Xu(Kb,e)}var Vb=g("ZodAny",(e,t)=>{lu.init(e,t),Q.init(e,t)});function bO(){return Yu(Vb)}var Wb=g("ZodUnknown",(e,t)=>{mn.init(e,t),Q.init(e,t)});function _e(){return fn(Wb)}var Gb=g("ZodNever",(e,t)=>{du.init(e,t),Q.init(e,t)});function _l(e){return Qu(Gb,e)}var Jb=g("ZodVoid",(e,t)=>{pu.init(e,t),Q.init(e,t)});function SO(e){return el(Jb,e)}var vl=g("ZodDate",(e,t)=>{mu.init(e,t),Q.init(e,t),e.min=(o,n)=>e.check(tt(o,n)),e.max=(o,n)=>e.check(vt(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function xO(e){return tl(vl,e)}var Xb=g("ZodArray",(e,t)=>{no.init(e,t),Q.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(Rr(r,o)),e.nonempty=(r)=>e.check(Rr(1,r)),e.max=(r,o)=>e.check(uo(r,o)),e.length=(r,o)=>e.check(lo(r,o)),e.unwrap=()=>e.element});function te(e,t){return zs(Xb,e,t)}function kO(e){let t=e._zod.def.shape;return j(Object.keys(t))}var bl=g("ZodObject",(e,t)=>{Xi.init(e,t),Q.init(e,t),T.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Ke(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:_e()}),e.loose=()=>e.clone({...e._zod.def,catchall:_e()}),e.strict=()=>e.clone({...e._zod.def,catchall:_l()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>T.extend(e,r),e.merge=(r)=>T.merge(e,r),e.pick=(r)=>T.pick(e,r),e.omit=(r)=>T.omit(e,r),e.partial=(...r)=>T.partial(Uh,e,r[0]),e.required=(...r)=>T.required(Fh,e,r[0])});function N(e,t){let r={type:"object",get shape(){return T.assignProp(this,"shape",{...e}),this.shape},...T.normalizeParams(t)};return new bl(r)}function wO(e,t){return new bl({type:"object",get shape(){return T.assignProp(this,"shape",{...e}),this.shape},catchall:_l(),...T.normalizeParams(t)})}function Ze(e,t){return new bl({type:"object",get shape(){return T.assignProp(this,"shape",{...e}),this.shape},catchall:_e(),...T.normalizeParams(t)})}var zh=g("ZodUnion",(e,t)=>{Yi.init(e,t),Q.init(e,t),e.options=t.options});function me(e,t){return new zh({type:"union",options:e,...T.normalizeParams(t)})}var Yb=g("ZodDiscriminatedUnion",(e,t)=>{zh.init(e,t),fu.init(e,t)});function Sl(e,t,r){return new Yb({type:"union",options:t,discriminator:e,...T.normalizeParams(r)})}var Qb=g("ZodIntersection",(e,t)=>{hu.init(e,t),Q.init(e,t)});function Ls(e,t){return new Qb({type:"intersection",left:e,right:t})}var eS=g("ZodTuple",(e,t)=>{Er.init(e,t),Q.init(e,t),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});function $O(e,t,r){let o=t instanceof K,n=o?r:t;return new eS({type:"tuple",items:e,rest:o?t:null,...T.normalizeParams(n)})}var Nh=g("ZodRecord",(e,t)=>{gu.init(e,t),Q.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function fe(e,t,r){return new Nh({type:"record",keyType:e,valueType:t,...T.normalizeParams(r)})}function IO(e,t,r){return new Nh({type:"record",keyType:me([e,_l()]),valueType:t,...T.normalizeParams(r)})}var tS=g("ZodMap",(e,t)=>{yu.init(e,t),Q.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function TO(e,t,r){return new tS({type:"map",keyType:e,valueType:t,...T.normalizeParams(r)})}var rS=g("ZodSet",(e,t)=>{_u.init(e,t),Q.init(e,t),e.min=(...r)=>e.check(gn(...r)),e.nonempty=(r)=>e.check(gn(1,r)),e.max=(...r)=>e.check(co(...r)),e.size=(...r)=>e.check(ks(...r))});function PO(e,t){return new rS({type:"set",valueType:e,...T.normalizeParams(t)})}var Ns=g("ZodEnum",(e,t)=>{vu.init(e,t),Q.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Ns({...t,checks:[],...T.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Ns({...t,checks:[],...T.normalizeParams(n),entries:i})}});function Ke(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Ns({type:"enum",entries:r,...T.normalizeParams(t)})}function EO(e,t){return new Ns({type:"enum",entries:e,...T.normalizeParams(t)})}var nS=g("ZodLiteral",(e,t)=>{bu.init(e,t),Q.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function j(e,t){return new nS({type:"literal",values:Array.isArray(e)?e:[e],...T.normalizeParams(t)})}var oS=g("ZodFile",(e,t)=>{Su.init(e,t),Q.init(e,t),e.min=(r,o)=>e.check(gn(r,o)),e.max=(r,o)=>e.check(co(r,o)),e.mime=(r,o)=>e.check(Rs(Array.isArray(r)?r:[r],o))});function RO(e){return nl(oS,e)}var Dh=g("ZodTransform",(e,t)=>{oo.init(e,t),Q.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(T.issue(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),r.issues.push(T.issue(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r));return r.value=n,r}});function jh(e){return new Dh({type:"transform",transform:e})}var Uh=g("ZodOptional",(e,t)=>{xu.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ye(e){return new Uh({type:"optional",innerType:e})}var iS=g("ZodNullable",(e,t)=>{ku.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function hl(e){return new iS({type:"nullable",innerType:e})}function CO(e){return ye(hl(e))}var sS=g("ZodDefault",(e,t)=>{wu.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function aS(e,t){return new sS({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var cS=g("ZodPrefault",(e,t)=>{$u.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uS(e,t){return new cS({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var Fh=g("ZodNonOptional",(e,t)=>{Iu.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lS(e,t){return new Fh({type:"nonoptional",innerType:e,...T.normalizeParams(t)})}var dS=g("ZodSuccess",(e,t)=>{Tu.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function OO(e){return new dS({type:"success",innerType:e})}var pS=g("ZodCatch",(e,t)=>{Pu.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mS(e,t){return new pS({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var fS=g("ZodNaN",(e,t)=>{Eu.init(e,t),Q.init(e,t)});function AO(e){return rl(fS,e)}var Lh=g("ZodPipe",(e,t)=>{io.init(e,t),Q.init(e,t),e.in=t.in,e.out=t.out});function gl(e,t){return new Lh({type:"pipe",in:e,out:t})}var hS=g("ZodReadonly",(e,t)=>{Ru.init(e,t),Q.init(e,t)});function gS(e){return new hS({type:"readonly",innerType:e})}var yS=g("ZodTemplateLiteral",(e,t)=>{Cu.init(e,t),Q.init(e,t)});function MO(e,t){return new yS({type:"template_literal",parts:e,...T.normalizeParams(t)})}var _S=g("ZodLazy",(e,t)=>{Au.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.getter()});function vS(e){return new _S({type:"lazy",getter:e})}var bS=g("ZodPromise",(e,t)=>{Ou.init(e,t),Q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function zO(e){return new bS({type:"promise",innerType:e})}var xl=g("ZodCustom",(e,t)=>{Mu.init(e,t),Q.init(e,t)});function SS(e,t){let r=new xe({check:"custom",...T.normalizeParams(t)});return r._zod.check=e,r}function qh(e,t){return ol(xl,e??(()=>!0),t)}function xS(e,t={}){return il(xl,e,t)}function kS(e,t){let r=SS((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(T.issue(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(T.issue(i))}},e(o.value,o)),t);return r}function NO(e,t={error:`Input not instance of ${e.name}`}){let r=new xl({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...T.normalizeParams(t)});return r._zod.bag.Class=e,r}var DO=(...e)=>sl({Pipe:Lh,Boolean:Us,String:Ds,Transform:Dh},...e);function jO(e){let t=vS(()=>me([_(e),ae(),Ce(),yl(),te(t),fe(_(),t)]));return t}function kl(e,t){return gl(jh(e),t)}var UO={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function FO(e){Pe({customError:e})}function LO(){return Pe().customError}var Zh={};fr(Zh,{string:()=>qO,number:()=>ZO,date:()=>KO,boolean:()=>HO,bigint:()=>BO});function qO(e){return Bf(Ds,e)}function ZO(e){return Jf(js,e)}function HO(e){return Xf(Us,e)}function BO(e){return Yf(Fs,e)}function KO(e){return Qf(vl,e)}Pe(Qi());var re;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let i={};for(let s of n)i[s]=s;return i},e.getValidEnumValues=(n)=>{let i=e.objectKeys(n).filter((a)=>typeof n[n[a]]!=="number"),s={};for(let a of i)s[a]=n[a];return e.objectValues(s)},e.objectValues=(n)=>e.objectKeys(n).map(function(i){return n[i]}),e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let i=[];for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s))i.push(s);return i},e.find=(n,i)=>{for(let s of n)if(i(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map((s)=>typeof s==="string"?`'${s}'`:s).join(i)}e.joinValues=o,e.jsonStringifyReplacer=(n,i)=>{if(typeof i==="bigint")return i.toString();return i}})(re||(re={}));var wS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(wS||(wS={}));var P=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ir=(e)=>{switch(typeof e){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(e)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":if(Array.isArray(e))return P.array;if(e===null)return P.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return P.promise;if(typeof Map<"u"&&e instanceof Map)return P.map;if(typeof Set<"u"&&e instanceof Set)return P.set;if(typeof Date<"u"&&e instanceof Date)return P.date;return P.object;default:return P.unknown}};var k=re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class pt extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},r={_errors:[]},o=(n)=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;while(a<i.path.length){let c=i.path[a];if(a!==i.path.length-1)s[c]=s[c]||{_errors:[]};else s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i));s=s[c],a++}}};return o(this),r}static assert(e){if(!(e instanceof pt))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let o of this.issues)if(o.path.length>0){let n=o.path[0];t[n]=t[n]||[],t[n].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}pt.create=(e)=>new pt(e);var VO=(e,t)=>{let r;switch(e.code){case k.invalid_type:if(e.received===P.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,re.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:r=`Unrecognized key(s) in object: ${re.joinValues(e.keys,", ")}`;break;case k.invalid_union:r="Invalid input";break;case k.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${re.joinValues(e.options)}`;break;case k.invalid_enum_value:r=`Invalid enum value. Expected ${re.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:r="Invalid function arguments";break;case k.invalid_return_type:r="Invalid function return type";break;case k.invalid_date:r="Invalid date";break;case k.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else re.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case k.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case k.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case k.custom:r="Invalid input";break;case k.invalid_intersection_types:r="Intersection results could not be merged";break;case k.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:r="Number must be finite";break;default:r=t.defaultError,re.assertNever(e)}return{message:r}},Cr=VO;var WO=Cr;function qs(){return WO}var wl=(e)=>{let{data:t,path:r,errorMaps:o,issueData:n}=e,i=[...r,...n.path||[]],s={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",c=o.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...n,path:i,message:a}};function A(e,t){let r=qs(),o=wl({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Cr?void 0:Cr].filter((n)=>!!n)});e.common.issues.push(o)}class He{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let o of t){if(o.status==="aborted")return H;if(o.status==="dirty")e.dirty();r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let o of t){let n=await o.key,i=await o.value;r.push({key:n,value:i})}return He.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let o of t){let{key:n,value:i}=o;if(n.status==="aborted")return H;if(i.status==="aborted")return H;if(n.status==="dirty")e.dirty();if(i.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet))r[n.value]=i.value}return{status:e.value,value:r}}}var H=Object.freeze({status:"aborted"}),go=(e)=>({status:"dirty",value:e}),Ve=(e)=>({status:"valid",value:e}),Bh=(e)=>e.status==="aborted",Kh=(e)=>e.status==="dirty",yn=(e)=>e.status==="valid",Zs=(e)=>typeof Promise<"u"&&e instanceof Promise;var D;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(D||(D={}));class Ct{constructor(e,t,r,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=o}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var $S=(e,t)=>{if(yn(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new pt(e.common.issues);return this._error=r,this._error}}}};function J(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:o,description:n}=e;if(t&&(r||o))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(s,a)=>{let{message:c}=e;if(s.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??o??a.defaultError};if(s.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:n}}class ee{get description(){return this._def.description}_getType(e){return ir(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ir(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new He,ctx:{common:e.parent.common,data:e.data,parsedType:ir(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Zs(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ir(e)},o=this._parseSync({data:e,path:r.path,parent:r});return $S(r,o)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ir(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return yn(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>yn(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ir(e)},o=this._parse({data:e,path:r.path,parent:r}),n=await(Zs(o)?o:Promise.resolve(o));return $S(r,n)}refine(e,t){let r=(o)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(o);else return t};return this._refinement((o,n)=>{let i=e(o),s=()=>n.addIssue({code:k.custom,...r(o)});if(typeof Promise<"u"&&i instanceof Promise)return i.then((a)=>{if(!a)return s(),!1;else return!0});if(!i)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,o)=>{if(!e(r))return o.addIssue(typeof t==="function"?t(r,o):t),!1;else return!0})}_refinement(e){return new Ht({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return bt.create(this,this._def)}nullable(){return Or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zt.create(this)}promise(){return So.create(this,this._def)}or(e){return Ws.create([this,e],this._def)}and(e){return Gs.create(this,e,this._def)}transform(e){return new Ht({...J(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Qs({...J(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new Jh({typeName:w.ZodBranded,type:this,...J(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new ea({...J(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Ol.create(this,e)}readonly(){return ta.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var GO=/^c[^\s-]{8,}$/i,JO=/^[0-9a-z]+$/,XO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,YO=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,QO=/^[a-z0-9_-]{21}$/i,eA=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tA=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rA=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vh,oA=/^(?:(?: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])$/,iA=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,sA=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,aA=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cA=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,uA=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,IS="((\\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])))",lA=new RegExp(`^${IS}$`);function TS(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function dA(e){return new RegExp(`^${TS(e)}$`)}function pA(e){let t=`${IS}T${TS(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function mA(e,t){if((t==="v4"||!t)&&oA.test(e))return!0;if((t==="v6"||!t)&&sA.test(e))return!0;return!1}function fA(e,t){if(!eA.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function hA(e,t){if((t==="v4"||!t)&&iA.test(e))return!0;if((t==="v6"||!t)&&aA.test(e))return!0;return!1}class ar extends ee{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==P.string){let n=this._getOrReturnCtx(e);return A(n,{code:k.invalid_type,expected:P.string,received:n.parsedType}),H}let r=new He,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)o=this._getOrReturnCtx(e,o),A(o,{code:k.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)o=this._getOrReturnCtx(e,o),A(o,{code:k.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let i=e.data.length>n.value,s=e.data.length<n.value;if(i||s){if(o=this._getOrReturnCtx(e,o),i)A(o,{code:k.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(s)A(o,{code:k.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!rA.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"email",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!Vh)Vh=new RegExp(nA,"u");if(!Vh.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"emoji",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!YO.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"uuid",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!QO.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"nanoid",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!GO.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"cuid",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!JO.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"cuid2",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!XO.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"ulid",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),A(o,{validation:"url",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"regex",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))o=this._getOrReturnCtx(e,o),A(o,{code:k.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))o=this._getOrReturnCtx(e,o),A(o,{code:k.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))o=this._getOrReturnCtx(e,o),A(o,{code:k.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!pA(n).test(e.data))o=this._getOrReturnCtx(e,o),A(o,{code:k.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!lA.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{code:k.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!dA(n).test(e.data))o=this._getOrReturnCtx(e,o),A(o,{code:k.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!tA.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"duration",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!mA(e.data,n.version))o=this._getOrReturnCtx(e,o),A(o,{validation:"ip",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!fA(e.data,n.alg))o=this._getOrReturnCtx(e,o),A(o,{validation:"jwt",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!hA(e.data,n.version))o=this._getOrReturnCtx(e,o),A(o,{validation:"cidr",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!cA.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"base64",code:k.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!uA.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"base64url",code:k.invalid_string,message:n.message}),r.dirty()}else re.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((o)=>e.test(o),{validation:t,code:k.invalid_string,...D.errToObj(r)})}_addCheck(e){return new ar({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...D.errToObj(e)})}url(e){return this._addCheck({kind:"url",...D.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...D.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...D.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...D.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...D.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...D.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...D.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...D.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...D.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...D.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...D.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...D.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...D.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...D.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...D.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...D.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...D.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...D.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...D.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...D.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...D.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...D.errToObj(t)})}nonempty(e){return this.min(1,D.errToObj(e))}trim(){return new ar({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ar({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ar({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}ar.create=(e)=>new ar({checks:[],typeName:w.ZodString,coerce:e?.coerce??!1,...J(e)});function gA(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return i%s/10**n}class _o extends ee{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==P.number){let n=this._getOrReturnCtx(e);return A(n,{code:k.invalid_type,expected:P.number,received:n.parsedType}),H}let r=void 0,o=new He;for(let n of this._def.checks)if(n.kind==="int"){if(!re.isInteger(e.data))r=this._getOrReturnCtx(e,r),A(r,{code:k.invalid_type,expected:"integer",received:"float",message:n.message}),o.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),A(r,{code:k.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),A(r,{code:k.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(gA(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),A(r,{code:k.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),A(r,{code:k.not_finite,message:n.message}),o.dirty()}else re.assertNever(n);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,D.toString(t))}gt(e,t){return this.setLimit("min",e,!1,D.toString(t))}lte(e,t){return this.setLimit("max",e,!0,D.toString(t))}lt(e,t){return this.setLimit("max",e,!1,D.toString(t))}setLimit(e,t,r,o){return new _o({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:D.toString(o)}]})}_addCheck(e){return new _o({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:D.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:D.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:D.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&re.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}_o.create=(e)=>new _o({checks:[],typeName:w.ZodNumber,coerce:e?.coerce||!1,...J(e)});class vo extends ee{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==P.bigint)return this._getInvalidInput(e);let r=void 0,o=new He;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),A(r,{code:k.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),A(r,{code:k.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),A(r,{code:k.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else re.assertNever(n);return{status:o.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:P.bigint,received:t.parsedType}),H}gte(e,t){return this.setLimit("min",e,!0,D.toString(t))}gt(e,t){return this.setLimit("min",e,!1,D.toString(t))}lte(e,t){return this.setLimit("max",e,!0,D.toString(t))}lt(e,t){return this.setLimit("max",e,!1,D.toString(t))}setLimit(e,t,r,o){return new vo({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:D.toString(o)}]})}_addCheck(e){return new vo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:D.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}vo.create=(e)=>new vo({checks:[],typeName:w.ZodBigInt,coerce:e?.coerce??!1,...J(e)});class $l extends ee{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==P.boolean){let r=this._getOrReturnCtx(e);return A(r,{code:k.invalid_type,expected:P.boolean,received:r.parsedType}),H}return Ve(e.data)}}$l.create=(e)=>new $l({typeName:w.ZodBoolean,coerce:e?.coerce||!1,...J(e)});class Bs extends ee{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==P.date){let n=this._getOrReturnCtx(e);return A(n,{code:k.invalid_type,expected:P.date,received:n.parsedType}),H}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return A(n,{code:k.invalid_date}),H}let r=new He,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)o=this._getOrReturnCtx(e,o),A(o,{code:k.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)o=this._getOrReturnCtx(e,o),A(o,{code:k.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else re.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Bs({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:D.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:D.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Bs.create=(e)=>new Bs({checks:[],coerce:e?.coerce||!1,typeName:w.ZodDate,...J(e)});class Il extends ee{_parse(e){if(this._getType(e)!==P.symbol){let r=this._getOrReturnCtx(e);return A(r,{code:k.invalid_type,expected:P.symbol,received:r.parsedType}),H}return Ve(e.data)}}Il.create=(e)=>new Il({typeName:w.ZodSymbol,...J(e)});class Ks extends ee{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:k.invalid_type,expected:P.undefined,received:r.parsedType}),H}return Ve(e.data)}}Ks.create=(e)=>new Ks({typeName:w.ZodUndefined,...J(e)});class Vs extends ee{_parse(e){if(this._getType(e)!==P.null){let r=this._getOrReturnCtx(e);return A(r,{code:k.invalid_type,expected:P.null,received:r.parsedType}),H}return Ve(e.data)}}Vs.create=(e)=>new Vs({typeName:w.ZodNull,...J(e)});class Tl extends ee{constructor(){super(...arguments);this._any=!0}_parse(e){return Ve(e.data)}}Tl.create=(e)=>new Tl({typeName:w.ZodAny,...J(e)});class _n extends ee{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Ve(e.data)}}_n.create=(e)=>new _n({typeName:w.ZodUnknown,...J(e)});class cr extends ee{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:P.never,received:t.parsedType}),H}}cr.create=(e)=>new cr({typeName:w.ZodNever,...J(e)});class Pl extends ee{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:k.invalid_type,expected:P.void,received:r.parsedType}),H}return Ve(e.data)}}Pl.create=(e)=>new Pl({typeName:w.ZodVoid,...J(e)});class Zt extends ee{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),o=this._def;if(t.parsedType!==P.array)return A(t,{code:k.invalid_type,expected:P.array,received:t.parsedType}),H;if(o.exactLength!==null){let i=t.data.length>o.exactLength.value,s=t.data.length<o.exactLength.value;if(i||s)A(t,{code:i?k.too_big:k.too_small,minimum:s?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty()}if(o.minLength!==null){if(t.data.length<o.minLength.value)A(t,{code:k.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()}if(o.maxLength!==null){if(t.data.length>o.maxLength.value)A(t,{code:k.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((i,s)=>o.type._parseAsync(new Ct(t,i,t.path,s)))).then((i)=>He.mergeArray(r,i));let n=[...t.data].map((i,s)=>o.type._parseSync(new Ct(t,i,t.path,s)));return He.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Zt({...this._def,minLength:{value:e,message:D.toString(t)}})}max(e,t){return new Zt({...this._def,maxLength:{value:e,message:D.toString(t)}})}length(e,t){return new Zt({...this._def,exactLength:{value:e,message:D.toString(t)}})}nonempty(e){return this.min(1,e)}}Zt.create=(e,t)=>new Zt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...J(t)});function yo(e){if(e instanceof Ie){let t={};for(let r in e.shape){let o=e.shape[r];t[r]=bt.create(yo(o))}return new Ie({...e._def,shape:()=>t})}else if(e instanceof Zt)return new Zt({...e._def,type:yo(e.element)});else if(e instanceof bt)return bt.create(yo(e.unwrap()));else if(e instanceof Or)return Or.create(yo(e.unwrap()));else if(e instanceof ur)return ur.create(e.items.map((t)=>yo(t)));else return e}class Ie extends ee{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=re.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==P.object){let c=this._getOrReturnCtx(e);return A(c,{code:k.invalid_type,expected:P.object,received:c.parsedType}),H}let{status:r,ctx:o}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof cr&&this._def.unknownKeys==="strip")){for(let c in o.data)if(!i.includes(c))s.push(c)}let a=[];for(let c of i){let u=n[c],l=o.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new Ct(o,l,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof cr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)a.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict"){if(s.length>0)A(o,{code:k.unrecognized_keys,keys:s}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let l=o.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new Ct(o,l,o.path,u)),alwaysSet:u in o.data})}}if(o.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let l=await u.key,d=await u.value;c.push({key:l,value:d,alwaysSet:u.alwaysSet})}return c}).then((c)=>He.mergeObjectSync(r,c));else return He.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return D.errToObj,new Ie({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let o=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:D.errToObj(e).message??o};return{message:o}}}:{}})}strip(){return new Ie({...this._def,unknownKeys:"strip"})}passthrough(){return new Ie({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ie({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ie({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ie({...this._def,catchall:e})}pick(e){let t={};for(let r of re.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new Ie({...this._def,shape:()=>t})}omit(e){let t={};for(let r of re.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new Ie({...this._def,shape:()=>t})}deepPartial(){return yo(this)}partial(e){let t={};for(let r of re.objectKeys(this.shape)){let o=this.shape[r];if(e&&!e[r])t[r]=o;else t[r]=o.optional()}return new Ie({...this._def,shape:()=>t})}required(e){let t={};for(let r of re.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof bt)n=n._def.innerType;t[r]=n}return new Ie({...this._def,shape:()=>t})}keyof(){return PS(re.objectKeys(this.shape))}}Ie.create=(e,t)=>new Ie({shape:()=>e,unknownKeys:"strip",catchall:cr.create(),typeName:w.ZodObject,...J(t)});Ie.strictCreate=(e,t)=>new Ie({shape:()=>e,unknownKeys:"strict",catchall:cr.create(),typeName:w.ZodObject,...J(t)});Ie.lazycreate=(e,t)=>new Ie({shape:e,unknownKeys:"strip",catchall:cr.create(),typeName:w.ZodObject,...J(t)});class Ws extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function o(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let i=n.map((s)=>new pt(s.ctx.common.issues));return A(t,{code:k.invalid_union,unionErrors:i}),H}if(t.common.async)return Promise.all(r.map(async(n)=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(o);else{let n=void 0,i=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!n)n={result:u,ctx:c};if(c.common.issues.length)i.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let s=i.map((a)=>new pt(a));return A(t,{code:k.invalid_union,unionErrors:s}),H}}get options(){return this._def.options}}Ws.create=(e,t)=>new Ws({options:e,typeName:w.ZodUnion,...J(t)});var sr=(e)=>{if(e instanceof Js)return sr(e.schema);else if(e instanceof Ht)return sr(e.innerType());else if(e instanceof Xs)return[e.value];else if(e instanceof vn)return e.options;else if(e instanceof Ys)return re.objectValues(e.enum);else if(e instanceof Qs)return sr(e._def.innerType);else if(e instanceof Ks)return[void 0];else if(e instanceof Vs)return[null];else if(e instanceof bt)return[void 0,...sr(e.unwrap())];else if(e instanceof Or)return[null,...sr(e.unwrap())];else if(e instanceof Jh)return sr(e.unwrap());else if(e instanceof ta)return sr(e.unwrap());else if(e instanceof ea)return sr(e._def.innerType);else return[]};class Gh extends ee{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.object)return A(t,{code:k.invalid_type,expected:P.object,received:t.parsedType}),H;let r=this.discriminator,o=t.data[r],n=this.optionsMap.get(o);if(!n)return A(t,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),H;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let o=new Map;for(let n of t){let i=sr(n.shape[e]);if(!i.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of i){if(o.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,n)}}return new Gh({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...J(r)})}}function Wh(e,t){let r=ir(e),o=ir(t);if(e===t)return{valid:!0,data:e};else if(r===P.object&&o===P.object){let n=re.objectKeys(t),i=re.objectKeys(e).filter((a)=>n.indexOf(a)!==-1),s={...e,...t};for(let a of i){let c=Wh(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===P.array&&o===P.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],c=Wh(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else if(r===P.date&&o===P.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class Gs extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=(n,i)=>{if(Bh(n)||Bh(i))return H;let s=Wh(n.value,i.value);if(!s.valid)return A(r,{code:k.invalid_intersection_types}),H;if(Kh(n)||Kh(i))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>o(n,i));else return o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Gs.create=(e,t,r)=>new Gs({left:e,right:t,typeName:w.ZodIntersection,...J(r)});class ur extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.array)return A(r,{code:k.invalid_type,expected:P.array,received:r.parsedType}),H;if(r.data.length<this._def.items.length)return A(r,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H;if(!this._def.rest&&r.data.length>this._def.items.length)A(r,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((i,s)=>{let a=this._def.items[s]||this._def.rest;if(!a)return null;return a._parse(new Ct(r,i,r.path,s))}).filter((i)=>!!i);if(r.common.async)return Promise.all(n).then((i)=>He.mergeArray(t,i));else return He.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ur({...this._def,rest:e})}}ur.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ur({items:e,typeName:w.ZodTuple,rest:null,...J(t)})};class El extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.object)return A(r,{code:k.invalid_type,expected:P.object,received:r.parsedType}),H;let o=[],n=this._def.keyType,i=this._def.valueType;for(let s in r.data)o.push({key:n._parse(new Ct(r,s,r.path,s)),value:i._parse(new Ct(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return He.mergeObjectAsync(t,o);else return He.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof ee)return new El({keyType:e,valueType:t,typeName:w.ZodRecord,...J(r)});return new El({keyType:ar.create(),valueType:e,typeName:w.ZodRecord,...J(t)})}}class Rl extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.map)return A(r,{code:k.invalid_type,expected:P.map,received:r.parsedType}),H;let o=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([s,a],c)=>({key:o._parse(new Ct(r,s,r.path,[c,"key"])),value:n._parse(new Ct(r,a,r.path,[c,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let a of i){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return H;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let a of i){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return H;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}}}}Rl.create=(e,t,r)=>new Rl({valueType:t,keyType:e,typeName:w.ZodMap,...J(r)});class bo extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.set)return A(r,{code:k.invalid_type,expected:P.set,received:r.parsedType}),H;let o=this._def;if(o.minSize!==null){if(r.data.size<o.minSize.value)A(r,{code:k.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()}if(o.maxSize!==null){if(r.data.size>o.maxSize.value)A(r,{code:k.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty()}let n=this._def.valueType;function i(a){let c=new Set;for(let u of a){if(u.status==="aborted")return H;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let s=[...r.data.values()].map((a,c)=>n._parse(new Ct(r,a,r.path,c)));if(r.common.async)return Promise.all(s).then((a)=>i(a));else return i(s)}min(e,t){return new bo({...this._def,minSize:{value:e,message:D.toString(t)}})}max(e,t){return new bo({...this._def,maxSize:{value:e,message:D.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}bo.create=(e,t)=>new bo({valueType:e,minSize:null,maxSize:null,typeName:w.ZodSet,...J(t)});class Hs extends ee{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.function)return A(t,{code:k.invalid_type,expected:P.function,received:t.parsedType}),H;function r(s,a){return wl({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qs(),Cr].filter((c)=>!!c),issueData:{code:k.invalid_arguments,argumentsError:a}})}function o(s,a){return wl({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qs(),Cr].filter((c)=>!!c),issueData:{code:k.invalid_return_type,returnTypeError:a}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof So){let s=this;return Ve(async function(...a){let c=new pt([]),u=await s._def.args.parseAsync(a,n).catch((m)=>{throw c.addIssue(r(a,m)),c}),l=await Reflect.apply(i,this,u);return await s._def.returns._def.type.parseAsync(l,n).catch((m)=>{throw c.addIssue(o(l,m)),c})})}else{let s=this;return Ve(function(...a){let c=s._def.args.safeParse(a,n);if(!c.success)throw new pt([r(a,c.error)]);let u=Reflect.apply(i,this,c.data),l=s._def.returns.safeParse(u,n);if(!l.success)throw new pt([o(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Hs({...this._def,args:ur.create(e).rest(_n.create())})}returns(e){return new Hs({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Hs({args:e?e:ur.create([]).rest(_n.create()),returns:t||_n.create(),typeName:w.ZodFunction,...J(r)})}}class Js extends ee{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Js.create=(e,t)=>new Js({getter:e,typeName:w.ZodLazy,...J(t)});class Xs extends ee{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return A(t,{received:t.data,code:k.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:e.data}}get value(){return this._def.value}}Xs.create=(e,t)=>new Xs({value:e,typeName:w.ZodLiteral,...J(t)});function PS(e,t){return new vn({values:e,typeName:w.ZodEnum,...J(t)})}class vn extends ee{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{expected:re.joinValues(r),received:t.parsedType,code:k.invalid_type}),H}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{received:t.data,code:k.invalid_enum_value,options:r}),H}return Ve(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return vn.create(e,{...this._def,...t})}exclude(e,t=this._def){return vn.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}vn.create=PS;class Ys extends ee{_parse(e){let t=re.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==P.string&&r.parsedType!==P.number){let o=re.objectValues(t);return A(r,{expected:re.joinValues(o),received:r.parsedType,code:k.invalid_type}),H}if(!this._cache)this._cache=new Set(re.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let o=re.objectValues(t);return A(r,{received:r.data,code:k.invalid_enum_value,options:o}),H}return Ve(e.data)}get enum(){return this._def.values}}Ys.create=(e,t)=>new Ys({values:e,typeName:w.ZodNativeEnum,...J(t)});class So extends ee{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.promise&&t.common.async===!1)return A(t,{code:k.invalid_type,expected:P.promise,received:t.parsedType}),H;let r=t.parsedType===P.promise?t.data:Promise.resolve(t.data);return Ve(r.then((o)=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}}So.create=(e,t)=>new So({type:e,typeName:w.ZodPromise,...J(t)});class Ht extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=this._def.effect||null,n={addIssue:(i)=>{if(A(r,i),i.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),o.type==="preprocess"){let i=o.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async(s)=>{if(t.value==="aborted")return H;let a=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(a.status==="aborted")return H;if(a.status==="dirty")return go(a.value);if(t.value==="dirty")return go(a.value);return a});else{if(t.value==="aborted")return H;let s=this._def.schema._parseSync({data:i,path:r.path,parent:r});if(s.status==="aborted")return H;if(s.status==="dirty")return go(s.value);if(t.value==="dirty")return go(s.value);return s}}if(o.type==="refinement"){let i=(s)=>{let a=o.refinement(s,n);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return H;if(s.status==="dirty")t.dirty();return i(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return H;if(s.status==="dirty")t.dirty();return i(s.value).then(()=>({status:t.value,value:s.value}))})}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!yn(i))return H;let s=o.transform(i.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(!yn(i))return H;return Promise.resolve(o.transform(i.value,n)).then((s)=>({status:t.value,value:s}))});re.assertNever(o)}}Ht.create=(e,t,r)=>new Ht({schema:e,typeName:w.ZodEffects,effect:t,...J(r)});Ht.createWithPreprocess=(e,t,r)=>new Ht({schema:t,effect:{type:"preprocess",transform:e},typeName:w.ZodEffects,...J(r)});class bt extends ee{_parse(e){if(this._getType(e)===P.undefined)return Ve(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}bt.create=(e,t)=>new bt({innerType:e,typeName:w.ZodOptional,...J(t)});class Or extends ee{_parse(e){if(this._getType(e)===P.null)return Ve(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Or.create=(e,t)=>new Or({innerType:e,typeName:w.ZodNullable,...J(t)});class Qs extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===P.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Qs.create=(e,t)=>new Qs({innerType:e,typeName:w.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...J(t)});class ea extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Zs(o))return o.then((n)=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new pt(r.common.issues)},input:r.data})}));else return{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new pt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ea.create=(e,t)=>new ea({innerType:e,typeName:w.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...J(t)});class Cl extends ee{_parse(e){if(this._getType(e)!==P.nan){let r=this._getOrReturnCtx(e);return A(r,{code:k.invalid_type,expected:P.nan,received:r.parsedType}),H}return{status:"valid",value:e.data}}}Cl.create=(e)=>new Cl({typeName:w.ZodNaN,...J(e)});var l3=Symbol("zod_brand");class Jh extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ol extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return H;if(n.status==="dirty")return t.dirty(),go(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return H;if(o.status==="dirty")return t.dirty(),{status:"dirty",value:o.value};else return this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,t){return new Ol({in:e,out:t,typeName:w.ZodPipeline})}}class ta extends ee{_parse(e){let t=this._def.innerType._parse(e),r=(o)=>{if(yn(o))o.value=Object.freeze(o.value);return o};return Zs(t)?t.then((o)=>r(o)):r(t)}unwrap(){return this._def.innerType}}ta.create=(e,t)=>new ta({innerType:e,typeName:w.ZodReadonly,...J(t)});var d3={object:Ie.lazycreate},w;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(w||(w={}));var p3=ar.create,m3=_o.create,f3=Cl.create,h3=vo.create,g3=$l.create,y3=Bs.create,_3=Il.create,v3=Ks.create,b3=Vs.create,S3=Tl.create,x3=_n.create,k3=cr.create,w3=Pl.create,$3=Zt.create,ES=Ie.create,I3=Ie.strictCreate,T3=Ws.create,P3=Gh.create,E3=Gs.create,R3=ur.create,C3=El.create,O3=Rl.create,A3=bo.create,M3=Hs.create,z3=Js.create,N3=Xs.create,D3=vn.create,j3=Ys.create,U3=So.create,F3=Ht.create,L3=bt.create,q3=Or.create,Z3=Ht.createWithPreprocess,H3=Ol.create;var _A=g("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");K.init(e,t),e.def=t,e.parse=(r,o)=>ln(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>$r(e,r,o),e.parseAsync=async(r,o)=>dn(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Ir(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(r,o)=>qe(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e)});var vA=g("ZodMiniObject",(e,t)=>{Xi.init(e,t),_A.init(e,t),T.defineLazy(e,"shape",()=>t.shape)});function Xh(e,t){let r={type:"object",get shape(){return T.assignProp(this,"shape",{...e}),this.shape},...T.normalizeParams(t)};return new vA(r)}function St(e){return!!e._zod}function bn(e){let t=Object.values(e);if(t.length===0)return Xh({});let r=t.every(St),o=t.every((n)=>!St(n));if(r)return Xh(e);if(o)return ES(e);throw Error("Mixed Zod versions detected in object shape.")}function Ar(e,t){if(St(e))return $r(e,t);return e.safeParse(t)}async function Al(e,t){if(St(e))return await Ir(e,t);return await e.safeParseAsync(t)}function Mr(e){if(!e)return;let t;if(St(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function xo(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let o=Object.values(e);if(o.length>0&&o.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return bn(e)}}if(St(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function Ml(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function RS(e){return e.description}function CS(e){if(St(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function zl(e){if(St(e)){let i=e._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]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var Yh="2025-11-25";var OS=[Yh,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],zr="io.modelcontextprotocol/related-task",Dl="2.0",ze=qh((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),AS=me([_(),ae().int()]),MS=_(),i5=Ze({ttl:ae().optional(),pollInterval:ae().optional()}),SA=N({ttl:ae().optional()}),xA=N({taskId:_()}),Qh=Ze({progressToken:AS.optional(),[zr]:xA.optional()}),mt=N({_meta:Qh.optional()}),ra=mt.extend({task:SA.optional()}),zS=(e)=>ra.safeParse(e).success,De=N({method:_(),params:mt.loose().optional()}),xt=N({_meta:Qh.optional()}),kt=N({method:_(),params:xt.loose().optional()}),je=Ze({_meta:Qh.optional()}),jl=me([_(),ae().int()]),NS=N({jsonrpc:j(Dl),id:jl,...De.shape}).strict(),eg=(e)=>NS.safeParse(e).success,DS=N({jsonrpc:j(Dl),...kt.shape}).strict(),jS=(e)=>DS.safeParse(e).success,tg=N({jsonrpc:j(Dl),id:jl,result:je}).strict(),na=(e)=>tg.safeParse(e).success;var L;(function(e){e[e.ConnectionClosed=-32000]="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"})(L||(L={}));var rg=N({jsonrpc:j(Dl),id:jl.optional(),error:N({code:ae().int(),message:_(),data:_e().optional()})}).strict();var US=(e)=>rg.safeParse(e).success;var s5=me([NS,DS,tg,rg]),a5=me([tg,rg]),Ul=je.strict(),kA=xt.extend({requestId:jl.optional(),reason:_().optional()}),Fl=kt.extend({method:j("notifications/cancelled"),params:kA}),wA=N({src:_(),mimeType:_().optional(),sizes:te(_()).optional(),theme:Ke(["light","dark"]).optional()}),oa=N({icons:te(wA).optional()}),ko=N({name:_(),title:_().optional()}),FS=ko.extend({...ko.shape,...oa.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),$A=Ls(N({applyDefaults:Ce().optional()}),fe(_(),_e())),IA=kl((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Ls(N({form:$A.optional(),url:ze.optional()}),fe(_(),_e()).optional())),TA=Ze({list:ze.optional(),cancel:ze.optional(),requests:Ze({sampling:Ze({createMessage:ze.optional()}).optional(),elicitation:Ze({create:ze.optional()}).optional()}).optional()}),PA=Ze({list:ze.optional(),cancel:ze.optional(),requests:Ze({tools:Ze({call:ze.optional()}).optional()}).optional()}),EA=N({experimental:fe(_(),ze).optional(),sampling:N({context:ze.optional(),tools:ze.optional()}).optional(),elicitation:IA.optional(),roots:N({listChanged:Ce().optional()}).optional(),tasks:TA.optional(),extensions:fe(_(),ze).optional()}),RA=mt.extend({protocolVersion:_(),capabilities:EA,clientInfo:FS}),ng=De.extend({method:j("initialize"),params:RA});var CA=N({experimental:fe(_(),ze).optional(),logging:ze.optional(),completions:ze.optional(),prompts:N({listChanged:Ce().optional()}).optional(),resources:N({subscribe:Ce().optional(),listChanged:Ce().optional()}).optional(),tools:N({listChanged:Ce().optional()}).optional(),tasks:PA.optional(),extensions:fe(_(),ze).optional()}),OA=je.extend({protocolVersion:_(),capabilities:CA,serverInfo:FS,instructions:_().optional()}),og=kt.extend({method:j("notifications/initialized"),params:xt.optional()});var Ll=De.extend({method:j("ping"),params:mt.optional()}),AA=N({progress:ae(),total:ye(ae()),message:ye(_())}),MA=N({...xt.shape,...AA.shape,progressToken:AS}),ql=kt.extend({method:j("notifications/progress"),params:MA}),zA=mt.extend({cursor:MS.optional()}),ia=De.extend({params:zA.optional()}),sa=je.extend({nextCursor:MS.optional()}),NA=Ke(["working","input_required","completed","failed","cancelled"]),aa=N({taskId:_(),status:NA,ttl:me([ae(),yl()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:ye(ae()),statusMessage:ye(_())}),wo=je.extend({task:aa}),DA=xt.merge(aa),ca=kt.extend({method:j("notifications/tasks/status"),params:DA}),Zl=De.extend({method:j("tasks/get"),params:mt.extend({taskId:_()})}),Hl=je.merge(aa),Bl=De.extend({method:j("tasks/result"),params:mt.extend({taskId:_()})}),c5=je.loose(),Kl=ia.extend({method:j("tasks/list")}),Vl=sa.extend({tasks:te(aa)}),Wl=De.extend({method:j("tasks/cancel"),params:mt.extend({taskId:_()})}),LS=je.merge(aa),qS=N({uri:_(),mimeType:ye(_()),_meta:fe(_(),_e()).optional()}),ZS=qS.extend({text:_()}),ig=_().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),HS=qS.extend({blob:ig}),ua=Ke(["user","assistant"]),$o=N({audience:te(ua).optional(),priority:ae().min(0).max(1).optional(),lastModified:mo.datetime({offset:!0}).optional()}),BS=N({...ko.shape,...oa.shape,uri:_(),description:ye(_()),mimeType:ye(_()),size:ye(ae()),annotations:$o.optional(),_meta:ye(Ze({}))}),jA=N({...ko.shape,...oa.shape,uriTemplate:_(),description:ye(_()),mimeType:ye(_()),annotations:$o.optional(),_meta:ye(Ze({}))}),Gl=ia.extend({method:j("resources/list")}),UA=sa.extend({resources:te(BS)}),Jl=ia.extend({method:j("resources/templates/list")}),FA=sa.extend({resourceTemplates:te(jA)}),sg=mt.extend({uri:_()}),LA=sg,Xl=De.extend({method:j("resources/read"),params:LA}),qA=je.extend({contents:te(me([ZS,HS]))}),ZA=kt.extend({method:j("notifications/resources/list_changed"),params:xt.optional()}),HA=sg,BA=De.extend({method:j("resources/subscribe"),params:HA}),KA=sg,VA=De.extend({method:j("resources/unsubscribe"),params:KA}),WA=xt.extend({uri:_()}),GA=kt.extend({method:j("notifications/resources/updated"),params:WA}),JA=N({name:_(),description:ye(_()),required:ye(Ce())}),XA=N({...ko.shape,...oa.shape,description:ye(_()),arguments:ye(te(JA)),_meta:ye(Ze({}))}),Yl=ia.extend({method:j("prompts/list")}),YA=sa.extend({prompts:te(XA)}),QA=mt.extend({name:_(),arguments:fe(_(),_()).optional()}),Ql=De.extend({method:j("prompts/get"),params:QA}),ag=N({type:j("text"),text:_(),annotations:$o.optional(),_meta:fe(_(),_e()).optional()}),cg=N({type:j("image"),data:ig,mimeType:_(),annotations:$o.optional(),_meta:fe(_(),_e()).optional()}),ug=N({type:j("audio"),data:ig,mimeType:_(),annotations:$o.optional(),_meta:fe(_(),_e()).optional()}),eM=N({type:j("tool_use"),name:_(),id:_(),input:fe(_(),_e()),_meta:fe(_(),_e()).optional()}),tM=N({type:j("resource"),resource:me([ZS,HS]),annotations:$o.optional(),_meta:fe(_(),_e()).optional()}),rM=BS.extend({type:j("resource_link")}),lg=me([ag,cg,ug,rM,tM]),nM=N({role:ua,content:lg}),oM=je.extend({description:_().optional(),messages:te(nM)}),iM=kt.extend({method:j("notifications/prompts/list_changed"),params:xt.optional()}),sM=N({title:_().optional(),readOnlyHint:Ce().optional(),destructiveHint:Ce().optional(),idempotentHint:Ce().optional(),openWorldHint:Ce().optional()}),aM=N({taskSupport:Ke(["required","optional","forbidden"]).optional()}),KS=N({...ko.shape,...oa.shape,description:_().optional(),inputSchema:N({type:j("object"),properties:fe(_(),ze).optional(),required:te(_()).optional()}).catchall(_e()),outputSchema:N({type:j("object"),properties:fe(_(),ze).optional(),required:te(_()).optional()}).catchall(_e()).optional(),annotations:sM.optional(),execution:aM.optional(),_meta:fe(_(),_e()).optional()}),ed=ia.extend({method:j("tools/list")}),cM=sa.extend({tools:te(KS)}),td=je.extend({content:te(lg).default([]),structuredContent:fe(_(),_e()).optional(),isError:Ce().optional()}),u5=td.or(je.extend({toolResult:_e()})),uM=ra.extend({name:_(),arguments:fe(_(),_e()).optional()}),Io=De.extend({method:j("tools/call"),params:uM}),lM=kt.extend({method:j("notifications/tools/list_changed"),params:xt.optional()}),l5=N({autoRefresh:Ce().default(!0),debounceMs:ae().int().nonnegative().default(300)}),la=Ke(["debug","info","notice","warning","error","critical","alert","emergency"]),dM=mt.extend({level:la}),dg=De.extend({method:j("logging/setLevel"),params:dM}),pM=xt.extend({level:la,logger:_().optional(),data:_e()}),mM=kt.extend({method:j("notifications/message"),params:pM}),fM=N({name:_().optional()}),hM=N({hints:te(fM).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),gM=N({mode:Ke(["auto","required","none"]).optional()}),yM=N({type:j("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:te(lg).default([]),structuredContent:N({}).loose().optional(),isError:Ce().optional(),_meta:fe(_(),_e()).optional()}),_M=Sl("type",[ag,cg,ug]),Nl=Sl("type",[ag,cg,ug,eM,yM]),vM=N({role:ua,content:me([Nl,te(Nl)]),_meta:fe(_(),_e()).optional()}),bM=ra.extend({messages:te(vM),modelPreferences:hM.optional(),systemPrompt:_().optional(),includeContext:Ke(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:te(_()).optional(),metadata:ze.optional(),tools:te(KS).optional(),toolChoice:gM.optional()}),SM=De.extend({method:j("sampling/createMessage"),params:bM}),da=je.extend({model:_(),stopReason:ye(Ke(["endTurn","stopSequence","maxTokens"]).or(_())),role:ua,content:_M}),pg=je.extend({model:_(),stopReason:ye(Ke(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:ua,content:me([Nl,te(Nl)])}),xM=N({type:j("boolean"),title:_().optional(),description:_().optional(),default:Ce().optional()}),kM=N({type:j("string"),title:_().optional(),description:_().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:Ke(["email","uri","date","date-time"]).optional(),default:_().optional()}),wM=N({type:Ke(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),$M=N({type:j("string"),title:_().optional(),description:_().optional(),enum:te(_()),default:_().optional()}),IM=N({type:j("string"),title:_().optional(),description:_().optional(),oneOf:te(N({const:_(),title:_()})),default:_().optional()}),TM=N({type:j("string"),title:_().optional(),description:_().optional(),enum:te(_()),enumNames:te(_()).optional(),default:_().optional()}),PM=me([$M,IM]),EM=N({type:j("array"),title:_().optional(),description:_().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:N({type:j("string"),enum:te(_())}),default:te(_()).optional()}),RM=N({type:j("array"),title:_().optional(),description:_().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:N({anyOf:te(N({const:_(),title:_()}))}),default:te(_()).optional()}),CM=me([EM,RM]),OM=me([TM,PM,CM]),AM=me([OM,xM,kM,wM]),MM=ra.extend({mode:j("form").optional(),message:_(),requestedSchema:N({type:j("object"),properties:fe(_(),AM),required:te(_()).optional()})}),zM=ra.extend({mode:j("url"),message:_(),elicitationId:_(),url:_().url()}),NM=me([MM,zM]),DM=De.extend({method:j("elicitation/create"),params:NM}),jM=xt.extend({elicitationId:_()}),UM=kt.extend({method:j("notifications/elicitation/complete"),params:jM}),To=je.extend({action:Ke(["accept","decline","cancel"]),content:kl((e)=>e===null?void 0:e,fe(_(),me([_(),ae(),Ce(),te(_())])).optional())}),FM=N({type:j("ref/resource"),uri:_()});var LM=N({type:j("ref/prompt"),name:_()}),qM=mt.extend({ref:me([LM,FM]),argument:N({name:_(),value:_()}),context:N({arguments:fe(_(),_()).optional()}).optional()}),rd=De.extend({method:j("completion/complete"),params:qM});function VS(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function WS(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var ZM=je.extend({completion:Ze({values:te(_()).max(100),total:ye(ae().int()),hasMore:ye(Ce())})}),HM=N({uri:_().startsWith("file://"),name:_().optional(),_meta:fe(_(),_e()).optional()}),BM=De.extend({method:j("roots/list"),params:mt.optional()}),mg=je.extend({roots:te(HM)}),KM=kt.extend({method:j("notifications/roots/list_changed"),params:xt.optional()}),d5=me([Ll,ng,rd,dg,Ql,Yl,Gl,Jl,Xl,BA,VA,Io,ed,Zl,Bl,Kl,Wl]),p5=me([Fl,ql,og,KM,ca]),m5=me([Ul,da,pg,To,mg,Hl,Vl,wo]),f5=me([Ll,SM,DM,BM,Zl,Bl,Kl,Wl]),h5=me([Fl,ql,mM,GA,ZA,lM,iM,ca,UM]),g5=me([Ul,OA,ZM,oM,YA,UA,FA,qA,td,cM,Hl,Vl,wo]);class U extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===L.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new GS(o.elicitations,t)}return new U(e,t,r)}}class GS extends U{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(L.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function Nr(e){return e==="completed"||e==="failed"||e==="cancelled"}var XS=Symbol("Let zodToJsonSchema decide on which parser to use");var JS={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},YS=(e)=>typeof e==="string"?{...JS,name:e}:{...JS,...e};var QS=(e)=>{let t=YS(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([o,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,o],jsonSchema:void 0}]))}};function fg(e,t,r,o){if(!o?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function ne(e,t,r,o,n){e[t]=r,fg(e,t,o,n)}var nd=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function ke(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?nd(t,e.currentPath):t.join("/")}}function ex(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==w.ZodAny)r.items=B(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)ne(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)ne(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)ne(r,"minItems",e.exactLength.value,e.exactLength.message,t),ne(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function tx(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"min":if(t.target==="jsonSchema7")if(o.inclusive)ne(r,"minimum",o.value,o.message,t);else ne(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;ne(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)ne(r,"maximum",o.value,o.message,t);else ne(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;ne(r,"maximum",o.value,o.message,t)}break;case"multipleOf":ne(r,"multipleOf",o.value,o.message,t);break}return r}function rx(){return{type:"boolean"}}function od(e,t){return B(e.type._def,t)}var nx=(e,t)=>B(e.innerType._def,t);function hg(e,t,r){let o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>hg(e,t,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return VM(e,t)}}var VM=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let o of e.checks)switch(o.kind){case"min":ne(r,"minimum",o.value,o.message,t);break;case"max":ne(r,"maximum",o.value,o.message,t);break}return r};function ox(e,t){return{...B(e.innerType._def,t),default:e.defaultValue()}}function ix(e,t){return t.effectStrategy==="input"?B(e.schema._def,t):ke(t)}function sx(e){return{type:"string",enum:Array.from(e.values)}}var WM=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function ax(e,t){let r=[B(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),B(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((i)=>!!i),o=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((i)=>{if(WM(i)){if(n.push(...i.allOf),i.unevaluatedProperties===void 0)o=void 0}else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else o=void 0;n.push(s)}}),n.length?{allOf:n,...o}:void 0}function cx(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var gg=void 0,Ot={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(gg===void 0)gg=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return gg},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function id(e,t){let r={type:"string"};if(e.checks)for(let o of e.checks)switch(o.kind){case"min":ne(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t);break;case"max":ne(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"email":switch(t.emailStrategy){case"format:email":At(r,"email",o.message,t);break;case"format:idn-email":At(r,"idn-email",o.message,t);break;case"pattern:zod":We(r,Ot.email,o.message,t);break}break;case"url":At(r,"uri",o.message,t);break;case"uuid":At(r,"uuid",o.message,t);break;case"regex":We(r,o.regex,o.message,t);break;case"cuid":We(r,Ot.cuid,o.message,t);break;case"cuid2":We(r,Ot.cuid2,o.message,t);break;case"startsWith":We(r,RegExp(`^${yg(o.value,t)}`),o.message,t);break;case"endsWith":We(r,RegExp(`${yg(o.value,t)}$`),o.message,t);break;case"datetime":At(r,"date-time",o.message,t);break;case"date":At(r,"date",o.message,t);break;case"time":At(r,"time",o.message,t);break;case"duration":At(r,"duration",o.message,t);break;case"length":ne(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t),ne(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"includes":{We(r,RegExp(yg(o.value,t)),o.message,t);break}case"ip":{if(o.version!=="v6")At(r,"ipv4",o.message,t);if(o.version!=="v4")At(r,"ipv6",o.message,t);break}case"base64url":We(r,Ot.base64url,o.message,t);break;case"jwt":We(r,Ot.jwt,o.message,t);break;case"cidr":{if(o.version!=="v6")We(r,Ot.ipv4Cidr,o.message,t);if(o.version!=="v4")We(r,Ot.ipv6Cidr,o.message,t);break}case"emoji":We(r,Ot.emoji(),o.message,t);break;case"ulid":{We(r,Ot.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{At(r,"binary",o.message,t);break}case"contentEncoding:base64":{ne(r,"contentEncoding","base64",o.message,t);break}case"pattern:zod":{We(r,Ot.base64,o.message,t);break}}break}case"nanoid":We(r,Ot.nanoid,o.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(o)}return r}function yg(e,t){return t.patternStrategy==="escape"?JM(e):e}var GM=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function JM(e){let t="";for(let r=0;r<e.length;r++){if(!GM.has(e[r]))t+="\\";t+=e[r]}return t}function At(e,t,r,o){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&o.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&o.errorMessages&&{errorMessage:{format:r}}})}else ne(e,"format",t,r,o)}function We(e,t,r,o){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&o.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:ux(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})}else ne(e,"pattern",ux(t,o),r,o)}function ux(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source,n="",i=!1,s=!1,a=!1;for(let c=0;c<o.length;c++){if(i){n+=o[c],i=!1;continue}if(r.i){if(s){if(o[c].match(/[a-z]/)){if(a)n+=o[c],n+=`${o[c-2]}-${o[c]}`.toUpperCase(),a=!1;else if(o[c+1]==="-"&&o[c+2]?.match(/[a-z]/))n+=o[c],a=!0;else n+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){n+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){n+=`(^|(?<=[\r
94
+ ]))`;continue}else if(o[c]==="$"){n+=`($|(?=[\r
95
+ ]))`;continue}}if(r.s&&o[c]==="."){n+=s?`${o[c]}\r
96
+ `:`[${o[c]}\r
97
+ ]`;continue}if(n+=o[c],o[c]==="\\")i=!0;else if(s&&o[c]==="]")s=!1;else if(!s&&o[c]==="[")s=!0}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function sd(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===w.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((o,n)=>({...o,[n]:B(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??ke(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:B(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===w.ZodString&&e.keyType._def.checks?.length){let{type:o,...n}=id(e.keyType._def,t);return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===w.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===w.ZodBranded&&e.keyType._def.type._def.typeName===w.ZodString&&e.keyType._def.type._def.checks?.length){let{type:o,...n}=od(e.keyType._def,t);return{...r,propertyNames:n}}return r}function lx(e,t){if(t.mapStrategy==="record")return sd(e,t);let r=B(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||ke(t),o=B(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||ke(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function dx(e){let t=e.values,o=Object.keys(e.values).filter((i)=>typeof t[t[i]]!=="number").map((i)=>t[i]),n=Array.from(new Set(o.map((i)=>typeof i)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:o}}function px(e){return e.target==="openAi"?void 0:{not:ke({...e,currentPath:[...e.currentPath,"not"]})}}function mx(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var pa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function hx(e,t){if(t.target==="openApi3")return fx(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((o)=>(o._def.typeName in pa)&&(!o._def.checks||!o._def.checks.length))){let o=r.reduce((n,i)=>{let s=pa[i._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:o.length>1?o:o[0]}}else if(r.every((o)=>o._def.typeName==="ZodLiteral"&&!o.description)){let o=r.reduce((n,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(i._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(o.length===r.length){let n=o.filter((i,s,a)=>a.indexOf(i)===s);return{type:n.length>1?n:n[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every((o)=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,n)=>[...o,...n._def.values.filter((i)=>!o.includes(i))],[])};return fx(e,t)}var fx=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((o,n)=>B(o._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter((o)=>!!o&&(!t.strictUnions||typeof o==="object"&&Object.keys(o).length>0));return r.length?{anyOf:r}:void 0};function gx(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:pa[e.innerType._def.typeName],nullable:!0};return{type:[pa[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let o=B(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(o&&"$ref"in o)return{allOf:[o],nullable:!0};return o&&{...o,nullable:!0}}let r=B(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function yx(e,t){let r={type:"number"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"int":r.type="integer",fg(r,"type",o.message,t);break;case"min":if(t.target==="jsonSchema7")if(o.inclusive)ne(r,"minimum",o.value,o.message,t);else ne(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;ne(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)ne(r,"maximum",o.value,o.message,t);else ne(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;ne(r,"maximum",o.value,o.message,t)}break;case"multipleOf":ne(r,"multipleOf",o.value,o.message,t);break}return r}function _x(e,t){let r=t.target==="openAi",o={type:"object",properties:{}},n=[],i=e.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=YM(c);if(u&&r){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();u=!1}let l=B(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(l===void 0)continue;if(o.properties[a]=l,!u)n.push(a)}if(n.length)o.required=n;let s=XM(e,t);if(s!==void 0)o.additionalProperties=s;return o}function XM(e,t){if(e.catchall._def.typeName!=="ZodNever")return B(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function YM(e){try{return e.isOptional()}catch{return!0}}var vx=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return B(e.innerType._def,t);let r=B(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:ke(t)},r]}:ke(t)};var bx=(e,t)=>{if(t.pipeStrategy==="input")return B(e.in._def,t);else if(t.pipeStrategy==="output")return B(e.out._def,t);let r=B(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),o=B(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter((n)=>n!==void 0)}};function Sx(e,t){return B(e.type._def,t)}function xx(e,t){let o={type:"array",uniqueItems:!0,items:B(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)ne(o,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)ne(o,"maxItems",e.maxSize.value,e.maxSize.message,t);return o}function kx(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,o)=>B(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:B(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,o)=>B(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function wx(e){return{not:ke(e)}}function $x(e){return ke(e)}var Ix=(e,t)=>B(e.innerType._def,t);var Tx=(e,t,r)=>{switch(t){case w.ZodString:return id(e,r);case w.ZodNumber:return yx(e,r);case w.ZodObject:return _x(e,r);case w.ZodBigInt:return tx(e,r);case w.ZodBoolean:return rx();case w.ZodDate:return hg(e,r);case w.ZodUndefined:return wx(r);case w.ZodNull:return mx(r);case w.ZodArray:return ex(e,r);case w.ZodUnion:case w.ZodDiscriminatedUnion:return hx(e,r);case w.ZodIntersection:return ax(e,r);case w.ZodTuple:return kx(e,r);case w.ZodRecord:return sd(e,r);case w.ZodLiteral:return cx(e,r);case w.ZodEnum:return sx(e);case w.ZodNativeEnum:return dx(e);case w.ZodNullable:return gx(e,r);case w.ZodOptional:return vx(e,r);case w.ZodMap:return lx(e,r);case w.ZodSet:return xx(e,r);case w.ZodLazy:return()=>e.getter()._def;case w.ZodPromise:return Sx(e,r);case w.ZodNaN:case w.ZodNever:return px(r);case w.ZodEffects:return ix(e,r);case w.ZodAny:return ke(r);case w.ZodUnknown:return $x(r);case w.ZodDefault:return ox(e,r);case w.ZodBranded:return od(e,r);case w.ZodReadonly:return Ix(e,r);case w.ZodCatch:return nx(e,r);case w.ZodPipeline:return bx(e,r);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return((o)=>{return})(t)}};function B(e,t,r=!1){let o=t.seen.get(e);if(t.override){let a=t.override?.(e,t,o,r);if(a!==XS)return a}if(o&&!r){let a=QM(o,t);if(a!==void 0)return a}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let i=Tx(e,e.typeName,t),s=typeof i==="function"?B(i(),t):i;if(s)ez(e,t,s);if(t.postProcess){let a=t.postProcess(s,e,t);return n.jsonSchema=s,a}return n.jsonSchema=s,s}var QM=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:nd(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,o)=>t.currentPath[o]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),ke(t);return t.$refStrategy==="seen"?ke(t):void 0}}},ez=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var _g=(e,t)=>{let r=QS(t),o=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:B(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??ke(r)}),{}):void 0,n=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=B(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??ke(r),s=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(s!==void 0)i.title=s;if(r.flags.hasReferencedOpenAiAnyType){if(!o)o={};if(!o[r.openAiAnyTypeName])o[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let a=n===void 0?o?{...i,[r.definitionPath]:o}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...o,[n]:i}};if(r.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in a)||("oneOf"in a)||("allOf"in a)||("type"in a)&&Array.isArray(a.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return a};function tz(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function vg(e,t){if(St(e))return po(e,{target:tz(t?.target),io:t?.pipeStrategy??"input"});return _g(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function bg(e){let r=Mr(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=zl(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function Sg(e,t){let r=Ar(e,t);if(!r.success)throw r.error;return r.data}var rz=60000;class xg{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Fl,(t)=>{this._oncancel(t)}),this.setNotificationHandler(ql,(t)=>{this._onprogress(t)}),this.setRequestHandler(Ll,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(Zl,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new U(L.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Bl,async(t,r)=>{let o=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let s;while(s=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(s.type==="response"||s.type==="error"){let a=s.message,c=a.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),s.type==="response")u(a);else{let l=a,d=new U(l.error.code,l.error.message,l.error.data);u(d)}else{let l=s.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${c}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let i=await this._taskStore.getTask(n,r.sessionId);if(!i)throw new U(L.InvalidParams,`Task not found: ${n}`);if(!Nr(i.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(Nr(i.status)){let s=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...s,_meta:{...s._meta,[zr]:{taskId:n}}}}return await o()};return await o()}),this.setRequestHandler(Kl,async(t,r)=>{try{let{tasks:o,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:n,_meta:{}}}catch(o){throw new U(L.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Wl,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new U(L.InvalidParams,`Task not found: ${t.params.taskId}`);if(Nr(o.status))throw new U(L.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new U(L.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof U)throw o;throw new U(L.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),U.fromError(L.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{if(o?.(n,i),na(n)||US(n))this._onresponse(n);else if(eg(n))this._onrequest(n,i);else if(jS(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=U.fromError(L.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,n=e.params?._meta?.[zr]?.taskId;if(r===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:L.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:u,timestamp:Date.now()},o?.sessionId).catch((l)=>this._onerror(Error(`Failed to enqueue error response: ${l}`)));else o?.send(u).catch((l)=>this._onerror(Error(`Failed to send an error response: ${l}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let s=zS(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,c={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async(u)=>{if(i.signal.aborted)return;let l={relatedRequestId:e.id};if(n)l.relatedTask={taskId:n};await this.notification(u,l)},sendRequest:async(u,l,d)=>{if(i.signal.aborted)throw new U(L.ConnectionClosed,"Request was cancelled");let m={...d,relatedRequestId:e.id};if(n&&!m.relatedTask)m.relatedTask={taskId:n};let p=m.relatedTask?.taskId??n;if(p&&a)await a.updateTaskStatus(p,"input_required");return await this.request(u,l,m)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:a,taskRequestedTtl:s?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(s)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,c)).then(async(u)=>{if(i.signal.aborted)return;let l={result:u,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)},async(u)=>{if(i.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:L.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)}).catch((u)=>this._onerror(Error(`Failed to send response: ${u}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===i)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),na(e))r(e);else{let i=new U(e.error.code,e.error.message,e.error.data);r(i)}return}let o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(na(e)&&e.result&&typeof e.result==="object"){let i=e.result;if(i.task&&typeof i.task==="object"){let s=i.task;if(typeof s.taskId==="string")n=!0,this._taskProgressTokens.set(s.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(na(e))o(e);else{let i=U.fromError(e.error.code,e.error.message,e.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(i){yield{type:"error",error:i instanceof U?i:new U(L.InternalError,String(i))}}return}let n;try{let i=await this.request(e,wo,r);if(i.task)n=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new U(L.InternalError,"Task creation did not return a task");while(!0){let s=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:s},Nr(s.status)){if(s.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(s.status==="failed")yield{type:"error",error:new U(L.InternalError,`Task ${n} failed`)};else if(s.status==="cancelled")yield{type:"error",error:new U(L.InternalError,`Task ${n} was cancelled`)};return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let a=s.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),r?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof U?i:new U(L.InternalError,String(i))}}}request(e,t,r){let{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i,task:s,relatedTask:a}=r??{};return new Promise((c,u)=>{let l=(b)=>{u(b)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),s)this.assertTaskCapability(e.method)}catch(b){l(b);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(s)m.params={...m.params,task:s};if(a)m.params={...m.params,_meta:{...m.params?._meta||{},[zr]:a}};let p=(b)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(b)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i}).catch((C)=>this._onerror(Error(`Failed to send cancellation: ${C}`)));let I=b instanceof U?b:new U(L.RequestTimeout,String(b));u(I)};this._responseHandlers.set(d,(b)=>{if(r?.signal?.aborted)return;if(b instanceof Error)return u(b);try{let I=Ar(t,b.result);if(!I.success)u(I.error);else c(I.data)}catch(I){u(I)}}),r?.signal?.addEventListener("abort",()=>{p(r?.signal?.reason)});let f=r?.timeout??rz,h=()=>p(U.fromError(L.RequestTimeout,"Request timed out",{timeout:f}));this._setupTimeout(d,f,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let v=a?.taskId;if(v){let b=(I)=>{let C=this._responseHandlers.get(d);if(C)C(I);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch((I)=>{this._cleanupTimeout(d),u(I)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i}).catch((b)=>{this._cleanupTimeout(d),u(b)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Hl,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Vl,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},LS,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[zr]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[zr]:t.relatedTask}}};this._transport?.send(s,t).catch((a)=>this._onerror(a))});return}let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[zr]:t.relatedTask}}};await this._transport.send(i,t)}setRequestHandler(e,t){let r=bg(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let i=Sg(e,o);return Promise.resolve(t(i,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=bg(e);this._notificationHandlers.set(r,(o)=>{let n=Sg(e,o);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let o of r)if(o.type==="request"&&eg(o.message)){let n=o.message.id,i=this._requestResolvers.get(n);if(i)i(new U(L.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,n)=>{if(t.aborted){n(new U(L.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(i),n(new U(L.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!e)throw Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async(o)=>{let n=await r.getTask(o,t);if(!n)throw new U(L.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(o,n,i)=>{await r.storeTaskResult(o,n,i,t);let s=await r.getTask(o,t);if(s){let a=ca.parse({method:"notifications/tasks/status",params:s});if(await this.notification(a),Nr(s.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>r.getTaskResult(o,t),updateTaskStatus:async(o,n,i)=>{let s=await r.getTask(o,t);if(!s)throw new U(L.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Nr(s.status))throw new U(L.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,n,i,t);let a=await r.getTask(o,t);if(a){let c=ca.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),Nr(a.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>r.listTasks(o,t)}}}function Px(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Ex(e,t){let r={...e};for(let o in t){let n=o,i=t[n];if(i===void 0)continue;let s=r[n];if(Px(s)&&Px(i))r[n]={...s,...i};else r[n]=i}return r}var dT=Dy(yy(),1),pT=Dy(lT(),1);function wL(){let e=new dT.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return pT.default(e),e}class Ty{constructor(e){this._ajv=e??wL()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class Py{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],i=n.some((u)=>u.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some((u)=>u.type==="tool_use");if(i){if(n.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!c)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter((d)=>d.type==="tool_use").map((d)=>d.id)),l=new Set(n.filter((d)=>d.type==="tool_result").map((d)=>d.toolUseId));if(u.size!==l.size||![...u].every((d)=>l.has(d)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},da,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},To,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function mT(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function fT(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class Ey extends xg{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(la.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let n=this._loggingLevels.get(o);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Ty,this.setRequestHandler(ng,(r)=>this._oninitialize(r)),this.setNotificationHandler(og,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(dg,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=r.params,s=la.safeParse(i);if(s.success)this._loggingLevels.set(n,s.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Py(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Ex(this._capabilities,e)}setRequestHandler(e,t){let o=Mr(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(St(o)){let s=o;n=s._zod?.def?.value??s.value}else{let s=o;n=s._def?.value??s.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let s=async(a,c)=>{let u=Ar(Io,a);if(!u.success){let p=u.error instanceof Error?u.error.message:String(u.error);throw new U(L.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:l}=u.data,d=await Promise.resolve(t(a,c));if(l.task){let p=Ar(wo,d);if(!p.success){let f=p.error instanceof Error?p.error.message:String(p.error);throw new U(L.InvalidParams,`Invalid task creation result: ${f}`)}return p.data}let m=Ar(td,d);if(!m.success){let p=m.error instanceof Error?m.error.message:String(m.error);throw new U(L.InvalidParams,`Invalid tools/call result: ${p}`)}return m.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){fT(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;mT(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:OS.includes(t)?t:Yh,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"},Ul)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],n=o.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=i?Array.isArray(i.content)?i.content:[i.content]:[],a=s.some((c)=>c.type==="tool_use");if(n){if(o.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let c=new Set(s.filter((l)=>l.type==="tool_use").map((l)=>l.id)),u=new Set(o.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(c.size!==u.size||![...c].every((l)=>u.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},pg,t);return this.request({method:"sampling/createMessage",params:e},da,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},To,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:o},To,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!s.valid)throw new U(L.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(i){if(i instanceof U)throw i;throw new U(L.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},mg,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var gT=Symbol.for("mcp.completable");function Ry(e){return!!e&&typeof e==="object"&&gT in e}function yT(e){return e[gT]?.complete}var hT;(function(e){e.Completable="McpCompletable"})(hT||(hT={}));var $L=/^[A-Za-z0-9._-]{1,128}$/;function IL(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!$L.test(e)){let r=e.split("").filter((o)=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,i)=>i.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map((o)=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function TL(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Cy(e){let t=IL(e);return TL(e,t.warnings),t.isValid}class Oy{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let o={taskSupport:"required",...t.execution};if(o.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,o,t._meta,r)}}class My{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Ey(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new Oy(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(Hr(ed)),this.server.assertCanSetRequestHandler(Hr(Io)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(ed,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let o=xo(t.inputSchema);return o?vg(o,{strictUnions:!0,pipeStrategy:"input"}):PL})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let o=xo(t.outputSchema);if(o)r.outputSchema=vg(o,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(Io,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new U(L.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new U(L.InvalidParams,`Tool ${e.params.name} disabled`);let o=!!e.params.task,n=r.execution?.taskSupport,i="createTask"in r.handler;if((n==="required"||n==="optional")&&!i)throw new U(L.InternalError,`Tool ${e.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!o)throw new U(L.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!o&&i)return await this.handleAutomaticTaskPolling(r,e,t);let s=await this.validateToolInput(r,e.params.arguments,e.params.name),a=await this.executeToolHandler(r,s,t);if(o)return a;return await this.validateToolOutput(r,a,e.params.name),a}catch(r){if(r instanceof U){if(r.code===L.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=xo(e.inputSchema)??e.inputSchema,i=await Al(n,t);if(!i.success){let s="error"in i?i.error:"Unknown error",a=Ml(s);throw new U(L.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a}`)}return i.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new U(L.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=xo(e.outputSchema),n=await Al(o,t.structuredContent);if(!n.success){let i="error"in n?n.error:"Unknown error",s=Ml(i);throw new U(L.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${s}`)}}async executeToolHandler(e,t,r){let o=e.handler;if("createTask"in o){if(!r.taskStore)throw Error("No task store provided.");let i={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(o.createTask(t,i));else return await Promise.resolve(o.createTask(i))}if(e.inputSchema)return await Promise.resolve(o(t,r));else return await Promise.resolve(o(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(e,t.params.arguments,t.params.name),n=e.handler,i={...r,taskStore:r.taskStore},s=o?await Promise.resolve(n.createTask(o,i)):await Promise.resolve(n.createTask(i)),a=s.task.taskId,c=s.task,u=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((d)=>setTimeout(d,u));let l=await r.taskStore.getTask(a);if(!l)throw new U(L.InternalError,`Task ${a} not found during polling`);c=l}return await r.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(Hr(rd)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(rd,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return VS(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return WS(e),this.handleResourceCompletion(e,e.params.ref);default:throw new U(L.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new U(L.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new U(L.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Na;let n=Mr(r.argsSchema)?.[e.params.argument.name];if(!Ry(n))return Na;let i=yT(n);if(!i)return Na;let s=await i(e.params.argument.value,e.params.context);return vT(s)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((i)=>i.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Na;throw new U(L.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return Na;let n=await o(e.params.argument.value,e.params.context);return vT(n)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(Hr(Gl)),this.server.assertCanSetRequestHandler(Hr(Jl)),this.server.assertCanSetRequestHandler(Hr(Xl)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Gl,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let i=await n.resourceTemplate.listCallback(t);for(let s of i.resources)o.push({...n.metadata,...s})}return{resources:[...r,...o]}}),this.server.setRequestHandler(Jl,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(Xl,async(e,t)=>{let r=new URL(e.params.uri),o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new U(L.InvalidParams,`Resource ${r} disabled`);return o.readCallback(r,t)}for(let n of Object.values(this._registeredResourceTemplates)){let i=n.resourceTemplate.uriTemplate.match(r.toString());if(i)return n.readCallback(r,i,t)}throw new U(L.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(Hr(Yl)),this.server.assertCanSetRequestHandler(Hr(Ql)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Yl,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?EL(t.argsSchema):void 0}))})),this.server.setRequestHandler(Ql,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new U(L.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new U(L.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let o=xo(r.argsSchema),n=await Al(o,e.params.arguments);if(!n.success){let a="error"in n?n.error:"Unknown error",c=Ml(a);throw new U(L.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let i=n.data,s=r.callback;return await Promise.resolve(s(i,t))}else{let o=r.callback;return await Promise.resolve(o(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let o;if(typeof r[0]==="object")o=r.shift();let n=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,void 0,t,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,t,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,t,r,o){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,r.title,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,r.title,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,r,o,n){let i={name:e,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:(s)=>{if(typeof s.uri<"u"&&s.uri!==r){if(delete this._registeredResources[r],s.uri)this._registeredResources[s.uri]=i}if(typeof s.name<"u")i.name=s.name;if(typeof s.title<"u")i.title=s.title;if(typeof s.metadata<"u")i.metadata=s.metadata;if(typeof s.callback<"u")i.readCallback=s.callback;if(typeof s.enabled<"u")i.enabled=s.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,o,n){let i={resourceTemplate:r,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=i}if(typeof c.title<"u")i.title=c.title;if(typeof c.template<"u")i.resourceTemplate=c.template;if(typeof c.metadata<"u")i.metadata=c.metadata;if(typeof c.callback<"u")i.readCallback=c.callback;if(typeof c.enabled<"u")i.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let s=r.uriTemplate.variableNames;if(Array.isArray(s)&&s.some((c)=>!!r.completeCallback(c)))this.setCompletionRequestHandler();return i}_createRegisteredPrompt(e,t,r,o,n){let i={title:t,description:r,argsSchema:o===void 0?void 0:bn(o),callback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:(s)=>{if(typeof s.name<"u"&&s.name!==e){if(delete this._registeredPrompts[e],s.name)this._registeredPrompts[s.name]=i}if(typeof s.title<"u")i.title=s.title;if(typeof s.description<"u")i.description=s.description;if(typeof s.argsSchema<"u")i.argsSchema=bn(s.argsSchema);if(typeof s.callback<"u")i.callback=s.callback;if(typeof s.enabled<"u")i.enabled=s.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=i,o){if(Object.values(o).some((a)=>{let c=a instanceof bt?a._def?.innerType:a;return Ry(c)}))this.setCompletionRequestHandler()}return i}_createRegisteredTool(e,t,r,o,n,i,s,a,c){Cy(e);let u={title:t,description:r,inputSchema:_T(o),outputSchema:_T(n),annotations:i,execution:s,_meta:a,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(l)=>{if(typeof l.name<"u"&&l.name!==e){if(typeof l.name==="string")Cy(l.name);if(delete this._registeredTools[e],l.name)this._registeredTools[l.name]=u}if(typeof l.title<"u")u.title=l.title;if(typeof l.description<"u")u.description=l.description;if(typeof l.paramsSchema<"u")u.inputSchema=bn(l.paramsSchema);if(typeof l.outputSchema<"u")u.outputSchema=bn(l.outputSchema);if(typeof l.callback<"u")u.handler=l.callback;if(typeof l.annotations<"u")u.annotations=l.annotations;if(typeof l._meta<"u")u._meta=l._meta;if(typeof l.enabled<"u")u.enabled=l.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,o,n,i;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let a=t[0];if(Ay(a)){if(o=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!Ay(t[0]))i=t.shift()}else if(typeof a==="object"&&a!==null){if(Object.values(a).some((c)=>typeof c==="object"&&c!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=t.shift()}}let s=t[0];return this._createRegisteredTool(e,void 0,r,o,n,i,{taskSupport:"forbidden"},void 0,s)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:i,outputSchema:s,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,o,n,i,s,a,{taskSupport:"forbidden"},c,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let o;if(t.length>1)o=t.shift();let n=t[0],i=this._createRegisteredPrompt(e,void 0,r,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:i}=t,s=this._createRegisteredPrompt(e,o,n,i,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var PL={type:"object",properties:{}};function bT(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function ST(e){return"_def"in e||"_zod"in e||bT(e)}function Ay(e){if(typeof e!=="object"||e===null)return!1;if(ST(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(bT)}function _T(e){if(!e)return;if(Ay(e))return bn(e);if(!ST(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function EL(e){let t=Mr(e);if(!t)return[];return Object.entries(t).map(([r,o])=>{let n=RS(o),i=CS(o);return{name:r,description:n,required:!i}})}function Hr(e){let r=Mr(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=zl(r);if(typeof o==="string")return o;throw Error("Schema method literal must be a string")}function vT(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Na={completion:{values:[],hasMore:!1}};function RL(e,t,r,o,n){let i={};if(n?.searchHint)i["anthropic/searchHint"]=n.searchHint;if(n?.alwaysLoad)i["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:r,handler:o,annotations:n?.annotations,_meta:Object.keys(i).length>0?i:void 0}}function CL(e){let t=new My({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((r)=>{for(let o of Object.values(r.inputSchema)){if(!OL(o))continue;let n=o.description;if(n&&!et.has(o))et.add(o,{description:n})}t.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema,annotations:r.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...r._meta}:r._meta},r.handler)});return{type:"sdk",name:e.name,instance:t}}function OL(e){return typeof e==="object"&&e!==null&&"_zod"in e}function jQ(e){let t=e.abortController||hb(),r=new Map;if(e.mcpServers)for(let[i,s]of Object.entries(e.mcpServers))if(s.type==="sdk"&&s.instance)r.set(i,s.instance);else throw Error("Browser SDK only supports SDK MCP servers for now");let o;if(e.sse)o=new Wp({streamUrl:e.sse.streamUrl,sendUrl:e.sse.sendUrl,sessionId:e.sse.sessionId,headers:e.sse.headers,abortController:t});else o=new Gp({url:e.websocket.url,headers:e.websocket.headers,authMessage:e.websocket.authMessage,abortController:t});let n=new Kp(o,!1,e.canUseTool,e.hooks,t,r,e.jsonSchema,void 0,e.onElicitation,void 0,void 0,e.onUserDialog);return n.streamInput(e.prompt).catch((i)=>t.abort(i)),n}export{Hh as z,RL as tool,jQ as query,CL as createSdkMcpServer};